diff --git a/AtlasGeometryCommon/SubDetectorEnvelopes/SubDetectorEnvelopes/IEnvelopeDefSvc.h b/AtlasGeometryCommon/SubDetectorEnvelopes/SubDetectorEnvelopes/IEnvelopeDefSvc.h
index 3883433a218c9afde1a826a66615589404e8337e..88332ef2658795d45bd9fbec026c530a0f269d55 100644
--- a/AtlasGeometryCommon/SubDetectorEnvelopes/SubDetectorEnvelopes/IEnvelopeDefSvc.h
+++ b/AtlasGeometryCommon/SubDetectorEnvelopes/SubDetectorEnvelopes/IEnvelopeDefSvc.h
@@ -50,15 +50,6 @@ class IEnvelopeDefSvc : virtual public IInterface {
     const RZPairVector &getMuonRZBoundary()     const { return getRZBoundary(AtlasDetDescr::fAtlasMS);      }
     const RZPairVector &getCavernRZBoundary()   const { return getRZBoundary(AtlasDetDescr::fAtlasCavern);  }
 
-    /** legacy methods
-          Any client should update to use the methods defined above!
-          The following lecagy methods will be phased out once all clients have migrated to the new methods above */
-    RZPairVector &getBeamPipeRZValues ATLAS_NOT_THREAD_SAFE ( unsigned short = 0) const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasForward) ); }
-    RZPairVector &getInDetRZValues ATLAS_NOT_THREAD_SAFE ( unsigned short = 0)    const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasID) );      }
-    RZPairVector &getCaloRZValues ATLAS_NOT_THREAD_SAFE ( unsigned short = 0)     const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasCalo) );    }
-    RZPairVector &getMuonRZValues ATLAS_NOT_THREAD_SAFE ( unsigned short = 0)     const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasMS) );      }
-    RZPairVector &getCavernRZValues ATLAS_NOT_THREAD_SAFE ( unsigned short = 0)   const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasCavern) );  }
-
   protected:
     /** mirror the given srcRZ RZPairVector in the XY-plane to describe all corner points
      in (r,z) space in the dstRZ RZPairVector */
diff --git a/Calorimeter/CaloInterface/CaloInterface/IToolWithConstants.h b/Calorimeter/CaloInterface/CaloInterface/IToolWithConstants.h
new file mode 100644
index 0000000000000000000000000000000000000000..d58d79b057cb86e2492aa9ea8c39b6ad5840018b
--- /dev/null
+++ b/Calorimeter/CaloInterface/CaloInterface/IToolWithConstants.h
@@ -0,0 +1,48 @@
+// This file's extension implies that it's C, but it's really -*- C++ -*-.
+/*
+ * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
+ */
+/**
+ * @file CaloInterface/IToolWithConstants.h
+ * @author scott snyder <snyder@bnl.gov>
+ * @date Sep, 2020
+ * @brief Abstact interface for ToolWithConstants.
+ */
+
+
+#ifndef CALOINTERFACE_ITOOLWITHCONSTANTS_H
+#define CALOINTERFACE_ITOOLWITHCONSTANTS_H
+
+
+#include "CaloConditions/ToolConstants.h"
+#include "GaudiKernel/IAlgTool.h"
+#include "GaudiKernel/StatusCode.h"
+#include "GaudiKernel/EventContext.h"
+#include <string>
+
+
+/**
+ * @brief Abstact interface for ToolWithConstants.
+ *
+ * Defines operations needed by CaloClusterCorrDBWriter.
+ */
+class IToolWithConstants
+  : virtual public IAlgTool
+{
+public:
+  DeclareInterfaceID (IToolWithConstants, 1, 0);
+
+
+  /**
+   * @brief Merge our constants into @c out with the proper prefix.
+   * @param[out] out Object to receive our constants.
+   * @param ctx Event context.
+   */
+  virtual
+  StatusCode
+  mergeConstants (CaloRec::ToolConstants& out,
+                  const EventContext& ctx) const = 0;
+};
+
+
+#endif // not CALOINTERFACE_ITOOLWITHCONSTANTS_H
diff --git a/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilder.cxx b/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilder.cxx
index 863c05aae82b1d3230083a7eca71f74ce4fde2e3..876a01a83c1da11427105e069f650b70f02fd87a 100755
--- a/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilder.cxx
+++ b/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilder.cxx
@@ -233,8 +233,7 @@ const Trk::TrackingGeometry* Calo::CaloTrackingGeometryBuilder::trackingGeometry
     keyDim.push_back(RZPair(enclosedInnerSectorRadius, enclosedInnerSectorHalflength));
   }   
   // get the dimensions from the envelope service
-  RZPairVector& envelopeDefsIn = m_enclosingEnvelopeSvc->getCaloRZValues(0);
-  //RZPairVector& envelopeDefs = m_enclosingEnvelopeSvc->getCaloRZValues(0);
+  const RZPairVector& envelopeDefsIn = m_enclosingEnvelopeSvc->getCaloRZBoundary();
 
   // find the max,max pair
   unsigned int ii=0;
@@ -316,7 +315,7 @@ const Trk::TrackingGeometry* Calo::CaloTrackingGeometryBuilder::trackingGeometry
  
   // BEAM PIPE
   //std::cout <<"envelope svc : number of BeamPipe Volumes:"<< m_enclosingEnvelopeSvc->getBeamPipeNumVols()<< std::endl;  
-  RZPairVector& bpDefs = m_enclosingEnvelopeSvc->getBeamPipeRZValues(0);
+  const RZPairVector& bpDefs = m_enclosingEnvelopeSvc->getBeamPipeRZBoundary();
   
   ATH_MSG_VERBOSE( "BeamPipe envelope definition retrieved:" );   
   m_bpCutouts.clear();
diff --git a/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilderCond.cxx b/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilderCond.cxx
index ad91e58448529f31ca4cc4d9a67fb7c8422e05a5..1992999c271be8fc4091b294a3cfefb1592722b3 100755
--- a/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilderCond.cxx
+++ b/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilderCond.cxx
@@ -240,8 +240,7 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Calo::CaloTrackingGeometry
     keyDim.push_back(RZPair(enclosedInnerSectorRadius, enclosedInnerSectorHalflength));
   }   
   // get the dimensions from the envelope service
-  RZPairVector& envelopeDefsIn = m_enclosingEnvelopeSvc->getCaloRZValues(0);
-  //RZPairVector& envelopeDefs = m_enclosingEnvelopeSvc->getCaloRZValues(0);
+  const RZPairVector& envelopeDefsIn = m_enclosingEnvelopeSvc->getCaloRZBoundary();
 
   // find the max,max pair
   unsigned int ii=0;
@@ -323,7 +322,7 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Calo::CaloTrackingGeometry
  
   // BEAM PIPE
   //std::cout <<"envelope svc : number of BeamPipe Volumes:"<< m_enclosingEnvelopeSvc->getBeamPipeNumVols()<< std::endl;  
-  RZPairVector& bpDefs = m_enclosingEnvelopeSvc->getBeamPipeRZValues(0);
+  const RZPairVector& bpDefs = m_enclosingEnvelopeSvc->getBeamPipeRZBoundary();
   
   ATH_MSG_VERBOSE( "BeamPipe envelope definition retrieved:" );   
   m_bpCutouts.clear();
diff --git a/Control/AthAnalysisBaseComps/AthAnalysisBaseComps/AthAnalysisHelper.h b/Control/AthAnalysisBaseComps/AthAnalysisBaseComps/AthAnalysisHelper.h
index 51707fde53be472c6cecd887d922ccb3c1e8acd2..b0f8645d292f1ea9dd8efa5098e1e48622e7c74d 100644
--- a/Control/AthAnalysisBaseComps/AthAnalysisBaseComps/AthAnalysisHelper.h
+++ b/Control/AthAnalysisBaseComps/AthAnalysisBaseComps/AthAnalysisHelper.h
@@ -31,6 +31,8 @@
 
 #include "GaudiKernel/ToolHandle.h"
 
+#include <type_traits>
+
 class AthAnalysisHelper { //thought about being a namespace but went for static methods instead, in case I want private data members in future
 
 public:
@@ -55,7 +57,19 @@ public:
         return StatusCode::FAILURE;
       }
      }
-     joSvc->set( name+"."+property , Gaudi::Utils::toString ( value ) );
+
+     if constexpr (std::is_convertible<W, std::string>::value) {
+       // If value is already convertible to a string, don't use toString().
+       // Otherwise, toString() will add quotes around the string,
+       // which confuses things further on.
+       // (These quotes used to be removed by the old 
+       // IJobOptionsSvc::addPropertyToCatalogue interface, but IOptionsSvc::set
+       // doesn't do that.)
+       joSvc->set( name+"."+property , std::string (value) );
+     }
+     else {
+       joSvc->set( name+"."+property , Gaudi::Utils::toString ( value ) );
+     }
      return StatusCode::SUCCESS;
    }
    
diff --git a/Control/AthenaCommon/share/Preparation.py b/Control/AthenaCommon/share/Preparation.py
index 8bf10b03a4dee40126f1edb487303a453c758a12..de3afe83a052c806cef900f4491964d9d994044a 100644
--- a/Control/AthenaCommon/share/Preparation.py
+++ b/Control/AthenaCommon/share/Preparation.py
@@ -75,7 +75,7 @@ else:
    min_cppyy_vmem_growth = None
 
 from PyUtils.Helpers import ROOT6Setup
-ROOT6Setup()
+ROOT6Setup(batch=opts.run_batch)
 
 if min_cppyy_vmem_growth:
    grow_vmem( vmem_before_cppyy + min_cppyy_vmem_growth )
diff --git a/Control/AthenaConfiguration/python/MainServicesConfig.py b/Control/AthenaConfiguration/python/MainServicesConfig.py
index 072ec1ea40fd494f342a8f54f3ce254edb26d8b4..0b8a8eba503825d897449e9d945a2ea6b6fce4ad 100644
--- a/Control/AthenaConfiguration/python/MainServicesConfig.py
+++ b/Control/AthenaConfiguration/python/MainServicesConfig.py
@@ -78,7 +78,8 @@ def MainServicesCfg(cfgFlags):
     cfg.addService(StoreGateSvc("HistoryStore"))
     cfg.addService(StoreGateSvc("ConditionStore"))
 
-    cfg.addService(CompFactory.GeoModelSvc(), create=True)
+    from AtlasGeoModel.GeoModelConfig import GeoModelCfg
+    cfg.merge( GeoModelCfg(cfgFlags) )
     cfg.addService(CompFactory.DetDescrCnvSvc(), create=True)
     cfg.addService(CompFactory.CoreDumpSvc(), create=True)
 
diff --git a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h
index 4240937a3dba98c155e7b4a269907a49de2c5d63..8deb6504183a603cb0a8ef3518b2a4cb3aacd674 100644
--- a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h
+++ b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h
@@ -21,7 +21,7 @@
 
 #include "StoreGate/ReadHandleKey.h"
 #include "xAODEventInfo/EventInfo.h"
-
+#include "AthenaMonitoringKernel/HistogramFiller.h"
 
 /* Here, by forward declaring these two classes, which appear as parameters and values
    in GenericMonitoringTool functions only as pointers (not as the objects themselves),
@@ -81,8 +81,9 @@ private:
   Gaudi::Property<bool> m_explicitBooking { this, "ExplicitBooking", false, "Do not create histograms automatically in initialize but wait until the method book is called." };
   Gaudi::Property<bool> m_failOnEmpty { this, "FailOnEmpty", true, "Fail in initialize() if no histograms defined" };
 
-  std::unordered_map<std::string, std::vector<std::shared_ptr<Monitored::HistogramFiller>>> m_fillerMap; //!< map from variables to fillers
+  std::vector<std::shared_ptr<Monitored::HistogramFiller>> m_fillers; //!< plain list of fillers
   mutable std::mutex m_fillMutex;
+  mutable Monitored::HistogramFiller::VariablesPack m_vars ATLAS_THREAD_SAFE;
 };
 
 /**
diff --git a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/HistogramFiller.h b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/HistogramFiller.h
index 96b7bf5db3a8b11a4867a092f52552dbff5a43f5..670f3efe686b5990c5e73a5f118745725ec35e46 100644
--- a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/HistogramFiller.h
+++ b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/HistogramFiller.h
@@ -8,6 +8,7 @@
 #include <functional>
 #include <memory>
 #include <vector>
+#include "CxxUtils/AthUnlikelyMacros.h"
 
 #include "AthenaMonitoringKernel/HistogramDef.h"
 #include "AthenaMonitoringKernel/IHistogramProvider.h"
@@ -45,9 +46,7 @@ namespace Monitored {
      */
     HistogramFiller(const HistogramFiller& hf)
       : m_histDef(hf.m_histDef),
-        m_histogramProvider(hf.m_histogramProvider),
-        m_monWeight(hf.m_monWeight),
-        m_monCutMask(hf.m_monCutMask) {}
+        m_histogramProvider(hf.m_histogramProvider) {}
     /**
      * @brief Move constructor
      */
@@ -58,35 +57,65 @@ namespace Monitored {
      */
     virtual ~HistogramFiller() {}
 
+
     /**
-     * @brief Method that actually fills the ROOT object
-     * @return number of fills performed
+     * @brief helper class to pass variables to fillers
      */
-    virtual unsigned fill() const = 0;
+    struct VariablesPack {
+      VariablesPack() {}
+      VariablesPack( const std::initializer_list<const Monitored::IMonitoredVariable*>&  v)
+	:var( v ) {}
+
+      /**
+       * @brief number of variables in the pack ( not counting the weight and mask )
+       */
+      size_t size () const {
+	return var.size() - std::count( var.begin(), var.end(), nullptr );
+      }
 
+      /**
+       * @brief removes all monitored variables
+       */
+      inline void reset() {
+	std::fill( var.begin(), var.end(), nullptr );
+	cut = nullptr;
+	weight = nullptr;
+      }
 
-    /**
-     * @brief clone filler for actual filling
-     * Note that this operation is very cheap as the this class is effectively a flyweight
-     */
-    virtual HistogramFiller* clone() const = 0;
+      /**
+       * @brief sets monitored variable at the index (may need to reszie vector of variables)
+       */
+      inline void set( unsigned index, const IMonitoredVariable* ptr ) {
+	if ( ATH_UNLIKELY( var.size() <= index ) ) {
+	  var.resize(index+1);
+	}
+	var[index] = ptr;
+      }
 
+      /**
+       * @brief names of all varaibles stored
+       */
+      std::vector<std::string> names() const {
+	std::vector<std::string> r;
+	for ( const auto* v: var )
+	  if ( v != nullptr )
+	    r.push_back( v->name() );
+	return r;
+      }
 
-    void setMonitoredVariables(std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>&& monitoredVariables) {
-      m_monVariables = std::move(monitoredVariables);
-    }
+      std::vector<const Monitored::IMonitoredVariable*> var = { nullptr, nullptr, nullptr, nullptr }; //!< storage for variables, default size of 4, serves all histograming uses
+      const Monitored::IMonitoredVariable* weight = nullptr; //!< pointer to weight variable, typically absent
+      const Monitored::IMonitoredVariable* cut = nullptr; //!< pointer to cut mask variable, typically absent
+    };
 
     /**
-     * @brief Stores histogram weight
-     * @param monitoredWeight weight to use
+     * @brief Method that actually fills the ROOT object
+     * @return number of fills performed
      */
-    void setMonitoredWeight(Monitored::IMonitoredVariable* monitoredWeight) {
-      m_monWeight = monitoredWeight;
-    }
+    virtual unsigned fill( const VariablesPack& ) const = 0;
+
+
 
-    void setMonitoredCutMask(Monitored::IMonitoredVariable* monitoredCutMask) {
-      m_monCutMask = monitoredCutMask;
-    }
 
     const std::vector<std::string>& histogramVariablesNames() const {
       return m_histDef->name;
@@ -99,7 +128,7 @@ namespace Monitored {
     const std::string& histogramCutMaskName() const {
       return m_histDef->cutMask;
     }
-    
+
   protected:
     template <class H>
     H* histogram() const {
@@ -107,19 +136,19 @@ namespace Monitored {
     }
 
     // convenience function to provide a function that interprets the cutmask
-    std::pair<size_t, std::function<bool(size_t)>> getCutMaskFunc() const {
-      std::function<bool(size_t)> cutMaskValue = [] (size_t){ return true; }; // default is true
+    std::pair<size_t, std::function<bool(size_t)>> getCutMaskFunc(const Monitored::IMonitoredVariable* mask ) const {
+      std::function<bool(size_t)> cutMaskValue = [mask] (size_t){ return true; }; // default is true
       size_t maskSize = 1;
-      if ( m_monCutMask != nullptr ) {
-        maskSize = m_monCutMask->size();
+      if ( mask != nullptr ) {
+        maskSize = mask->size();
         if (maskSize == 1) {
-          if (!m_monCutMask->get(0)) {
+          if (!mask->get(0)) {
             // globally fails cut; zero first argument is a signal that one can abort
             return std::make_pair(0, [](size_t){ return false; });
             // otherwise, default cutMaskValue is sufficient
           }
         } else {
-          return std::make_pair(maskSize, [this](size_t i){ return static_cast<bool>(m_monCutMask->get(i)); });
+          return std::make_pair(maskSize, [mask](size_t i){ return static_cast<bool>(mask->get(i)); });
         }
       }
       return std::make_pair(maskSize, cutMaskValue);
@@ -150,10 +179,7 @@ namespace Monitored {
 
     std::shared_ptr<HistogramDef> m_histDef;
     std::shared_ptr<IHistogramProvider> m_histogramProvider;
-    std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> m_monVariables;
-    Monitored::IMonitoredVariable* m_monWeight{nullptr}; // bare pointer instead of reference as it can be null
-    Monitored::IMonitoredVariable* m_monCutMask{nullptr};
-    
+
   private:
     HistogramFiller& operator=(HistogramFiller const&) = delete;
   };
diff --git a/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx b/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx
index 15bc0bb6aef566f0192a28dfbfb613a6ada3d87f..3431c7a2138ef45c0ffab32d45a2e0e0a9646064 100644
--- a/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx
+++ b/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx
@@ -39,7 +39,7 @@ StatusCode GenericMonitoringTool::start() {
 }
 
 StatusCode GenericMonitoringTool::stop() {
-  m_fillerMap.clear();
+  m_fillers.clear();
   return StatusCode::SUCCESS;
 }
 
@@ -58,10 +58,6 @@ StatusCode GenericMonitoringTool::book() {
 
   HistogramFillerFactory factory(this, m_histoPath);
 
-  // First, make a vector of fillers. Then move the pointers to an unordered_map en masse.
-  std::vector<std::shared_ptr<Monitored::HistogramFiller>> fillers;
-  fillers.reserve(m_histograms.size());
-  m_fillerMap.reserve(m_histograms.size());
   for (const std::string& item : m_histograms) {
     if (item.empty()) {
       ATH_MSG_DEBUG( "Skipping empty histogram definition" );
@@ -74,7 +70,7 @@ StatusCode GenericMonitoringTool::book() {
       std::shared_ptr<HistogramFiller> filler(factory.create(def));
 
       if (filler) {
-        fillers.push_back(filler);
+	m_fillers.push_back(filler);
       } else {
         ATH_MSG_WARNING( "The histogram filler cannot be instantiated for: " << def.name );
       }
@@ -85,7 +81,7 @@ StatusCode GenericMonitoringTool::book() {
     ATH_MSG_DEBUG( "Monitoring for variable " << def.name << " prepared" );
   }
 
-  if ( fillers.empty() && m_failOnEmpty ) {
+  if ( m_fillers.empty() && m_failOnEmpty ) {
     std::string hists;
     for (const auto &h : m_histograms) hists += (h+",");
     ATH_MSG_ERROR("No monitored variables created based on histogram definition: [" << hists <<
@@ -93,12 +89,6 @@ StatusCode GenericMonitoringTool::book() {
     return StatusCode::FAILURE;
   }
 
-  for (const auto& filler : fillers ) {
-    const auto& fillerVariables = filler->histogramVariablesNames();
-    for (const auto& fillerVariable : fillerVariables) {
-      m_fillerMap[fillerVariable].push_back(filler);
-    }
-  }
 
   return StatusCode::SUCCESS;
 }
@@ -112,89 +102,68 @@ namespace Monitored {
 
 
 void GenericMonitoringTool::invokeFillers(const std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>& monitoredVariables) const {
-
-  // stage 1: get candidate fillers (assume generally we get only a few variables)
-  std::vector<HistogramFiller*> candidates;
-  for (const auto& monValue : monitoredVariables) {
-    const auto& match = m_fillerMap.find(monValue.get().name());
-    if (match != m_fillerMap.end()) {
-      candidates.reserve(candidates.size() + match->second.size());
-      for (const auto& i : match->second) {
-        candidates.push_back(i.get());
-      }
-    }
-  }
-  // dedup vector (yes, this is faster than using std::set above)
-  std::sort(candidates.begin(), candidates.end());
-  candidates.erase(std::unique(candidates.begin(), candidates.end()), candidates.end());
-  // stage 2: refine for fillers that have all variables set
-  std::vector<std::reference_wrapper<IMonitoredVariable>> variables;
-  variables.reserve(3); // enough for all current fillers
-
-  for (const auto& filler : candidates) {
-    // Find the associated monitored variable for each histogram's variable(s)
-    const auto& fillerVariables = filler->histogramVariablesNames();
-
-    variables.clear();
-    for (const auto& fillerVariable : fillerVariables) {
-      for (const auto& monValue : monitoredVariables) {
-        if (fillerVariable.compare(monValue.get().name()) == 0) {
-          variables.push_back(monValue);
+  std::scoped_lock guard(m_fillMutex);
+  for ( auto filler: m_fillers ) {
+    m_vars.reset();
+    const int fillerCardinality = filler->histogramVariablesNames().size() + (filler->histogramWeightName().empty() ? 0: 1) + (filler->histogramCutMaskName().empty() ? 0 : 1);
+
+    if ( fillerCardinality == 1 ) { // simplest case, optimising this to be super fast
+      for ( auto& var: monitoredVariables ) {
+        if ( var.get().name().compare( filler->histogramVariablesNames()[0] ) == 0 )  {
+	  m_vars.var[0] = &var.get();
+          filler->fill( m_vars );
           break;
         }
       }
-    }
-
-    // Find the weight variable in the list of monitored variables
-    const auto& fillerWeight = filler->histogramWeightName();
-    Monitored::IMonitoredVariable* weight(nullptr);
-    if ( not fillerWeight.empty() ) {
-      for (const auto& monValue : monitoredVariables) {
-        if (fillerWeight.compare(monValue.get().name()) == 0) {
-          weight = &monValue.get();
-          break;
-        }
+    } else { // a more complicated case, and cuts or weights
+      int matchesCount = 0;
+      for ( const auto& var: monitoredVariables ) {
+	bool matched = false;
+	for ( unsigned fillerVarIndex = 0; fillerVarIndex < filler->histogramVariablesNames().size(); ++fillerVarIndex ) {
+	  if ( var.get().name().compare( filler->histogramVariablesNames()[fillerVarIndex] ) == 0 ) {
+	    m_vars.set(fillerVarIndex, &var.get());
+	    matched = true;
+	    matchesCount++;
+	    break;
+	  }
+	}
+	if ( matchesCount == fillerCardinality ) break;
+	if ( not matched ) { // may be a weight or cut variable still
+	  if ( var.get().name().compare( filler->histogramWeightName() ) == 0 )  {
+	    m_vars.weight = &var.get();
+	    matchesCount ++;
+	  } else if ( var.get().name().compare( filler->histogramCutMaskName() ) == 0 )  {
+	    m_vars.cut = &var.get();
+	    matchesCount++;
+	  }
+	}
+	if ( matchesCount == fillerCardinality ) break;
       }
-    }
-
-    // Find the cutMask variable in the list of monitored variables
-    const auto& fillerCutMask = filler->histogramCutMaskName();
-    Monitored::IMonitoredVariable* cutmask(nullptr);
-    if ( not fillerCutMask.empty() ) {
-      for (const auto& monValue : monitoredVariables) {
-        if (fillerCutMask.compare(monValue.get().name()) == 0) {
-          cutmask = &monValue.get();
-          break;
-        }
+      if ( matchesCount == fillerCardinality ) {
+	filler->fill( m_vars );
+      } else if ( ATH_UNLIKELY( matchesCount != 0 ) ) { // something has matched, but not all, worth informing user
+	bool reasonFound = false;
+	if (ATH_UNLIKELY(!filler->histogramWeightName().empty() && !m_vars.weight)) {
+	  reasonFound = true;
+	  ATH_MSG_DEBUG("Filler weight not found in monitoredVariables:"
+			<< "\n  Filler weight               : " << filler->histogramWeightName()
+			<< "\n  Asked to fill from mon. vars: " << monitoredVariables);
+	}
+	if (ATH_UNLIKELY(!filler->histogramCutMaskName().empty() && !m_vars.cut)) {
+	  reasonFound = true;
+	  ATH_MSG_DEBUG("Filler cut mask not found in monitoredVariables:"
+			<< "\n  Filler cut mask             : " << filler->histogramCutMaskName()
+			<< "\n  Asked to fill from mon. vars: " << monitoredVariables);
+	}
+	if ( not reasonFound ) {
+	  ATH_MSG_DEBUG("Filler has different variables than monitoredVariables:"
+			<< "\n  Filler variables            : " << filler->histogramVariablesNames()
+			<< "\n  Asked to fill from mon. vars: " << monitoredVariables
+			<< "\n  Selected monitored variables: " << m_vars.names() );
+	}
       }
     }
-
-    if (fillerVariables.size() != variables.size()) {
-      ATH_MSG_DEBUG("Filler has different variables than monitoredVariables:"
-                    << "\n  Filler variables            : " << fillerVariables
-                    << "\n  Asked to fill from mon. vars: " << monitoredVariables
-                    << "\n  Selected monitored variables: " << variables);
-      continue;
-    }
-    if (ATH_UNLIKELY(!fillerWeight.empty() && !weight)) {
-      ATH_MSG_DEBUG("Filler weight not found in monitoredVariables:"
-                    << "\n  Filler weight               : " << fillerWeight
-                    << "\n  Asked to fill from mon. vars: " << monitoredVariables);
-      continue;
-    }
-    if (ATH_UNLIKELY(!fillerCutMask.empty() && !cutmask)) {
-      ATH_MSG_DEBUG("Filler cut mask not found in monitoredVariables:"
-                    << "\n  Filler cut mask             : " << fillerCutMask
-                    << "\n  Asked to fill from mon. vars: " << monitoredVariables);
-      continue;
-    }
-    
-    std::scoped_lock guard(m_fillMutex);
-    filler->setMonitoredVariables(std::move(variables));
-    filler->setMonitoredWeight(weight);
-    filler->setMonitoredCutMask(cutmask);
-    filler->fill();    
-  }  
+  }
 }
 
 uint32_t GenericMonitoringTool::runNumber() {
diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/CumulativeHistogramFiller1D.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/CumulativeHistogramFiller1D.h
index 195ce9c23b6617da681aca6580d8c4a20ece2e6c..3cd467a27562c1c258f893fed90dbf3a65ba1892 100644
--- a/Control/AthenaMonitoringKernel/src/HistogramFiller/CumulativeHistogramFiller1D.h
+++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/CumulativeHistogramFiller1D.h
@@ -16,20 +16,17 @@ namespace Monitored {
     CumulativeHistogramFiller1D(const HistogramDef& definition, std::shared_ptr<IHistogramProvider> provider)
       : HistogramFiller1D(definition, provider) {}
 
-    virtual CumulativeHistogramFiller1D* clone() const override {
-      return new CumulativeHistogramFiller1D( *this );
-    }
 
     
-    virtual unsigned fill() const override {
-      if (m_monVariables.size() != 1) {
+    virtual unsigned fill( const HistogramFiller::VariablesPack& vars ) const override {
+      if ( vars.size() != 1) {
         return 0;
       }
 
-      size_t varVecSize = m_monVariables.at(0).get().size();
+      const size_t varVecSize = vars.var[0]->size();
 
       // handling of the cutmask
-      auto cutMaskValuePair = getCutMaskFunc();
+      auto cutMaskValuePair = getCutMaskFunc( vars.cut );
       if (cutMaskValuePair.first == 0) { return 0; }
       if (ATH_UNLIKELY(cutMaskValuePair.first > 1 && cutMaskValuePair.first != varVecSize)) {
         MsgStream log(Athena::getMessageSvc(), "CumulativeHistogramFiller1D");
@@ -37,13 +34,11 @@ namespace Monitored {
             << cutMaskValuePair.first << " " << varVecSize << endmsg;
       }
       auto cutMaskValue = cutMaskValuePair.second;
-
-      unsigned i(0);
+      unsigned i{0};
       auto histogram = this->histogram<TH1>();
-      const IMonitoredVariable& var = m_monVariables[0].get();
-      for (size_t i = 0; i < var.size(); i++) {
+      for (; i < varVecSize; i++) {
         if (!cutMaskValue(i)) { continue; }
-        const unsigned bin = histogram->FindBin(var.get(i));
+        const unsigned bin = histogram->FindBin(vars.var[0]->get(i));
 
         for (unsigned j = bin; j > 0; --j) {
           histogram->AddBinContent(j);
diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller1D.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller1D.h
index 4d0232d865496375faec67f200669a61fc6016bb..57c8e9064b1ef4240c36b6cc9eedc319233acfa4 100644
--- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller1D.h
+++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller1D.h
@@ -24,42 +24,35 @@ namespace Monitored {
       : HistogramFiller(definition, provider) {
     }
 
-    virtual HistogramFiller1D* clone() const override {
-      return new HistogramFiller1D( *this );
-    }
-
-    virtual unsigned fill() const override {
-      if (m_monVariables.size() != 1) { return 0; }
-      const IMonitoredVariable& var = m_monVariables.at(0).get();
-
+    virtual unsigned fill( const HistogramFiller::VariablesPack& vars ) const override {
       std::function<bool(size_t)> cutMaskAccessor;
-      if (m_monCutMask) {
+      if ( vars.cut ) {
         // handling of the cutmask
-        auto cutMaskValuePair = getCutMaskFunc();
+        auto cutMaskValuePair = getCutMaskFunc(vars.cut);
         if (cutMaskValuePair.first == 0) { return 0; }
-        if (ATH_UNLIKELY(cutMaskValuePair.first > 1 && cutMaskValuePair.first != var.size())) {
+        if (ATH_UNLIKELY(cutMaskValuePair.first > 1 && cutMaskValuePair.first != vars.var[0]->size())) {
           MsgStream log(Athena::getMessageSvc(), "HistogramFiller1D");
           log << MSG::ERROR << "CutMask does not match the size of plotted variable: "
-              << cutMaskValuePair.first << " " << var.size() << endmsg;
+              << cutMaskValuePair.first << " " << vars.var[0]->size() << endmsg;
         }
         cutMaskAccessor = cutMaskValuePair.second;
       }
 
-      if (m_monWeight) {
-        auto weightAccessor = [&](size_t i){ return m_monWeight->get(i); };
+      if (vars.weight) {
+        auto weightAccessor = [&](size_t i){ return vars.weight->get(i); };
 
-        if (ATH_UNLIKELY(m_monWeight->size() != var.size())) {
+        if (ATH_UNLIKELY(vars.weight->size() != vars.var[0]->size())) {
           MsgStream log(Athena::getMessageSvc(), "HistogramFiller1D");
           log << MSG::ERROR << "Weight does not match the size of plotted variable: "
-              << m_monWeight->size() << " " << var.size() << endmsg;
+              << vars.weight->size() << " " << vars.var[0]->size() << endmsg;
         }
         // Need to fill here while weightVector is still in scope
-        if (not m_monCutMask) return HistogramFiller::fill<TH1>(weightAccessor, detail::noCut, var);
-        else                  return HistogramFiller::fill<TH1>(weightAccessor, cutMaskAccessor, var);
+        if (not vars.cut) return HistogramFiller::fill<TH1>(weightAccessor, detail::noCut, *vars.var[0]);
+        else                  return HistogramFiller::fill<TH1>(weightAccessor, cutMaskAccessor, *vars.var[0]);
       }
 
-      if (not m_monCutMask) return HistogramFiller::fill<TH1>(detail::noWeight, detail::noCut, var);
-      else                  return HistogramFiller::fill<TH1>(detail::noWeight, cutMaskAccessor, var);
+      if (not vars.cut) return HistogramFiller::fill<TH1>(detail::noWeight, detail::noCut, *vars.var[0]);
+      else                  return HistogramFiller::fill<TH1>(detail::noWeight, cutMaskAccessor, *vars.var[0]);      
     }
   };
 }
diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2D.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2D.h
index 302e6f3c293874f748e6bf08414d65e4f9718244..fdea3f617abb955f1cada3df3851380d8f66f0b8 100644
--- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2D.h
+++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2D.h
@@ -25,62 +25,55 @@ namespace Monitored {
     HistogramFiller2DGeneric(const HistogramDef& definition, std::shared_ptr<IHistogramProvider> provider)
       : HistogramFiller(definition, provider) {}
 
-    virtual HistogramFiller2DGeneric* clone() const override {
-      return new HistogramFiller2DGeneric( *this );
-    }
-    
-    virtual unsigned fill() const override {
-      if (ATH_UNLIKELY(m_monVariables.size() != 2)) return 0;
+    virtual unsigned fill( const HistogramFiller::VariablesPack& vars) const override {
+      if (ATH_UNLIKELY(vars.var[0] == nullptr or vars.var[1] == nullptr )) return 0;
 
-      const IMonitoredVariable& var1 = m_monVariables[0].get();
-      const IMonitoredVariable& var2 = m_monVariables[1].get();
-      const size_t size1 = var1.size();
-      const size_t size2 = var2.size();
+      const size_t size0 = vars.var[0]->size();
+      const size_t size1 = vars.var[1]->size();
 
-      if (ATH_UNLIKELY(size1 == 0 || size2 == 0)) {
+      if (ATH_UNLIKELY(size0 == 0 || size1 == 0)) {
         // nothing to do
         return 0;
       }
 
-      if (ATH_UNLIKELY(size1 > 1 && size2 > 1 && size1 != size2)) {
+      if (ATH_UNLIKELY(size0 > 1 && size1 > 1 && size0 != size1)) {
         MsgStream log(Athena::getMessageSvc(), "HistogramFiller2D");
         log << MSG::ERROR << "Mismatch of provided vector sizes "
-            << size1 << "," << size2 << " for " << m_histDef->alias << endmsg;
+            << size0 << "," << size1 << " for " << m_histDef->alias << endmsg;
         return 0;
       }
 
       std::function<bool(size_t)> cutMaskAccessor;
-      if (m_monCutMask) {
+      if (vars.cut) {
         // handling of the cutmask
-        auto cutMaskValuePair = getCutMaskFunc();
+        auto cutMaskValuePair = getCutMaskFunc(vars.cut);
         if (cutMaskValuePair.first == 0) { return 0; }
-        if (ATH_UNLIKELY(size1 > 1 && size2 > 1 &&
-                         cutMaskValuePair.first > 1 && size1 != cutMaskValuePair.first)) {
+        if (ATH_UNLIKELY(size0 > 1 && size1 > 1 &&
+                         cutMaskValuePair.first > 1 && size0 != cutMaskValuePair.first)) {
           MsgStream log(Athena::getMessageSvc(), "HistogramFiller2D");
           log << MSG::ERROR << "CutMask does not match the size of plotted variable: "
-              << cutMaskValuePair.first << " " << size1 << endmsg;
+              << cutMaskValuePair.first << " " << size0 << endmsg;
           return 0;
         }
         cutMaskAccessor = cutMaskValuePair.second;
       }
 
-      if (m_monWeight) {
-        auto weightAccessor = [&](size_t i){ return m_monWeight->get(i); };
-
-        if (ATH_UNLIKELY(size1 > 1 && size2 > 1 &&
-                         m_monWeight->size() > 1 && size1 != m_monWeight->size())) {
+      if (vars.weight) {
+        auto weightAccessor = [&](size_t i){ return vars.weight->get(i); };
+        if (ATH_UNLIKELY(size0 > 1 && size1 > 1 &&
+                         vars.weight->size() > 1 && size0 != vars.weight->size())) {
           MsgStream log(Athena::getMessageSvc(), "HistogramFiller2D");
           log << MSG::ERROR << "Weight does not match the size of plotted variable: "
-              << m_monWeight->size() << " " << size1 << endmsg;
+              << vars.weight->size() << " " << size0 << endmsg;
           return 0;
         }
         // Need to fill here while weightVector is still in scope
-        if (not m_monCutMask) return HistogramFiller::fill<H>(weightAccessor, detail::noCut, var1, var2);
-        else                  return HistogramFiller::fill<H>(weightAccessor, cutMaskAccessor, var1, var2);
+        if (not vars.cut) return HistogramFiller::fill<H>(weightAccessor, detail::noCut, *vars.var[0], *vars.var[1]);
+        else                  return HistogramFiller::fill<H>(weightAccessor, cutMaskAccessor, *vars.var[0], *vars.var[1]);
       }
 
-      if (not m_monCutMask) return HistogramFiller::fill<H>(detail::noWeight, detail::noCut, var1, var2);
-      else                  return HistogramFiller::fill<H>(detail::noWeight, cutMaskAccessor, var1, var2);
+      if (not vars.cut) return HistogramFiller::fill<H>(detail::noWeight, detail::noCut, *vars.var[0], *vars.var[1]);
+      else                  return HistogramFiller::fill<H>(detail::noWeight, cutMaskAccessor, *vars.var[0], *vars.var[1]);
     }
   };
 
@@ -88,3 +81,4 @@ namespace Monitored {
 }
 
 #endif /* AthenaMonitoringKernel_HistogramFiller_HistogramFiller2D_h */
+
diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2DProfile.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2DProfile.h
index e8f8e150b19a248d42680300bfa93387b5f04012..1e79c9462cc76dd251491fcb0e8b883fbb6d5644 100644
--- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2DProfile.h
+++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2DProfile.h
@@ -19,26 +19,18 @@ namespace Monitored {
     HistogramFiller2DProfile(const HistogramDef& definition, std::shared_ptr<IHistogramProvider> provider)
       : HistogramFiller(definition, provider) {}
 
-    virtual HistogramFiller2DProfile* clone() const override {
-      return new HistogramFiller2DProfile( *this );
-    }
-
 
-    virtual unsigned fill() const override {
-      if (m_monVariables.size() != 3) {
+    virtual unsigned fill( const HistogramFiller::VariablesPack& vars ) const override {
+	if ( vars.size() != 3) {
         return 0;
       }
 
       // handling of the cutmask
-      auto cutMaskValuePair = getCutMaskFunc();
+      auto cutMaskValuePair = getCutMaskFunc(vars.cut);
       if (cutMaskValuePair.first == 0) { return 0; }
       auto cutMaskAccessor = cutMaskValuePair.second;
 
       auto histogram = this->histogram<TProfile2D>();
-      const IMonitoredVariable& var1 = m_monVariables[0].get();
-      const IMonitoredVariable& var2 = m_monVariables[1].get();
-      const IMonitoredVariable& var3 = m_monVariables[2].get();
-
       /*HERE NEED TO INCLUDE CASE IN WHICH SOME VARIABLES ARE SCALAR AND SOME VARIABLES ARE VECTORS
       unsigned i(0);
       if (m_variable1->size() != m_variable2->size() || m_variable1->size() != m_variable3->size() || m_variable2->size() != m_variable3->size() ) {
@@ -46,22 +38,22 @@ namespace Monitored {
       }*/
 
       //For now lets just consider the case in which all variables are of the same length
-      if ( m_monWeight && m_monWeight->size()==var1.size() ) {
+      if ( vars.weight && vars.weight->size() == vars.var[0]->size() ) {
         // Weighted fill
-        for (unsigned i = 0; i < var1.size(); ++i) {
+        for (unsigned i = 0; i < vars.var[0]->size(); ++i) {
           if (cutMaskAccessor(i)) {
-            histogram->Fill(var1.get(i), var2.get(i), var3.get(i), m_monWeight->get(i));
+            histogram->Fill(vars.var[0]->get(i), vars.var[1]->get(i), vars.var[2]->get(i), vars.weight->get(i));
           }
         }
       } else {
         // Unweighted fill
-        for (unsigned i = 0; i < var1.size(); ++i) {
+        for (unsigned i = 0; i < vars.var[0]->size(); ++i) {
           if (cutMaskAccessor(i)) {
-            histogram->Fill(var1.get(i), var2.get(i), var3.get(i));
+            histogram->Fill(vars.var[0]->get(i), vars.var[1]->get(i), vars.var[2]->get(i));
           }
         }
       }
-      return var1.size();
+      return vars.var[0]->size();
     }
   };
 }
diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerEfficiency.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerEfficiency.h
index 2cd1f38d003ed449de1d7481d93aeeb76f088056..14a619ce24526925832ca0129fb6655a1714742d 100644
--- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerEfficiency.h
+++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerEfficiency.h
@@ -19,58 +19,57 @@ namespace Monitored {
     HistogramFillerEfficiency(const HistogramDef& definition, std::shared_ptr<IHistogramProvider> provider)
       : HistogramFiller(definition, provider) {}
 
-    virtual HistogramFillerEfficiency* clone() const override {
-      return new HistogramFillerEfficiency( *this );
-    }
+    virtual unsigned fill( const HistogramFiller::VariablesPack& vars ) const override {
+
+      if ( ATH_UNLIKELY( vars.var[0] == nullptr or vars.var[1] == nullptr ) ) return 0;
 
-    virtual unsigned fill() const override {
-      const size_t nMonVar = m_monVariables.size();
-      if ( nMonVar<2 ) return 0;
 
-      const IMonitoredVariable& var0 = m_monVariables[0].get();
 
-      auto cutMaskValuePair = getCutMaskFunc();
+      auto cutMaskValuePair = getCutMaskFunc(vars.cut);
       if (cutMaskValuePair.first == 0) { return 0; }
-      if (ATH_UNLIKELY(cutMaskValuePair.first > 1 && cutMaskValuePair.first != var0.size())) {
+      if (ATH_UNLIKELY(cutMaskValuePair.first > 1 && cutMaskValuePair.first != vars.var[0]->size())) {
         MsgStream log(Athena::getMessageSvc(), "HistogramFillerEfficiency");
         log << MSG::ERROR << "CutMask does not match the size of plotted variable: " 
-            << cutMaskValuePair.first << " " << var0.size() << endmsg;
+            << cutMaskValuePair.first << " " << vars.var[0]->size() << endmsg;
       }
       auto cutMaskAccessor = cutMaskValuePair.second;
 
       TEfficiency* efficiency = this->histogram<TEfficiency>();
       const TH1* efftot = efficiency->GetTotalHistogram();
 
+      const unsigned nMonVar = vars.size();
+      const size_t var0Size = vars.var[0]->size();
       if ( nMonVar==2 ) { // Single observable (1D TEfficiency)
-        for (unsigned i = 0; i < var0.size(); ++i) {
+        for (unsigned i = 0; i < var0Size; ++i) {
           if (cutMaskAccessor(i)) {
-            efficiency->Fill(var0.get(i),
-                             detail::getFillValue<Axis::X>(efftot, m_monVariables[1].get(), i));
+            efficiency->Fill(vars.var[0]->get(i),
+                             detail::getFillValue<Axis::X>(efftot, vars.var[1], i));
           }
         }
-        return var0.size();
+        return var0Size;
       } else if ( nMonVar==3 ) { // Two observables (2D TEfficiency)
-        for (unsigned i = 0; i < var0.size(); ++i) {
+        for (unsigned i = 0; i < var0Size; ++i) {
           if (cutMaskAccessor(i)) {
-            efficiency->Fill(var0.get(i),
-                             detail::getFillValue<Axis::X>(efftot, m_monVariables[1].get(), i),
-                             detail::getFillValue<Axis::Y>(efftot, m_monVariables[2].get(), i));
+            efficiency->Fill(vars.var[0]->get(i),
+                             detail::getFillValue<Axis::X>(efftot, vars.var[1], i),
+                             detail::getFillValue<Axis::Y>(efftot, vars.var[2], i));
           }
         }
-        return var0.size();
+        return var0Size;
       } else if ( nMonVar==4 ) { // Three observables (3D Efficiency)
-        for (unsigned i = 0; i < var0.size(); ++i) {
+        for (unsigned i = 0; i < var0Size; ++i) {
           if (cutMaskAccessor(i)) {
-            efficiency->Fill(var0.get(i),
-                             detail::getFillValue<Axis::X>(efftot, m_monVariables[1].get(), i),
-                             detail::getFillValue<Axis::Y>(efftot, m_monVariables[2].get(), i),
-                             detail::getFillValue<Axis::Z>(efftot, m_monVariables[3].get(), i));
+            efficiency->Fill(vars.var[0]->get(i),
+                             detail::getFillValue<Axis::X>(efftot, vars.var[1], i),
+                             detail::getFillValue<Axis::Y>(efftot, vars.var[2], i),
+                             detail::getFillValue<Axis::Z>(efftot, vars.var[3], i));
           }
         }
-        return var0.size();
+        return var0Size;
       } else {
         return 0;
       }
+      return var0Size;
     }
   };
 }
diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerRebinable.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerRebinable.h
index e609696d8bebd50d32548d61a2b972a0f1f394db..acbfe563cd74822a1730ac02309c7d3c02461634 100644
--- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerRebinable.h
+++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerRebinable.h
@@ -33,17 +33,13 @@ namespace Monitored {
       }
     }
 
-    virtual HistogramFillerRebinableAxis* clone() const override {
-      return new HistogramFillerRebinableAxis( *this );
-    }
-
-    virtual unsigned fill() const override {
-      if (AXIS >= this->m_monVariables.size()) { return 0; }
-      if (this->m_monVariables[AXIS].get().size()==0) { return 0; }
+    virtual unsigned fill( const HistogramFiller::VariablesPack& vars ) const override {
+      if (AXIS >= vars.size() ) { return 0; }
+      if (vars.var[AXIS]->size()==0) { return 0; }
 
       double min = std::numeric_limits<double>::max();
       double max = std::numeric_limits<double>::min();
-      const IMonitoredVariable& var = this->m_monVariables[AXIS].get();
+      const IMonitoredVariable& var = *vars.var[AXIS];
       for (size_t i = 0; i < var.size(); i++) {
         const double v = var.get(i);
         if (v < min) min = v;
@@ -62,7 +58,7 @@ namespace Monitored {
         if (max >= axis->GetXmax()) hist->ExtendAxis(max, axis);
         if (min < axis->GetXmin()) hist->ExtendAxis(min, axis);
       }
-      return BASE::fill();
+      return BASE::fill( vars );
     }
 
   private:
diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerTree.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerTree.h
index f06b017558dc78eec1e485e2e7f14b8d3b712f1d..07f5bdf52af566b1c2eda5ca002e2b51a67aadc4 100644
--- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerTree.h
+++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerTree.h
@@ -26,13 +26,9 @@ namespace Monitored {
         parseDefinition();
     }
 
-    virtual HistogramFillerTree* clone() const override {
-      return new HistogramFillerTree( *this );
-    }
-
-    virtual unsigned fill() const override {
-      // handling of the cutmask
-      auto cutMaskValuePair = getCutMaskFunc();
+    virtual unsigned fill( const HistogramFiller::VariablesPack& vars ) const override {
+      // handling of the cutmask      
+      auto cutMaskValuePair = getCutMaskFunc(vars.cut);
       if (cutMaskValuePair.first == 0) { return 0; }
       if (ATH_UNLIKELY(cutMaskValuePair.first > 1)) {
         MsgStream log(Athena::getMessageSvc(), "HistogramFillerTree");
@@ -42,10 +38,10 @@ namespace Monitored {
         if (! cutMaskValuePair.second(0)) { return 0; }
       }
 
-      if (ATH_UNLIKELY(m_monVariables.size() != m_branchDefs.size())) {
+      if (ATH_UNLIKELY(vars.size() != m_branchDefs.size())) {
         MsgStream log(Athena::getMessageSvc(), "HistogramFillerTree");
         log << MSG::ERROR << "Mismatch of passed variables and expected variables for " << m_histDef->alias 
-                          << "(" << m_monVariables.size() << ", " << m_branchDefs.size() << ")" << endmsg;
+                          << "(" << vars.size() << ", " << m_branchDefs.size() << ")" << endmsg;
         return 0;
       }
 
@@ -63,7 +59,8 @@ namespace Monitored {
           ++idx; continue;
         }
         TBranch* branch = static_cast<TBranch*>(branchList->At(idxgood));
-        m_fillerFunctions[idx](branch, m_monVariables[idx].get());
+	std::cout << "Calling filler function for var : " <<  vars.var[idx]->name() << " branch " << branch->GetName() << "\n";
+        m_fillerFunctions[idx](branch, *vars.var[idx]);
         ++idx; ++idxgood;
       }
       for (Int_t i = 0; i < branchList->GetEntries(); ++i) {
@@ -71,7 +68,7 @@ namespace Monitored {
 
       }
       tree->SetEntries(tree->GetEntries() + 1);
-      return 1;
+      return 1;     
     }
 
   private:
diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerUtils.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerUtils.h
index 3552810fe76032bf441e17625bc3371a399dba8d..546eaf03f1876d4bd4f31ef9b2f7e6ae31ede1f8 100644
--- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerUtils.h
+++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerUtils.h
@@ -51,13 +51,13 @@ namespace Monitored {
      * @param  i       index for IMonitoredVariable value lookup
      */
     template<Axis AXIS, typename H>
-    double getFillValue(const H* hist, const IMonitoredVariable& var, size_t i) {
-      if ( var.hasStringRepresentation() ) {
+    double getFillValue(const H* hist, const IMonitoredVariable* var, size_t i) {
+      if ( var->hasStringRepresentation() ) {
         const TAxis* axis = getAxis<AXIS>(hist);
-        const int binNumber = axis->FindFixBin( var.getString(i).c_str() );
+        const int binNumber = axis->FindFixBin( var->getString(i).c_str() );
         return axis->GetBinCenter(binNumber);
       } else {
-        return var.get(i);
+        return var->get(i);
       }
     }
 
diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/VecHistogramFiller1D.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/VecHistogramFiller1D.h
index 71424fa18f1c123a6a45e6a2d763ea805a1c725e..27ecc1c19d164512785a5911276f544c6c78052d 100644
--- a/Control/AthenaMonitoringKernel/src/HistogramFiller/VecHistogramFiller1D.h
+++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/VecHistogramFiller1D.h
@@ -13,38 +13,34 @@ namespace Monitored {
     VecHistogramFiller1D(const HistogramDef& definition, std::shared_ptr<IHistogramProvider> provider)
       : HistogramFiller1D(definition, provider) {}
 
-    virtual VecHistogramFiller1D* clone() const override {
-      return new VecHistogramFiller1D( *this );
-    }
 
-    virtual unsigned fill() const override {
-      if (m_monVariables.size() != 1) { return 0; }
-      const IMonitoredVariable& var = m_monVariables[0].get();
+    virtual unsigned fill(const HistogramFiller::VariablesPack& vars) const override {
+      if ( ATH_UNLIKELY( vars.var[0] == nullptr or vars.size() != 0 ) ) { return 0; }
 
       std::function<bool(size_t)> cutMaskAccessor;
-      if (m_monCutMask) {
+      if (vars.cut) {
         // handling of the cutmask
-        auto cutMaskValuePair = getCutMaskFunc();
+        auto cutMaskValuePair = getCutMaskFunc(vars.cut);
         if (cutMaskValuePair.first == 0) { return 0; }
-        if (ATH_UNLIKELY(cutMaskValuePair.first > 1 && cutMaskValuePair.first != var.size())) {
+        if (ATH_UNLIKELY(cutMaskValuePair.first > 1 && cutMaskValuePair.first != vars.var[0]->size())) {
           MsgStream log(Athena::getMessageSvc(), "VecHistogramFiller1D");
           log << MSG::ERROR << "CutMask does not match the size of plotted variable: "
-              << cutMaskValuePair.first << " " << var.size() << endmsg;
+              << cutMaskValuePair.first << " " << vars.var[0]->size() << endmsg;
         }
         cutMaskAccessor = cutMaskValuePair.second;
       }
 
       auto histogram = this->histogram<TH1>();
       const unsigned offset = m_histDef->kVecUO ? 0 : 1;
-      for (unsigned i = 0; i < var.size(); ++i) {
+      for (unsigned i = 0; i < vars.var[0]->size(); ++i) {
         if (cutMaskAccessor && cutMaskAccessor(i)) {
-          const double value = var.get(i);
+          const double value = vars.var[0]->get(i);
           histogram->AddBinContent(i+offset, value);
           histogram->SetEntries(histogram->GetEntries() + value);
         }
       }
 
-      return var.size();
+      return vars.var[0]->size();
     }
   };
 }
diff --git a/Control/AthenaMonitoringKernel/test/HistogramFillerFactoryTestSuite.cxx b/Control/AthenaMonitoringKernel/test/HistogramFillerFactoryTestSuite.cxx
index a16941c0cc10146ccd499318dcc83215f4795f70..a62e401b2280e52438e24e4ddda6da1ed455e723 100644
--- a/Control/AthenaMonitoringKernel/test/HistogramFillerFactoryTestSuite.cxx
+++ b/Control/AthenaMonitoringKernel/test/HistogramFillerFactoryTestSuite.cxx
@@ -47,7 +47,7 @@ class HistogramProviderGetter : public HistogramFiller {
     HistogramProviderGetter(const HistogramFiller& hf) 
       : HistogramFiller(hf) {}
 
-    virtual unsigned fill() const { return 0; }
+  virtual unsigned fill( const HistogramFiller::VariablesPack& ) const { return 0; }
     virtual HistogramFiller* clone() const { return nullptr; }
 
     std::shared_ptr<IHistogramProvider> histogramProvider() { return m_histogramProvider; }
diff --git a/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable1DTestSuite.cxx b/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable1DTestSuite.cxx
index 1744e3dd5e901e61349133e23bc20957df7f59a0..4133e65d0efb96343a29913f455dee260cac8006 100644
--- a/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable1DTestSuite.cxx
+++ b/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable1DTestSuite.cxx
@@ -64,12 +64,14 @@ class HistogramFillerRebinable1DTestSuite {
 
     void test_shouldKeepNumberOfBinsForValueInHistogramsRange() {
       Monitored::Scalar<double> var("var", 2.9);
-      m_testObj->setMonitoredVariables({var});
+      HistogramFiller::VariablesPack vars({&var});
+
+
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
       VALUE(m_histogram->GetXaxis()->GetXmax()) EXPECTED(3.0);
 
-      m_testObj->fill();
+      m_testObj->fill(vars);
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
@@ -79,13 +81,13 @@ class HistogramFillerRebinable1DTestSuite {
 
     void test_shouldDoubleNumberOfBinsForBoundaryValueOf3() {
       Monitored::Scalar<double> var("var", 3.0);
-      m_testObj->setMonitoredVariables({var});
+      HistogramFiller::VariablesPack vars({&var});
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
       VALUE(m_histogram->GetXaxis()->GetXmax()) EXPECTED(3.0);
 
-      m_testObj->fill();
+      m_testObj->fill(vars);
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(16);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
@@ -95,13 +97,13 @@ class HistogramFillerRebinable1DTestSuite {
 
     void test_shouldDoubleNumberOfBinsForValueSlightlySmallerThan5() {
       Monitored::Scalar<double> var("var", 4.9);
-      m_testObj->setMonitoredVariables({var});
+      HistogramFiller::VariablesPack vars({&var});
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
       VALUE(m_histogram->GetXaxis()->GetXmax()) EXPECTED(3.0);
 
-      m_testObj->fill();
+      m_testObj->fill(vars);
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(16);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
@@ -111,13 +113,13 @@ class HistogramFillerRebinable1DTestSuite {
 
     void test_shouldQuadrupleNumberOfBinsForBoundaryValueOf5() {
       Monitored::Scalar<double> var("var", 5.0);
-      m_testObj->setMonitoredVariables({var});
+      HistogramFiller::VariablesPack vars({&var});
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
       VALUE(m_histogram->GetXaxis()->GetXmax()) EXPECTED(3.0);
 
-      m_testObj->fill();
+      m_testObj->fill(vars);
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(32);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
@@ -127,13 +129,13 @@ class HistogramFillerRebinable1DTestSuite {
 
     void test_shouldQuadrupleNumberOfBinsForValueSlightlyBiggerThan5() {
       Monitored::Scalar<double> var("var", 5.1);
-      m_testObj->setMonitoredVariables({var});
+      HistogramFiller::VariablesPack vars({&var});
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
       VALUE(m_histogram->GetXaxis()->GetXmax()) EXPECTED(3.0);
 
-      m_testObj->fill();
+      m_testObj->fill(vars);
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(32);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
@@ -143,13 +145,13 @@ class HistogramFillerRebinable1DTestSuite {
 
     void test_shouldQuadrupleNumberOfBinsForValueSlightlySmallerThan9() {
       Monitored::Scalar<double> var("var", 8.9);
-      m_testObj->setMonitoredVariables({var});
+      HistogramFiller::VariablesPack vars({&var});
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
       VALUE(m_histogram->GetXaxis()->GetXmax()) EXPECTED(3.0);
 
-      m_testObj->fill();
+      m_testObj->fill(vars);
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(32);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
@@ -159,13 +161,13 @@ class HistogramFillerRebinable1DTestSuite {
 
     void test_shouldOctupleNumberOfBinsForBoundaryValueOf9() {
       Monitored::Scalar<double> var("var", 9.0);
-      m_testObj->setMonitoredVariables({var});
+      HistogramFiller::VariablesPack vars({&var});
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
       VALUE(m_histogram->GetXaxis()->GetXmax()) EXPECTED(3.0);
 
-      m_testObj->fill();
+      m_testObj->fill(vars);
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(64);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
@@ -175,13 +177,13 @@ class HistogramFillerRebinable1DTestSuite {
 
     void test_shouldOctupleNumberOfBinsForValueSlightlyBiggerThan9() {
       Monitored::Scalar<double> var("var", 9.1);
-      m_testObj->setMonitoredVariables({var});
+      HistogramFiller::VariablesPack vars({&var});
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
       VALUE(m_histogram->GetXaxis()->GetXmax()) EXPECTED(3.0);
 
-      m_testObj->fill();
+      m_testObj->fill(vars);
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(64);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
@@ -194,7 +196,7 @@ class HistogramFillerRebinable1DTestSuite {
 
   // ==================== Initialization & run ====================
   public:
-    HistogramFillerRebinable1DTestSuite() 
+    HistogramFillerRebinable1DTestSuite()
       : m_log(Athena::getMessageSvc(), "HistogramFillerRebinable1DTestSuite") {
     }
 
@@ -224,7 +226,7 @@ class HistogramFillerRebinable1DTestSuite {
     HistogramDef m_histogramDef;
     shared_ptr<MockHistogramProvider> m_histogramProvider;
     shared_ptr<TH1D> m_histogram;
-    
+
     shared_ptr<HistogramFillerRebinable1D> m_testObj;
 };
 
diff --git a/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable2DTestSuite.cxx b/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable2DTestSuite.cxx
index 3986434f8673586094261287f63aa4b910a5d66f..f55abb00313aa8dc81bd34a738c6fe8c2514d0f8 100644
--- a/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable2DTestSuite.cxx
+++ b/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable2DTestSuite.cxx
@@ -22,7 +22,7 @@
 #include "AthenaKernel/getMessageSvc.h"
 
 #include "TH2D.h"
-
+#include "AthenaMonitoringKernel/HistogramFiller.h"
 #include "AthenaMonitoringKernel/MonitoredScalar.h"
 #include "../src/HistogramFiller/HistogramFillerRebinable.h"
 
@@ -60,7 +60,7 @@ class HistogramFillerRebinable2DTestSuite {
     void test_shouldKeepNumberOfBinsForValueInHistogramsRange() {
       Monitored::Scalar<double> var1("var1", 2.9);
       Monitored::Scalar<double> var2("var2", 4.9);
-      m_testObj->setMonitoredVariables({var1, var2});
+      HistogramFiller::VariablesPack vars({&var1, &var2});
 
       auto check = [&](){
         VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8);
@@ -71,7 +71,7 @@ class HistogramFillerRebinable2DTestSuite {
         VALUE(m_histogram->GetYaxis()->GetXmax()) EXPECTED(5.0);
       };
       check();
-      m_testObj->fill();
+      m_testObj->fill(vars);
       check();
       VALUE(m_histogram->GetBinContent(8,5)) EXPECTED(1.0);
     }
@@ -79,9 +79,9 @@ class HistogramFillerRebinable2DTestSuite {
     void test_shouldDoubleNumberOfBinsForValueOutsideRange() {
       Monitored::Scalar<double> var1("var1", 3.0);
       Monitored::Scalar<double> var2("var2", 5.0);
-      m_testObj->setMonitoredVariables({var1, var2});
+      HistogramFiller::VariablesPack vars({&var1, &var2});
 
-      m_testObj->fill();
+      m_testObj->fill(vars);
 
       VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(16);
       VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0);
@@ -125,7 +125,7 @@ class HistogramFillerRebinable2DTestSuite {
     HistogramDef m_histogramDef;
     shared_ptr<MockHistogramProvider> m_histogramProvider;
     shared_ptr<TH2D> m_histogram;
-    
+
     shared_ptr<HistogramFillerRebinable2D> m_testObj;
 };
 
diff --git a/Control/AthenaPython/share/icopy_file.py b/Control/AthenaPython/share/icopy_file.py
index 7b78938e01718d9eb438f43f1481d1fb862ff83a..ce7b1b4749fc5033d7030fc1d6bc4dac477ba5bf 100644
--- a/Control/AthenaPython/share/icopy_file.py
+++ b/Control/AthenaPython/share/icopy_file.py
@@ -13,7 +13,7 @@ __doc__ = "simple jobo to copy any file, leveraging the auto-config fwk"
 from AthenaCommon.AthenaCommonFlags import jobproperties as jp
 acf = jp.AthenaCommonFlags
 _input_files = globals()['FNAME']
-if isinstance(_input_files, basestring):
+if isinstance(_input_files, str):
     _input_files = [_input_files]
 acf.FilesInput = _input_files
 del _input_files
diff --git a/Control/AthenaPython/share/iread_file.py b/Control/AthenaPython/share/iread_file.py
index 057cbad995e4d93f23cf707946ddd1e1cba3cf95..398d27da60ccb274518fe26f7f040284c329b079 100644
--- a/Control/AthenaPython/share/iread_file.py
+++ b/Control/AthenaPython/share/iread_file.py
@@ -13,7 +13,7 @@ __doc__ = "simple jobo to read any file, leveraging the auto-config fwk"
 from AthenaCommon.AthenaCommonFlags import jobproperties as jp
 acf = jp.AthenaCommonFlags
 _input_files = globals().get('FNAME', [])
-if isinstance(_input_files, basestring):
+if isinstance(_input_files, str):
     _input_files = [_input_files]
 acf.FilesInput = _input_files
 del _input_files
diff --git a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonSvc.cxx b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonSvc.cxx
index 5a91438576a77917b97bac81cf83febb96883434..c160ec3bcc04bfb1c398a6beea9e9d2c76e0f7b5 100644
--- a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonSvc.cxx
+++ b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonSvc.cxx
@@ -594,10 +594,6 @@ StatusCode PerfMonSvc::initialize()
     PMON_ERROR("Unable to get the IncidentSvc");
     return StatusCode::FAILURE;
   }
-  const long highestPriority = static_cast<long>(-1);
-  const long lowestPriority  = 0;
-  incSvc->addListener( this, IncidentType::BeginEvent, highestPriority );
-  incSvc->addListener( this, IncidentType::EndEvent,    lowestPriority );
   incSvc->addListener( this, IncidentType::SvcPostFinalize );
 
   // make sure the correct auditor is configured and running
@@ -853,33 +849,6 @@ void PerfMonSvc::handle( const Incident& inc )
     return;
   }
 
-  // Performing performance-monitoring for BeginEvent incident
-  if ( inc.type() == IncidentType::BeginEvent ) {
-    static bool s_firstEvt = true;
-    if ( s_firstEvt ) {
-      s_firstEvt = false;
-      stopAud( "ini", "PerfMonSlice" );
-      // capture the number of algorithms - here
-      ServiceHandle<IAlgManager> mgr("ApplicationMgr", this->name());
-      m_nalgs = mgr->getAlgorithms().size();
-      m_ntuple.comp["ini"].clear();
-      m_ntuple.comp["cbk"].clear();
-      m_ntuple.comp["preLoadProxies"].clear();
-    }
-    startAud( "evt", "PerfMonSlice" );
-    PMON_VERBOSE("[" << IncidentType::BeginEvent << "] handled");
-    return;
-  }
-
-  // Performing performance-monitoring for EndEvent incident
-  if ( inc.type() == IncidentType::EndEvent ) {
-    // make sure we update the data from declareInfo...
-    poll();
-    stopAud( "evt", "PerfMonSlice" );
-    PMON_VERBOSE("[" << IncidentType::EndEvent << "] handled");
-    return;
-  }
-
   return;
 }
 
@@ -1146,6 +1115,23 @@ do_msg_mon(int lvl,
 void PerfMonSvc::startAud( const std::string& stepName,
                            const std::string& compName )
 {
+  // Performing performance-monitoring for BeginEvent
+  if ( compName == "AthMasterSeq" && stepName == "evt" ) {
+    static bool s_firstEvt = true;
+    if ( s_firstEvt ) {
+      s_firstEvt = false;
+      stopAud( "ini", "PerfMonSlice" );
+      // capture the number of algorithms - here
+      ServiceHandle<IAlgManager> mgr("ApplicationMgr", this->name());
+      m_nalgs = mgr->getAlgorithms().size();
+      m_ntuple.comp["ini"].clear();
+      m_ntuple.comp["cbk"].clear();
+      m_ntuple.comp["preLoadProxies"].clear();
+    }
+    startAud( "evt", "PerfMonSlice" );
+    return;
+  }
+
   if (m_extraPrintouts) {
     double vmem,rss;
     PMonSD::get_vmem_rss_kb(vmem,rss);
@@ -1172,6 +1158,14 @@ void PerfMonSvc::startAud( const std::string& stepName,
 void PerfMonSvc::stopAud( const std::string& stepName,
                           const std::string& compName )
 {
+  // Performing performance-monitoring for EndEvent
+  if ( compName == "AthMasterSeq" && stepName == "evt" ) {
+    // make sure we update the data from declareInfo...
+    poll();
+    stopAud( "evt", "PerfMonSlice" );
+    return;
+  }
+
   if (m_pmonsd)
     m_pmonsd->stopAud(stepName,compName,m_nevts);
 
diff --git a/DataQuality/DCSCalculator2/CMakeLists.txt b/DataQuality/DCSCalculator2/CMakeLists.txt
index 828e03df1d321f6d4f05b088be3d5425fb397adf..5428b74761aca932feb39fbcef75331a2f66480c 100644
--- a/DataQuality/DCSCalculator2/CMakeLists.txt
+++ b/DataQuality/DCSCalculator2/CMakeLists.txt
@@ -1,17 +1,8 @@
-################################################################################
-# Package: DCSCalculator2
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( DCSCalculator2 )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Database/CoolRunQuery
-                          TileCalorimeter/TileCalib/TileCalibBlobObjs
-                          DataQuality/DQDefects
-                          DataQuality/DQUtils )
-
 # External dependencies:
 find_package( sqlalchemy )
 find_package( ipython )
diff --git a/DataQuality/DQDefects/CMakeLists.txt b/DataQuality/DQDefects/CMakeLists.txt
index 78af5128d1f22db445d1d3809339d08139d1b5d8..c852b89d64f51f810f7b98897a1be7abd2d7b421 100644
--- a/DataQuality/DQDefects/CMakeLists.txt
+++ b/DataQuality/DQDefects/CMakeLists.txt
@@ -1,14 +1,8 @@
-################################################################################
-# Package: DQDefects
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( DQDefects )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          DataQuality/DQUtils )
-
 # External dependencies:
 find_package( Oracle )
 find_package( pyyaml )
diff --git a/DataQuality/DQUtils/CMakeLists.txt b/DataQuality/DQUtils/CMakeLists.txt
index 5ffbd7d58b04c4c0430311f157382a8679726773..70e8fd0e45dd84371f52580601f9ce90ffa2f625 100644
--- a/DataQuality/DQUtils/CMakeLists.txt
+++ b/DataQuality/DQUtils/CMakeLists.txt
@@ -1,14 +1,8 @@
-################################################################################
-# Package: DQUtils
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( DQUtils )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Database/CoraCool )
-
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( COOL COMPONENTS CoolKernel CoolApplication )
@@ -21,7 +15,6 @@ find_package( sqlalchemy )
 
 string(REPLACE "-Wl,--as-needed" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
 
-
 # Component(s) in the package:
 atlas_add_library( DQUtils
                    src/quick_retrieve.cxx
diff --git a/DataQuality/DataQualityConfigurations/CMakeLists.txt b/DataQuality/DataQualityConfigurations/CMakeLists.txt
index 4e11aa4cc5d6bd0511d9b265642564e0b9044ac0..2a673e40cd41459f98139f3b90708c5bcc07318d 100644
--- a/DataQuality/DataQualityConfigurations/CMakeLists.txt
+++ b/DataQuality/DataQualityConfigurations/CMakeLists.txt
@@ -1,14 +1,8 @@
-################################################################################
-# Package: DataQualityConfigurations
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( DataQualityConfigurations )
 
-# Requires DQI for binary build - this turns out not to do much, but keep for indication
-# Actual heavy lifting done by DEPENDS in add_custom_command
-atlas_depends_on_subdirs(PRIVATE DataQuality/DataQualityInterfaces)
-
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
 atlas_install_scripts( scripts/MergeConfigs.py scripts/UploadDQAMITag.py
diff --git a/DataQuality/DataQualityConfigurations/config/AFP/collisions_run.config b/DataQuality/DataQualityConfigurations/config/AFP/collisions_run.config
new file mode 100644
index 0000000000000000000000000000000000000000..902fe0284263ff85a0dad4fc4500007dc5ce9429
--- /dev/null
+++ b/DataQuality/DataQualityConfigurations/config/AFP/collisions_run.config
@@ -0,0 +1,969 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+############################################################
+# AFP
+# Nikola Dikic
+############################################################
+
+############################################################
+ # Reference
+reference AFPBinContentReference {
+	 location = /eos/atlas/atlascerngroupdisk/data-dqm/references/Other/,root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/data-dqm/references/Other/
+	 file = data18_13TeV.00337176.physics_Main.merge.HIST.f940_h308.root
+	 path = run_337176
+	 name = same_name
+}
+############################################################
+
+############################################################
+# Output
+############################################################
+
+output top_level {
+	output AFP {
+		output SiT {
+			output pixelColRow2D {
+			}
+			output PixelColIDChip {
+			}
+			output PixelRowIDChip {
+			}
+			output SiTimeOverThreshold {
+			}
+			output Cluster {
+			}
+			output Track {
+			}
+			output clustersPerPlane {
+			}
+			output clustersPerStation {
+			}
+			output clustersPerPlaneFront {
+			}
+			output clustersPerPlaneEnd {
+			}
+			output clustersPerPlaneMiddle {
+			}
+		}
+		output ToF {
+			output HitBarvsTrain {
+			}
+		}
+	}
+}
+
+############################################################
+# Histogram Assessments
+############################################################
+
+dir AFP {
+	dir SiT {
+		dir pixelColRow2D {
+			hist pixelColIDChip_vs_pixelRowIDChip_nearAside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+			hist pixelColIDChip_vs_pixelRowIDChip_nearAside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+			hist pixelColIDChip_vs_pixelRowIDChip_nearAside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+			hist pixelColIDChip_vs_pixelRowIDChip_nearAside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+			hist pixelColIDChip_vs_pixelRowIDChip_nearCside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+			hist pixelColIDChip_vs_pixelRowIDChip_nearCside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+			hist pixelColIDChip_vs_pixelRowIDChip_nearCside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+			hist pixelColIDChip_vs_pixelRowIDChip_nearCside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+			hist pixelColIDChip_vs_pixelRowIDChip_farAside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+			hist pixelColIDChip_vs_pixelRowIDChip_farAside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+			hist pixelColIDChip_vs_pixelRowIDChip_farAside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+			hist pixelColIDChip_vs_pixelRowIDChip_farAside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+			hist pixelColIDChip_vs_pixelRowIDChip_farCside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+			hist pixelColIDChip_vs_pixelRowIDChip_farCside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+			hist pixelColIDChip_vs_pixelRowIDChip_farCside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+			hist pixelColIDChip_vs_pixelRowIDChip_farCside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/pixelColRow2D
+				display = LogZ,Draw=COLZ
+			}
+		}
+		dir PixelColIDChip {
+			hist pixelColIDChip_nearAside_P0 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+			hist pixelColIDChip_nearAside_P1 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+			hist pixelColIDChip_nearAside_P2 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+			hist pixelColIDChip_nearAside_P3 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+			hist pixelColIDChip_farAside_P0 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+			hist pixelColIDChip_farAside_P1 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+			hist pixelColIDChip_farAside_P2 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+			hist pixelColIDChip_farAside_P3 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+			hist pixelColIDChip_nearCside_P0 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+			hist pixelColIDChip_nearCside_P1 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+			hist pixelColIDChip_nearCside_P2 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+			hist pixelColIDChip_nearCside_P3 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+			hist pixelColIDChip_farCside_P0 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+			hist pixelColIDChip_farCside_P1 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+			hist pixelColIDChip_farCside_P2 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+			hist pixelColIDChip_farCside_P3 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelColIDChip
+				display = Draw=HIST
+			}
+		}
+		dir PixelRowIDChip {
+			hist pixelRowIDChip_nearAside_P0 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+			hist pixelRowIDChip_nearAside_P1 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+			hist pixelRowIDChip_nearAside_P2 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+			hist pixelRowIDChip_nearAside_P3 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+			hist pixelRowIDChip_farAside_P0 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+			hist pixelRowIDChip_farAside_P1 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+			hist pixelRowIDChip_farAside_P2 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+			hist pixelRowIDChip_farAside_P3 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+			hist pixelRowIDChip_nearCside_P0 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+			hist pixelRowIDChip_nearCside_P1 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+			hist pixelRowIDChip_nearCside_P2 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+			hist pixelRowIDChip_nearCside_P3 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+			hist pixelRowIDChip_farCside_P0 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+			hist pixelRowIDChip_farCside_P1 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+			hist pixelRowIDChip_farCside_P2 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+			hist pixelRowIDChip_farCside_P3 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/PixelRowIDChip
+				display = Draw=HIST
+			}
+		}
+		dir SiTimeOverThreshold {
+			hist timeOverThreshold_nearAside_P0 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+			hist timeOverThreshold_nearAside_P1 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+			hist timeOverThreshold_nearAside_P2 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+			hist timeOverThreshold_nearAside_P3 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+			hist timeOverThreshold_farAside_P0 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+			hist timeOverThreshold_farAside_P1 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+			hist timeOverThreshold_farAside_P2 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+			hist timeOverThreshold_farAside_P3 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+			hist timeOverThreshold_nearCside_P0 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+			hist timeOverThreshold_nearCside_P1 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+			hist timeOverThreshold_nearCside_P2 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+			hist timeOverThreshold_nearCside_P3 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+			hist timeOverThreshold_farCside_P0 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+			hist timeOverThreshold_farCside_P1 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+			hist timeOverThreshold_farCside_P2 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+			hist timeOverThreshold_farCside_P3 {
+				algorithm = AFPBinContentComp
+				output = AFP/SiT/SiTimeOverThreshold
+				display = Draw=HIST
+			}
+		}
+		dir Cluster {
+			hist clusterX_vs_clusterY_nearAside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+			hist clusterX_vs_clusterY_nearAside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+			hist clusterX_vs_clusterY_nearAside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+			hist clusterX_vs_clusterY_nearAside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+			hist clusterX_vs_clusterY_farAside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+			hist clusterX_vs_clusterY_farAside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+			hist clusterX_vs_clusterY_farAside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+			hist clusterX_vs_clusterY_farAside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+			hist clusterX_vs_clusterY_nearCside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+			hist clusterX_vs_clusterY_nearCside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+			hist clusterX_vs_clusterY_nearCside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+			hist clusterX_vs_clusterY_nearCside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+			hist clusterX_vs_clusterY_farCside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+			hist clusterX_vs_clusterY_farCside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+			hist clusterX_vs_clusterY_farCside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+			hist clusterX_vs_clusterY_farCside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/Cluster
+				display = LogZ,Draw=COLZ
+			}
+		}
+		dir Track {
+			hist trackX_vs_trackY_nearAside {
+				algorithm = HNE
+				output = AFP/SiT/Track
+				display = LogZ,Draw=COLZ
+			}
+			hist trackX_vs_trackY_nearCside {
+				algorithm = HNE
+				output = AFP/SiT/Track
+				display = LogZ,Draw=COLZ
+			}
+			hist trackX_vs_trackY_farAside {
+				algorithm = HNE
+				output = AFP/SiT/Track
+				display = LogZ,Draw=COLZ
+			}
+			hist trackX_vs_trackY_farCside {
+				algorithm = HNE
+				output = AFP/SiT/Track
+				display = LogZ,Draw=COLZ
+			}
+		}
+		dir clustersPerPlane {
+			hist clustersPerPlane_vs_lb_farAside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+			hist clustersPerPlane_vs_lb_farAside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+			hist clustersPerPlane_vs_lb_farAside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+			hist clustersPerPlane_vs_lb_farAside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+			hist clustersPerPlane_vs_lb_nearAside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+			hist clustersPerPlane_vs_lb_nearAside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+			hist clustersPerPlane_vs_lb_nearAside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+			hist clustersPerPlane_vs_lb_nearAside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+			hist clustersPerPlane_vs_lb_farCside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+			hist clustersPerPlane_vs_lb_farCside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+			hist clustersPerPlane_vs_lb_farCside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+			hist clustersPerPlane_vs_lb_farCside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+			hist clustersPerPlane_vs_lb_nearCside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+			hist clustersPerPlane_vs_lb_nearCside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+			hist clustersPerPlane_vs_lb_nearCside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+			hist clustersPerPlane_vs_lb_nearCside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlane
+				display = Draw=COLZ
+			}
+		}
+		dir clustersPerPlaneFront {
+			hist clustersPerPlaneFront_vs_lb_farAside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneFront_vs_lb_farAside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneFront_vs_lb_farAside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneFront_vs_lb_farAside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneFront_vs_lb_nearAside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneFront_vs_lb_nearAside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneFront_vs_lb_nearAside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneFront_vs_lb_nearAside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneFront_vs_lb_farCside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneFront_vs_lb_farCside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneFront_vs_lb_farCside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneFront_vs_lb_farCside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneFront_vs_lb_nearCside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneFront_vs_lb_nearCside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneFront_vs_lb_nearCside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneFront_vs_lb_nearCside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneFront
+				display = Draw=COLZ
+			}
+		}
+		dir clustersPerPlaneEnd {
+			hist clustersPerPlaneEnd_vs_lb_farAside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneEnd_vs_lb_farAside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneEnd_vs_lb_farAside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneEnd_vs_lb_farAside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneEnd_vs_lb_nearAside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneEnd_vs_lb_nearAside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneEnd_vs_lb_nearAside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneEnd_vs_lb_nearAside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneEnd_vs_lb_farCside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneEnd_vs_lb_farCside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneEnd_vs_lb_farCside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneEnd_vs_lb_farCside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneEnd_vs_lb_nearCside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneEnd_vs_lb_nearCside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneEnd_vs_lb_nearCside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneEnd_vs_lb_nearCside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneEnd
+				display = Draw=COLZ
+			}
+		}
+		dir clustersPerPlaneMiddle {
+			hist clustersPerPlaneMiddle_vs_lb_farAside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneMiddle_vs_lb_farAside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneMiddle_vs_lb_farAside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneMiddle_vs_lb_farAside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneMiddle_vs_lb_nearAside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneMiddle_vs_lb_nearAside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneMiddle_vs_lb_nearAside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneMiddle_vs_lb_nearAside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneMiddle_vs_lb_farCside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneMiddle_vs_lb_farCside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneMiddle_vs_lb_farCside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneMiddle_vs_lb_farCside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneMiddle_vs_lb_nearCside_P0 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneMiddle_vs_lb_nearCside_P1 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneMiddle_vs_lb_nearCside_P2 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+			hist clustersPerPlaneMiddle_vs_lb_nearCside_P3 {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerPlaneMiddle
+				display = Draw=COLZ
+			}
+		}
+		dir clustersPerStation {
+			hist clustersPerStation_vs_lb_farAside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+			hist clustersPerStation_vs_lb_farCside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+			hist clustersPerStation_vs_lb_nearAside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+			hist clustersPerStation_vs_lb_nearCside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+			hist clustersPerStationFront_vs_lb_farAside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+			hist clustersPerStationFront_vs_lb_farCside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+			hist clustersPerStationFront_vs_lb_nearAside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+			hist clustersPerStationFront_vs_lb_nearCside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+			hist clustersPerStationEnd_vs_lb_farAside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+			hist clustersPerStationEnd_vs_lb_farCside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+			hist clustersPerStationEnd_vs_lb_nearAside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+			hist clustersPerStationEnd_vs_lb_nearCside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+			hist clustersPerStationMiddle_vs_lb_farAside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+			hist clustersPerStationMiddle_vs_lb_farCside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+			hist clustersPerStationMiddle_vs_lb_nearAside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+			hist clustersPerStationMiddle_vs_lb_nearCside {
+				algorithm = HNE
+				output = AFP/SiT/clustersPerStation
+				display = Draw=COLZ
+			}
+		}
+		hist nSiHits_vs_lb {
+			algorithm = HNE
+			output = AFP/SiT
+			display = Draw=HIST
+		}
+		hist muPerBCID_vs_lb {
+			algorithm = HNE
+			output = AFP/SiT
+			display = Draw=HIST
+		}
+	}
+	dir ToF {
+		hist numberOfHit_S0 {
+			algorithm = HNE
+			output = AFP/ToF
+			display = Draw=HIST
+		}
+		hist numberOfHit_S3 {
+			algorithm = HNE
+			output = AFP/ToF
+			display = Draw=HIST
+		}
+		dir HitBarvsTrain {
+			hist trainID_vs_barInTrainID_farAside {
+				algorithm = HNE
+				output = AFP/ToF/HitBarvsTrain
+				display = Draw=COLZ
+			}
+			hist trainID_vs_barInTrainID_farCside {
+				algorithm = HNE
+				output = AFP/ToF/HitBarvsTrain
+				display = Draw=COLZ
+			}
+		}
+	}
+}
+
+############################################################
+# Algorithms
+
+algorithm HNE {
+	libname = libdqm_algorithms.so
+	name = Histogram_Not_Empty
+}
+
+algorithm AFPBinContentComp {
+	libname = libdqm_algorithms.so
+	name = BinContentComp
+	thresholds = AFPTestThreshold
+	NSigma = 3
+	reference = AFPBinContentReference
+	publish = 1
+	NormRef = 1
+}
+############################################################
+
+
+############################################################
+# Thresholds
+thresholds AFPTestThreshold {
+	limits NBins {
+		warning = 3
+		error = 5
+	}
+}
+###########################################################
diff --git a/DataQuality/DataQualityConfigurations/config/AFP/collisions_run.hcfg b/DataQuality/DataQualityConfigurations/config/AFP/collisions_run.hcfg
new file mode 100644
index 0000000000000000000000000000000000000000..df62dc20436da44684e8df4182b5dcaf9b9ce1f2
Binary files /dev/null and b/DataQuality/DataQualityConfigurations/config/AFP/collisions_run.hcfg differ
diff --git a/DataQuality/DataQualityInterfaces/CMakeLists.txt b/DataQuality/DataQualityInterfaces/CMakeLists.txt
index 380a68b28a7bb6134bba071d92242003888ab372..5082eaa1373918493ed92843cf5c8d6331d2a79b 100644
--- a/DataQuality/DataQualityInterfaces/CMakeLists.txt
+++ b/DataQuality/DataQualityInterfaces/CMakeLists.txt
@@ -1,6 +1,4 @@
-################################################################################
-# Package: DataQualityInterfaces
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( DataQualityInterfaces )
@@ -17,7 +15,7 @@ find_package( nlohmann_json )
 atlas_add_root_dictionary( DataQualityInterfaces
                            DataQualityInterfacesDictSource
                            ROOT_HEADERS DataQualityInterfaces/DatabaseConfig.h DataQualityInterfaces/MiniConfig.h DataQualityInterfaces/MiniConfigTreeNode.h DataQualityInterfaces/HanApp.h DataQualityInterfaces/HanConfig.h DataQualityInterfaces/HanConfigAlgLimit.h DataQualityInterfaces/HanConfigAlgPar.h DataQualityInterfaces/HanConfigParMap.h DataQualityInterfaces/HanConfigAssessor.h DataQualityInterfaces/HanConfigCompAlg.h DataQualityInterfaces/HanConfigGroup.h DataQualityInterfaces/HanConfigMetadata.h DataQualityInterfaces/ConditionsSingleton.h DataQualityInterfaces/LinkDef.h
-                           EXTERNAL_PACKAGES ROOT  Boost tdaq-common COOL CORAL nlohmann_json)
+                           EXTERNAL_PACKAGES ROOT Boost tdaq-common COOL CORAL nlohmann_json)
 
 atlas_add_library( DataQualityInterfaces
                    src/HanAlgorithmConfig.cxx
@@ -45,15 +43,12 @@ atlas_add_library( DataQualityInterfaces
 
 atlas_add_executable( han
                       src/han.cxx
-                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} DataQualityInterfaces )
+                      LINK_LIBRARIES DataQualityInterfaces )
 
 atlas_add_executable( han-config-gen
                       src/han_config_gen.cxx
-                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}  nlohmann_json::nlohmann_json ${COOL_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} DataQualityInterfaces nlohmann_json::nlohmann_json ${CORAL_LIBRARIES} ${COOL_LIBRARIES} )
+                      LINK_LIBRARIES DataQualityInterfaces )
 
 atlas_add_executable( han-config-print
                       src/han_config_print.cxx
-                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} DataQualityInterfaces )
+                      LINK_LIBRARIES DataQualityInterfaces )
diff --git a/DataQuality/DataQualityUtils/CMakeLists.txt b/DataQuality/DataQualityUtils/CMakeLists.txt
index 565713764670446a23d7975934fc08ad5a1427f6..efb1dc25eb00ec7a345f6515a408843720789567 100644
--- a/DataQuality/DataQualityUtils/CMakeLists.txt
+++ b/DataQuality/DataQualityUtils/CMakeLists.txt
@@ -1,15 +1,8 @@
-################################################################################
-# Package: DataQualityUtils
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( DataQualityUtils )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          DataQuality/DataQualityInterfaces
-                          DataQuality/ZLumiScripts )
-
 # External dependencies:
 find_package( Boost COMPONENTS regex filesystem thread system )
 find_package( COOL COMPONENTS CoolKernel CoolApplication )
@@ -76,8 +69,7 @@ atlas_add_library( DataQualityUtils
 
 atlas_add_executable( han-results-print
                       src/han_results_print.cxx
-                      INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${Boost_LIBRARIES} ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} DataQualityInterfaces DataQualityUtils )
+                      LINK_LIBRARIES DataQualityUtils )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py
diff --git a/DataQuality/GoodRunsLists/CMakeLists.txt b/DataQuality/GoodRunsLists/CMakeLists.txt
index 8abe281e81d44adbad71375badb1525d5ac69f64..9683d2affca791902675e7fd3b35590c3629174e 100644
--- a/DataQuality/GoodRunsLists/CMakeLists.txt
+++ b/DataQuality/GoodRunsLists/CMakeLists.txt
@@ -1,36 +1,8 @@
-# $Id: CMakeLists.txt 777875 2016-10-11 17:17:13Z krasznaa $
-################################################################################
-# Package: GoodRunsLists
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( GoodRunsLists )
 
-# Declare the package's dependencies:
-if( XAOD_STANDALONE )
-   atlas_depends_on_subdirs(
-      PUBLIC
-      Control/AthToolSupport/AsgTools
-      Event/xAOD/xAODEventInfo
-      PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces
-      PRIVATE
-      Tools/PathResolver )
-else()
-   atlas_depends_on_subdirs(
-      PUBLIC
-      Control/AthToolSupport/AsgTools
-      Control/AthenaBaseComps
-      Control/AthenaKernel
-      Event/xAOD/xAODEventInfo
-      PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces
-      GaudiKernel
-      PRIVATE
-      Control/StoreGate
-      Event/EventInfo
-      Tools/PathResolver
-      AtlasTest/TestTools )
-endif()
-
 # External dependencies:
 find_package( ROOT COMPONENTS Core Tree TreePlayer XMLIO XMLParser )
 find_package( LibXml2 )
@@ -48,14 +20,13 @@ atlas_add_library( GoodRunsListsLib
    PUBLIC_HEADERS GoodRunsLists
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
    PRIVATE_INCLUDE_DIRS ${LIBXML2_INCLUDE_DIR}
-   LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODEventInfo AsgAnalysisInterfaces
+   LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools AsgAnalysisInterfaces
    PRIVATE_LINK_LIBRARIES ${LIBXML2_LIBRARIES} PathResolver )
 
 if( NOT XAOD_STANDALONE )
    atlas_add_component( GoodRunsLists
       src/*.cxx src/components/*.cxx
-      LINK_LIBRARIES AthenaBaseComps AthenaKernel xAODEventInfo GaudiKernel
-      StoreGateLib EventInfo PathResolver GoodRunsListsLib )
+      LINK_LIBRARIES AthenaBaseComps AthenaKernel EventInfo GaudiKernel GoodRunsListsLib PathResolver StoreGateLib xAODEventInfo )
 endif()
 
 atlas_add_dictionary( GoodRunsListsDict
diff --git a/DataQuality/GoodRunsListsUser/CMakeLists.txt b/DataQuality/GoodRunsListsUser/CMakeLists.txt
index 092b549ae1301e041b4a4716716043455c5650fc..4aa54cc500023ef09b38c192d114cfbfc5c6772a 100644
--- a/DataQuality/GoodRunsListsUser/CMakeLists.txt
+++ b/DataQuality/GoodRunsListsUser/CMakeLists.txt
@@ -1,20 +1,8 @@
-################################################################################
-# Package: GoodRunsListsUser
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( GoodRunsListsUser )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          Control/StoreGate
-                          DataQuality/GoodRunsLists
-                          Event/EventInfo
-                          GaudiKernel
-                          Trigger/TrigAnalysis/TrigDecisionTool
-                          Trigger/TrigEvent/TrigDecisionEvent )
-
 # External dependencies:
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint )
 
@@ -25,7 +13,7 @@ atlas_add_component( GoodRunsListsUser
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps StoreGateLib SGtests GoodRunsListsLib EventInfo GaudiKernel TrigDecisionToolLib TrigDecisionEvent )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GoodRunsListsLib EventInfo GaudiKernel TrigDecisionToolLib TrigDecisionEvent )
 
 # Install files from the package:
 atlas_install_headers( GoodRunsListsUser )
diff --git a/DataQuality/ZLumiScripts/CMakeLists.txt b/DataQuality/ZLumiScripts/CMakeLists.txt
index b658acb5bba60af166e5ece565628c9b784817fd..5378b300298e51b01c4976ee62e071731036843d 100644
--- a/DataQuality/ZLumiScripts/CMakeLists.txt
+++ b/DataQuality/ZLumiScripts/CMakeLists.txt
@@ -1,13 +1,8 @@
-################################################################################
-# Package: ZLumiScripts
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( ZLumiScripts )
 
-# Declare the package's dependencies:
-#atlas_depends_on_subdirs( )
-
 # External dependencies:
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
 
diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref
index c1dd45cb5593698a668913879ee05c93511e8c73..814f5dd5a1bdea2b0ebb0a57524a01fbc078de3d 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref
@@ -1,17 +1,17 @@
-Fri Sep 11 23:45:59 CEST 20?0
+Wed Sep 23 17:58:44 CEST 20?0
 Preloading tcmalloc_minimal.so
 Athena               INFO including file "AthenaCommon/Preparation.py"
 Athena               INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Athena               INFO executing ROOT6Setup
 Athena               INFO including file "AthenaCommon/Execution.py"
 Athena               INFO including file "AthenaPoolExampleAlgorithms/AthenaPoolExample_RWJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5568 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5565 configurables from 45 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 Athena               INFO including file "AthenaCommon/runbatch.py"
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
                                                    Welcome to ApplicationMgr (GaudiCoreSvc v34r0)
-                                          running on aibuild028.cern.ch on Fri Sep 11 23:46:11 20?0
+                                          running on lxplus750.cern.ch on Wed Sep 23 17:58:51 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -32,8 +32,8 @@ PoolSvc             DEBUG Service base class initialized successfully
 PoolSvc              INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc              INFO Frontier compression level set to 5
 DBReplicaSvc         INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy-atlas.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data
-DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-09-10T2101/Athena/22.0.18/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 10 servers found for host aibuild028.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
+DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-09-22T2101/Athena/22.0.18/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus750.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
 PoolSvc              INFO Successfully setup replica sorting algorithm
 PoolSvc             DEBUG OutputLevel is 2
 PoolSvc              INFO Setting up APR FileCatalog and Streams
@@ -1835,6 +1835,7 @@ Stream1             DEBUG AthenaOutputStream Stream1 ::stop()
 MetaDataSvc         DEBUG MetaDataSvc::stop()
 Stream1             DEBUG slot 0  handle() incident type: MetaDataStop
 MetaDataSvc         DEBUG  calling metaDataStop for ToolSvc.IOVDbMetaDataTool
+MetaDataSvc         DEBUG Locking metadata tools
 Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*]
 Stream1             DEBUG addItemObjects(167728019,"Stream1") called
 Stream1             DEBUG            Key:Stream1
@@ -1873,6 +1874,7 @@ MetaDataHdrForm...  DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of ty
 SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (d , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
 Stream1              INFO Metadata records written: 21
+MetaDataSvc         DEBUG Unlocking metadata tools
 Stream1             DEBUG Leaving incident handler for MetaDataStop
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   CREATE    [ROOT_All] ????
 Domain[ROOT_All]     INFO >   Deaccess DbDomain     UPDATE    [ROOT_All] 
@@ -1891,13 +1893,13 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 *****Chrono*****     INFO ****************************************************************************************************
 *****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
 *****Chrono*****     INFO ****************************************************************************************************
-commitOutput         INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 21
 cRep_ALL             INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 62
-cObjR_ALL            INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.152(+-    1.22)/       0/      10 [ms] #= 66
-cObj_ALL             INFO Time User   : Tot=   20 [ms] Ave/Min/Max=   0.317(+-    1.75)/       0/      10 [ms] #= 63
-cRepR_ALL            INFO Time User   : Tot=   20 [ms] Ave/Min/Max=   0.139(+-    1.66)/       0/      20 [ms] #=144
-fRep_ALL             INFO Time User   : Tot=   40 [ms] Ave/Min/Max=   0.645(+-    3.04)/       0/      20 [ms] #= 62
-ChronoStatSvc        INFO Time User   : Tot=  430 [ms]  #=  1
+cObjR_ALL            INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 66
+commitOutput         INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 21
+cObj_ALL             INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.159(+-    1.25)/       0/      10 [ms] #= 63
+fRep_ALL             INFO Time User   : Tot=   20 [ms] Ave/Min/Max=   0.323(+-    1.77)/       0/      10 [ms] #= 62
+cRepR_ALL            INFO Time User   : Tot=   20 [ms] Ave/Min/Max=   0.139(+-    1.17)/       0/      10 [ms] #=144
+ChronoStatSvc        INFO Time User   : Tot=  280 [ms]  #=  1
 *****Chrono*****     INFO ****************************************************************************************************
 ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref
index 43bdcbf6f6daa201cdbf6e9b9e7d16425e43a445..4ec01f4e859a4e072d09b64e053436aa9dead769 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref
@@ -1,17 +1,17 @@
-Fri Sep 11 23:46:44 CEST 20?0
+Wed Sep 23 17:41:03 CEST 20?0
 Preloading tcmalloc_minimal.so
 Athena               INFO including file "AthenaCommon/Preparation.py"
 Athena               INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Athena               INFO executing ROOT6Setup
 Athena               INFO including file "AthenaCommon/Execution.py"
 Athena               INFO including file "AthenaPoolExampleAlgorithms/AthenaPoolExample_ReWriteAgainJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5568 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5565 configurables from 45 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 Athena               INFO including file "AthenaCommon/runbatch.py"
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
                                                    Welcome to ApplicationMgr (GaudiCoreSvc v34r0)
-                                          running on aibuild028.cern.ch on Fri Sep 11 23:46:56 20?0
+                                          running on lxplus750.cern.ch on Wed Sep 23 17:41:10 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -32,8 +32,8 @@ PoolSvc             DEBUG Service base class initialized successfully
 PoolSvc              INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc              INFO Frontier compression level set to 5
 DBReplicaSvc         INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy-atlas.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data
-DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-09-10T2101/Athena/22.0.18/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 10 servers found for host aibuild028.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
+DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-09-22T2101/Athena/22.0.18/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus750.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
 PoolSvc              INFO Successfully setup replica sorting algorithm
 PoolSvc             DEBUG OutputLevel is 2
 PoolSvc              INFO Setting up APR FileCatalog and Streams
@@ -1858,6 +1858,7 @@ Stream1             DEBUG AthenaOutputStream Stream1 ::stop()
 MetaDataSvc         DEBUG MetaDataSvc::stop()
 Stream1             DEBUG slot 0  handle() incident type: MetaDataStop
 MetaDataSvc         DEBUG  calling metaDataStop for ToolSvc.IOVDbMetaDataTool
+MetaDataSvc         DEBUG Locking metadata tools
 Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*]
 Stream1             DEBUG addItemObjects(167728019,"Stream1") called
 Stream1             DEBUG            Key:Stream1
@@ -1896,6 +1897,7 @@ MetaDataHdrForm...  DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of ty
 SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (d , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
 Stream1              INFO Metadata records written: 21
+MetaDataSvc         DEBUG Unlocking metadata tools
 Stream1             DEBUG Leaving incident handler for MetaDataStop
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   CREATE    [ROOT_All] ????
 Domain[ROOT_All]     INFO >   Deaccess DbDomain     UPDATE    [ROOT_All] 
@@ -1917,10 +1919,10 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 cRep_ALL             INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 62
 cObjR_ALL            INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 65
 commitOutput         INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 21
+cObj_ALL             INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.159(+-    1.25)/       0/      10 [ms] #= 63
 cRepR_ALL            INFO Time User   : Tot=   10 [ms] Ave/Min/Max=  0.0694(+-    0.83)/       0/      10 [ms] #=144
-cObj_ALL             INFO Time User   : Tot=   20 [ms] Ave/Min/Max=   0.317(+-    1.75)/       0/      10 [ms] #= 63
-fRep_ALL             INFO Time User   : Tot=   30 [ms] Ave/Min/Max=   0.484(+-    2.15)/       0/      10 [ms] #= 62
-ChronoStatSvc        INFO Time User   : Tot=  380 [ms]  #=  1
+fRep_ALL             INFO Time User   : Tot=   20 [ms] Ave/Min/Max=   0.323(+-    1.77)/       0/      10 [ms] #= 62
+ChronoStatSvc        INFO Time User   : Tot=  260 [ms]  #=  1
 *****Chrono*****     INFO ****************************************************************************************************
 ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref
index 680578f81ce0a6b84dae8c69a95666ee873f730f..51941979e8ecf7d93a05fdd48378a7ad1b70bdc5 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref
@@ -1,17 +1,17 @@
-Fri Sep 11 23:46:59 CEST 20?0
+Wed Sep 23 16:50:48 CEST 20?0
 Preloading tcmalloc_minimal.so
 Athena               INFO including file "AthenaCommon/Preparation.py"
 Athena               INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Athena               INFO executing ROOT6Setup
 Athena               INFO including file "AthenaCommon/Execution.py"
 Athena               INFO including file "AthenaPoolExampleAlgorithms/AthenaPoolExample_ReWriteNextJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5568 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5565 configurables from 45 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 Athena               INFO including file "AthenaCommon/runbatch.py"
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
                                                    Welcome to ApplicationMgr (GaudiCoreSvc v34r0)
-                                          running on aibuild028.cern.ch on Fri Sep 11 23:47:11 20?0
+                                          running on lxplus750.cern.ch on Wed Sep 23 16:50:56 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -32,8 +32,8 @@ PoolSvc             DEBUG Service base class initialized successfully
 PoolSvc              INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc              INFO Frontier compression level set to 5
 DBReplicaSvc         INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy-atlas.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data
-DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-09-10T2101/Athena/22.0.18/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 10 servers found for host aibuild028.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
+DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-09-22T2101/Athena/22.0.18/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus750.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
 PoolSvc              INFO Successfully setup replica sorting algorithm
 PoolSvc             DEBUG OutputLevel is 2
 PoolSvc              INFO Setting up APR FileCatalog and Streams
@@ -1193,6 +1193,7 @@ Stream1             DEBUG AthenaOutputStream Stream1 ::stop()
 MetaDataSvc         DEBUG MetaDataSvc::stop()
 Stream1             DEBUG slot 0  handle() incident type: MetaDataStop
 MetaDataSvc         DEBUG  calling metaDataStop for ToolSvc.IOVDbMetaDataTool
+MetaDataSvc         DEBUG Locking metadata tools
 Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*]
 Stream1             DEBUG addItemObjects(167728019,"Stream1") called
 Stream1             DEBUG            Key:Stream1
@@ -1231,6 +1232,7 @@ MetaDataHdrForm...  DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of ty
 SimplePoolFile4...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (d , ffffffff)
 SimplePoolFile4...  DEBUG ---->ClassID:????
 Stream1              INFO Metadata records written: 21
+MetaDataSvc         DEBUG Unlocking metadata tools
 Stream1             DEBUG Leaving incident handler for MetaDataStop
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   CREATE    [ROOT_All] ????
 Domain[ROOT_All]     INFO >   Deaccess DbDomain     UPDATE    [ROOT_All] 
@@ -1251,11 +1253,11 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 *****Chrono*****     INFO ****************************************************************************************************
 commitOutput         INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 21
 cRep_ALL             INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 62
-cObjR_ALL            INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 65
+fRep_ALL             INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.161(+-    1.26)/       0/      10 [ms] #= 62
+cObjR_ALL            INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.154(+-    1.23)/       0/      10 [ms] #= 65
 cRepR_ALL            INFO Time User   : Tot=   10 [ms] Ave/Min/Max=  0.0694(+-    0.83)/       0/      10 [ms] #=144
-fRep_ALL             INFO Time User   : Tot=   20 [ms] Ave/Min/Max=   0.323(+-    1.77)/       0/      10 [ms] #= 62
 cObj_ALL             INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.159(+-    1.25)/       0/      10 [ms] #= 63
-ChronoStatSvc        INFO Time User   : Tot=  370 [ms]  #=  1
+ChronoStatSvc        INFO Time User   : Tot=  270 [ms]  #=  1
 *****Chrono*****     INFO ****************************************************************************************************
 ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py b/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py
index 2da385b00cfd760c2ff64178aa71dbef734696bc..b6ee4e15d3978213da1ee3a16c5f8a789c800609 100644
--- a/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py
+++ b/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py
@@ -22,7 +22,7 @@ def GeoModelCfg(configFlags):
     if configFlags.Detector.Simulate:
         ## Protects GeoModelSvc in the simulation from the AlignCallbacks
         gms.AlignCallbacks = False
-    result.addService(gms,primary=True)
+    result.addService(gms, primary=True, create=True)
 
 
     #Get DetDescrCnvSvc (for identifier dictionaries (identifier helpers)
diff --git a/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/DumpGeo/DumpGeo.h b/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/DumpGeo/DumpGeo.h
index 076191d8870047849649178c1946139b75c8784a..85e8e6d99b0c3d4ab6c194eda06e1726334e6e0f 100755
--- a/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/DumpGeo/DumpGeo.h
+++ b/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/DumpGeo/DumpGeo.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
 */
 
 /////////////////////////////////////////////////////////////
@@ -13,7 +13,6 @@
 //                                                         //
 /////////////////////////////////////////////////////////////
 
-
 #ifndef DumpGeo_DumpGeo
 #define DumpGeo_DumpGeo
 
@@ -30,11 +29,10 @@ class DumpGeo: public AthAlgorithm,
 {
  public:
   DumpGeo(const std::string& name, ISvcLocator* pSvcLocator);
-  ~DumpGeo();
+  ~DumpGeo()=default;
 
   StatusCode initialize();
   StatusCode execute();
-  StatusCode finalize();
 
   void handle(const Incident& inc);
 
diff --git a/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo.py b/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo.py
index e5aa8a114cd81e91fe5cfcc14753afb428d1a4fb..448174309dfb1a1cb08b4293f984f32d71f528d3 100644
--- a/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo.py
+++ b/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo.py
@@ -354,6 +354,10 @@ if (vp1InputFiles != []):
 else:
     vp1Extrapolator = False
 
+# do not need to run execute since layout is dumped during initialize
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+athenaCommonFlags.EvtMax = 0
+
 #watch LAr HV:
 if ( vp1LarHvData ):
     from time import time
diff --git a/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/src/DumpGeo.cxx b/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/src/DumpGeo.cxx
index a87a10bfabbd1d912f519ec01713d08e4e2385e8..75e3e5cf38508357537c4f00fe719ee760467c62 100755
--- a/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/src/DumpGeo.cxx
+++ b/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/src/DumpGeo.cxx
@@ -1,8 +1,7 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-
 #include "DumpGeo/DumpGeo.h"
 
 #include "GeoExporter/GeoExporter.h"
@@ -13,7 +12,6 @@
 #include <iomanip>
 #include <cstdlib> //For setenv
 
-
 //____________________________________________________________________
 DumpGeo::DumpGeo(const std::string& name, ISvcLocator* svcLocator):
   AthAlgorithm(name, svcLocator),
@@ -24,11 +22,6 @@ DumpGeo::DumpGeo(const std::string& name, ISvcLocator* svcLocator):
   ::setenv("LCGPATCH_COINMULTISELECT","1",1);
 }
 
-//____________________________________________________________________
-DumpGeo::~DumpGeo()
-{
-}
-
 //____________________________________________________________________
 StatusCode DumpGeo::initialize()
 {
@@ -60,17 +53,9 @@ StatusCode DumpGeo::initialize()
 StatusCode DumpGeo::execute()
 {
   msg(MSG::DEBUG) <<" in execute() " << endmsg;
-  return StatusCode::FAILURE;
-}
-
-//____________________________________________________________________
-StatusCode DumpGeo::finalize()
-{
-  msg(MSG::INFO) <<" in finalize() " << endmsg;
   return StatusCode::SUCCESS;
 }
 
-
 //____________________________________________________________________
 void DumpGeo::handle(const Incident& inc)
 {
diff --git a/Event/EventInfoUtils/EventInfoUtils/ATLAS_CHECK_THREAD_SAFETY b/Event/EventInfoUtils/EventInfoUtils/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..d37d44670034def48d5bcf82ded9662fc77a6fb0
--- /dev/null
+++ b/Event/EventInfoUtils/EventInfoUtils/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+Event/EventInfoUtils
diff --git a/Event/EventOverlay/EventOverlayJobTransforms/share/Rt_override_CONDBR2-BLKPA-2015-12.py b/Event/EventOverlay/EventOverlayJobTransforms/share/Rt_override_CONDBR2-BLKPA-2015-12.py
index 3c0d0f16074bc5962eb8d8cd1751421f58974d45..8aff6fb2e8364b5f3235ceb3dfdfc161c15ebf00 100644
--- a/Event/EventOverlay/EventOverlayJobTransforms/share/Rt_override_CONDBR2-BLKPA-2015-12.py
+++ b/Event/EventOverlay/EventOverlayJobTransforms/share/Rt_override_CONDBR2-BLKPA-2015-12.py
@@ -127,6 +127,13 @@ conddb.addFolderSplitMC("SCT","/SCT/DAQ/Config/Chip","/SCT/DAQ/Config/Chip",forc
 conddb.blockFolder("/SCT/DAQ/Config/Module")
 conddb.addFolderSplitMC("SCT","/SCT/DAQ/Config/Module","/SCT/DAQ/Config/Module",force=True)
 
+conddb.blockFolder("/LAR/BadChannels/BadChannels")
+conddb.blockFolder("/LAR/BadChannelsOfl/BadChannels")
+conddb.addFolderWithTag("LAR_OFL","/LAR/BadChannels/BadChannels","LARBadChannelsBadChannels-HECAQ3Missing",force=True,forceMC=True)
+conddb.blockFolder("/LAR/BadChannels/MissingFEBs")
+conddb.blockFolder("/LAR/BadChannelsOfl/MissingFEBs")
+conddb.addFolderWithTag("LAR_OFL","/LAR/BadChannels/MissingFEBs","LArBadChannelsMissingFEBs-IOVDEP-04",force=True,forceMC=True)
+
 dofolderoverrides = True
 if dofolderoverrides:
 	printfunc ("ACH - overriding folder access patterns")
diff --git a/Event/PyDumper/python/Dumpers.py b/Event/PyDumper/python/Dumpers.py
index df924f27a2fbd70776ffb13e89bb66fa2b456cd0..53450f2afc932f7cbc52e8ef1495090b209bd7a1 100644
--- a/Event/PyDumper/python/Dumpers.py
+++ b/Event/PyDumper/python/Dumpers.py
@@ -45,7 +45,8 @@ getattr (ROOT.xAOD, 'Jet_v1', None)
 
 #Typed nullptr:
 JetAssociationBase = getattr (cppyy.gbl, 'JetAssociationBase', None)
-Muon = getattr (cppyy.gbl, 'Muon', None)
+Analysis = getattr (cppyy.gbl, 'Analysis', None)
+Muon = getattr (Analysis, 'Muon', None) if Analysis else None
 jetAssocNull = cppyy.bind_object(cppyy.nullptr, JetAssociationBase) if JetAssociationBase else None
 muonNull = cppyy.bind_object(cppyy.nullptr, Muon) if Muon else None
 
diff --git a/Event/xAOD/xAODPFlow/xAODPFlow/xAODPFlowDict.h b/Event/xAOD/xAODPFlow/xAODPFlow/xAODPFlowDict.h
index 11b944665f6ac200060c4a6b054cda7b846fc840..4829da63e9a1e00cf26ee9c14a1062233c1f556a 100644
--- a/Event/xAOD/xAODPFlow/xAODPFlow/xAODPFlowDict.h
+++ b/Event/xAOD/xAODPFlow/xAODPFlow/xAODPFlowDict.h
@@ -43,12 +43,11 @@ namespace {
      XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, IParticleContainer );
      // Weird/bad types used by the PFO reconstruction as attributes on
      // xAOD::PFO objects. :-(
-     std::pair< ElementLink< xAOD::CaloClusterContainer >, double > dummy1;
-     std::vector< std::pair< ElementLink< xAOD::CaloClusterContainer >, double > >
-     dummy2;
-     std::vector< std::vector< std::pair< ElementLink< xAOD::CaloClusterContainer >, double > > >
-     dummy3;
-     std::vector< xAOD::PFODetails::PFOLeptonType > dummy4;
+     std::pair< ElementLink< xAOD::CaloClusterContainer >, double > FlowElemdummy1;
+     std::vector< std::pair< ElementLink< xAOD::CaloClusterContainer >, double > > FlowElemdummy2;
+     std::vector< std::vector< std::pair< ElementLink< xAOD::CaloClusterContainer >, double > > > FlowElemdummy3;
+     std::vector< xAOD::PFODetails::PFOLeptonType > FlowElemdummy4;
+     
 
    };
 }
diff --git a/Event/xAOD/xAODTau/Root/TauJetAccessors_v3.icc b/Event/xAOD/xAODTau/Root/TauJetAccessors_v3.icc
index 7c47d7168287db43083e59bf1a8baf0fbfbf5676..34c935fffec362d2cf62a9ecc5d05f9fcb5fc644 100644
--- a/Event/xAOD/xAODTau/Root/TauJetAccessors_v3.icc
+++ b/Event/xAOD/xAODTau/Root/TauJetAccessors_v3.icc
@@ -32,10 +32,12 @@ break;
       DEFINE_TAUJETPARAMETER_ACCESSOR( float, EleMatchLikelihoodScore );
       DEFINE_TAUJETPARAMETER_ACCESSOR( float, BDTJetScore );	
       DEFINE_TAUJETPARAMETER_ACCESSOR( float, RNNJetScore );	
+      DEFINE_TAUJETPARAMETER_ACCESSOR( float, RNNEleScore );	
       DEFINE_TAUJETPARAMETER_ACCESSOR( float, BDTEleScore );	
       DEFINE_TAUJETPARAMETER_ACCESSOR( float, PanTauScore );   
       DEFINE_TAUJETPARAMETER_ACCESSOR( float, BDTJetScoreSigTrans );   
       DEFINE_TAUJETPARAMETER_ACCESSOR( float, RNNJetScoreSigTrans );   
+      DEFINE_TAUJETPARAMETER_ACCESSOR( float, RNNEleScoreSigTrans );   
       //DEFINE_TAUJETPARAMETER_ACCESSOR( float, BDTJetScoreBkgTrans );   
 
     default:
diff --git a/Event/xAOD/xAODTau/Root/TauJetAuxContainer_v3.cxx b/Event/xAOD/xAODTau/Root/TauJetAuxContainer_v3.cxx
index e868ef0507fda444f442cbf7023b14848105cbb7..32dc32e9af27cbcd9e23eebe6d079ea0d00c1544 100644
--- a/Event/xAOD/xAODTau/Root/TauJetAuxContainer_v3.cxx
+++ b/Event/xAOD/xAODTau/Root/TauJetAuxContainer_v3.cxx
@@ -266,6 +266,10 @@ namespace xAOD {
     // RNN tau ID
     AUX_VARIABLE( RNNJetScore );
     AUX_VARIABLE( RNNJetScoreSigTrans ); 
+
+    //RNN tau eVeto
+    AUX_VARIABLE( RNNEleScore );
+    AUX_VARIABLE( RNNEleScoreSigTrans ); 
     
   }
   
diff --git a/Event/xAOD/xAODTau/xAODTau/TauDefs.h b/Event/xAOD/xAODTau/xAODTau/TauDefs.h
index f8c7bbea70ad21745ab5f50096091b65b3c3878d..67715716a56ed27fce210d24e59235c410f815e8 100644
--- a/Event/xAOD/xAODTau/xAODTau/TauDefs.h
+++ b/Event/xAOD/xAODTau/xAODTau/TauDefs.h
@@ -90,7 +90,11 @@ namespace TauJetParameters
         //! RNN score for Jet rejection (not transformed)
         RNNJetScore           = 21,
         //! RNN score which is signal transformed/flattened
-        RNNJetScoreSigTrans   = 22 // new
+        RNNJetScoreSigTrans   = 22, // new
+        //! RNN score for Ele rejection (not transformed)
+        RNNEleScore           = 23,
+        //! RNN score which is signal transformed/flattened
+        RNNEleScoreSigTrans   = 24 // new
       };
 
     //-------------------------------------------------------------------------
@@ -144,6 +148,9 @@ namespace TauJetParameters
         JetRNNSigLoose          = 29,
         JetRNNSigMedium         = 30,
         JetRNNSigTight          = 31,
+        EleRNNLoose          = 32,
+        EleRNNMedium         = 33,
+        EleRNNTight          = 34,	
       };
 
     //-------------------------------------------------------------------------
diff --git a/Event/xAOD/xAODTau/xAODTau/versions/TauJetAuxContainer_v3.h b/Event/xAOD/xAODTau/xAODTau/versions/TauJetAuxContainer_v3.h
index cad0612b9fdbdfa3f297f28a04e67a2a2ed08b77..58fa1316fe762f6772f00b882afda8ec06d21a6b 100644
--- a/Event/xAOD/xAODTau/xAODTau/versions/TauJetAuxContainer_v3.h
+++ b/Event/xAOD/xAODTau/xAODTau/versions/TauJetAuxContainer_v3.h
@@ -318,6 +318,10 @@ namespace xAOD {
     // RNN tau ID
     std::vector< float > RNNJetScore;
     std::vector< float > RNNJetScoreSigTrans;
+
+    // RNN tau eVeto
+    std::vector< float > RNNEleScore;
+    std::vector< float > RNNEleScoreSigTrans;
     
   }; // class TauJetAuxContainer_v3
 
diff --git a/ForwardDetectors/AFP/Run3AFPMonitoring/Run3AFPMonitoring/AFPSiLayerAlgorithm.h b/ForwardDetectors/AFP/Run3AFPMonitoring/Run3AFPMonitoring/AFPSiLayerAlgorithm.h
index 8b4146f20b306b4a2890593f6fe13ecea881d84d..c35cf6b4240a69c12326706c4e060a3b397b0a44 100644
--- a/ForwardDetectors/AFP/Run3AFPMonitoring/Run3AFPMonitoring/AFPSiLayerAlgorithm.h
+++ b/ForwardDetectors/AFP/Run3AFPMonitoring/Run3AFPMonitoring/AFPSiLayerAlgorithm.h
@@ -25,8 +25,9 @@ public:
 	virtual StatusCode fillHistograms( const EventContext& ctx ) const override;
 
 private:
-	std::map<std::string,std::map<std::string,int>> m_HitmapGroups;
-	std::map<std::string,int> m_TrackGroup; 
+
+	std::map<std::string,std::map<std::string,int>> m_StationPlaneGroup;
+	std::map<std::string,int> m_StationGroup; 
 	SG::ReadHandleKey<xAOD::AFPSiHitContainer> m_afpHitContainerKey;
 	SG::ReadCondHandleKey<BunchCrossingCondData> m_bunchCrossingKey{this, "BunchCrossingKey", "BunchCrossingData", "Key BunchCrossing CDO" };
 	
diff --git a/ForwardDetectors/AFP/Run3AFPMonitoring/Run3AFPMonitoring/AFPToFAlgorithm.h b/ForwardDetectors/AFP/Run3AFPMonitoring/Run3AFPMonitoring/AFPToFAlgorithm.h
index 0f19a5f3d1b1a1ae5275494e1e043f5f85536397..05dd2d8cbd0ce9329687839e2a92b5b0e8bef5d2 100644
--- a/ForwardDetectors/AFP/Run3AFPMonitoring/Run3AFPMonitoring/AFPToFAlgorithm.h
+++ b/ForwardDetectors/AFP/Run3AFPMonitoring/Run3AFPMonitoring/AFPToFAlgorithm.h
@@ -21,15 +21,14 @@ public:
 	virtual StatusCode fillHistograms( const EventContext& ctx ) const override;
 
 private:
-	std::map<std::string,int> m_HitmapGroupsToF;
-   
+	std::map<std::string,int> m_StationNamesGroup;
+	std::map<std::string,int> m_TrainsToFGroup;
 	SG::ReadHandleKey<xAOD::AFPToFHitContainer> m_afpToFHitContainerKey;
 
 protected:
 	// Only 0 and 3 are ToF stations (farAside and farCside)
 	std::vector<std::string> m_stationNamesToF = { "farAside", "nearAside" , "nearCside" , "farCside" };
-
-   
+	std::vector<std::string> m_trainsToF = { "train0", "train1" , "train2" , "train3" };
 };
 #endif
 
diff --git a/ForwardDetectors/AFP/Run3AFPMonitoring/python/Run3AFPExampleMonitorAlgorithm.py b/ForwardDetectors/AFP/Run3AFPMonitoring/python/Run3AFPExampleMonitorAlgorithm.py
index 4c354c9f9cfc3ed0f17556e44d5bd597cf5b78fb..5a1c07c50c2c0806ab7934ed9b1d3e80b9750b24 100644
--- a/ForwardDetectors/AFP/Run3AFPMonitoring/python/Run3AFPExampleMonitorAlgorithm.py
+++ b/ForwardDetectors/AFP/Run3AFPMonitoring/python/Run3AFPExampleMonitorAlgorithm.py
@@ -35,40 +35,52 @@ def Run3AFPExampleMonitoringConfig(inputFlags):
 
     AFPSiGroup.defineHistogram('lb,nSiHits', title='Total number of hits;lb;total number of Hits', type='TProfile', path='SiT/', xbins=1000, xmin=-0.5, xmax=999.5)
     AFPSiGroup.defineHistogram('lb,muPerBCID', title='<mu>;lumiBlock;<mu>', type='TProfile', path='SiT/', xbins=1000, xmin=-0.5, xmax=999.5)
+    AFPSiGroup.defineHistogram('planeHitsAll', title='Number of hits per plane;plane; hits', type='TH1F', path='SiT/HitsPerPlanes', xbins=16, xmin=-0.5, xmax=15.5)
     #AFPSiGroup.defineHistogram('layerNumber,layerEfficiency', title='LayerEfficiency;layerNumber', path='SiT/', xbins = 16, xmin=0.5, xmax=16.5, ybins=100, ymin=0, ymax=1)
     #AFPSiGroup.defineHistogram('layerEfficiency', type='TH1F', title='1D layer efficiency;layerEfficiency', path='SiT/', xbins=16, xmin=0.5, xmax=16.5)
 
     AFPToFGroup.defineHistogram('lb,nTofHits', title='Multiplicity;lb;total number of Hits', type='TProfile', path='ToF/', xbins=1000, xmin=-0.5, xmax=999.5) 
     AFPToFGroup.defineHistogram('numberOfHit_S0', title='Number of hit per bar station 0;bar', path='ToF/', xbins=4, xmin=-0.5, xmax=3.5)
     AFPToFGroup.defineHistogram('numberOfHit_S3', title='Number of hit per bar station 3;bar', path='ToF/', xbins=4, xmin=-0.5, xmax=3.5)
+    AFPToFGroup.defineHistogram('barInTrainAllA', title='Number of hits in bar per plane; barInTrain;hits',type='TH1F', path='ToF/HitsPerBarsInTrain', xbins=16, xmin=-0.5, xmax=15.5)
+    AFPToFGroup.defineHistogram('barInTrainAllC', title='Number of hits in bar per plane; barInTrain;hits',type='TH1F', path='ToF/HitsPerBarsInTrain', xbins=16, xmin=-0.5, xmax=15.5)
 
     # Using a map of groups
     layerList = ['P0','P1', 'P2', 'P3'] ## TODO XXX adapt to the enum/xAOD namespace names
-    combinedList = ['farAside', 'nearAside', 'nearCside', 'farCside']
+    stationList = ['farAside', 'nearAside', 'nearCside', 'farCside']
+    trainList = ['train0', 'train1', 'train2', 'train3']
 
-    array = helper.addArray([combinedList,layerList], afpSiLayerAlgorithm, 'AFPSiLayerTool', topPath = 'AFP/SiT/')
+    array = helper.addArray([stationList,layerList], afpSiLayerAlgorithm, 'AFPSiLayerTool', topPath = 'AFP/SiT/')
 
-    array.defineHistogram('pixelColIDChip', title='Hits per column for {0} layer {1};pixelColIDChip; entries', path='PixelColIDChip', xbins=80, xmin=0.5, xmax=80.5)
-    array.defineHistogram('pixelRowIDChip', title='Hits per row for {0} Layer {1};pixelRowIDChip; entries', path='PixelRowIDChip', xbins=336, xmin=0.5, xmax=336.5)
-    array.defineHistogram('pixelRowIDChip,pixelColIDChip', title='Hitmap for {0} Layer {1};pixelRowIDChip;pixelColIDChip', type='TH2F', path='pixelColRow2D', xbins=336, xmin=0.5, xmax=336.5, ybins=80, ymin=0.5, ymax=80.5)
-    array.defineHistogram('timeOverThreshold', type='TH1F', title='Time over threshold for {0} Layer {1};timeOverThreshold; entries', path='SiTimeOverThreshold', xbins=16, xmin=0.5, xmax=16.5)
-    array.defineHistogram('clusterY,clusterX', title='Cluster position in station {0} Layer {1};x [mm];y [mm]', type='TH2F', path='Cluster', xbins=336, xmin=0.0, xmax=17.0, ybins=80, ymin=0.0, ymax=20.0)
-    array.defineHistogram('lb,clustersPerPlane', title='Number of clusters per event divided by <mu> in station {0}, layer {1};lb; clusters per event / <mu>', type='TH2F', path='clustersPerPlane', xbins=1000, xmin=-0.5, xmax=999.5, ybins=1000, ymin=-0.2, ymax=1.0)
-    array.defineHistogram('lb,clustersPerPlaneFront', title='(Front BCID) Number of clusters per event divided by <mu> in station {0}, layer {1};lb; clusters per event / <mu>', type='TH2F', path='clustersPerPlaneFront', xbins=1000, xmin=-0.5, xmax=999.5, ybins=1000, ymin=-0.2, ymax=1.0)
-    array.defineHistogram('lb,clustersPerPlaneEnd', title='(End BCID) Number of clusters per event divided by <mu> in station {0}, layer {1};lb; clusters per event / <mu>', type='TH2F', path='clustersPerPlaneEnd', xbins=1000, xmin=-0.5, xmax=999.5, ybins=1000, ymin=-0.2, ymax=1.0)
-    array.defineHistogram('lb,clustersPerPlaneMiddle', title='(Middle BCID) Number of clusters per event divided by <mu> in station {0}, layer {1};lb; clusters per event / <mu>', type='TH2F', path='clustersPerPlaneMiddle', xbins=1000, xmin=-0.5, xmax=999.5, ybins=1000, ymin=-0.2, ymax=1.0)
+    array.defineHistogram('pixelColIDChip', title='Hits per column for station {0}, layer {1};pixelColIDChip; entries', path='PixelColIDChip/{0}', xbins=80, xmin=0.5, xmax=80.5)
+    array.defineHistogram('pixelRowIDChip', title='Hits per row for station {0}, layer {1};pixelRowIDChip; entries', path='PixelRowIDChip/{0}', xbins=336, xmin=0.5, xmax=336.5)
+    array.defineHistogram('pixelRowIDChip,pixelColIDChip', title='Hitmap for station {0}, layer {1};pixelRowIDChip;pixelColIDChip', type='TH2F', path='pixelColRow2D/{0}', xbins=336, xmin=0.5, xmax=336.5, ybins=80, ymin=0.5, ymax=80.5)
+    array.defineHistogram('timeOverThreshold', type='TH1F', title='Time over threshold for station {0}, layer {1};timeOverThreshold; entries', path='SiTimeOverThreshold/{0}', xbins=16, xmin=0.5, xmax=16.5)
+    
+    array.defineHistogram('clusterY,clusterX', title='Cluster position in station {0} Layer {1};x [mm];y [mm]', type='TH2F', path='Cluster/{0}', xbins=336, xmin=0.0, xmax=17.0, ybins=80, ymin=0.0, ymax=20.0)
+    array.defineHistogram('lb,clustersPerPlane', title='Number of clusters per event divided by <mu> in station {0}, layer {1};lb; clusters per event / <mu>', type='TH2F', path='clustersPerPlane/{0}', xbins=1000, xmin=-0.5, xmax=999.5, ybins=1000, ymin=-0.2, ymax=1.0)
+    array.defineHistogram('lb,clustersPerPlaneFront', title='(Front BCID) Number of clusters per event divided by <mu> in station {0}, layer {1};lb; clusters per event / <mu>', type='TH2F', path='clustersPerPlaneFront/{0}', xbins=1000, xmin=-0.5, xmax=999.5, ybins=1000, ymin=-0.2, ymax=1.0)
+    array.defineHistogram('lb,clustersPerPlaneEnd', title='(End BCID) Number of clusters per event divided by <mu> in station {0}, layer {1};lb; clusters per event / <mu>', type='TH2F', path='clustersPerPlaneEnd/{0}', xbins=1000, xmin=-0.5, xmax=999.5, ybins=1000, ymin=-0.2, ymax=1.0)
+    array.defineHistogram('lb,clustersPerPlaneMiddle', title='(Middle BCID) Number of clusters per event divided by <mu> in station {0}, layer {1};lb; clusters per event / <mu>', type='TH2F', path='clustersPerPlaneMiddle/{0}', xbins=1000, xmin=-0.5, xmax=999.5, ybins=1000, ymin=-0.2, ymax=1.0)
 
 
-    array = helper.addArray([combinedList], afpSiLayerAlgorithm, 'AFPSiLayerTool', topPath='AFP/SiT/')
+    array = helper.addArray([stationList], afpSiLayerAlgorithm, 'AFPSiLayerTool', topPath='AFP/SiT/')
+    
+    array.defineHistogram('planeHits', type='TH1F', title='Number of hits per plane, station {0};plane; hits', path='HitsPerPlanes', xbins=4, xmin=-0.5, xmax=3.5)
     array.defineHistogram('trackY,trackX', title='Track in AFP station {0};x [mm];y [mm]', type='TH2F', path='Track', xbins=336, xmin=0.0, xmax=17.0, ybins=80, ymin=0.0, ymax=20.0)
     array.defineHistogram('lb,clustersPerStation', title ='Number of clusters per event divided by <mu> in station {0};lb; clustersPerStation', type='TH2F', path='clustersPerStation', xbins=1000, xmin=-0.5, xmax=999.5, ybins=1000, ymin=-0.2, ymax=1.0)
     array.defineHistogram('lb,clustersPerStationFront', title ='(Front) Number of clusters per event divided by <mu> in station {0};lb; clustersPerStation', type='TH2F', path='clustersPerStation', xbins=1000, xmin=-0.5, xmax=999.5, ybins=1000, ymin=-0.2, ymax=1.0)
     array.defineHistogram('lb,clustersPerStationEnd', title ='(End) Number of clusters per event divided by <mu> in station {0};lb; clustersPerStation', type='TH2F', path='clustersPerStation', xbins=1000, xmin=-0.5, xmax=999.5, ybins=1000, ymin=-0.2, ymax=1.0)
     array.defineHistogram('lb,clustersPerStationMiddle', title ='(Middle) Number of clusters per event divided by <mu> in station {0};lb; clustersPerStation', type='TH2F', path='clustersPerStation', xbins=1000, xmin=-0.5, xmax=999.5, ybins=1000, ymin=-0.2, ymax=1.0)
 
-    arrayOneList = helper.addArray([combinedList], afpToFAlgorithm, 'AFPToFTool', topPath='AFP/ToF/')
-    arrayOneList.defineHistogram('barInTrainID,trainID', title='ToF hit bar vs train {0};barInTrainID;trainID', type='TH2F', path='HitBarvsTrain/',xbins=4,xmin=-0.5,xmax=3.5,ybins=4,ymin=-0.5,ymax=3.5)
 
+    arrayToF = helper.addArray([stationList], afpToFAlgorithm, 'AFPToFTool', topPath='AFP/ToF/')
+    
+    arrayToF.defineHistogram('barInTrainID,trainID', title='ToF hit bar vs train {0};barInTrainID;trainID', type='TH2F', path='HitBarvsTrain/',xbins=4,xmin=-0.5,xmax=3.5,ybins=4,ymin=-0.5,ymax=3.5)
+    arrayToF = helper.addArray([trainList], afpToFAlgorithm, 'AFPToFTool', topPath='AFP/ToF/')
+    arrayToF.defineHistogram('barInTrainIDA', title='Total hits per bars in {}; barID; hits', type='TH1F', path='HitsPerBarsInTrain/farAside', xbins=4,xmin=-0.5,xmax=3.5)
+    arrayToF.defineHistogram('barInTrainIDC', title='Total hits per bars in {}; barID; hits', type='TH1F', path='HitsPerBarsInTrain/farCside', xbins=4,xmin=-0.5,xmax=3.5)
+    
     # Finalize. The return value should be a tuple of the ComponentAccumulator
     result.merge(helper.result())
     return result
@@ -89,7 +101,7 @@ if __name__=='__main__':
 
     ConfigFlags.Input.Files = ['/eos/atlas/atlascerngroupdisk/det-afp/xAODCalibrationStream/2017/user.ladamczy.00337371.calibration_AFP.daq.AOD_EXT0/user.ladamczy.22326990.EXT0._000001.xAOD.root']
     ConfigFlags.Input.isMC = False
-    ConfigFlags.Output.HISTFileName = 'AFPOutput54-test.root'
+    ConfigFlags.Output.HISTFileName = 'AFPOutput63-test.root'
     
     ConfigFlags.lock()
 
@@ -102,6 +114,6 @@ if __name__=='__main__':
     exampleMonitorAcc = Run3AFPExampleMonitoringConfig(ConfigFlags)
     cfg.merge(exampleMonitorAcc)
 
-    cfg.run(50000)
+    cfg.run(10000)
 
 
diff --git a/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPSiLayerAlgorithm.cxx b/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPSiLayerAlgorithm.cxx
index bc42635bc766958ca62db69de12665ef8f3b052a..f2a9bc75a9e567282a4b83f2cd07e7e571e43289 100644
--- a/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPSiLayerAlgorithm.cxx
+++ b/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPSiLayerAlgorithm.cxx
@@ -49,6 +49,8 @@
 	std::vector<int> middleBCIDsVector;
 	std::vector<int> endBCIDsVector;
 	
+	unsigned int efficiencyHistogramCounter=0;
+	
 	bool isInListVector(const int bcid, const std::vector<int>&arr)
 	{
 		return std::find_if(arr.begin(),arr.end(),[&bcid](const int& ele){return ele==bcid;})!= arr.end();
@@ -70,8 +72,8 @@ StatusCode AFPSiLayerAlgorithm::initialize() {
 
 	using namespace Monitored;
 
-	m_HitmapGroups = buildToolMap<std::map<std::string,int>>(m_tools,"AFPSiLayerTool", m_stationnames, m_pixlayers);
-	m_TrackGroup = buildToolMap<int>(m_tools, "AFPSiLayerTool", m_stationnames);
+	m_StationPlaneGroup = buildToolMap<std::map<std::string,int>>(m_tools,"AFPSiLayerTool", m_stationnames, m_pixlayers);
+	m_StationGroup = buildToolMap<int>(m_tools, "AFPSiLayerTool", m_stationnames);
 
 
 	// We must declare to the framework in initialize what SG objects we are going to use:
@@ -124,7 +126,7 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const
 	// Declare the quantities which should be monitored:
 	auto lb = Monitored::Scalar<int>("lb", 0);
 	auto muPerBCID = Monitored::Scalar<float>("muPerBCID", 0.0);
-	auto run = Monitored::Scalar<int>("run",0);
+	//auto run = Monitored::Scalar<int>("run",0);
 	auto weight = Monitored::Scalar<float>("weight", 1.0);
 
 	auto nSiHits = Monitored::Scalar<int>("nSiHits", 1);
@@ -143,6 +145,9 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const
 	auto layerEfficiency = Monitored::Scalar<float>("layerEfficiency", 0.0);
 	auto layerNumber = Monitored::Scalar<int>("layerNumber", 0);
 	
+	auto planeHits = Monitored::Scalar<int>("planeHits", 0);
+	auto planeHitsAll = Monitored::Scalar<int>("planeHitsAll", 0);
+	
 	
 	lb = GetEventInfo(ctx)->lumiBlock();
 	muPerBCID = lbAverageInteractionsPerCrossing(ctx);
@@ -165,7 +170,6 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const
 	nSiHits = afpHitContainer->size();
 	fill("AFPSiLayerTool", lb, nSiHits);
 
-
 	for(const xAOD::AFPSiHit *hitsItr: *afpHitContainer)
 	{
 		lb = GetEventInfo(ctx)->lumiBlock();
@@ -175,10 +179,15 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const
 		
 		if (hitsItr->stationID()<4 && hitsItr->stationID()>=0 && hitsItr->pixelLayerID()<4 && hitsItr->pixelLayerID()>=0) 
 		{
-			fill(m_tools[m_HitmapGroups.at(m_stationnames.at(hitsItr->stationID())).at(m_pixlayers.at(hitsItr->pixelLayerID()))], pixelRowIDChip, pixelColIDChip);
-			fill(m_tools[m_HitmapGroups.at(m_stationnames.at(hitsItr->stationID())).at(m_pixlayers.at(hitsItr->pixelLayerID()))], pixelRowIDChip);
-			fill(m_tools[m_HitmapGroups.at(m_stationnames.at(hitsItr->stationID())).at(m_pixlayers.at(hitsItr->pixelLayerID()))], pixelColIDChip);
-			fill(m_tools[m_HitmapGroups.at(m_stationnames.at(hitsItr->stationID())).at(m_pixlayers.at(hitsItr->pixelLayerID()))], timeOverThreshold);
+			fill(m_tools[m_StationPlaneGroup.at(m_stationnames.at(hitsItr->stationID())).at(m_pixlayers.at(hitsItr->pixelLayerID()))], pixelRowIDChip, pixelColIDChip);
+			fill(m_tools[m_StationPlaneGroup.at(m_stationnames.at(hitsItr->stationID())).at(m_pixlayers.at(hitsItr->pixelLayerID()))], pixelRowIDChip);
+			fill(m_tools[m_StationPlaneGroup.at(m_stationnames.at(hitsItr->stationID())).at(m_pixlayers.at(hitsItr->pixelLayerID()))], pixelColIDChip);
+			fill(m_tools[m_StationPlaneGroup.at(m_stationnames.at(hitsItr->stationID())).at(m_pixlayers.at(hitsItr->pixelLayerID()))], timeOverThreshold);
+			
+			planeHits = hitsItr->pixelLayerID();
+			fill(m_tools[m_StationGroup.at(m_stationnames.at(hitsItr->stationID()))], planeHits);
+			planeHitsAll = (hitsItr->stationID())*4+hitsItr->pixelLayerID();
+			fill("AFPSiLayerTool", planeHitsAll);
 			
 		}
 		else ATH_MSG_WARNING("Unrecognised station index: " << hitsItr->stationID());
@@ -193,7 +202,7 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const
 	{
 		trackX = track.x;
 		trackY = track.y;
-		fill(m_tools[m_TrackGroup.at(m_stationnames.at(track.station))], trackY, trackX);
+		fill(m_tools[m_StationGroup.at(m_stationnames.at(track.station))], trackY, trackX);
 	}
 
 	// Cluster histograms 
@@ -201,7 +210,7 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const
 	{
 		clusterX = cluster.x;
 		clusterY = cluster.y;
-		fill(m_tools[m_HitmapGroups.at(m_stationnames.at(cluster.station)).at(m_pixlayers.at(cluster.layer))], clusterY, clusterX);
+		fill(m_tools[m_StationPlaneGroup.at(m_stationnames.at(cluster.station)).at(m_pixlayers.at(cluster.layer))], clusterY, clusterX);
 	}
 	
 	// Synch histograms:
@@ -239,6 +248,7 @@ void AFPSiLayerAlgorithm::fillSynchHistogramsStation(Monitored::Scalar<int> &lb,
 			for(int i = 0; i < 4; i++)
 			{
 				clustersPerStationFloat = clusterCounterStationA[previouslbStationA][i];
+				clusterCounterStationA[previouslbStationA][i] = 0;
 				if(muPerBCID != 0 && clustersPerStationFloat!=0)
 				{
 					clustersPerStationFloat = clustersPerStationFloat/(muPerBCID*counterForEventsStationA*4);
@@ -249,25 +259,25 @@ void AFPSiLayerAlgorithm::fillSynchHistogramsStation(Monitored::Scalar<int> &lb,
 				{
 					auto clustersPerStation = Monitored::Scalar<float>("clustersPerStation", 0.0);
 					clustersPerStation = clustersPerStationFloat;
-					fill(m_tools[m_TrackGroup.at(m_stationnames.at(i))], lb, clustersPerStation);
+					fill(m_tools[m_StationGroup.at(m_stationnames.at(i))], lb, clustersPerStation);
 				}
 				else if (histogramType == 'F')
 				{
 					auto clustersPerStationFront = Monitored::Scalar<float>("clustersPerStationFront", 0.0);
 					clustersPerStationFront = clustersPerStationFloat;
-					fill(m_tools[m_TrackGroup.at(m_stationnames.at(i))], lb, clustersPerStationFront);
+					fill(m_tools[m_StationGroup.at(m_stationnames.at(i))], lb, clustersPerStationFront);
 				}
 				else if (histogramType == 'M')
 				{
 					auto clustersPerStationMiddle = Monitored::Scalar<float>("clustersPerStationMiddle", 0.0);
 					clustersPerStationMiddle = clustersPerStationFloat;
-					fill(m_tools[m_TrackGroup.at(m_stationnames.at(i))], lb, clustersPerStationMiddle);
+					fill(m_tools[m_StationGroup.at(m_stationnames.at(i))], lb, clustersPerStationMiddle);
 				}
 				else if (histogramType == 'E')
 				{
 					auto clustersPerStationEnd = Monitored::Scalar<float>("clustersPerStationEnd", 0.0);
 					clustersPerStationEnd = clustersPerStationFloat;
-					fill(m_tools[m_TrackGroup.at(m_stationnames.at(i))], lb, clustersPerStationEnd);
+					fill(m_tools[m_StationGroup.at(m_stationnames.at(i))], lb, clustersPerStationEnd);
 				}
 			}
 			previouslbStationA=lb;
@@ -296,6 +306,7 @@ void AFPSiLayerAlgorithm::fillSynchHistogramsPlane(Monitored::Scalar<int> &lb, i
 				for(int j=0; j<4; j++)
 				{
 					clustersPerPlaneFloat = clusterCounterPlane[previouslbPlane][i][j];
+					clusterCounterPlane[previouslbPlane][i][j] = 0;
 					if(muPerBCID != 0 && clustersPerPlaneFloat != 0)
 					{
 						clustersPerPlaneFloat = clustersPerPlaneFloat/(muPerBCID*counterForEventsPlane);
@@ -309,25 +320,25 @@ void AFPSiLayerAlgorithm::fillSynchHistogramsPlane(Monitored::Scalar<int> &lb, i
 					{
 						auto clustersPerPlane = Monitored::Scalar<float>("clustersPerPlane", 0.0);
 						clustersPerPlane = clustersPerPlaneFloat;
-						fill(m_tools[m_HitmapGroups.at(m_stationnames.at(i)).at(m_pixlayers.at(j))], lb, clustersPerPlane);
+						fill(m_tools[m_StationPlaneGroup.at(m_stationnames.at(i)).at(m_pixlayers.at(j))], lb, clustersPerPlane);
 					}
 					else if(histogramType == 'F')
 					{
 						auto clustersPerPlaneFront = Monitored::Scalar<float>("clustersPerPlaneFront", 0.0);
 						clustersPerPlaneFront = clustersPerPlaneFloat;
-						fill(m_tools[m_HitmapGroups.at(m_stationnames.at(i)).at(m_pixlayers.at(j))], lb, clustersPerPlaneFront);
+						fill(m_tools[m_StationPlaneGroup.at(m_stationnames.at(i)).at(m_pixlayers.at(j))], lb, clustersPerPlaneFront);
 					}
 					else if(histogramType == 'M')
 					{
 						auto clustersPerPlaneMiddle = Monitored::Scalar<float>("clustersPerPlaneMiddle", 0.0);
 						clustersPerPlaneMiddle = clustersPerPlaneFloat;
-						fill(m_tools[m_HitmapGroups.at(m_stationnames.at(i)).at(m_pixlayers.at(j))], lb, clustersPerPlaneMiddle);
+						fill(m_tools[m_StationPlaneGroup.at(m_stationnames.at(i)).at(m_pixlayers.at(j))], lb, clustersPerPlaneMiddle);
 					}
 					else if(histogramType == 'E')
 					{
 						auto clustersPerPlaneEnd = Monitored::Scalar<float>("clustersPerPlaneEnd", 0.0);
 						clustersPerPlaneEnd = clustersPerPlaneFloat;
-						fill(m_tools[m_HitmapGroups.at(m_stationnames.at(i)).at(m_pixlayers.at(j))], lb, clustersPerPlaneEnd);
+						fill(m_tools[m_StationPlaneGroup.at(m_stationnames.at(i)).at(m_pixlayers.at(j))], lb, clustersPerPlaneEnd);
 					}
 				}
 			}
@@ -347,3 +358,4 @@ void AFPSiLayerAlgorithm::fillSynchHistogramsPlane(Monitored::Scalar<int> &lb, i
 	}
 }
 
+
diff --git a/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPToFAlgorithm.cxx b/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPToFAlgorithm.cxx
index cde7c1fcce371184df4b33e5312aa5b38bc69bae..8bf07a93bb176afd6a691710fd97f86cae0d7d52 100644
--- a/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPToFAlgorithm.cxx
+++ b/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPToFAlgorithm.cxx
@@ -27,7 +27,8 @@ AFPToFAlgorithm::~AFPToFAlgorithm() {}
 StatusCode AFPToFAlgorithm::initialize() {
 	using namespace Monitored;
 
-	m_HitmapGroupsToF = buildToolMap<int>(m_tools,"AFPToFTool", m_stationNamesToF);
+	m_StationNamesGroup = buildToolMap<int>(m_tools,"AFPToFTool", m_stationNamesToF);
+	m_TrainsToFGroup = buildToolMap<int>(m_tools, "AFPToFTool", m_trainsToF);
 
 	// We must declare to the framework in initialize what SG objects we are going to use
 	SG::ReadHandleKey<xAOD::AFPToFHitContainer> afpToFHitContainerKey("AFPToFHits");
@@ -47,6 +48,10 @@ StatusCode AFPToFAlgorithm::fillHistograms( const EventContext& ctx ) const {
 	auto numberOfHit_S3 = Monitored::Scalar<int>("numberOfHit_S3", 0);
 	auto trainID = Monitored::Scalar<int>("trainID", 0); 
 	auto barInTrainID = Monitored::Scalar<int>("barInTrainID", 0); 
+	auto barInTrainAllA = Monitored::Scalar<int>("barInTrainAllA", 0);
+	auto barInTrainIDA = Monitored::Scalar<int>("barInTrainIDA", 0); 
+	auto barInTrainAllC = Monitored::Scalar<int>("barInTrainAllC", 0);
+	auto barInTrainIDC = Monitored::Scalar<int>("barInTrainIDC", 0); 
     
 	lb = GetEventInfo(ctx)->lumiBlock();
  
@@ -71,16 +76,26 @@ StatusCode AFPToFAlgorithm::fillHistograms( const EventContext& ctx ) const {
 		{
 			numberOfHit_S0 = hitsItr->trainID();
 			fill("AFPToFTool", numberOfHit_S0);
+			
+			barInTrainIDA = hitsItr->barInTrainID();
+			fill(m_tools[m_TrainsToFGroup.at(m_trainsToF.at(hitsItr->trainID()))], barInTrainIDA);
+			barInTrainAllA = (hitsItr->trainID()*4)+barInTrainIDA;
+			fill("AFPToFTool", barInTrainAllA);
 		}
 		else if(hitsItr->isSideC())
 		{
 			numberOfHit_S3 = hitsItr->trainID();
 			fill("AFPToFTool", numberOfHit_S3);
+			
+			barInTrainIDC = hitsItr->barInTrainID();
+			fill(m_tools[m_TrainsToFGroup.at(m_trainsToF.at(hitsItr->trainID()))], barInTrainIDC);
+			barInTrainAllC = (hitsItr->trainID()*4)+barInTrainIDC;
+			fill("AFPToFTool", barInTrainAllC);
 		}
 
 		if (hitsItr->stationID() == 0 || hitsItr->stationID() == 3)
 		{
-			fill(m_tools[m_HitmapGroupsToF.at(m_stationNamesToF.at(hitsItr->stationID()))], barInTrainID, trainID);
+			fill(m_tools[m_StationNamesGroup.at(m_stationNamesToF.at(hitsItr->stationID()))], barInTrainID, trainID);
 		}
 	}
 
diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p4.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p4.h
index 19ba716047d09374eb5bc509e929ad6890b1447c..3615633b6724cb8b039618266a8425c39f7fb59f 100755
--- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p4.h
+++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p4.h
@@ -129,17 +129,27 @@ class McEventCollectionCnv_p4 : public T_AthenaPoolTPCnvBase<
    *  vertex is added to the persistent is added to the persistent
    *  @c GenEvent.
    */
+#ifdef HEPMC3
+  void writeGenVertex( HepMC::ConstGenVertexPtr vtx,
+                       McEventCollection_p4& persEvt ) const;
+#else
   void writeGenVertex( const HepMC::GenVertex& vtx,
                        McEventCollection_p4& persEvt ) const;
+#endif
 
   /** @brief Method to write a persistent @c GenParticle object
    *  It returns the index of the persistent @c GenParticle into the
    *  collection of persistent of @c GenParticles from the
    *  persistent @c GenEvent
    */
+#ifdef HEPMC3   
+  int writeGenParticle( HepMC::ConstGenParticlePtr p,
+                        McEventCollection_p4& persEvt ) const;
+#else
   int writeGenParticle( const HepMC::GenParticle& p,
                         McEventCollection_p4& persEvt ) const;
 
+#endif
   ///////////////////////////////////////////////////////////////////
   // Protected data:
   ///////////////////////////////////////////////////////////////////
diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p5.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p5.h
index c5649ca6fd448c6d4db866e18a9266767751546d..59701c3de5f4d72a12e39dd670d8ce8e38783039 100755
--- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p5.h
+++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p5.h
@@ -130,16 +130,26 @@ class McEventCollectionCnv_p5 : public T_AthenaPoolTPCnvBase<
    *  vertex is added to the persistent is added to the persistent
    *  @c GenEvent.
    */
+#ifdef HEPMC3
+  void writeGenVertex( HepMC::ConstGenVertexPtr vtx,
+                       McEventCollection_p5& persEvt ) const;
+#else
   void writeGenVertex( const HepMC::GenVertex& vtx,
                        McEventCollection_p5& persEvt ) const;
 
+#endif
   /** @brief Method to write a persistent @c GenParticle object
    *  It returns the index of the persistent @c GenParticle into the
    *  collection of persistent of @c GenParticles from the
    *  persistent @c GenEvent
    */
+#ifdef HEPMC3
+  int writeGenParticle( HepMC::ConstGenParticlePtr p,
+                        McEventCollection_p5& persEvt ) const;
+#else
   int writeGenParticle( const HepMC::GenParticle& p,
                         McEventCollection_p5& persEvt ) const;
+#endif
 
   ///////////////////////////////////////////////////////////////////
   // Protected data:
diff --git a/Generators/GeneratorObjectsTPCnv/src/HepMcDataPool.h b/Generators/GeneratorObjectsTPCnv/src/HepMcDataPool.h
index be051d1fbb405777b6c5251a460626ac291e441e..3bc40ae512b38fc7bdf140d1f3dc1f8476d17683 100755
--- a/Generators/GeneratorObjectsTPCnv/src/HepMcDataPool.h
+++ b/Generators/GeneratorObjectsTPCnv/src/HepMcDataPool.h
@@ -35,6 +35,33 @@
 // various DataPool<Xyz>.
 namespace SG {
 
+#ifdef HEPMC3
+
+
+  template<>
+  inline void
+  ArenaAllocatorBase::destroy_fcn<HepMC::GenParticlePtr>(ArenaAllocatorBase::pointer p)
+  {
+  //GenParticlePtr is smart pointer
+  }
+
+  template<>
+  inline void
+  ArenaAllocatorBase::destroy_fcn<HepMC::GenVertexPtr>(ArenaAllocatorBase::pointer p)
+  {
+  //GenVertexPtr is smart pointer
+  }
+
+  template<>
+  inline void
+  ArenaAllocatorBase::destroy_fcn<HepMC::GenEvent>(ArenaAllocatorBase::pointer p)
+  {
+    HepMC::GenEvent* evt = reinterpret_cast<HepMC::GenEvent*>(p);
+    evt->~GenEvent();
+  }
+
+#else
+
   template<>
   inline void
   ArenaAllocatorBase::destroy_fcn<HepMC::GenParticle>(ArenaAllocatorBase::pointer p)
@@ -66,9 +93,26 @@ namespace SG {
     delete evt->m_pdf_info; evt->m_pdf_info = 0;
     evt->~GenEvent();
   }
+#endif  
 } // end namespace SG
 
 namespace HepMC {
+ #ifdef HEPMC3
+  struct DataPool {
+
+    typedef ::DataPool<HepMC::GenEvent> GenEvtPool_t;
+    /// an arena of @c HepMC::GenEvent for efficient object instantiation
+    GenEvtPool_t evt;
+
+    typedef ::DataPool<HepMC::GenVertexPtr> GenVtxPool_t;
+    /// an arena of @c HepMC::GenVertex for efficient object instantiation
+    GenVtxPool_t vtx;
+
+    typedef ::DataPool<HepMC::GenParticlePtr> GenPartPool_t;
+    /// an arena of @c HepMC::GenParticle for efficient object instantiation
+    GenPartPool_t part;
+  };
+#else
   struct DataPool {
 
     typedef ::DataPool<HepMC::GenEvent> GenEvtPool_t;
@@ -84,6 +128,7 @@ namespace HepMC {
     GenPartPool_t part;
   };
 
+#endif
 } // end namespace HepMC
 
 #endif // GENERATOROBJECTSATHENAPOOL_HEPMCDATAPOOL_H
diff --git a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p4.cxx b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p4.cxx
index db580216dada75be74dcccb20254b414ee99b4e3..38b204417a7e3c4c671077b05e001ecf1ee55268 100755
--- a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p4.cxx
+++ b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p4.cxx
@@ -107,6 +107,37 @@ void McEventCollectionCnv_p4::persToTrans( const McEventCollection_p4* persObj,
         {
           genEvt        =  poolOfEvents.nextElementPtr();
         }
+#ifdef HEPMC3
+      genEvt->add_attribute("signal_process_id",std::make_shared<HepMC3::IntAttribute>(persEvt.m_signalProcessId));
+      genEvt->set_event_number(persEvt.m_eventNbr);
+      genEvt->add_attribute("event_scale",std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_eventScale));
+      genEvt->add_attribute("alphaQCD",std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_alphaQCD));
+      genEvt->add_attribute("alphaQED",std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_alphaQED));
+
+      genEvt->add_attribute("signal_process_vertex",std::make_shared<HepMC3::IntAttribute>(0));
+      genEvt->weights()= persEvt.m_weights;
+      genEvt->add_attribute("random_states",std::make_shared<HepMC3::VectorLongIntAttribute>(persEvt.m_randomStates));
+      //restore weight names from the dedicated svc (which was keeping them in metadata for efficiency)
+      if(genEvt->run_info()) genEvt->run_info()->set_weight_names(name_index_map_to_names(m_hepMCWeightSvc->weightNames()));
+      else msg << MSG::WARNING << "No run info!" << endmsg;
+
+
+       // pdfinfo restore
+      if (!persEvt.m_pdfinfo.empty())
+        {
+          const std::vector<double>& pdf = persEvt.m_pdfinfo;
+              HepMC3::GenPdfInfoPtr pi;
+              pi->set(
+              static_cast<int>(pdf[6]), // id1
+              static_cast<int>(pdf[5]), // id2
+              pdf[4],                   // x1
+              pdf[3],                   // x2
+              pdf[2],                   // scalePDF
+              pdf[1],                   // pdf1
+              pdf[0] );                 // pdf2
+              genEvt->set_pdf_info(pi);
+        }
+#else
       genEvt->m_signal_process_id     = persEvt.m_signalProcessId;
       genEvt->m_event_number          = persEvt.m_eventNbr;
       genEvt->m_event_scale           = persEvt.m_eventScale;
@@ -134,6 +165,7 @@ void McEventCollectionCnv_p4::persToTrans( const McEventCollection_p4* persObj,
               pdf[1],                   // pdf1
               pdf[0] );                 // pdf2
         }
+#endif
 
       transObj->push_back( genEvt );
 
@@ -205,6 +237,56 @@ void McEventCollectionCnv_p4::transToPers( const McEventCollection* transObj,
         itr != itrEnd;
         ++itr )
     {
+#ifdef HEPMC3 
+      const unsigned int nPersVtx   = persObj->m_genVertices.size();
+      const unsigned int nPersParts = persObj->m_genParticles.size();
+      const HepMC::GenEvent* genEvt = *itr;
+      //save the weight names to metadata via the HepMCWeightSvc
+      m_hepMCWeightSvc->setWeightNames(  names_to_name_index_map(genEvt->weight_names()) ).ignore(); 
+      auto A_signal_process_id=genEvt->attribute<HepMC3::IntAttribute>("signal_process_id");    
+      auto A_event_scale=genEvt->attribute<HepMC3::DoubleAttribute>("event_scale");    
+      auto A_alphaQCD=genEvt->attribute<HepMC3::DoubleAttribute>("alphaQCD");    
+      auto A_alphaQED=genEvt->attribute<HepMC3::DoubleAttribute>("alphaQED");    
+      auto A_signal_process_vertex=genEvt->attribute<HepMC3::IntAttribute>("signal_process_vertex");    
+      auto A_random_states=genEvt->attribute<HepMC3::VectorLongIntAttribute>("random_states");    
+
+      persObj->m_genEvents.
+      push_back( GenEvent_p4( A_signal_process_id?(A_signal_process_id->value()):0,
+                                genEvt->event_number(),
+                                A_event_scale?(A_event_scale->value()):0.0, 
+                                A_alphaQCD?(A_alphaQCD->value()):0.0, 
+                                A_alphaQED?(A_alphaQED->value()):0.0, 
+                                A_signal_process_vertex?(A_signal_process_vertex->value()):0, 
+                                genEvt->weights(), 
+                                std::vector<double>(),//No idea why it is empty 
+                                A_random_states?(A_random_states->value()):std::vector<long>(), 
+                                nPersVtx,
+                                nPersVtx + genEvt->vertices().size(),
+                                nPersParts,
+                                nPersParts + genEvt->particles().size() ) );
+
+      //PdfInfo encoding
+   if (genEvt->pdf_info())
+        {
+          auto pi=genEvt->pdf_info();
+          GenEvent_p4& persEvt = persObj->m_genEvents.back();
+          std::vector<double>& pdfinfo = persEvt.m_pdfinfo;
+          pdfinfo.resize(7);
+          pdfinfo[6] = static_cast<double>(pi->parton_id[0]);
+          pdfinfo[5] = static_cast<double>(pi->parton_id[1]);
+          pdfinfo[4] = pi->x[0];
+          pdfinfo[3] = pi->x[1];
+          pdfinfo[2] = pi->scale;
+          pdfinfo[1] = pi->xf[0];
+          pdfinfo[0] = pi->xf[1];
+        }
+      // create vertices
+      for ( auto v: genEvt->vertices())
+        {
+          writeGenVertex( v, *persObj );
+        }
+
+#else
       const unsigned int nPersVtx   = persObj->m_genVertices.size();
       const unsigned int nPersParts = persObj->m_genParticles.size();
       const HepMC::GenEvent* genEvt = *itr;
@@ -250,6 +332,7 @@ void McEventCollectionCnv_p4::transToPers( const McEventCollection* transObj,
         {
           writeGenVertex( **i, *persObj );
         }
+#endif
 
     } //> end loop over GenEvents
 
@@ -265,6 +348,24 @@ McEventCollectionCnv_p4::createGenVertex( const McEventCollection_p4& persEvt,
                                           ParticlesMap_t& partToEndVtx,
                                           HepMC::DataPool* datapools ) const
 {
+#ifdef HEPMC3
+  DataPool<HepMC::GenVertexPtr>& poolOfVertices = datapools->vtx;
+  HepMC::GenVertexPtr vtx(0);
+  if(m_isPileup)
+    {
+      vtx=HepMC::newGenVertexPtr();
+    }
+  else
+    {
+      vtx = *(poolOfVertices.nextElementPtr());
+    }
+  vtx->set_position(HepMC::FourVector( persVtx.m_x , persVtx.m_y , persVtx.m_z ,persVtx.m_t ));
+  //AV ID cannot be assigned in HepMC3. And its meaning in HepMC2 is not clear.
+  // vtx->m_id      = persVtx.m_id;
+  vtx->add_attribute("weights",std::make_shared<HepMC3::VectorFloatAttribute>(persVtx.m_weights));
+  vtx->add_attribute("barcode",std::make_shared<HepMC3::IntAttribute>(persVtx.m_barcode));
+
+#else
   DataPool<HepMC::GenVertex>& poolOfVertices = datapools->vtx;
   HepMC::GenVertexPtr vtx(0);
   if(m_isPileup)
@@ -287,6 +388,7 @@ McEventCollectionCnv_p4::createGenVertex( const McEventCollection_p4& persEvt,
                                     persVtx.m_weights.end() );
   vtx->m_event   = 0;
   vtx->m_barcode = persVtx.m_barcode;
+#endif
 
   // handle the in-going (orphans) particles
   const unsigned int nPartsIn = persVtx.m_particlesIn.size();
@@ -314,6 +416,60 @@ McEventCollectionCnv_p4::createGenParticle( const GenParticle_p4& persPart,
                                             ParticlesMap_t& partToEndVtx,
                                             HepMC::DataPool* datapools ) const
 {
+#ifdef HEPMC3
+  DataPool<HepMC::GenParticlePtr>& poolOfParticles = datapools->part;
+  HepMC::GenParticlePtr p(0);
+  if (m_isPileup)
+    {
+      p = HepMC::newGenParticlePtr();
+    }
+  else
+    {
+      p    = *(poolOfParticles.nextElementPtr());
+    }
+  p->set_pdg_id(              persPart.m_pdgId);
+  p->set_status(              persPart.m_status);
+  p->add_attribute("phi",std::make_shared<HepMC3::DoubleAttribute>(persPart.m_phiPolarization));
+  p->add_attribute("theta",std::make_shared<HepMC3::DoubleAttribute>(persPart.m_thetaPolarization));
+  p->add_attribute("barcode",std::make_shared<HepMC3::IntAttribute>(persPart.m_barcode));  
+
+  // Note: do the E calculation in extended (long double) precision.
+  // That happens implicitly on x86 with optimization on; saying it
+  // explicitly ensures that we get the same results with and without
+  // optimization.  (If this is a performance issue for platforms
+  // other than x86, one could change to double for those platforms.)
+  if ( 0 == persPart.m_recoMethod )
+    {
+      double temp_e = std::sqrt( (long double)(persPart.m_px)*persPart.m_px +
+                            (long double)(persPart.m_py)*persPart.m_py +
+                            (long double)(persPart.m_pz)*persPart.m_pz +
+                            (long double)(persPart.m_m) *persPart.m_m );
+      p->set_momentum( HepMC::FourVector(persPart.m_px,persPart.m_px,persPart.m_px,temp_e));
+    }
+  else
+    {
+      const int signM2 = ( persPart.m_m >= 0. ? 1 : -1 );
+      const double persPart_ene =
+        std::sqrt( std::abs((long double)(persPart.m_px)*persPart.m_px +
+                  (long double)(persPart.m_py)*persPart.m_py +
+                  (long double)(persPart.m_pz)*persPart.m_pz +
+                  signM2* (long double)(persPart.m_m)* persPart.m_m));
+      const int signEne = ( persPart.m_recoMethod == 1 ? 1 : -1 );
+     p->set_momentum( HepMC::FourVector( persPart.m_px,
+                         persPart.m_py,
+                         persPart.m_pz,
+                         signEne * persPart_ene ));
+    }
+
+  // setup flow
+  std::vector<int> flows;
+  const unsigned int nFlow = persPart.m_flow.size();
+  for ( unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
+  flows.push_back(persPart.m_flow[iFlow].second );
+  }
+  //We construct it here as vector w/o gaps.
+  p->add_attribute("flows", std::make_shared<HepMC3::VectorIntAttribute>(flows));
+#else
   DataPool<HepMC::GenParticle>& poolOfParticles = datapools->part;
   HepMC::GenParticlePtr p(0);
   if (m_isPileup)
@@ -339,10 +495,6 @@ McEventCollectionCnv_p4::createGenParticle( const GenParticle_p4& persPart,
   // other than x86, one could change to double for those platforms.)
   if ( 0 == persPart.m_recoMethod )
     {
-      //    p->m_momentum.setVectM(Hep4Vector( persPart.m_px,
-      //					persPart.m_py,
-      //					persPart.m_pz ),
-      //                            persPart.m_m );
 
       p->m_momentum.setPx( persPart.m_px);
       p->m_momentum.setPy( persPart.m_py);
@@ -375,6 +527,7 @@ McEventCollectionCnv_p4::createGenParticle( const GenParticle_p4& persPart,
       p->m_flow.set_icode( persPart.m_flow[iFlow].first,
                            persPart.m_flow[iFlow].second );
     }
+#endif
 
   if ( persPart.m_endVtx != 0 )
     {
@@ -384,6 +537,42 @@ McEventCollectionCnv_p4::createGenParticle( const GenParticle_p4& persPart,
   return p;
 }
 
+#ifdef HEPMC3
+void McEventCollectionCnv_p4::writeGenVertex( HepMC::ConstGenVertexPtr vtx,
+                                              McEventCollection_p4& persEvt ) const
+{                                              
+  const HepMC::FourVector& position = vtx->position();
+  auto A_weights=vtx->attribute<HepMC3::VectorDoubleAttribute>("weights"); 
+  auto A_barcode=vtx->attribute<HepMC3::IntAttribute>("barcode"); 
+  std::vector<double> weights=A_weights?(A_weights->value()):std::vector<double>();
+  persEvt.m_genVertices.push_back(
+                                  GenVertex_p4( position.x(),
+                                                position.y(),
+                                                position.z(),
+                                                position.t(),
+                                                vtx->id(),
+                                                weights.begin(),
+                                                weights.end(),
+                                                A_barcode?(A_barcode->value()):vtx->id()
+                                                ) );
+  GenVertex_p4& persVtx = persEvt.m_genVertices.back();
+  // we write only the orphans in-coming particles
+  persVtx.m_particlesIn.reserve(vtx->particles_in().size());
+  for ( auto p: vtx->particles_in())
+    {
+      if ( !p->production_vertex() )
+        {
+          persVtx.m_particlesIn.push_back( writeGenParticle(p, persEvt ));
+        }
+    }
+  persVtx.m_particlesOut.reserve(vtx->particles_out().size());
+  for ( auto p: vtx->particles_out())
+    {
+      persVtx.m_particlesOut.push_back( writeGenParticle(p, persEvt ) );
+    }
+  return;
+}
+#else
 void McEventCollectionCnv_p4::writeGenVertex( const HepMC::GenVertex& vtx,
                                               McEventCollection_p4& persEvt ) const
 {
@@ -423,7 +612,49 @@ void McEventCollectionCnv_p4::writeGenVertex( const HepMC::GenVertex& vtx,
 
   return;
 }
+#endif
 
+#ifdef HEPMC3
+int McEventCollectionCnv_p4::writeGenParticle( HepMC::ConstGenParticlePtr p,
+                                               McEventCollection_p4& persEvt ) const
+{                                               
+  const HepMC::FourVector& mom = p->momentum();
+  const double ene = mom.e();
+  const double m2  = mom.m2();
+
+  // Definitions of Bool isTimeLilike, isSpacelike and isLightlike according to HepLorentzVector definition
+  const bool useP2M2 = !(m2 > 0) &&   // !isTimelike
+    (m2 < 0) &&   //  isSpacelike
+    !(std::abs(m2) < 2.0*DBL_EPSILON*ene*ene); // !isLightlike
+
+    const short recoMethod = ( !useP2M2 ? 0: ( ene >= 0. ? 1 : 2 ) );
+    auto A_theta=p->attribute<HepMC3::DoubleAttribute>("theta"); 
+    auto A_phi=p->attribute<HepMC3::DoubleAttribute>("phi"); 
+    auto A_flows=p->attribute<HepMC3::VectorIntAttribute>("flows"); 
+    
+    
+    persEvt.m_genParticles.push_back( GenParticle_p4( mom.px(),
+                               mom.py(),
+                               mom.pz(),
+                               mom.m(),
+                               p->pdg_id(),
+                               p->status(),
+                               A_flows?(A_flows->value().size()):0,
+                               A_theta?(A_theta->value()):0.0,
+                               A_phi?(A_phi->value()):0.0,
+                               p->production_vertex()?(HepMC::barcode(p->production_vertex())):0,
+                               p->end_vertex()?(HepMC::barcode(p->end_vertex())):0,
+                               HepMC::barcode(p),
+                               recoMethod ) );
+  
+  std::vector< std::pair<int,int> > flow_hepmc2;
+  if(A_flows) flow_hepmc2=vector_to_vector_int_int(A_flows->value());
+  persEvt.m_genParticles.back().m_flow.assign( flow_hepmc2.begin(),flow_hepmc2.end() );
+  // we return the index of the particle in the big vector of particles
+  // (contained by the persistent GenEvent)
+  return (persEvt.m_genParticles.size() - 1);
+}                                               
+#else
 int McEventCollectionCnv_p4::writeGenParticle( const HepMC::GenParticle& p,
                                                McEventCollection_p4& persEvt ) const
 {
@@ -467,6 +698,7 @@ int McEventCollectionCnv_p4::writeGenParticle( const HepMC::GenParticle& p,
   // (contained by the persistent GenEvent)
   return (persEvt.m_genParticles.size() - 1);
 }
+#endif
 
 void McEventCollectionCnv_p4::setPileup()
 {
diff --git a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p5.cxx b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p5.cxx
index a769cb98d3f46c7388ceee45f2456fd7345b0ab1..bdf12ec5494c4f3f606de5944b3b05b2166bced1 100755
--- a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p5.cxx
+++ b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p5.cxx
@@ -93,6 +93,119 @@ void McEventCollectionCnv_p5::persToTrans( const McEventCollection_p5* persObj,
     } else {
       genEvt        =  poolOfEvents.nextElementPtr();
     }
+#ifdef HEPMC3
+    genEvt->add_attribute("signal_process_id",std::make_shared<HepMC3::IntAttribute>(persEvt.m_signalProcessId));
+    genEvt->set_event_number(persEvt.m_eventNbr);
+    genEvt->add_attribute("mpi",std::make_shared<HepMC3::IntAttribute>(persEvt.m_mpi));
+    genEvt->add_attribute("event_scale",std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_eventScale));
+    genEvt->add_attribute("alphaQCD",std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_alphaQCD));
+    genEvt->add_attribute("alphaQED",std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_alphaQED));
+    genEvt->weights()= persEvt.m_weights;
+    genEvt->add_attribute("random_states",std::make_shared<HepMC3::VectorLongIntAttribute>(persEvt.m_randomStates));
+
+    genEvt->set_units(static_cast<HepMC3::Units::MomentumUnit>(persEvt.m_momentumUnit),
+                      static_cast<HepMC3::Units::LengthUnit>(persEvt.m_lengthUnit));
+
+    //restore weight names from the dedicated svc (which was keeping them in metadata for efficiency)
+    if(genEvt->run_info()) genEvt->run_info()->set_weight_names(name_index_map_to_names(m_hepMCWeightSvc->weightNames()));
+    else msg << MSG::WARNING << "No run info!" << endmsg;
+    // cross-section restore
+
+    auto cs = std::make_shared<HepMC3::GenCrossSection>();
+    if (!persEvt.m_crossSection.empty()) {
+      const std::vector<double>& xsection = persEvt.m_crossSection;
+      if( static_cast<bool>(xsection[0]) )
+        cs->set_cross_section(xsection[2],xsection[1]);
+    genEvt->set_cross_section(cs);
+    }
+    
+    // heavyIon restore
+    auto hi = std::make_shared<HepMC3::GenHeavyIon>();
+    if (!persEvt.m_heavyIon.empty()) {
+      const std::vector<float>& hIon = persEvt.m_heavyIon;
+      //AV NOTE THE ORDER
+      hi->set(
+         static_cast<int>(hIon[12]), // Ncoll_hard
+         static_cast<int>(hIon[11]), // Npart_proj
+         static_cast<int>(hIon[10]), // Npart_targ
+         static_cast<int>(hIon[9]), // Ncoll
+         static_cast<int>(hIon[8]), // spectator_neutrons
+         static_cast<int>(hIon[7]), // spectator_protons
+         static_cast<int>(hIon[6]), // N_Nwounded_collisions
+         static_cast<int>(hIon[5]), // Nwounded_N_collisions
+         static_cast<int>(hIon[4]), // Nwounded_Nwounded_collisions
+         hIon[3],                   // impact_parameter
+         hIon[2],                  // event_plane_angle
+         hIon[1],                  // eccentricity
+         hIon[0]         );         // sigma_inel_NN
+    genEvt->set_heavy_ion(hi);
+    }
+
+
+
+       // pdfinfo restore
+      if (!persEvt.m_pdfinfo.empty())
+        {
+          const std::vector<double>& pdf = persEvt.m_pdfinfo;
+              HepMC3::GenPdfInfoPtr pi;
+              pi->set(
+              static_cast<int>(pdf[6]), // id1
+              static_cast<int>(pdf[5]), // id2
+              pdf[4],                   // x1
+              pdf[3],                   // x2
+              pdf[2],                   // scalePDF
+              pdf[1],                   // pdf1
+              pdf[0] );                 // pdf2
+              genEvt->set_pdf_info(pi);
+        }
+    transObj->push_back( genEvt );
+
+    // create a temporary map associating the barcode of an end-vtx to its
+    // particle.
+    // As not all particles are stable (d'oh!) we take 50% of the number of
+    // particles as an initial size of the hash-map (to prevent re-hash)
+    ParticlesMap_t partToEndVtx( (persEvt.m_particlesEnd-
+                                  persEvt.m_particlesBegin)/2 );
+
+    // create the vertices
+    const unsigned int endVtx = persEvt.m_verticesEnd;
+    for ( unsigned int iVtx= persEvt.m_verticesBegin; iVtx != endVtx; ++iVtx ) {
+      genEvt->add_vertex( createGenVertex( *persObj,
+                                           persObj->m_genVertices[iVtx],
+                                           partToEndVtx,
+                                           &datapools ) );
+    } //> end loop over vertices
+
+    // set the signal process vertex
+    const int sigProcVtx = persEvt.m_signalProcessVtx;
+    if ( sigProcVtx != 0 ) {
+     HepMC::set_signal_process_vertex(genEvt,HepMC::barcode_to_vertex(genEvt, sigProcVtx ) );
+    }
+
+    // connect particles to their end vertices
+    for ( ParticlesMap_t::iterator
+            p = partToEndVtx.begin(),
+            endItr = partToEndVtx.end();
+          p != endItr;
+          ++p ) {
+      auto decayVtx = HepMC::barcode_to_vertex(genEvt, p->second );
+      if ( decayVtx ) {
+        decayVtx->add_particle_in( p->first );
+      } else {
+        msg << MSG::ERROR
+            << "GenParticle points to null end vertex !!"
+            << endmsg;
+      }
+    }
+    // set the beam particles
+    const int beamPart1 = persEvt.m_beamParticle1;
+    const int beamPart2 = persEvt.m_beamParticle2;
+    if (  beamPart1 != 0  &&  beamPart2 !=0 ) {
+      genEvt->set_beam_particles(HepMC::barcode_to_particle(genEvt,beamPart1),
+                                 HepMC::barcode_to_particle(genEvt,beamPart2));
+    }
+
+#else  
     genEvt->m_signal_process_id     = persEvt.m_signalProcessId;
     genEvt->m_event_number          = persEvt.m_eventNbr;
     genEvt->m_mpi                   = persEvt.m_mpi;
@@ -217,6 +330,7 @@ void McEventCollectionCnv_p5::persToTrans( const McEventCollection_p5* persObj,
                                  genEvt->barcode_to_particle(beamPart2));
     }
 
+#endif
 
 
   } //> end loop over m_genEvents
@@ -246,6 +360,95 @@ void McEventCollectionCnv_p5::transToPers( const McEventCollection* transObj,
     const unsigned int nPersVtx   = persObj->m_genVertices.size();
     const unsigned int nPersParts = persObj->m_genParticles.size();
     const HepMC::GenEvent* genEvt = *itr;
+#ifdef HEPMC3
+   //save the weight names to metadata via the HepMCWeightSvc 
+      m_hepMCWeightSvc->setWeightNames(  names_to_name_index_map(genEvt->weight_names()) ).ignore();
+   
+      auto A_mpi=genEvt->attribute<HepMC3::IntAttribute>("mpi");    
+      auto A_signal_process_id=genEvt->attribute<HepMC3::IntAttribute>("signal_process_id");    
+      auto A_event_scale=genEvt->attribute<HepMC3::DoubleAttribute>("event_scale");    
+      auto A_alphaQCD=genEvt->attribute<HepMC3::DoubleAttribute>("alphaQCD");    
+      auto A_alphaQED=genEvt->attribute<HepMC3::DoubleAttribute>("alphaQED");    
+      auto A_signal_process_vertex=genEvt->attribute<HepMC3::IntAttribute>("signal_process_vertex");    
+      auto A_random_states=genEvt->attribute<HepMC3::VectorLongIntAttribute>("random_states");    
+      auto beams=genEvt->beams();
+      persObj->m_genEvents.
+      push_back( GenEvent_p5(A_signal_process_id?(A_signal_process_id->value()):0,
+                              genEvt->event_number(),
+                              A_mpi?(A_mpi->value()):-1, 
+                              A_event_scale?(A_event_scale->value()):0.0, 
+                              A_alphaQCD?(A_alphaQCD->value()):0.0, 
+                              A_alphaQED?(A_alphaQED->value()):0.0, 
+                              A_signal_process_vertex?(A_signal_process_vertex->value()):0, 
+                              HepMC::barcode(beams[0]),
+                              HepMC::barcode(beams[1]),
+                              genEvt->weights(),
+                              A_random_states?(A_random_states->value()):std::vector<long>(), 
+                              std::vector<double>(),      // cross section
+                              std::vector<float>(),       // heavyion
+                              std::vector<double>(),      // pdf info
+                              genEvt->momentum_unit(),
+                              genEvt->length_unit(),
+                              nPersVtx,
+                              nPersVtx + genEvt->vertices().size(),
+                              nPersParts,
+                              nPersParts + genEvt->particles().size() ) );
+    
+                                    
+    //HepMC::GenCrossSection encoding
+    if (genEvt->cross_section()) {
+      auto cs=genEvt->cross_section();
+      GenEvent_p5& persEvt = persObj->m_genEvents.back();
+      std::vector<double>& crossSection = persEvt.m_crossSection;
+      crossSection.resize(3);
+      crossSection[2] = cs->xsec();
+      crossSection[1] = cs->xsec_err();
+      crossSection[0] = static_cast<double>(cs->is_valid());
+    }
+
+    //HepMC::HeavyIon encoding
+    if (genEvt->heavy_ion()) {
+      auto hi=genEvt->heavy_ion();
+      GenEvent_p5& persEvt = persObj->m_genEvents.back();
+      std::vector<float>& heavyIon = persEvt.m_heavyIon;
+      heavyIon.resize(13);
+      heavyIon[12]  = static_cast<float>(hi->Ncoll_hard);
+      heavyIon[11]  = static_cast<float>(hi->Npart_proj);
+      heavyIon[10]  = static_cast<float>(hi->Npart_targ);
+      heavyIon[9]   = static_cast<float>(hi->Ncoll);
+      heavyIon[8]   = static_cast<float>(hi->spectator_neutrons);
+      heavyIon[7]   = static_cast<float>(hi->spectator_protons);
+      heavyIon[6]   = static_cast<float>(hi->N_Nwounded_collisions);
+      heavyIon[5]   = static_cast<float>(hi->Nwounded_N_collisions);
+      heavyIon[4]   = static_cast<float>(hi->Nwounded_Nwounded_collisions);
+      heavyIon[3]   = hi->impact_parameter;
+      heavyIon[2]   = hi->event_plane_angle;
+      heavyIon[1]   = hi->eccentricity;
+      heavyIon[0]   = hi->sigma_inel_NN;
+    }
+
+    //PdfInfo encoding
+    if (genEvt->pdf_info()) {
+      auto pi=genEvt->pdf_info();
+      GenEvent_p5& persEvt = persObj->m_genEvents.back();
+      std::vector<double>& pdfinfo = persEvt.m_pdfinfo;
+      pdfinfo.resize(9);
+      pdfinfo[8] = static_cast<double>(pi->parton_id[0]);
+      pdfinfo[7] = static_cast<double>(pi->parton_id[1]);
+      pdfinfo[6] = static_cast<double>(pi->pdf_id[0]);
+      pdfinfo[5] = static_cast<double>(pi->pdf_id[1]);
+      pdfinfo[4] = pi->x[0];
+      pdfinfo[3] = pi->x[1];
+      pdfinfo[2] = pi->scale;
+      pdfinfo[1] = pi->xf[0];
+      pdfinfo[0] = pi->xf[1];
+    }
+
+    // create vertices
+    for (auto v: genEvt->vertices()) {
+      writeGenVertex( v, *persObj );
+    }
+#else
     const int signalProcessVtx = genEvt->m_signal_process_vertex
       ? genEvt->m_signal_process_vertex->barcode()
       : 0;
@@ -334,6 +537,7 @@ void McEventCollectionCnv_p5::transToPers( const McEventCollection* transObj,
           ++i ) {
       writeGenVertex( **i, *persObj );
     }
+#endif
 
   } //> end loop over GenEvents
 
@@ -349,6 +553,20 @@ McEventCollectionCnv_p5::createGenVertex( const McEventCollection_p5& persEvt,
                                           ParticlesMap_t& partToEndVtx, HepMC::DataPool* datapools
                                           ) const
 {
+#ifdef HEPMC3
+  HepMC::GenVertexPtr vtx(0);
+  DataPool<HepMC::GenVertexPtr>& poolOfVertices = datapools->vtx;
+  if(m_isPileup) {
+    vtx=HepMC::newGenVertexPtr();
+  } else {
+    vtx = *(poolOfVertices.nextElementPtr());
+  }
+  vtx->set_position(HepMC::FourVector( persVtx.m_x , persVtx.m_y , persVtx.m_z ,persVtx.m_t ));
+  //AV ID cannot be assigned in HepMC3. And its meaning in HepMC2 is not clear.
+  // vtx->m_id      = persVtx.m_id;
+  vtx->add_attribute("weights",std::make_shared<HepMC3::VectorFloatAttribute>(persVtx.m_weights));
+  vtx->add_attribute("barcode",std::make_shared<HepMC3::IntAttribute>(persVtx.m_barcode));
+#else
   DataPool<HepMC::GenVertex>& poolOfVertices = datapools->vtx;
   HepMC::GenVertexPtr vtx(0);
   if(m_isPileup) {
@@ -368,6 +586,7 @@ McEventCollectionCnv_p5::createGenVertex( const McEventCollection_p5& persEvt,
                                     persVtx.m_weights.end() );
   vtx->m_event   = 0;
   vtx->m_barcode = persVtx.m_barcode;
+#endif
 
   // handle the in-going (orphans) particles
   const unsigned int nPartsIn = persVtx.m_particlesIn.size();
@@ -392,6 +611,55 @@ HepMC::GenParticlePtr
 McEventCollectionCnv_p5::createGenParticle( const GenParticle_p5& persPart,
                                             ParticlesMap_t& partToEndVtx, HepMC::DataPool* datapools ) const
 {
+#ifdef HEPMC3
+  DataPool<HepMC::GenParticlePtr>& poolOfParticles = datapools->part;
+  HepMC::GenParticlePtr p(0);
+    if (m_isPileup) {
+    p = HepMC::newGenParticlePtr();
+  } else {
+    p    = *(poolOfParticles.nextElementPtr());
+  }
+  p->set_pdg_id(              persPart.m_pdgId);
+  p->set_status(              persPart.m_status);
+  p->add_attribute("phi",std::make_shared<HepMC3::DoubleAttribute>(persPart.m_phiPolarization));
+  p->add_attribute("theta",std::make_shared<HepMC3::DoubleAttribute>(persPart.m_thetaPolarization));
+  p->add_attribute("barcode",std::make_shared<HepMC3::IntAttribute>(persPart.m_barcode));  
+  p->set_generated_mass(persPart.m_generated_mass);
+
+  // Note: do the E calculation in extended (long double) precision.
+  // That happens implicitly on x86 with optimization on; saying it
+  // explicitly ensures that we get the same results with and without
+  // optimization.  (If this is a performance issue for platforms
+  // other than x86, one could change to double for those platforms.)
+  if ( 0 == persPart.m_recoMethod ) {
+    double temp_e = std::sqrt( (long double)(persPart.m_px)*persPart.m_px +
+                          (long double)(persPart.m_py)*persPart.m_py +
+                          (long double)(persPart.m_pz)*persPart.m_pz +
+                          (long double)(persPart.m_m) *persPart.m_m );
+      p->set_momentum( HepMC::FourVector(persPart.m_px,persPart.m_px,persPart.m_px,temp_e));
+  } else {
+    const int signM2 = ( persPart.m_m >= 0. ? 1 : -1 );
+    const double persPart_ene =
+      std::sqrt( std::abs((long double)(persPart.m_px)*persPart.m_px +
+                (long double)(persPart.m_py)*persPart.m_py +
+                (long double)(persPart.m_pz)*persPart.m_pz +
+                signM2* (long double)(persPart.m_m)* persPart.m_m));
+    const int signEne = ( persPart.m_recoMethod == 1 ? 1 : -1 );
+    p->set_momentum(HepMC::FourVector( persPart.m_px,
+                       persPart.m_py,
+                       persPart.m_pz,
+                       signEne * persPart_ene ));
+  }
+
+  // setup flow
+  std::vector<int> flows;
+  const unsigned int nFlow = persPart.m_flow.size();
+  for ( unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
+  flows.push_back(persPart.m_flow[iFlow].second );
+  }
+  //We construct it here as vector w/o gaps.
+  p->add_attribute("flows", std::make_shared<HepMC3::VectorIntAttribute>(flows));
+#else
   DataPool<HepMC::GenParticle>& poolOfParticles = datapools->part;
   HepMC::GenParticlePtr p(0);
   if (m_isPileup) {
@@ -444,6 +712,7 @@ McEventCollectionCnv_p5::createGenParticle( const GenParticle_p5& persPart,
     p->m_flow.set_icode( persPart.m_flow[iFlow].first,
                          persPart.m_flow[iFlow].second );
   }
+#endif
 
   if ( persPart.m_endVtx != 0 ) {
     partToEndVtx[p] = persPart.m_endVtx;
@@ -452,6 +721,41 @@ McEventCollectionCnv_p5::createGenParticle( const GenParticle_p5& persPart,
   return p;
 }
 
+#ifdef HEPMC3
+void McEventCollectionCnv_p5::writeGenVertex( HepMC::ConstGenVertexPtr vtx,
+                                              McEventCollection_p5& persEvt ) const
+{
+  const HepMC::FourVector& position = vtx->position();
+  auto A_weights=vtx->attribute<HepMC3::VectorDoubleAttribute>("weights"); 
+  auto A_barcode=vtx->attribute<HepMC3::IntAttribute>("barcode"); 
+  std::vector<double> weights=A_weights?(A_weights->value()):std::vector<double>();
+  persEvt.m_genVertices.push_back(
+                                  GenVertex_p5( position.x(),
+                                                position.y(),
+                                                position.z(),
+                                                position.t(),
+                                                vtx->id(),
+                                                weights.begin(),
+                                                weights.end(),
+                                                A_barcode?(A_barcode->value()):vtx->id()) );
+  GenVertex_p5& persVtx = persEvt.m_genVertices.back();
+
+  // we write only the orphans in-coming particles
+  persVtx.m_particlesIn.reserve(vtx->particles_in().size());
+  for (auto p: vtx->particles_in()) {
+    if ( !p->production_vertex() ) {
+      persVtx.m_particlesIn.push_back( writeGenParticle( p, persEvt ) );
+    }
+  }
+
+  persVtx.m_particlesOut.reserve(vtx->particles_out().size());
+  for (auto p: vtx->particles_out()) {
+    persVtx.m_particlesOut.push_back( writeGenParticle( p, persEvt ) );
+  }
+
+  return;
+}
+#else
 void McEventCollectionCnv_p5::writeGenVertex( const HepMC::GenVertex& vtx,
                                               McEventCollection_p5& persEvt ) const
 {
@@ -488,7 +792,51 @@ void McEventCollectionCnv_p5::writeGenVertex( const HepMC::GenVertex& vtx,
 
   return;
 }
+#endif
 
+#ifdef HEPMC3
+int McEventCollectionCnv_p5::writeGenParticle( HepMC::ConstGenParticlePtr p,
+                                               McEventCollection_p5& persEvt ) const
+{
+  const HepMC::FourVector mom = p->momentum();
+  const double ene = mom.e();
+  const double m2  = mom.m2();
+
+  // Definitions of Bool isTimeLilike, isSpacelike and isLightlike according to HepLorentzVector definition
+  const bool useP2M2 = !(m2 > 0) &&   // !isTimelike
+    (m2 < 0) &&   //  isSpacelike
+    !(std::abs(m2) < 2.0*DBL_EPSILON*ene*ene); // !isLightlike
+    auto A_flows=p->attribute<HepMC3::VectorIntAttribute>("flows"); 
+    auto A_phi=p->attribute<HepMC3::DoubleAttribute>("phi"); 
+    auto A_theta=p->attribute<HepMC3::DoubleAttribute>("theta"); 
+    
+  const short recoMethod = ( !useP2M2 ? 0: ( ene >= 0.? 1: 2 ) );
+  persEvt.m_genParticles.
+    push_back( GenParticle_p5( mom.px(),
+                               mom.py(),
+                               mom.pz(),
+                               mom.m(),
+                               p->pdg_id(),
+                               p->status(),
+                               A_flows?(A_flows->value().size()):0,
+                               A_theta?(A_theta->value()):0.0,
+                               A_phi?(A_phi->value()):0.0,
+                               p->production_vertex()? HepMC::barcode(p->production_vertex()):0,
+                               p->end_vertex()? HepMC::barcode(p->end_vertex()):0,
+                               HepMC::barcode(p),
+                               p->generated_mass(),
+                               recoMethod ) );
+                               
+  std::vector< std::pair<int,int> > flow_hepmc2;
+  if(A_flows) flow_hepmc2=vector_to_vector_int_int(A_flows->value());
+  persEvt.m_genParticles.back().m_flow.assign( flow_hepmc2.begin(),flow_hepmc2.end() );
+
+  // we return the index of the particle in the big vector of particles
+  // (contained by the persistent GenEvent)
+  return (persEvt.m_genParticles.size() - 1);
+
+}
+#else
 int McEventCollectionCnv_p5::writeGenParticle( const HepMC::GenParticle& p,
                                                McEventCollection_p5& persEvt ) const
 {
@@ -534,6 +882,7 @@ int McEventCollectionCnv_p5::writeGenParticle( const HepMC::GenParticle& p,
   // (contained by the persistent GenEvent)
   return (persEvt.m_genParticles.size() - 1);
 }
+#endif
 
 void McEventCollectionCnv_p5::setPileup() {
   m_isPileup = true;
diff --git a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_utils.h b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_utils.h
index 30b519f17a3937e51b2fd6450a9d6b71b80c96b8..46b86158da55f85fb0645ab49ae96b6f67c9fa6c 100644
--- a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_utils.h
+++ b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_utils.h
@@ -20,4 +20,31 @@ namespace {
 
     return std::make_pair( nParts, nVerts );
   }
+#ifdef HEPMC3
+std::vector<std::string>   name_index_map_to_names(const std::map<std::string, unsigned long int> &input)
+{
+std::vector<std::string> result;
+std::vector<std::pair<std::string, unsigned long int> > sorted; 
+for (auto el: input) sorted.push_back(el);
+std::sort(sorted.begin(), sorted.end(),[](std::pair<std::string, unsigned long int> a, std::pair<std::string, unsigned long int> b) {return a.second > b.second; }); 
+for (auto a: sorted) result.push_back(a.first);
+return result;
+}
+
+std::map<std::string, unsigned long int> names_to_name_index_map(const  std::vector<std::string>  &input )
+{
+std::map<std::string, unsigned long int> result;
+unsigned long int i=0;
+for (auto a: input) {result[a]=i; i++;}
+return result;
+}
+
+std::vector<std::pair<int,int> > vector_to_vector_int_int(const  std::vector<int>  &input )
+{
+std::vector<std::pair<int,int> > result;
+unsigned long int i=0;
+for (auto a: input) {result.push_back(std::pair<int,int>(a,i)); i++;}
+return result;
+}
+#endif
 }
diff --git a/Generators/MadGraphControl/python/MadGraphUtils.py b/Generators/MadGraphControl/python/MadGraphUtils.py
index 994d630839fdd5cf35d0aa141b55b258f0c4b8fc..238df7d9aca03ebcc6d63d306efbf68defdcd882 100755
--- a/Generators/MadGraphControl/python/MadGraphUtils.py
+++ b/Generators/MadGraphControl/python/MadGraphUtils.py
@@ -1016,12 +1016,18 @@ def arrange_output(process_dir=MADGRAPH_GRIDPACK_LOCATION,lhe_version=None,saveP
         orig_input = process_dir+'/Events/'+MADGRAPH_RUN_NAME+'/events.lhe'
         mod_output = open(os.getcwd()+'/events.lhe','w')
 
-    #Removing empty lines in LHE
+    #Removing empty lines and bad comments in LHE
     nEmpty=0
     with open(orig_input,'r') as fileobject:
         for line in fileobject:
             if line.strip():
-                mod_output.write(line)
+                if '#' not in line:
+                    mod_output.write(line)
+                elif '>' not in line[ line.find('#'): ]:
+                    mod_output.write(line)
+                else:
+                    mglog.warning('Found bad LHE line with an XML mark in a comment: "'+line.strip()+'"')
+                    mod_output.write(line[:line.find('#')]+'#'+ (line[line.find('#'):].replace('>','-')))
             else:
                 nEmpty=nEmpty+1
     mod_output.close()
diff --git a/HLT/Trigger/TrigControl/TrigServices/python/TriggerUnixStandardSetup.py b/HLT/Trigger/TrigControl/TrigServices/python/TriggerUnixStandardSetup.py
index ee0c6cad6bd22a610d1ed46f88433110afd645f5..8904eec9b96bbff0a3a90f796577e51d334b2e40 100644
--- a/HLT/Trigger/TrigControl/TrigServices/python/TriggerUnixStandardSetup.py
+++ b/HLT/Trigger/TrigControl/TrigServices/python/TriggerUnixStandardSetup.py
@@ -68,7 +68,7 @@ def setupCommonServices():
 
     # setup ROOT6
     from PyUtils.Helpers import ROOT6Setup
-    ROOT6Setup()
+    ROOT6Setup(batch=True)
 
     # Setup online THistSvc unless specifically configured otherwise
     #    setup the THistSvc early and force the creation of the THistSvc 
diff --git a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/Calibrator.cxx b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/Calibrator.cxx
index 2a17e6fced88e5eeb866bfc0287a5afff4b02fe6..0bf227d58431f7a95b5cb483fd0addfe0d29d80b 100644
--- a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/Calibrator.cxx
+++ b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/Calibrator.cxx
@@ -52,9 +52,6 @@ caldata::caldata(){
   calflag  = -999;
   rtflag  = -999;
   t0flag  = -999;
-  m_treshist  = nullptr;
-  reshist  = nullptr;
-  rthist  = nullptr;
   det = -999;
   lay = -999;
   mod = -999;
@@ -71,10 +68,6 @@ caldata::caldata(){
 }
 
 caldata::~caldata(){
-  delete[] m_treshist;
-  delete[] reshist;
-  delete[] rthist;
-
 }
 
 caldata::caldata(bool makehist, int nbinst, int nbinsr){
@@ -100,9 +93,6 @@ caldata::caldata(bool makehist, int nbinst, int nbinsr){
   calflag  = -999;
   rtflag  = -999;
   t0flag  = -999;
-  m_treshist  = nullptr;
-  reshist  = nullptr;
-  rthist  = nullptr;
   det = -999;
   lay = -999;
   mod = -999;
@@ -118,16 +108,9 @@ caldata::caldata(bool makehist, int nbinst, int nbinsr){
   rtgraph = nullptr;
 
   if (makehist) {
-    if (m_treshist) delete m_treshist;
-    m_treshist = new float[100];
-  }
-  if (makehist) {
-    if (reshist) delete reshist;
-    reshist = new float[100];
-  }
-  if (makehist) {
-    if (rthist) delete rthist;
-    rthist = new float[nbinsr*nbinst+200];
+    m_treshist.resize (100);
+    reshist.resize (100);
+    rthist.resize (nbinsr*nbinst+200);
   }
 }
 
@@ -299,18 +282,18 @@ RtGraph::RtGraph(TH2F* rtHist, int binvar, const char* binlabel, bool pflag, TDi
 
 RtGraph::~RtGraph(){  
 
- delete hslizes   ;
- delete m_btype     ;
- delete m_tv        ;
- delete m_dv        ;
- delete m_etv       ;
- delete m_edv       ;
- delete m_rightsig  ;
- delete m_leftsig   ;
- delete m_leftval   ;
- delete m_rightval  ;
- delete m_maxbin    ;
- delete m_maxval    ;
+ delete [] hslizes   ;
+ delete [] m_btype     ;
+ delete [] m_tv        ;
+ delete [] m_dv        ;
+ delete [] m_etv       ;
+ delete [] m_edv       ;
+ delete [] m_rightsig  ;
+ delete [] m_leftsig   ;
+ delete [] m_leftval   ;
+ delete [] m_rightval  ;
+ delete [] m_maxbin    ;
+ delete [] m_maxval    ;
 }
 
 
@@ -350,98 +333,94 @@ double rtrel_dines(double *x, double*par){
 
 
 
-Calibrator::Calibrator(){
-  level =-10;
-  m_name ="None"; 
-  m_rtbinning ="None";
-  m_minrtstat =-10;
-  m_mint0stat =-10;
-  m_t0shift =-100.;
-  m_mint=-5;
-  m_maxt=50;
-  m_nbinst=55;
-
-  m_minr=0;
-  m_maxr=2;
-  m_nbinsr=100;
-
-  m_mintres=-10;
-  m_maxtres=10;
-  m_nbinstres=100;
-
-  m_minres=-0.6;
-  m_maxres=0.6;
-  m_nbinsres=100;
-
-  m_isdines = false;
-  dort=false;
-  dot0=false;
-  dores=false;
-  nort=false;
-  not0=false;
-  usebref=false;
-  bequiet=false;
-  printlog=false;
-  printt0=false;
-  printrt=false;
-  usep0=false;
-  floatp3=false;
+Calibrator::Calibrator()
+  : dort(false),
+    dot0(false),
+    dores(false),
+    nort(false),
+    not0(false),
+    usebref(false),
+    bequiet(false),
+    printlog(false),
+    printt0(false),
+    printrt(false),
+    usep0(false),
+    floatp3(false),
+    useshortstraws(true),
+
+    m_name ("None"),
+    m_rtbinning ("None"),
+    m_minrtstat (-10),
+    m_mint0stat (-10),
+    m_t0shift (-100.),
+
+    m_nbinsr(100),
+    m_nbinst(55),
+    m_nbinstres(100),
+    m_nbinsres(100),
+    m_minr(0),
+    m_maxr(2),
+    m_mint(-5),
+    m_maxt(50),
+    m_mintres(-10),
+    m_maxtres(10),
+    m_minres(-0.6),
+    m_maxres(0.6),
+
+    m_ntreshits(0),
+    m_nreshits(0),
+    m_nrthits(0),
+    m_nhits(0),
+
+    m_isdines ( false)
+{
   selection.insert(-3);
-  useshortstraws=true;
-  m_ntreshits=0;
-  m_nreshits=0;
-  m_nrthits=0;
-  m_nhits=0;
-
-
-
-
-
+  level =-10;
 }
 
-Calibrator::Calibrator(int lev, std::string nme, int mint0, int minrt, std::string rtr, std::string rtb, float t0sft){
+Calibrator::Calibrator(int lev, const std::string& nme, int mint0, int minrt, const std::string& rtr, const std::string& rtb, float t0sft)
+  :  dort(false),
+     dot0(false),
+     dores(false),
+     nort(false),
+     not0(false),
+     usebref(false),
+     bequiet(false),
+     printlog(false),
+     printt0(false),
+     printrt(false),
+     usep0(false),
+     floatp3(false),
+     useshortstraws(true),
+
+     m_name(nme), 
+     m_rtbinning(rtb),
+     m_minrtstat(minrt),
+     m_mint0stat(mint0),
+     m_t0shift(t0sft),
+
+     m_nbinsr(100),
+     m_nbinst(55),
+     m_nbinstres(100),
+     m_nbinsres(100),
+     m_minr(0),
+     m_maxr(2),
+     m_mint(-5),
+     m_maxt(50),
+     m_mintres(-10),
+     m_maxtres(10),
+     m_minres(-0.6),
+     m_maxres(0.6),
+
+     m_ntreshits(0),
+     m_nreshits(0),
+     m_nrthits(0),
+     m_nhits(0),
+
+     m_isdines ( rtr.find("dines")!=std::string::npos)
+{
   level=lev;
-  m_name=nme; 
-  m_rtbinning=rtb;
-  m_minrtstat=minrt;
-  m_mint0stat=mint0;
-  m_t0shift=t0sft;
-
-  m_mint=-5;
-  m_maxt=50;
-  m_nbinst=55;
-
-  m_minr=0;
-  m_maxr=2;
-  m_nbinsr=100;
-
-  m_mintres=-10;
-  m_maxtres=10;
-  m_nbinstres=100;
-
-  m_minres=-0.6;
-  m_maxres=0.6;
-  m_nbinsres=100;
-
-  m_isdines = rtr.find("dines")!=std::string::npos;
-  dort=false;
-  dot0=false;
-  dores=false;
-  nort=false;
-  not0=false;
-  usebref=false;
-  bequiet=false;
-  printlog=false;
-  printt0=false;
-  printrt=false;
-  usep0=false;
-  floatp3=false;
   selection.insert(-3);
-  useshortstraws=true;
-  m_ntreshits=0;
-  m_nreshits=0;
-  m_nrthits=0;
-  m_nhits=0;
 }
 
 Calibrator::~Calibrator(){
@@ -482,10 +461,10 @@ bool Calibrator::Skip(){
 std::string Calibrator::PrintInfo(){
   std::string yn[2]={"NO","YES"};
   std::string info = std::string(Form("CONFIGURATION %-16s: dort=%-3s, dot0=%-3s, dores=%-3s, selection=",m_name.data(),yn[dort].data(),yn[dot0].data(),yn[dores].data()));
-  for (std::set<int>::iterator isel = selection.begin(); isel != selection.end(); isel++) {
-    if (*isel==-3) info += std::string("all"); 
-    else if (*isel==-4) info += std::string("none"); 
-    else info += std::string(Form("%2i,",*isel)); 
+  for (int isel : selection) {
+    if (isel==-3) info += std::string("all"); 
+    else if (isel==-4) info += std::string("none"); 
+    else info += std::string(Form("%2i,",isel)); 
   } 
   return info;
 }
@@ -520,7 +499,7 @@ std::string Calibrator::GetSelString(){
   std::string selstr="";
   if (selection.find(-3)!=selection.end()) selstr="*";
   else if (selection.find(-4)!=selection.end()) selstr="-";
-  else for (std::set<int>::iterator isel=selection.begin(); isel!=selection.end(); isel++) selstr += std::string(Form("%i",*isel));
+  else for (int isel : selection)  selstr += std::string(Form("%i",isel));
   return selstr;
 }
 
@@ -1212,9 +1191,8 @@ void Calibrator::DumpConstants(){
 
   std::ofstream dumpfile( "calib_constants_out.txt", std::ios::out | std::ios::app);
 
-  for(std::map<std::string,caldata>::iterator ihist=data.begin(); ihist!=data.end(); ihist++){
-    
-    dumpfile << ihist->first << " " << (ihist->second).t0 << " " << std::endl;
+  for (const std::pair<const std::string, caldata>& p : data) {
+    dumpfile << p.first << " " << p.second.t0 << " " << std::endl;
     
   }
   
diff --git a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/Calibrator.h b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/Calibrator.h
index d59d7a4ea978ddfd5adc68ff679d6bfaaf79874a..afbc6650f18da7c807a8e3c4f8f85b75f830ddec 100755
--- a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/Calibrator.h
+++ b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/Calibrator.h
@@ -141,9 +141,9 @@ class caldata{
   /**flag indicating if any calibration has been made*/ bool calflag;
   /**flag indicating if an R-t calibration has been made*/ bool rtflag;
   /**flag indicating if a t0 calibration has been made*/ bool t0flag;
-  /**the 1D time residual histogram (100 bins)*/ float* m_treshist;
-  /**the 1D residual histogram (100 bins)*/ float* reshist;
-  /**the 2D rt histogram (20x32 bins)*/ float* rthist;
+  /**the 1D time residual histogram (100 bins)*/ std::vector<float> m_treshist;
+  /**the 1D residual histogram (100 bins)*/ std::vector<float> reshist;
+  /**the 2D rt histogram (20x32 bins)*/ std::vector<float> rthist;
   /**the rt graph*/ RtGraph* rtgraph;
 };
 
@@ -187,7 +187,10 @@ public:
      @param[in] rtr which rt-relation to use
      @param[in] rtb which rt binning to use
   */
-  Calibrator(int,std::string,int,int,std::string,std::string,float);
+  Calibrator(int,const std::string&,int,int,const std::string&,const std::string&,float);
+
+  Calibrator (const Calibrator&) = delete;
+  Calibrator& operator= (const Calibrator&) = delete;
 
   /**
      Destructor
diff --git a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/TRTCalibrator.cxx b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/TRTCalibrator.cxx
index ebcd7e2a3c7243614b004f7ff3d0c90188ea016d..699e2321889329da30106ad22c990afc2c81614a 100755
--- a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/TRTCalibrator.cxx
+++ b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/TRTCalibrator.cxx
@@ -290,7 +290,7 @@ void TRTCalibrator::DumpStrawData(int isid){
 }
 
 
-bool TRTCalibrator::IsSubLev(std::string key, int lev, std::string sublev){  
+bool TRTCalibrator::IsSubLev(const std::string& key, int lev, const std::string& sublev){  
   
   std::string sl=sublev;
 
@@ -305,7 +305,7 @@ bool TRTCalibrator::IsSubLev(std::string key, int lev, std::string sublev){
 
 }
 
-int TRTCalibrator::GetSubLevels(std::string key, int lev, std::set<int>* levels){ 
+int TRTCalibrator::GetSubLevels(const std::string& key, int lev, std::set<int>* levels){ 
 
   std::string sl=SubLev(key,lev);
 
@@ -418,26 +418,27 @@ bool TRTCalibrator::calibrate ATLAS_NOT_THREAD_SAFE () {
   }
 
   //configure the calibrators
-  for (std::vector<std::string>::iterator it = m_doRt.begin();        it != m_doRt.end();        it++) calibrators[*it]->dort=true;
-  for (std::vector<std::string>::iterator it = m_doT0.begin();        it != m_doT0.end();        it++) calibrators[*it]->dot0=true;
-  for (std::vector<std::string>::iterator it = m_doRes.begin();       it != m_doRes.end();       it++) calibrators[*it]->dores=true;
-  for (std::vector<std::string>::iterator it = m_beQuiet.begin();     it != m_beQuiet.end();     it++) calibrators[*it]->bequiet=true;
-  for (std::vector<std::string>::iterator it = m_doOutPrint.begin();  it != m_doOutPrint.end();  it++) calibrators[*it]->printt0=true;
-  for (std::vector<std::string>::iterator it = m_doRtPrint.begin();   it != m_doRtPrint.end();   it++)  calibrators[*it]->printrt=true;
-  for (std::vector<std::string>::iterator it = m_doLogPrint.begin();  it != m_doLogPrint.end();  it++) calibrators[*it]->printlog=true;
-  for (std::vector<std::string>::iterator it = m_useBoardRef.begin(); it != m_useBoardRef.end(); it++) calibrators[*it]->usebref=true;
-  for (std::map<std::string,Calibrator*>::iterator it = calibrators.begin(); it != calibrators.end(); it++){
-    (it->second)->usep0=m_useP0;
-    (it->second)->floatp3=m_floatP3;
-    (it->second)->useshortstraws=m_DoShortStrawCorrection;
-
-    if (m_doRt.size()==0) (it->second)->nort=true;
-    if (m_doT0.size()==0) (it->second)->not0=true;
+  for (const std::string& s : m_doRt)        calibrators[s]->dort=true;
+  for (const std::string& s : m_doT0)        calibrators[s]->dot0=true;
+  for (const std::string& s : m_doRes)       calibrators[s]->dores=true;
+  for (const std::string& s : m_beQuiet)     calibrators[s]->bequiet=true;
+  for (const std::string& s : m_doOutPrint)  calibrators[s]->printt0=true;
+  for (const std::string& s : m_doRtPrint)   calibrators[s]->printrt=true;
+  for (const std::string& s : m_doLogPrint)  calibrators[s]->printlog=true;
+  for (const std::string& s : m_useBoardRef) calibrators[s]->usebref=true;
+  for (std::pair<const std::string, Calibrator*>& p : calibrators) {
+    Calibrator* calib = p.second;
+    calib->usep0=m_useP0;
+    calib->floatp3=m_floatP3;
+    calib->useshortstraws=m_DoShortStrawCorrection;
+
+    if (m_doRt.size()==0) calib->nort=true;
+    if (m_doT0.size()==0) calib->not0=true;
     
     std::set<int> selset;
-    GetSubLevels(m_selstring,(it->second)->level+1,&selset); //get the set of selections for level "level+1" from the m_selstring ... 
-    for (std::set<int>::iterator imod=selset.begin(); imod!=selset.end(); imod++){
-      (it->second)->selection = selset;//... and configure the calibrator with them
+    GetSubLevels(m_selstring,calib->level+1,&selset); //get the set of selections for level "level+1" from the m_selstring ...
+    for (std::set<int>::iterator imod=selset.begin(); imod!=selset.end(); ++imod){
+      calib->selection = selset;//... and configure the calibrator with them
     }
   }     
 
@@ -461,26 +462,27 @@ bool TRTCalibrator::calibrate ATLAS_NOT_THREAD_SAFE () {
   calibratorsAr["Straw"]                =&Straw_Ar;
 
   //configure the calibrators
-  for (std::vector<std::string>::iterator it = m_doRt.begin();        it != m_doRt.end();        it++) calibratorsAr[*it]->dort=true;
-  for (std::vector<std::string>::iterator it = m_doT0.begin();        it != m_doT0.end();        it++) calibratorsAr[*it]->dot0=true;
-  for (std::vector<std::string>::iterator it = m_doRes.begin();       it != m_doRes.end();       it++) calibratorsAr[*it]->dores=true;
-  for (std::vector<std::string>::iterator it = m_beQuiet.begin();     it != m_beQuiet.end();     it++) calibratorsAr[*it]->bequiet=true;
-  for (std::vector<std::string>::iterator it = m_doOutPrint.begin();  it != m_doOutPrint.end();  it++) calibratorsAr[*it]->printt0=true;
-  for (std::vector<std::string>::iterator it = m_doRtPrint.begin();   it != m_doRtPrint.end();   it++)  calibratorsAr[*it]->printrt=true;
-  for (std::vector<std::string>::iterator it = m_doLogPrint.begin();  it != m_doLogPrint.end();  it++) calibratorsAr[*it]->printlog=true;
-  for (std::vector<std::string>::iterator it = m_useBoardRef.begin(); it != m_useBoardRef.end(); it++) calibratorsAr[*it]->usebref=true;
-  for (std::map<std::string,Calibrator*>::iterator it = calibratorsAr.begin(); it != calibratorsAr.end(); it++){
-    (it->second)->usep0=m_useP0;
-    (it->second)->floatp3=m_floatP3;
-    (it->second)->useshortstraws=m_DoShortStrawCorrection;
-
-    if (m_doRt.size()==0) (it->second)->nort=true;
-    if (m_doT0.size()==0) (it->second)->not0=true;
+  for (const std::string& s : m_doRt)        calibratorsAr[s]->dort=true;
+  for (const std::string& s : m_doT0)        calibratorsAr[s]->dot0=true;
+  for (const std::string& s : m_doRes)       calibratorsAr[s]->dores=true;
+  for (const std::string& s : m_beQuiet)     calibratorsAr[s]->bequiet=true;
+  for (const std::string& s : m_doOutPrint)  calibratorsAr[s]->printt0=true;
+  for (const std::string& s : m_doRtPrint)   calibratorsAr[s]->printrt=true;
+  for (const std::string& s : m_doLogPrint)  calibratorsAr[s]->printlog=true;
+  for (const std::string& s : m_useBoardRef) calibratorsAr[s]->usebref=true;
+  for (std::pair<const std::string, Calibrator*>& p : calibratorsAr) {
+    Calibrator* calib = p.second;
+    calib->usep0=m_useP0;
+    calib->floatp3=m_floatP3;
+    calib->useshortstraws=m_DoShortStrawCorrection;
+
+    if (m_doRt.size()==0) calib->nort=true;
+    if (m_doT0.size()==0) calib->not0=true;
 
     std::set<int> selset;
-    GetSubLevels(m_selstring,(it->second)->level+1,&selset); //get the set of selections for level "level+1" from the m_selstring ... 
-    for (std::set<int>::iterator imod=selset.begin(); imod!=selset.end(); imod++){
-      (it->second)->selection = selset;//... and configure the calibrator with them
+    GetSubLevels(m_selstring,calib->level+1,&selset); //get the set of selections for level "level+1" from the m_selstring ... 
+    for (std::set<int>::iterator imod=selset.begin(); imod!=selset.end(); ++imod){
+      calib->selection = selset;//... and configure the calibrator with them
     }
   }
 
@@ -959,59 +961,59 @@ bool TRTCalibrator::calibrate ATLAS_NOT_THREAD_SAFE () {
 
   //if (m_SplitBarrel){
   
-  for (std::map<std::string,BDdetector>::iterator it = m_trt.t.begin(); it != m_trt.t.end(); it++){
+  for (std::pair<const std::string, BDdetector>& pt : m_trt.t) {
     
     if (TRT.Skip()) break;
-    if (TRT.HasKey(it->first)) {
-      trtdir = TRT.Calibrate(m_histfile,it->first,SubLev(m_options,1),&startdata);
-      if (TRT.printt0) t0calfile << Form("-3 -1 -1 -1 -1 : %e %e",TRT.data[it->first].t0,TRT.data[it->first].t0err) << std::endl;
-      if (TRT.printrt) rtcalfile << Form("-3 -1 -1 -1 -1 : %i %e %e %e %e",rtint,TRT.data[it->first].rtpar[0],TRT.data[it->first].rtpar[1],TRT.data[it->first].rtpar[2],TRT.data[it->first].rtpar[3]) << std::endl;
+    if (TRT.HasKey(pt.first)) {
+      trtdir = TRT.Calibrate(m_histfile,pt.first,SubLev(m_options,1),&startdata);
+      if (TRT.printt0) t0calfile << Form("-3 -1 -1 -1 -1 : %e %e",TRT.data[pt.first].t0,TRT.data[pt.first].t0err) << std::endl;
+      if (TRT.printrt) rtcalfile << Form("-3 -1 -1 -1 -1 : %i %e %e %e %e",rtint,TRT.data[pt.first].rtpar[0],TRT.data[pt.first].rtpar[1],TRT.data[pt.first].rtpar[2],TRT.data[pt.first].rtpar[3]) << std::endl;
     }
-    for (std::map<std::string,BDlayer>::iterator id = (it->second.d).begin() ; id != (it->second.d).end(); id++){
+    for (std::pair<const std::string, BDlayer>& pd : pt.second.d) {
       
       if(Detector.Skip()) break; 
-      if(Detector.HasKey(id->first)){
-        detdir = Detector.Calibrate(trtdir,id->first,SubLev(m_options,2),&TRT.data[it->first]);
+      if(Detector.HasKey(pd.first)){
+        detdir = Detector.Calibrate(trtdir,pd.first,SubLev(m_options,2),&TRT.data[pt.first]);
       }
-      for (std::map<std::string,BDmodule>::iterator il = (id->second.l).begin(); il != (id->second.l).end(); il++){
+      for (std::pair<const std::string, BDmodule>& pl : pd.second.l) {
 
         if(Layer.Skip()) break;
-        if(Layer.HasKey(il->first)){
-          laydir = Layer.Calibrate(detdir,il->first,SubLev(m_options,3),&Detector.data[id->first]);
-          if (Layer.printt0) t0calfile << Form("%i %i -1 -1 -1 : %e %e",Layer.data[il->first].det,Layer.data[il->first].lay,Layer.data[il->first].t0,Layer.data[il->first].t0err) << std::endl;
-          if (Layer.printrt) rtcalfile    << Form("%i %i -1 -1 -1 : %i %e %e %e %e",Layer.data[il->first].det,Layer.data[il->first].lay,rtint,Layer.data[il->first].rtpar[0],Layer.data[il->first].rtpar[1],Layer.data[il->first].rtpar[2],Layer.data[il->first].rtpar[3]) << std::endl;
+        if(Layer.HasKey(pl.first)){
+          laydir = Layer.Calibrate(detdir,pl.first,SubLev(m_options,3),&Detector.data[pd.first]);
+          if (Layer.printt0) t0calfile << Form("%i %i -1 -1 -1 : %e %e",Layer.data[pl.first].det,Layer.data[pl.first].lay,Layer.data[pl.first].t0,Layer.data[pl.first].t0err) << std::endl;
+          if (Layer.printrt) rtcalfile    << Form("%i %i -1 -1 -1 : %i %e %e %e %e",Layer.data[pl.first].det,Layer.data[pl.first].lay,rtint,Layer.data[pl.first].rtpar[0],Layer.data[pl.first].rtpar[1],Layer.data[pl.first].rtpar[2],Layer.data[pl.first].rtpar[3]) << std::endl;
           if (!m_SplitBarrel) {
-            if (Layer.printt0) t0calfile    << Form("%i %i -1 -1 -1 : %e %e",-Layer.data[il->first].det,Layer.data[il->first].lay,Layer.data[il->first].t0,Layer.data[il->first].t0err) << std::endl;
-            if (Layer.printrt) rtcalfile    << Form("%i %i -1 -1 -1 : %i %e %e %e %e",-Layer.data[il->first].det,Layer.data[il->first].lay,rtint,Layer.data[il->first].rtpar[0],Layer.data[il->first].rtpar[1],Layer.data[il->first].rtpar[2],Layer.data[il->first].rtpar[3]) << std::endl;
+            if (Layer.printt0) t0calfile    << Form("%i %i -1 -1 -1 : %e %e",-Layer.data[pl.first].det,Layer.data[pl.first].lay,Layer.data[pl.first].t0,Layer.data[pl.first].t0err) << std::endl;
+            if (Layer.printrt) rtcalfile    << Form("%i %i -1 -1 -1 : %i %e %e %e %e",-Layer.data[pl.first].det,Layer.data[pl.first].lay,rtint,Layer.data[pl.first].rtpar[0],Layer.data[pl.first].rtpar[1],Layer.data[pl.first].rtpar[2],Layer.data[pl.first].rtpar[3]) << std::endl;
           }
         }
-        for (std::map<std::string,BDboard>::iterator im = (il->second.m).begin(); im != (il->second.m).end(); im++){
+        for (std::pair<const std::string, BDboard>& pm : pl.second.m) {
 
           if(Module.Skip()) break; 
-          if(Module.HasKey(im->first)){ 
-            moddir = Module.Calibrate(laydir,im->first,SubLev(m_options,4),&Layer.data[il->first]);
-            if (Module.printt0) t0calfile << Form("%i %i %i -1 -1 : %e %e",Module.data[im->first].det,Module.data[im->first].lay,Module.data[im->first].mod,Module.data[im->first].t0,Module.data[im->first].t0err) << std::endl;
-            if (Module.printrt) rtcalfile    << Form("%i %i %i -1 -1 : %i %e %e %e %e",Module.data[im->first].det,Module.data[im->first].lay,Module.data[im->first].mod,rtint,Module.data[im->first].rtpar[0],Module.data[im->first].rtpar[1],Module.data[im->first].rtpar[2],Module.data[im->first].rtpar[3]) << std::endl;
+          if(Module.HasKey(pm.first)){ 
+            moddir = Module.Calibrate(laydir,pm.first,SubLev(m_options,4),&Layer.data[pl.first]);
+            if (Module.printt0) t0calfile << Form("%i %i %i -1 -1 : %e %e",Module.data[pm.first].det,Module.data[pm.first].lay,Module.data[pm.first].mod,Module.data[pm.first].t0,Module.data[pm.first].t0err) << std::endl;
+            if (Module.printrt) rtcalfile    << Form("%i %i %i -1 -1 : %i %e %e %e %e",Module.data[pm.first].det,Module.data[pm.first].lay,Module.data[pm.first].mod,rtint,Module.data[pm.first].rtpar[0],Module.data[pm.first].rtpar[1],Module.data[pm.first].rtpar[2],Module.data[pm.first].rtpar[3]) << std::endl;
           } 
-          for (std::map<std::string,BDchip>::iterator ib = (im->second.b).begin(); ib != (im->second.b).end(); ib++){
+          for (std::pair<const std::string, BDchip>& pb : pm.second.b) {
 
             if(Board.Skip()) break; 
-            if(Board.HasKey(ib->first)){ 
-              brddir = Board.Calibrate(moddir,ib->first,SubLev(m_options,5),&Module.data[im->first]);
+            if(Board.HasKey(pb.first)){ 
+              brddir = Board.Calibrate(moddir,pb.first,SubLev(m_options,5),&Module.data[pm.first]);
             } 
-            for (std::map<std::string,BDstraw>::iterator ic = (ib->second.c).begin(); ic != (ib->second.c).end(); ic++){
+            for (std::pair<const std::string, BDstraw>& pc : pb.second.c) {
 
               if(Chip.Skip()) break; 
-              if(Chip.HasKey(ic->first)){ 
-                chpdir = Chip.Calibrate(brddir,ic->first,SubLev(m_options,6),&Board.data[ib->first]);
+              if(Chip.HasKey(pc.first)){ 
+                chpdir = Chip.Calibrate(brddir,pc.first,SubLev(m_options,6),&Board.data[pb.first]);
               }
-              for (std::map<std::string,BDzero>::iterator is = (ic->second.s).begin(); is != (ic->second.s).end(); is++){
+              for (std::pair<const std::string, BDzero>& ps : pc.second.s) {
 
                 if(Straw.Skip()) break;
-                if(Straw.HasKey(is->first)){ 
-                  Straw.Calibrate(chpdir,is->first,SubLev(m_options,7),&Chip.data[ic->first]);
-                  if (Straw.printt0) t0calfile << Form("%i %i %i %i %i : %e %e",Straw.data[is->first].det,Straw.data[is->first].lay,Straw.data[is->first].mod,Straw.data[is->first].stl,Straw.data[is->first].stw,Straw.data[is->first].t0,Straw.data[is->first].t0err) << std::endl;
-                  if (Straw.printrt) rtcalfile << Form("%i %i %i %i %i : %i %e %e %e %e",Straw.data[is->first].det,Straw.data[is->first].lay,Straw.data[is->first].mod,Straw.data[is->first].stl,Straw.data[is->first].stw,rtint,Straw.data[is->first].rtpar[0],Straw.data[is->first].rtpar[1],Straw.data[is->first].rtpar[2],Straw.data[is->first].rtpar[3]) << std::endl;
+                if(Straw.HasKey(ps.first)){ 
+                  Straw.Calibrate(chpdir,ps.first,SubLev(m_options,7),&Chip.data[pc.first]);
+                  if (Straw.printt0) t0calfile << Form("%i %i %i %i %i : %e %e",Straw.data[ps.first].det,Straw.data[ps.first].lay,Straw.data[ps.first].mod,Straw.data[ps.first].stl,Straw.data[ps.first].stw,Straw.data[ps.first].t0,Straw.data[ps.first].t0err) << std::endl;
+                  if (Straw.printrt) rtcalfile << Form("%i %i %i %i %i : %i %e %e %e %e",Straw.data[ps.first].det,Straw.data[ps.first].lay,Straw.data[ps.first].mod,Straw.data[ps.first].stl,Straw.data[ps.first].stw,rtint,Straw.data[ps.first].rtpar[0],Straw.data[ps.first].rtpar[1],Straw.data[ps.first].rtpar[2],Straw.data[ps.first].rtpar[3]) << std::endl;
                 
 
                 }
@@ -1033,52 +1035,51 @@ bool TRTCalibrator::calibrate ATLAS_NOT_THREAD_SAFE () {
 
   if (m_DoArXenonSep){
 
-  for (std::map<std::string,BDdetector>::iterator it = m_trt.t.begin(); it != m_trt.t.end(); it++){
+  for (std::pair<const std::string, BDdetector>& pt : m_trt.t) {
 
     if (TRT_Ar.Skip()) break;
-    if (TRT_Ar.HasKey(it->first)) {
-      trtdirAr = TRT_Ar.Calibrate(m_histfile,it->first,SubLev(m_options,1),&startdata);
+    if (TRT_Ar.HasKey(pt.first)) {
+      trtdirAr = TRT_Ar.Calibrate(m_histfile,pt.first,SubLev(m_options,1),&startdata);
     }
-    for (std::map<std::string,BDlayer>::iterator id = (it->second.d).begin() ; id != (it->second.d).end(); id++){
+    for (std::pair<const std::string, BDlayer>& pd : pt.second.d) {
 
       if(Detector_Ar.Skip()) break;
-      if(Detector_Ar.HasKey(id->first)){
-        detdirAr = Detector_Ar.Calibrate(trtdirAr,id->first,SubLev(m_options,2),&TRT_Ar.data[it->first]);
+      if(Detector_Ar.HasKey(pd.first)){
+        detdirAr = Detector_Ar.Calibrate(trtdirAr,pd.first,SubLev(m_options,2),&TRT_Ar.data[pt.first]);
       }
-      for (std::map<std::string,BDmodule>::iterator il = (id->second.l).begin(); il != (id->second.l).end(); il++){
+      for (std::pair<const std::string, BDmodule>& pl : pd.second.l) {
 
         if(Layer_Ar.Skip()) break;
-        if(Layer_Ar.HasKey(il->first)){
-          laydirAr = Layer_Ar.Calibrate(detdirAr,il->first,SubLev(m_options,3),&Detector_Ar.data[id->first]);
+        if(Layer_Ar.HasKey(pl.first)){
+          laydirAr = Layer_Ar.Calibrate(detdirAr,pl.first,SubLev(m_options,3),&Detector_Ar.data[pd.first]);
        
         }
-        for (std::map<std::string,BDboard>::iterator im = (il->second.m).begin(); im != (il->second.m).end(); im++){
+        for (std::pair<const std::string, BDboard>& pm : pl.second.m) {
 
           if(Module_Ar.Skip()) break;
-          if(Module_Ar.HasKey(im->first)){
-            moddirAr = Module_Ar.Calibrate(laydirAr,im->first,SubLev(m_options,4),&Layer_Ar.data[il->first]);
-            if (Module_Ar.printt0) t0calfile << Form("%i %i %i -1 -1 : %e %e",Module_Ar.data[im->first].det,Module_Ar.data[im->first].lay,Module_Ar.data[im->first].mod,Module_Ar.data[im->first].t0,Module_Ar.data[im->first].t0err) << std::endl;
-            if (Layer_Ar.printrt) rtcalfile    << Form("%i %i %i -1 -1 : %i %e %e %e %e",Module_Ar.data[im->first].det,Module_Ar.data[im->first].lay,Module_Ar.data[im->first].mod,rtint,Module_Ar.data[im->first].rtpar[0],Module_Ar.data[im->first].rtpar[1],Module_Ar.data[im->first].rtpar[2],Module_Ar.data[im->first].rtpar[3]) << std::endl;
+          if(Module_Ar.HasKey(pm.first)){
+            moddirAr = Module_Ar.Calibrate(laydirAr,pm.first,SubLev(m_options,4),&Layer_Ar.data[pl.first]);
+            if (Module_Ar.printt0) t0calfile << Form("%i %i %i -1 -1 : %e %e",Module_Ar.data[pm.first].det,Module_Ar.data[pm.first].lay,Module_Ar.data[pm.first].mod,Module_Ar.data[pm.first].t0,Module_Ar.data[pm.first].t0err) << std::endl;
+            if (Layer_Ar.printrt) rtcalfile    << Form("%i %i %i -1 -1 : %i %e %e %e %e",Module_Ar.data[pm.first].det,Module_Ar.data[pm.first].lay,Module_Ar.data[pm.first].mod,rtint,Module_Ar.data[pm.first].rtpar[0],Module_Ar.data[pm.first].rtpar[1],Module_Ar.data[pm.first].rtpar[2],Module_Ar.data[pm.first].rtpar[3]) << std::endl;
           }
-          for (std::map<std::string,BDchip>::iterator ib = (im->second.b).begin(); ib != (im->second.b).end(); ib++){
-
+          for (std::pair<const std::string, BDchip>& pb : pm.second.b) {
             if(Board_Ar.Skip()) break;
-            if(Board_Ar.HasKey(ib->first)){
-              brddirAr = Board_Ar.Calibrate(moddirAr,ib->first,SubLev(m_options,5),&Module_Ar.data[im->first]);
+            if(Board_Ar.HasKey(pb.first)){
+              brddirAr = Board_Ar.Calibrate(moddirAr,pb.first,SubLev(m_options,5),&Module_Ar.data[pm.first]);
             }
-            for (std::map<std::string,BDstraw>::iterator ic = (ib->second.c).begin(); ic != (ib->second.c).end(); ic++){
+            for (std::pair<const std::string, BDstraw>& pc : pb.second.c) {
 
               if(Chip_Ar.Skip()) break;
-              if(Chip_Ar.HasKey(ic->first)){
-                chpdirAr = Chip_Ar.Calibrate(brddirAr,ic->first,SubLev(m_options,6),&Board_Ar.data[ib->first]);
+              if(Chip_Ar.HasKey(pc.first)){
+                chpdirAr = Chip_Ar.Calibrate(brddirAr,pc.first,SubLev(m_options,6),&Board_Ar.data[pb.first]);
               }
-              for (std::map<std::string,BDzero>::iterator is = (ic->second.s).begin(); is != (ic->second.s).end(); is++){
+              for (std::pair<const std::string, BDzero>& ps : pc.second.s) {
 
                 if(Straw_Ar.Skip()) break;
-                if(Straw_Ar.HasKey(is->first)){
-                  Straw_Ar.Calibrate(chpdirAr,is->first,SubLev(m_options,7),&Chip_Ar.data[ic->first]);
-                  if (Straw_Ar.printt0) t0calfile << Form("%i %i %i %i %i : %e %e",Straw_Ar.data[is->first].det,Straw_Ar.data[is->first].lay,Straw_Ar.data[is->first].mod,Straw_Ar.data[is->first].stl,Straw_Ar.data[is->first].stw,Straw_Ar.data[is->first].t0,Straw_Ar.data[is->first].t0err) << std::endl;
-                  if (Straw_Ar.printrt) rtcalfile << Form("%i %i %i %i %i : %i %e %e %e %e",Straw_Ar.data[is->first].det,Straw_Ar.data[is->first].lay,Straw_Ar.data[is->first].mod,Straw_Ar.data[is->first].stl,Straw_Ar.data[is->first].stw,rtint,Straw_Ar.data[is->first].rtpar[0],Straw_Ar.data[is->first].rtpar[1],Straw_Ar.data[is->first].rtpar[2],Straw_Ar.data[is->first].rtpar[3]) << std::endl;
+                if(Straw_Ar.HasKey(ps.first)){
+                  Straw_Ar.Calibrate(chpdirAr,ps.first,SubLev(m_options,7),&Chip_Ar.data[pc.first]);
+                  if (Straw_Ar.printt0) t0calfile << Form("%i %i %i %i %i : %e %e",Straw_Ar.data[ps.first].det,Straw_Ar.data[ps.first].lay,Straw_Ar.data[ps.first].mod,Straw_Ar.data[ps.first].stl,Straw_Ar.data[ps.first].stw,Straw_Ar.data[ps.first].t0,Straw_Ar.data[ps.first].t0err) << std::endl;
+                  if (Straw_Ar.printrt) rtcalfile << Form("%i %i %i %i %i : %i %e %e %e %e",Straw_Ar.data[ps.first].det,Straw_Ar.data[ps.first].lay,Straw_Ar.data[ps.first].mod,Straw_Ar.data[ps.first].stl,Straw_Ar.data[ps.first].stw,rtint,Straw_Ar.data[ps.first].rtpar[0],Straw_Ar.data[ps.first].rtpar[1],Straw_Ar.data[ps.first].rtpar[2],Straw_Ar.data[ps.first].rtpar[3]) << std::endl;
                 }
               }
             }
diff --git a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/TRTCalibrator.h b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/TRTCalibrator.h
index 0f5de05eae42d74aba2285c7ad5e17574b9efe27..00330815d4e3fad435ddf13e8a9f16efac53a737 100755
--- a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/TRTCalibrator.h
+++ b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/TRTCalibrator.h
@@ -87,7 +87,7 @@ public:
   /**
      returns true if the ...
   */
-  bool IsSubLev(std::string, int, std::string);  
+  bool IsSubLev(const std::string&, int, const std::string&);  
 
   /**
      returns true if the ...
@@ -97,7 +97,7 @@ public:
   /**
      fills a set of integers with the indexes af the sub-modules that are conatined in a selection 
   */
-  int GetSubLevels(std::string, int, std::set<int>*);  
+  int GetSubLevels(const std::string&, int, std::set<int>*);  
 
   /**
      makes the key strings for a sub-module
diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrors/CMakeLists.txt b/InnerDetector/InDetConditions/InDetByteStreamErrors/CMakeLists.txt
index 5559457d833fe49f8ea9df2673197b8a76fa1c8a..4c252f00bcb9581d392dfd2f07204b61e5100c26 100644
--- a/InnerDetector/InDetConditions/InDetByteStreamErrors/CMakeLists.txt
+++ b/InnerDetector/InDetConditions/InDetByteStreamErrors/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( InDetByteStreamErrors )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaKernel
-                          Control/AthContainers
-                          Event/EventContainers
-                          DetectorDescription/Identifier )
-
-# this line failed automatic conversion in cmt2cmake :
-# use AtlasReflex          AtlasReflex-*              External - no_auto_imports
-
 # Component(s) in the package:
 atlas_add_dictionary( InDetByteStreamErrorsDict
                       InDetByteStreamErrors/InDetByteStreamErrorsDict.h
@@ -24,5 +14,5 @@ atlas_add_dictionary( InDetByteStreamErrorsDict
 atlas_add_library( InDetByteStreamErrors
                    src/*.cxx
                    PUBLIC_HEADERS InDetByteStreamErrors
-                   LINK_LIBRARIES AthenaKernel )
+                   LINK_LIBRARIES AthenaKernel EventContainers )
 
diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/CMakeLists.txt b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/CMakeLists.txt
index f117789cb97c64dbdbdeff6155c09d5999288f82..7a30a784da66fb86985f5efa2fd48bffcf810d16 100644
--- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/CMakeLists.txt
+++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/CMakeLists.txt
@@ -5,18 +5,6 @@
 # Declare the package name:
 atlas_subdir( InDetByteStreamErrorsAthenaPool )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs(
-   PUBLIC
-   Database/AthenaPOOL/AthenaPoolUtilities
-   DetectorDescription/Identifier
-   PRIVATE
-   GaudiKernel
-   AtlasTest/TestTools
-   Control/AthAllocators
-   Database/AthenaPOOL/AthenaPoolCnvSvc
-   InnerDetector/InDetConditions/InDetByteStreamErrors )
-
 # Component(s) in the package:
 atlas_add_poolcnv_library( InDetByteStreamErrorsAthenaPoolPoolCnv src/*.cxx
    FILES InDetByteStreamErrors/InDetBSErrContainer.h
@@ -36,22 +24,22 @@ atlas_add_dictionary( InDetByteStreamErrorsAthenaPoolCnvDict
 atlas_add_test( InDetBSErrContainerCnv_p1_test
    SOURCES test/InDetBSErrContainerCnv_p1_test.cxx
    src/InDetBSErrContainerCnv_p1.cxx
-   LINK_LIBRARIES GaudiKernel AthenaPoolCnvSvcLib Identifier AthAllocators )
+   LINK_LIBRARIES GaudiKernel AthenaPoolCnvSvcLib Identifier AthAllocators InDetByteStreamErrors )
 
 atlas_add_test( IDCInDetBSErrContainerCnv_p1_test
    SOURCES test/IDCInDetBSErrContainerCnv_p1_test.cxx
    src/IDCInDetBSErrContainerCnv_p1.cxx
-   LINK_LIBRARIES GaudiKernel AthenaPoolCnvSvcLib Identifier AthAllocators )
+   LINK_LIBRARIES GaudiKernel AthenaPoolCnvSvcLib Identifier AthAllocators InDetByteStreamErrors )
 
 #atlas_add_test( TRT_BSErrContainerCnv_p1_test
 #   SOURCES test/TRT_BSErrContainerCnv_p1_test.cxx
 #   src/TRT_BSErrContainerCnv_p1.cxx
-#   LINK_LIBRARIES GaudiKernel AthenaPoolCnvSvcLib Identifier AthAllocators )
+#   LINK_LIBRARIES GaudiKernel AthenaPoolCnvSvcLib Identifier AthAllocators InDetByteStreamErrors )
 
 atlas_add_test( TRT_BSIdErrContainerCnv_p1_test
    SOURCES test/TRT_BSIdErrContainerCnv_p1_test.cxx
    src/TRT_BSIdErrContainerCnv_p1.cxx
-   LINK_LIBRARIES GaudiKernel AthenaPoolCnvSvcLib Identifier AthAllocators )
+   LINK_LIBRARIES GaudiKernel AthenaPoolCnvSvcLib Identifier AthAllocators InDetByteStreamErrors )
 
 # Install files from the package:
 atlas_install_headers( InDetByteStreamErrorsAthenaPool )
diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/share/IDCInDetBSErrContainerCnv_p1_test.ref b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/share/IDCInDetBSErrContainerCnv_p1_test.ref
new file mode 100644
index 0000000000000000000000000000000000000000..a5bce3fd2565d8f458555a0c6f42d0504a848bd5
--- /dev/null
+++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/share/IDCInDetBSErrContainerCnv_p1_test.ref
@@ -0,0 +1 @@
+test1
diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p1.cxx b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p1.cxx
index e428085596a7e4fba28e55027dfa68af98a4fdb1..a27a6c7839ee5ff3adb44cc58737d893943c05fd 100644
--- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p1.cxx
+++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p1.cxx
@@ -4,7 +4,7 @@
 
 #include "InDetBSErrContainerCnv_p1.h"
 
-void InDetBSErrContainerCnv_p1::transToPers ATLAS_NOT_THREAD_SAFE // const_cast is used.
+void InDetBSErrContainerCnv_p1::transToPers
 (const InDetBSErrContainer* transCont, InDetBSErrContainer_p1* persCont, MsgStream& /*log*/)
 {
   InDetBSErrContainer::const_iterator it = transCont->begin();
@@ -14,7 +14,7 @@ void InDetBSErrContainerCnv_p1::transToPers ATLAS_NOT_THREAD_SAFE // const_cast
   for (; it != itEnd; ++it) {
     // FIXME: Should change type of m_bsErrs, but don't want to cause possible
     // back-compatibility problems.
-    std::pair<IdentifierHash, int>* ptr = const_cast<std::pair<IdentifierHash, int>*> (*it);
+    std::pair<IdentifierHash, int>* ptr ATLAS_THREAD_SAFE = const_cast<std::pair<IdentifierHash, int>*> (*it);
     (persCont->m_bsErrs).push_back(ptr);
   }
   return;
diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSIdErrContainerCnv_p1.cxx b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSIdErrContainerCnv_p1.cxx
index d27504bc31d26ea306df492385a11435d97caacc..0161e97b8a756e7dc99a44e744ec62f97baa5098 100644
--- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSIdErrContainerCnv_p1.cxx
+++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSIdErrContainerCnv_p1.cxx
@@ -11,7 +11,7 @@
 
 #include <iostream>
 
-void TRT_BSIdErrContainerCnv_p1::transToPers ATLAS_NOT_THREAD_SAFE // const_cast is used.
+void TRT_BSIdErrContainerCnv_p1::transToPers
 (const TRT_BSIdErrContainer* transCont, TRT_BSIdErrContainer_p1* persCont, MsgStream & /* log */) 
 {
   TRT_BSIdErrContainer::const_iterator it = transCont->begin();
@@ -21,7 +21,7 @@ void TRT_BSIdErrContainerCnv_p1::transToPers ATLAS_NOT_THREAD_SAFE // const_cast
   for (; it != itEnd; ++it) {
     // FIXME: Should change type of m_bsErrs, but don't want to cause possible
     // back-compatibility problems.
-    std::pair<uint8_t, std::pair<uint32_t, uint8_t> >* ptr = const_cast<std::pair<uint8_t, std::pair<uint32_t, uint8_t> >*> (*it);
+    std::pair<uint8_t, std::pair<uint32_t, uint8_t> >* ptr ATLAS_THREAD_SAFE = const_cast<std::pair<uint8_t, std::pair<uint32_t, uint8_t> >*> (*it);
     (persCont->m_bsErrs).push_back(ptr);
   }
   return;
diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/RobustTrackingGeometryBuilder.cxx b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/RobustTrackingGeometryBuilder.cxx
index 4252dae946b9ab3497d754b8b772f0b3071392a2..26f66afbe71619d92322eeb8d0be21b1f4549daf 100755
--- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/RobustTrackingGeometryBuilder.cxx
+++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/RobustTrackingGeometryBuilder.cxx
@@ -531,7 +531,7 @@ const Trk::TrackingGeometry* InDet::RobustTrackingGeometryBuilder::trackingGeome
                                                                    "Container");
                                                                    
    // get the dimensions from the envelope service 
-   RZPairVector& envelopeDefs = m_enclosingEnvelopeSvc->getInDetRZValues();
+   const RZPairVector& envelopeDefs = m_enclosingEnvelopeSvc->getInDetRZBoundary();
    ATH_MSG_VERBOSE("       -> retrieved Inner Detector envelope definitions at size " << envelopeDefs.size());
    double enclosingVolumeRadius = envelopeDefs[1].first;
    double enclosingVolumeHalfZ  = fabs(envelopeDefs[1].second);
diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/RobustTrackingGeometryBuilderCond.cxx b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/RobustTrackingGeometryBuilderCond.cxx
index fc37f3dd31066c2f7f5fbd81cc2bf19062b9174b..b4857202b0bc363d21f27c2c27aa3289ce7f599f 100755
--- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/RobustTrackingGeometryBuilderCond.cxx
+++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/RobustTrackingGeometryBuilderCond.cxx
@@ -542,7 +542,7 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> InDet::RobustTrackingGeome
                                                                    "Container");
                                                                    
    // get the dimensions from the envelope service 
-   RZPairVector& envelopeDefs = m_enclosingEnvelopeSvc->getInDetRZValues();
+   const RZPairVector& envelopeDefs = m_enclosingEnvelopeSvc->getInDetRZBoundary();
    ATH_MSG_VERBOSE("       -> retrieved Inner Detector envelope definitions at size " << envelopeDefs.size());
    double enclosingVolumeRadius = envelopeDefs[1].first;
    double enclosingVolumeHalfZ  = fabs(envelopeDefs[1].second);
diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/StagedTrackingGeometryBuilder.cxx b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/StagedTrackingGeometryBuilder.cxx
index ff798f6dfb71e2479fec331238b0d1fde498b03f..4a975bc65e5061e639cc9b9cfb594abfa9d1e9c2 100755
--- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/StagedTrackingGeometryBuilder.cxx
+++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/StagedTrackingGeometryBuilder.cxx
@@ -134,7 +134,7 @@ const Trk::TrackingGeometry* InDet::StagedTrackingGeometryBuilder::trackingGeome
    Trk::TrackingGeometry* trackingGeometry = 0;   
 
    // get the dimensions from the envelope service 
-   RZPairVector& envelopeDefs = m_enclosingEnvelopeSvc->getInDetRZValues();
+   const RZPairVector& envelopeDefs = m_enclosingEnvelopeSvc->getInDetRZBoundary();
    ATH_MSG_VERBOSE("       -> retrieved Inner Detector envelope definitions at size " << envelopeDefs.size());
    double envelopeVolumeRadius = envelopeDefs[1].first;
    double envelopeVolumeHalfZ  = fabs(envelopeDefs[1].second);
diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/StagedTrackingGeometryBuilderCond.cxx b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/StagedTrackingGeometryBuilderCond.cxx
index c297b686c96416fd9d519f146d104f4cd12ef5f8..f88833a8d419ee12c01a2e1598279f1659da37e6 100755
--- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/StagedTrackingGeometryBuilderCond.cxx
+++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/StagedTrackingGeometryBuilderCond.cxx
@@ -135,7 +135,7 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> InDet::StagedTrackingGeome
    Trk::TrackingGeometry* trackingGeometry = 0;   
 
    // get the dimensions from the envelope service 
-   RZPairVector& envelopeDefs = m_enclosingEnvelopeSvc->getInDetRZValues();
+   const RZPairVector& envelopeDefs = m_enclosingEnvelopeSvc->getInDetRZBoundary();
    ATH_MSG_VERBOSE("       -> retrieved Inner Detector envelope definitions at size " << envelopeDefs.size());
    double envelopeVolumeRadius = envelopeDefs[1].first;
    double envelopeVolumeHalfZ  = fabs(envelopeDefs[1].second);
diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DataBase.h b/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DataBase.h
index 7f960b3832b55e72773108ebfed303910b7cb8bf..4fa0a746e0f93ba0f39d757dc589ec577b8170db 100644
--- a/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DataBase.h
+++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DataBase.h
@@ -19,7 +19,7 @@ class SCT_DataBase
   
 public:
 
-  SCT_DataBase(SCT_GeoModelAthenaComps* athenaComps) ATLAS_CTORDTOR_NOT_THREAD_SAFE; // Thread unsafe AthenaComps::rdbAccessSvc const method is used.
+  SCT_DataBase(SCT_GeoModelAthenaComps* athenaComps);
 
   SCT_GeoModelAthenaComps* athenaComps();
 
diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorFactory.h b/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorFactory.h
index 4158c1406879342335c1eba62b34dd008a846791..a509917a12ad8674006e75f93895d676f1009f32 100644
--- a/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorFactory.h
+++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorFactory.h
@@ -25,7 +25,7 @@ class SCT_DetectorFactory : public InDetDD::DetectorFactoryBase
  public: 
   // Constructor
   SCT_DetectorFactory(SCT_GeoModelAthenaComps * athenaComps, 
-		      const SCT_Options & options) ATLAS_CTORDTOR_NOT_THREAD_SAFE; // Thread unsafe InDetDD::DetectorFactoryBase::rdbAccessSvc() method is used.
+		      const SCT_Options & options);
 
   // Destructor
   virtual ~SCT_DetectorFactory(); 
diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorTool.cxx b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorTool.cxx
index 2fc7636e39f29227446711297e30e50ca90df956..e1a1394147e47956ed8327491b63888fd8c1d111 100644
--- a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorTool.cxx
+++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorTool.cxx
@@ -48,7 +48,7 @@ SCT_DetectorTool::SCT_DetectorTool(const std::string& type,
 //
 
 StatusCode
-SCT_DetectorTool::create ATLAS_NOT_THREAD_SAFE () // Thread unsafe SCT_DetectorFactory constructor is used.
+SCT_DetectorTool::create()
 {
   // Get the detector configuration.
   ATH_CHECK(m_geoDbTagSvc.retrieve());
diff --git a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.cxx b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.cxx
index 3ced1b74b7cad805810e1943ce74335d730c4ac8..d48ccba8a08df32bbc13294b822a8138998741de 100755
--- a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.cxx
+++ b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.cxx
@@ -2287,7 +2287,7 @@ GeoPhysVol * TRTDetectorFactory_Full::makeStraw( double& activeGasZPosition, boo
 ///////////////////////////////// makeStrawPlane /////////////////////////////////
 //
 //GeoFullPhysVol * TRTDetectorFactory_Full::makeStrawPlane(size_t w) const {
-GeoFullPhysVol * TRTDetectorFactory_Full::makeStrawPlane(size_t w, ActiveGasMixture gasMixture) const {
+GeoFullPhysVol * TRTDetectorFactory_Full::makeStrawPlane(size_t w, ActiveGasMixture gasMixture) {
   // -----------------------------------------------------------------------------------//
   //                                                                                    //
   // There are twelve straw planes; however there are only two kinds, one for sector    //
@@ -2295,29 +2295,29 @@ GeoFullPhysVol * TRTDetectorFactory_Full::makeStrawPlane(size_t w, ActiveGasMixt
   // In order to economize, we shall only create two planes.                            //
   // -----------------------------------------------------------------------------------//
 
-  static GeoFullPhysVol *type1Plane=nullptr, *type2Plane=nullptr, *type1PlaneAr=nullptr, *type2PlaneAr=nullptr, *type1PlaneKr=nullptr, *type2PlaneKr=nullptr;
   size_t nstraws=0;
 
   //A and B wheels have similar straw planes, but the C wheels are different.
   //  const size_t firstIndexOfC = 15; //hardcoded
   const size_t firstIndexOfC = 14; //hardcoded
 
-  GeoFullPhysVol *&cur_type1Plane = (gasMixture == GM_KRYPTON) ? type1PlaneKr :
-                                    (gasMixture == GM_ARGON  ) ? type1PlaneAr :
-                                                                 type1Plane;
-  GeoFullPhysVol *&cur_type2Plane = (gasMixture == GM_KRYPTON) ? type2PlaneKr :
-                                    (gasMixture == GM_ARGON  ) ? type2PlaneAr :
-                                                                 type2Plane;
+  unsigned iplane = 0;
+  if (gasMixture == GM_ARGON) {
+    iplane = 1;
+  }
+  else if (gasMixture == GM_KRYPTON) {
+    iplane = 2;
+  }
 
   if (w>=firstIndexOfC) {
-    if (cur_type2Plane!=nullptr) {
-      return cur_type2Plane;
+    if (m_type2Planes[iplane] != nullptr) {
+      return m_type2Planes[iplane];
     }
     nstraws=m_data->endcapNumberOfStrawsInStrawLayer_CWheels;
   } 
   else {
-    if (cur_type1Plane!=nullptr) {
-      return cur_type1Plane;
+    if (m_type1Planes[iplane] != nullptr) {
+      return m_type1Planes[iplane];
     }
     nstraws=m_data->endcapNumberOfStrawsInStrawLayer_AWheels;
     //Check here that (m_data->endcapNumberOfStrawsInStrawLayer_AWheels == m_data->endcapNumberOfStrawsInStrawLayer_BWheels) !!
@@ -2415,15 +2415,13 @@ GeoFullPhysVol * TRTDetectorFactory_Full::makeStrawPlane(size_t w, ActiveGasMixt
   GeoPhysVol *pWire = new GeoPhysVol(lWire);
   pStraw->add(pWire);
 
-  // Look above *type2Plane=nullptr
-  if (w>=firstIndexOfC && type2Plane!=nullptr) {
-    cur_type2Plane=pStrawPlane;
-    return cur_type2Plane;
+  if (w>=firstIndexOfC) {
+    m_type2Planes[iplane] = pStrawPlane;
   }
   else {
-    cur_type1Plane=pStrawPlane;
-    return cur_type1Plane;
+    m_type1Planes[iplane] = pStrawPlane;
   }
+  return pStrawPlane;
 
 }
 
diff --git a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.h b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.h
index eed23fcd1885bed4f8375d7122becf8fe7ad3382..aabed98257aee7f0281a05423bae73cd5856ef1b 100755
--- a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.h
+++ b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.h
@@ -29,7 +29,7 @@ class GeoFullPhysVol;
 class TRTParameterInterface;
 class InDetMaterialManager;
 
-class ATLAS_NOT_THREAD_SAFE TRTDetectorFactory_Full : public InDetDD::DetectorFactoryBase  { // Static variables are used.
+class TRTDetectorFactory_Full : public InDetDD::DetectorFactoryBase  {
 
  public:
   
@@ -88,7 +88,7 @@ class ATLAS_NOT_THREAD_SAFE TRTDetectorFactory_Full : public InDetDD::DetectorFa
   //GeoPhysVol * makeStraw( double& activeGasZPosition, bool hasLargeDeadRegion=false ) const;
   GeoPhysVol * makeStraw( double& activeGasZPosition, bool hasLargeDeadRegion=false, ActiveGasMixture gasMixture = GM_XENON) const;
   //GeoFullPhysVol  *makeStrawPlane( size_t w ) const;
-  GeoFullPhysVol  *makeStrawPlane( size_t w , ActiveGasMixture gasMixture = GM_XENON) const;
+  GeoFullPhysVol  *makeStrawPlane( size_t w , ActiveGasMixture gasMixture = GM_XENON);
 
   // private member data:
   InDetDD::TRT_DetectorManager * m_detectorManager;
@@ -105,6 +105,8 @@ class ATLAS_NOT_THREAD_SAFE TRTDetectorFactory_Full : public InDetDD::DetectorFa
   bool m_doKrypton;
   bool m_useDynamicAlignFolders;
 
+  GeoFullPhysVol* m_type1Planes[3] = {nullptr, nullptr, nullptr};
+  GeoFullPhysVol* m_type2Planes[3] = {nullptr, nullptr, nullptr};
 };
 
 #endif // TRTDetectorFactory_Full_h
diff --git a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetDescrDB_ParameterInterface.cxx b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetDescrDB_ParameterInterface.cxx
index 02fd09c0bb6aad631adabad045f98d438a88b760..65baba4b4caa5f5b87ceafe23a2c15308b774180 100755
--- a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetDescrDB_ParameterInterface.cxx
+++ b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetDescrDB_ParameterInterface.cxx
@@ -53,7 +53,7 @@ TRT_DetDescrDB_ParameterInterface::~TRT_DetDescrDB_ParameterInterface() {
 }
 
 //_________________________________________________________________________________________
-void TRT_DetDescrDB_ParameterInterface::SetValues ATLAS_NOT_THREAD_SAFE () { // Thread unsafe AthenaComps::rdbAccessSvc const method is used.
+void TRT_DetDescrDB_ParameterInterface::SetValues() {
 
   /////////////////////////////////////////////////////////////////////////////////////////
   //                                 Initialize Services                                 //
diff --git a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetDescrDB_ParameterInterface.h b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetDescrDB_ParameterInterface.h
index 7d294887ce1e719f9e3ab963c09d9219861de36f..f28529a3f1ddd31b66b2fd9a22ebae56eef097dd 100755
--- a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetDescrDB_ParameterInterface.h
+++ b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetDescrDB_ParameterInterface.h
@@ -23,7 +23,7 @@ public:
 
    
   // Only allowed constructor
-  TRT_DetDescrDB_ParameterInterface(InDetDD::AthenaComps * athenaComps) ATLAS_CTORDTOR_NOT_THREAD_SAFE; // Thread unsafe SetValues method is used.
+  TRT_DetDescrDB_ParameterInterface(InDetDD::AthenaComps * athenaComps);
 
   ~TRT_DetDescrDB_ParameterInterface();
   // delete copy c'tor
diff --git a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetectorTool.cxx b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetectorTool.cxx
index b14adda18339446810d53b1713c54b84780e2adb..ffe15af57e624747300bb8bea9a567b199a25752 100755
--- a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetectorTool.cxx
+++ b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetectorTool.cxx
@@ -68,7 +68,7 @@ TRT_DetectorTool::~TRT_DetectorTool()
 
 //////////////  Create the Detector Node corresponding to this tool //////////////
 //
-StatusCode TRT_DetectorTool::create ATLAS_NOT_THREAD_SAFE () // Thread unsafe TRTDetectorFactory_Full class is used.
+StatusCode TRT_DetectorTool::create()
 { 
 
   // Get the detector configuration.
diff --git a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_DetectorManager.h b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_DetectorManager.h
index 28eaa8410bc537872814776e90515581e5871df8..79b19bc58359f481cc842b4d041b0da32010f124 100755
--- a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_DetectorManager.h
+++ b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_DetectorManager.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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -28,6 +28,8 @@
 
 #include "InDetReadoutGeometry/InDetDD_Defs.h"
 
+#include "CxxUtils/checker_macros.h"
+
 #include <map>
 #include <memory>
 #include <set>
@@ -170,7 +172,7 @@ namespace InDetDD {
 
     // Alignment stuff
     // DEPRECATED - kept for compatibilty with Lisbon CondDB
-    void addKey(const std::string & key, int level);
+    void addKey ATLAS_NOT_THREAD_SAFE (const std::string & key, int level);
     // DEPRECATED use addChannel
     void addKey(const std::string & key, int level, FrameType frame);
 
diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetEventAthenaPoolCnvDict.h b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetEventAthenaPoolCnvDict.h
index abf7ea017fef90ef6eebcb581d7870878e986f8f..c906216533e98f09ebafc1ac21bbe39402724441 100644
--- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetEventAthenaPoolCnvDict.h
+++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetEventAthenaPoolCnvDict.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 INDETEVENTATHENAPOOLDICT_H
@@ -18,6 +18,7 @@
 #include "InDetEventAthenaPool/InDetRawDataCollection_p1.h"
 #include "InDetEventAthenaPool/InDetRawDataContainer_p1.h"
 #include "InDetEventAthenaPool/InDetRawDataContainer_p2.h"
+#include "InDetEventAthenaPool/InDetRawDataContainer_p3.h"
 #include "InDetEventAthenaPool/SCT_RawDataContainer_p1.h"
 #include "InDetEventAthenaPool/SCT_RawDataContainer_p2.h"
 #include "InDetEventAthenaPool/SCT_RawDataContainer_p3.h"
diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetRawDataContainer_p3.h b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetRawDataContainer_p3.h
new file mode 100644
index 0000000000000000000000000000000000000000..bd9bb5002cd6d947dfab7e431a5bf2da5a8295e0
--- /dev/null
+++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetRawDataContainer_p3.h
@@ -0,0 +1,33 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef INDETRAWDATACONTAINER_P3_H
+#define INDETRAWDATACONTAINER_P3_H
+
+/*
+   For the TRT, the channel Ids are dropped from the persistent container and so
+   the p2 version "std::vector<InDetRawData_p2> m_rawdata;" is replaced with
+   the p3 version "std::vector<unsigned int>    m_rawdata;".
+*/
+
+#include <vector>
+#include <string>
+#include "InDetEventAthenaPool/InDetRawDataCollection_p1.h"
+
+class InDetRawDataContainer_p3
+{
+ public:
+/// Default constructor
+  InDetRawDataContainer_p3 ();
+  friend class TRT_LoLumRawDataContainerCnv_p3;
+ private:
+  std::vector<InDetRawDataCollection_p1>  m_collections;
+  std::vector<unsigned int>               m_rawdata;
+};
+
+// inlines
+inline
+InDetRawDataContainer_p3::InDetRawDataContainer_p3 () {}
+
+#endif
diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/selection.xml b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/selection.xml
index 04f9a62a2feb8391d38c878c5614c8e71e2b774a..6ec53a8d40f7e8878ac8493e3df70673a999c14b 100644
--- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/selection.xml
+++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/selection.xml
@@ -29,6 +29,7 @@
   <class name="std::vector<SCT3_RawData_p4>" />
   <class name="InDetRawDataContainer_p1" id="DA76970C-E019-43D2-B2F9-25660DCECD9D" />
   <class name="InDetRawDataContainer_p2" id="7138342E-0A80-4A32-A387-2842A01C2539" />
+  <class name="InDetRawDataContainer_p3" id="D0313948-9BC8-415F-BE58-7BA8178F93CD" />
   <class name="SCT_RawDataContainer_p1" id="8E13963E-13E5-4D10-AA8B-73F00AFF8FA8" />
   <class name="SCT_RawDataContainer_p2" id="D1258125-2CBA-476E-8578-E09D54F477E1" />
   <class name="SCT_RawDataContainer_p3" id="5FBC8D4D-7B4D-433A-8487-0EA0C870CBDB" />
diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_LoLumRawDataContainerCnv_p3.cxx b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_LoLumRawDataContainerCnv_p3.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..2315df926a59ed418f71b9ba745dd5f6c32b4006
--- /dev/null
+++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_LoLumRawDataContainerCnv_p3.cxx
@@ -0,0 +1,240 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+#include "InDetEventAthenaPool/InDetRawDataCollection_p1.h"
+#include "InDetRawData/TRT_RDO_Container.h"
+#include "InDetIdentifier/TRT_ID.h"
+#include "TRT_LoLumRawDataContainerCnv_p3.h"
+#include "TRT_RDO_Elements.h"
+#include "MsgUtil.h"
+
+void TRT_LoLumRawDataContainerCnv_p3::transToPers(const TRT_RDO_Container* transCont, InDetRawDataContainer_p3* persCont, MsgStream &log)
+{
+
+  // The transient model has a container holding collections (up to 14912 TRT detector elements/modules)
+  // and the collections hold channels (e.g. up to 24 straws in the TRT endcaps). There are a total of 350848 TRT straws.
+  // The persistent model flattens this so that the persistent container has two vectors: 1) all collections, 2) all RDO
+  // The persistent collections then only maintain indexes into the container's vector of all channels.
+  // So here we loop over all collection and add their channels to the container's vector, saving the indexes in the collection.
+
+  // Hard-code the number of collections their ids and their sizes to generate collections and channels for the whole detector
+  const unsigned int dummy_digit=0;
+  const unsigned int trt_number_of_collections=14912;
+  const unsigned int trt_number_of_channels=350848;
+  const unsigned int trt_channel_id_increment=0x20u;
+
+  std::vector<unsigned int> trt_collection_id;   // There are 14912 elements/modules in the TRT
+  std::vector<unsigned int> trt_collection_size; // Each element has a specific number of straws
+
+  set_vectors_of_collection_ids_and_size(trt_collection_id,
+                                         trt_collection_size,
+                                         trt_number_of_collections);
+
+  unsigned int trt_collection_index=0; // module index (0,14911), initialized first collection
+  unsigned int trt_channel_index=0;    // straw index (0,350847)
+  unsigned int trt_channel_id;         // straw id (32-bit), initialized to the first channel in the first collection
+  unsigned int tcoll_id;               // transient collection id from transCont
+  unsigned int tchan_id;               // transient channel id from transCont
+  unsigned int tchan_word;             // transient channel word from transCont
+
+  typedef TRT_RDO_Container TRANS;
+  TRANS::const_iterator it_transColl     = transCont->begin(); // The transient container has an incomplete list of collections
+  TRANS::const_iterator it_transCollEnd  = transCont->end();   // and channels, we can access them with this iterator
+
+  persCont->m_collections.resize(trt_number_of_collections);
+  persCont->m_rawdata.resize(trt_number_of_channels);
+
+  // Loop over all existing transient collections, add missing collections and missing channels
+  for (; it_transColl != it_transCollEnd; it_transColl++) {
+
+    const TRT_RDO_Collection& collection = (**it_transColl);
+    tcoll_id = collection.identify().get_identifier32().get_compact();
+
+    // create collections and channels until we find a match to a transient container
+    while ( trt_collection_id[trt_collection_index] != tcoll_id ) {
+      // The transient collection is missing; create the persistent collection with empty digits
+      trt_channel_id = trt_collection_id[trt_collection_index];
+      InDetRawDataCollection_p1& pcollection = persCont->m_collections[trt_collection_index];
+      pcollection.m_id     = 0;
+      pcollection.m_hashId = 0; // no hashId for this empty collection
+      pcollection.m_begin  = 0;
+      pcollection.m_end    = 0;
+      // Fill all the channels with with empty digits.
+      for (unsigned int i=0; i<trt_collection_size[trt_collection_index]; ++i) {
+        persCont->m_rawdata[trt_channel_index] = dummy_digit;
+        trt_channel_id += trt_channel_id_increment;
+        trt_channel_index++;
+      }
+      trt_collection_index++;
+    }
+
+    // Here we have a match to a transient collection
+    // create the persistent collection just as we did above
+    trt_channel_id = trt_collection_id[trt_collection_index];
+    InDetRawDataCollection_p1& pcollection = persCont->m_collections[trt_collection_index];
+    pcollection.m_id     = 0;
+    pcollection.m_hashId = (unsigned int) collection.identifyHash(); // Required by the overlay alogrithm (not the reco algorithms)
+    pcollection.m_begin  = 0;
+    pcollection.m_end    = 0;
+
+    const unsigned int collection_end = trt_channel_index+trt_collection_size[trt_collection_index];
+
+    // Fill all the channels; some with existing digits, the others with empty digits.
+    for (unsigned int i = 0; i < collection.size(); ++i) {
+
+      // Get the channel id and word from the digitization transient object
+      // We will use the id to determine when to insert missing straws to create a container that represents the complete detector.
+      // We will only store the digit word.
+      const TRT_LoLumRawData* tchan0 = dynamic_cast<const TRT_LoLumRawData*>(collection[i]);
+      tchan_id   = tchan0->identify().get_identifier32().get_compact(); // the i'th channel id in the transient collection
+      tchan_word = tchan0->getWord();                                   // the i'th channel word in the transient collection
+
+      while ( trt_channel_id != tchan_id) {
+        persCont->m_rawdata[trt_channel_index] = dummy_digit;
+        trt_channel_id += trt_channel_id_increment;
+        trt_channel_index++;
+      }
+
+      // Here we have a matching transient channel; write it.
+      persCont->m_rawdata[trt_channel_index]=tchan_word;
+      trt_channel_id += trt_channel_id_increment;
+      trt_channel_index++;
+
+    } // end transient channel loop
+
+    // write all other missing channels
+    while (trt_channel_index != collection_end) {
+      persCont->m_rawdata[trt_channel_index] = dummy_digit;
+      trt_channel_id += trt_channel_id_increment;
+      trt_channel_index++;
+    }
+
+    // increment to the next collection
+    trt_collection_index++;
+
+  } // end transient collection loop
+
+  // Finally, create any remaining missing collections
+    while ( trt_collection_index < trt_number_of_collections ) {
+      // The transient collection is missing; create the persistent collection with empty digits
+      trt_channel_id = trt_collection_id[trt_collection_index];
+      InDetRawDataCollection_p1& pcollection = persCont->m_collections[trt_collection_index];
+      pcollection.m_id     = 0;
+      pcollection.m_hashId = 0; // no hashId for this empty collection
+      pcollection.m_begin  = 0;
+      pcollection.m_end    = 0;
+
+      // Fill all the channels with with empty digits.
+      for (unsigned int i=0; i<trt_collection_size[trt_collection_index]; ++i) {
+        persCont->m_rawdata[trt_channel_index] = dummy_digit;
+        trt_channel_id += trt_channel_id_increment;
+        trt_channel_index++;
+      }
+      trt_collection_index++;
+    }
+
+  MSG_DEBUG(log," Prepared " << persCont->m_collections.size() << "Collections");
+  MSG_DEBUG(log," ***  Writing TRT_RDO_Container (TRT_LoLumRawData concrete type)");
+
+  trt_collection_id.clear();
+  trt_collection_size.clear();
+
+} // end of transToPers
+
+
+void  TRT_LoLumRawDataContainerCnv_p3::persToTrans(const InDetRawDataContainer_p3* persCont, TRT_RDO_Container* transCont, MsgStream &log)
+{
+
+  // The transient model has a container holding collections (up to 14912 TRT detector elements/modules)
+  // and the collections hold channels (e.g. up to 24 straws in the TRT endcaps). There are a total of 350848 TRT straws.
+  // The persistent model flattens this so that the persistent container has two vectors: 1) all collections, 2) all RDO
+  // The persistent collections then only maintain indexes into the container's vector of all channels.
+  // So here we loop over all collection and extract their channels from the vector.
+
+  // Hard-code the number of collections, their ids and their sizes to generate collections and channels for the whole detector
+  const unsigned int dummy_digit=0;
+  const unsigned int trt_number_of_collections=14912;
+  const unsigned int trt_channel_id_increment=0x20u;
+  std::vector<unsigned int> trt_collection_id;   // There are 14912 elements/modules in the TRT
+  std::vector<unsigned int> trt_collection_size; // Each element has a specific number of straws
+
+  set_vectors_of_collection_ids_and_size(trt_collection_id,
+                                         trt_collection_size,
+                                         trt_number_of_collections);
+
+  unsigned int trt_channel_id;
+  unsigned int trt_channel_index=0;
+  unsigned int trt_channel_index_old;
+  unsigned int total_number_of_channels=0;
+
+  TRT_RDO_Collection* tcoll=0;         // transient collection to be constructed
+
+  MSG_DEBUG(log," Reading " << persCont->m_collections.size() << "Collections");
+  if (persCont->m_collections.size() != trt_number_of_collections)
+    log << MSG::ERROR << "TRT_LoLumRawDataContainerCnv_p3::persToTrans expected 14912 collections but got " << persCont->m_collections.size() << ". We should be reading the whole detector!" << endmsg;
+
+  for (unsigned int trt_collection_index=0; trt_collection_index<trt_number_of_collections; ++trt_collection_index) {
+
+    // Create trans collection - in NOT owner of TRT_RDO_RawData (SG::VIEW_ELEMENTS); IDet collection don't have the Ownership policy c'tor
+
+    // count the number of non-dummy digits and skip to the next persistent collection if there are none.
+    unsigned int nchans = trt_collection_size[trt_collection_index];
+    trt_channel_index_old = trt_channel_index; // the beginning of this collection
+    unsigned int mchans = 0;
+    for (unsigned int ichan = 0; ichan < nchans; ++ichan) {
+      const unsigned int pword = persCont->m_rawdata[trt_channel_index];
+      if ( pword != dummy_digit ) mchans++;
+      trt_channel_index++;
+    }
+    if (!mchans) continue;
+
+    // This collection has "mchans" digits
+    total_number_of_channels += mchans;
+
+    // Create the transeint collection and fill with channels
+    tcoll = new TRT_RDO_Collection(IdentifierHash(trt_collection_index));
+    tcoll->setIdentifier(Identifier(trt_collection_id[trt_collection_index]));
+    tcoll->resize(mchans);
+
+    trt_channel_id = trt_collection_id[trt_collection_index]; // the id of the first channel in this collection
+    trt_channel_index = trt_channel_index_old; // go back to the beginning of this collection and process it again
+
+    unsigned int jchan=0; // counter for the non-dummy digits
+    for (unsigned int ichan = 0; ichan < nchans; ++ichan) {
+      const unsigned int pword = persCont->m_rawdata[trt_channel_index];
+      if ( pword == dummy_digit ) {
+        // advance to the next straw
+        trt_channel_id += trt_channel_id_increment;
+        trt_channel_index++;
+        continue; // don't write a dummy digit
+      }
+
+      TRT_LoLumRawData* tchan = new TRT_LoLumRawData(Identifier(trt_channel_id),pword);
+
+      (*tcoll)[jchan] = tchan;
+      jchan++;
+
+      // advance to the next straw
+      trt_channel_id += trt_channel_id_increment;
+      trt_channel_index++;
+    }
+
+    // register the rdo collection in IDC with hash - faster addCollection
+    StatusCode sc = transCont->addCollection(tcoll, IdentifierHash(trt_collection_index));
+    if (sc.isFailure()) throw std::runtime_error("Failed to add collection to ID Container");
+    MSG_VERBOSE(log,"AthenaPoolTPCnvIDCont::persToTrans, collection, hash_id / coll_id = " << trt_collection_index << " / " << trt_collection_id[trt_collection_index] << ", added to Identifiable container.");
+  }
+
+  trt_collection_id.clear();
+  trt_collection_size.clear();
+
+  MSG_DEBUG(log," ***  Reading TRT_RDO_Container (TRT_LoLumRawData concrete type)");
+
+} // end of persToTrans
+
+//================================================================
+TRT_RDO_Container* TRT_LoLumRawDataContainerCnv_p3::createTransient(const InDetRawDataContainer_p3* persObj, MsgStream& log) {
+  std::unique_ptr<TRT_RDO_Container> trans(std::make_unique<TRT_RDO_Container>(m_trtId->straw_layer_hash_max()));
+  persToTrans(persObj, trans.get(), log);
+  return(trans.release());
+}
diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_LoLumRawDataContainerCnv_p3.h b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_LoLumRawDataContainerCnv_p3.h
new file mode 100644
index 0000000000000000000000000000000000000000..4c2cd31ab08a6dc1d7f2339b8f3d982c36774fe1
--- /dev/null
+++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_LoLumRawDataContainerCnv_p3.h
@@ -0,0 +1,46 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TRT_LOLUMRAWDATACONTAINERCNV_P3_H
+#define TRT_LOLUMRAWDATACONTAINERCNV_P3_H
+
+// TRT_LoLumRawDataContainerCnv_p3, T/P separation of TRT Raw data
+// author D.Costanzo <davide.costanzo@cern.ch>
+
+#include "InDetRawData/TRT_RDO_Container.h"
+#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h"
+#include "InDetEventAthenaPool/InDetRawDataContainer_p3.h"
+class TRT_ID;
+
+
+// We do NOT use T_AthenaPoolTPCnvIDCont because we do all of the
+// conversion in the .cxx. Same as for the LAr Raw Channels
+// Note that this is used for a container of TRT Raw Data
+// that containes only TRT_LoLumRawData concrete types
+// TRT_RDO_ContainerCnv.cxx delegates the conversion to this
+// converter if the objects are of the correct type
+
+
+class TRT_LoLumRawDataContainerCnv_p3 : public T_AthenaPoolTPCnvBase<TRT_RDO_Container, InDetRawDataContainer_p3>
+{
+private:
+  const TRT_ID *m_trtId;
+public:
+  TRT_LoLumRawDataContainerCnv_p3() : m_trtId(0) {};
+
+  virtual void persToTrans(const InDetRawDataContainer_p3* persCont,
+                           TRT_RDO_Container* transCont,
+                           MsgStream &log) ;
+  virtual void transToPers(const TRT_RDO_Container* transCont,
+                           InDetRawDataContainer_p3* persCont,
+                           MsgStream &log) ;
+  virtual TRT_RDO_Container* createTransient(const InDetRawDataContainer_p3* persObj, MsgStream& log) ;
+
+
+  // ID helper can't be used in the constructor, need initialize()
+  void initialize(const TRT_ID *idhelper) { m_trtId = idhelper; }
+
+};
+
+#endif
diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_RDO_ContainerCnv.cxx b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_RDO_ContainerCnv.cxx
index 3b2c9d76bfc8ed4a2c95c8785eb1e28197d46082..22540ccb26ed13d5e9aee265249ad54d55731034 100644
--- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_RDO_ContainerCnv.cxx
+++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_RDO_ContainerCnv.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 "TRT_RDO_ContainerCnv.h"
@@ -73,6 +73,7 @@ StatusCode TRT_RDO_ContainerCnv::initialize() {
    m_converter_p1.initialize(idhelper, m_storeGate);
    m_converter_TP1.initialize(idhelper);
    m_converter_TP2.initialize(idhelper);
+   m_converter_TP3.initialize(idhelper);
 
    ATH_MSG_DEBUG("Converter initialized");
 
@@ -126,9 +127,17 @@ TRT_RDO_Container* TRT_RDO_ContainerCnv::createTransient() {
   static const pool::Guid   p1_guid("CFBDB7A8-C788-4EE7-A260-3C8B680234FE"); // with TRT_RDORawData
   static const pool::Guid   TP1_guid("DA76970C-E019-43D2-B2F9-25660DCECD9D"); // for t/p separated version with InDetRawDataContainer_p1
   static const pool::Guid   TP2_guid("7138342E-0A80-4A32-A387-2842A01C2539"); // for t/p separated version with InDetRawDataContainer_p2
+  static const pool::Guid   TP3_guid("D0313948-9BC8-415F-BE58-7BA8178F93CD"); // for t/p separated version with InDetRawDataContainer_p3
   ATH_MSG_DEBUG("createTransient(): main converter");
 
-  if( compareClassGuid(TP2_guid) ) {
+  if( compareClassGuid(TP3_guid) ) {
+    ATH_MSG_DEBUG("createTransient(): New TP version - TP3 branch");
+    std::unique_ptr< InDetRawDataContainer_p3 >   col_vect( poolReadObject< InDetRawDataContainer_p3 >() );
+    TRT_RDO_Container *res = m_converter_TP3.createTransient( col_vect.get(), msg() );
+    ATH_MSG_DEBUG("createTransient(), TP3 branch: returns TRANS = "<<shortPrint(res));
+    return res;
+  }
+  else if( compareClassGuid(TP2_guid) ) {
     ATH_MSG_DEBUG("createTransient(): New TP version - TP2 branch");
     std::unique_ptr< InDetRawDataContainer_p2 >   col_vect( poolReadObject< InDetRawDataContainer_p2 >() );
     TRT_RDO_Container *res = m_converter_TP2.createTransient( col_vect.get(), msg() );
diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_RDO_ContainerCnv.h b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_RDO_ContainerCnv.h
index ef4b23321d693c979faf588e8eff16032714da3f..66f994bb243745777f4a2ded3138a48a5887faf4 100644
--- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_RDO_ContainerCnv.h
+++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_RDO_ContainerCnv.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TRT_RDO_CONTAINERCNV_H
@@ -17,11 +17,15 @@
 #include "TRT_RDO_ContainerCnv_p1.h"
 #include "TRT_LoLumRawDataContainerCnv_p1.h"
 #include "TRT_LoLumRawDataContainerCnv_p2.h"
+#include "TRT_LoLumRawDataContainerCnv_p3.h"
 
 
 // the latest persistent representation type of DataCollection:
 typedef  InDetRawDataContainer_p2         TRT_RDO_Container_PERS;
 typedef  TRT_LoLumRawDataContainerCnv_p2  TRT_RDO_ContainerCnv_PERS;
+// To switch to the p3 version (20% RDO size reduction), comment the two lines above and uncomment the two below.
+// typedef  InDetRawDataContainer_p3         TRT_RDO_Container_PERS;
+// typedef  TRT_LoLumRawDataContainerCnv_p3  TRT_RDO_ContainerCnv_PERS;
 
 typedef  T_AthenaPoolCustomCnv<TRT_RDO_Container, TRT_RDO_Container_PERS >   TRT_RDO_ContainerCnvBase;
 
@@ -30,10 +34,11 @@ class TRT_RDO_ContainerCnv : public TRT_RDO_ContainerCnvBase {
 
   // Converters need to be initialized (use ID helpers)
   // Thus they can't be local
-  TRT_RDO_ContainerCnv_p1   m_converter_p1;
+  TRT_RDO_ContainerCnv_p1           m_converter_p1;
   TRT_RDO_ContainerCnv_p0           m_converter_p0;
   TRT_LoLumRawDataContainerCnv_p1   m_converter_TP1;
   TRT_LoLumRawDataContainerCnv_p2   m_converter_TP2;
+  TRT_LoLumRawDataContainerCnv_p3   m_converter_TP3;
   TRT_RDO_ContainerCnv_PERS         m_converter_PERS;
 
   // Should not be needed at some point.
diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_RDO_Elements.h b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_RDO_Elements.h
new file mode 100644
index 0000000000000000000000000000000000000000..3fe1b15fd51aa4b5141b5fa91f8baedbce6718a8
--- /dev/null
+++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/TRT_RDO_Elements.h
@@ -0,0 +1,90 @@
+void set_vectors_of_collection_ids_and_size(std::vector<unsigned int> &element, std::vector<unsigned int> &nstraws, const unsigned int number_of_elements) {
+
+  // The transient model has a container holding collections (TRT detector elements/modules)
+  // and the collections hold channels (e.g. up to 24 straws in the TRT endcaps).
+  // Here we construct, for the whole detector, the ids of the collections (14912 TRT detector elements/modules)
+  // and the number of channels (straws) in each collection according to the numbering scheme in the TRT RDO container.
+  // A total 350848 straw ids can be defined using these two vectors since the id of each straw simply follows from the
+  // previous id starting from the id of the collection that contains it.
+
+  /*
+    5120 endcap elements : 32(6*(15*1,17),7*(7*1,25),7*1,601)
+    4672 barrel elements : 64(18*1,14,23*1,9,29*1,931)
+    5120 endcap elements : 32(6*(15*1,17),7*(7*1,25),7*1,601)
+    ----
+   14912  << number_of_elements
+    ----
+  */
+
+  element.resize(number_of_elements);
+  nstraws.resize(number_of_elements,24); // all endcap modules have 24 straws. The barrels will need a more detailed assignment.
+
+  const unsigned int first_straw = 0x10000000u;
+  unsigned int i,j,k,n;
+  unsigned int c=0;
+
+  n=0;
+  element[n++]=0;
+  for (i=0; i<32; i++) {
+    for (j=0; j<6; j++) { for (k=0; k<15; k++) { c++; element[n++]=c; }; c=c+17; element[n++]=c; }
+    for (j=0; j<7; j++) { for (k=0; k< 7; k++) { c++; element[n++]=c; }; c=c+25; element[n++]=c; }
+    for (j=0; j<7; j++) { c++; element[n++]=c; }; c=c+601; element[n++]=c;
+  }
+  for (i=0; i<64; i++) {
+    for (k=0; k<18; k++) { c++; element[n++]=c; }; c=c+14;  element[n++]=c;
+    for (k=0; k<23; k++) { c++; element[n++]=c; }; c=c+9;   element[n++]=c;
+    for (k=0; k<29; k++) { c++; element[n++]=c; }; c=c+931; element[n++]=c;
+  }
+  for (i=0; i<32; i++) {
+    for (j=0; j<6; j++) { for (k=0; k<15; k++) { c++; element[n++]=c; }; c=c+17; element[n++]=c; }
+    for (j=0; j<7; j++) { for (k=0; k< 7; k++) { c++; element[n++]=c; }; c=c+25; element[n++]=c; }
+    for (j=0; j<7; j++) { c++; element[n++]=c; }; c=c+601; if (n<number_of_elements) element[n++]=c;
+  } // the very last item in the pattern is dropped.
+
+  // Finally convert from 22 bit to 32 bit form.
+  for (i=0; i<number_of_elements; i++) element[i] = (element[i]<<10)+first_straw;
+
+  /*
+    5120 endcap elements : 24
+    4672 barrel elements : 64(15,4*16,5*17,5*18,3*19,18,19,5*20,5*21,5*22,5*23,2*24,2*23,4*24,5*25,5*26,5*27,5*28,4*29,28)
+    5120 endcap elements : 24
+  */
+  n=5120;
+  for (i=0; i<64; i++) {
+    nstraws[n++]=15;
+    for (j=0; j<4; j++) nstraws[n++]=16;
+    for (j=0; j<5; j++) nstraws[n++]=17;
+    for (j=0; j<5; j++) nstraws[n++]=18;
+    for (j=0; j<3; j++) nstraws[n++]=19;
+    nstraws[n++]=18; nstraws[n++]=19;
+    for (j=0; j<5; j++) nstraws[n++]=20;
+    for (j=0; j<5; j++) nstraws[n++]=21;
+    for (j=0; j<5; j++) nstraws[n++]=22;
+    for (j=0; j<5; j++) nstraws[n++]=23;
+    for (j=0; j<2; j++) nstraws[n++]=24;
+    for (j=0; j<2; j++) nstraws[n++]=23;
+    for (j=0; j<4; j++) nstraws[n++]=24;
+    for (j=0; j<5; j++) nstraws[n++]=25;
+    for (j=0; j<5; j++) nstraws[n++]=26;
+    for (j=0; j<5; j++) nstraws[n++]=27;
+    for (j=0; j<5; j++) nstraws[n++]=28;
+    for (j=0; j<4; j++) nstraws[n++]=29;
+    nstraws[n++]=28;
+  }
+
+/*
+  // DEBUG dump out all straw ids (32-bit representation; no information is lost)
+  unsigned int trt_strawid[350848];
+  unsigned int istraw=0;
+  for (unsigned int i=0; i<trt_number_of_collections; i++) {
+    trt_strawid[istraw++] = trt_collection_id[i];
+    for (unsigned int j=1; j<trt_collection_size[i]; j++) {
+      trt_strawid[istraw]=trt_strawid[istraw-1]+0x20u;
+      istraw++;
+    }
+  }
+  std::cout << "AJB DUMP number of straws is " << istraw << std::endl;
+  for (unsigned int k=0; k<350848; k++) std::cout << "AJB DUMP " << std::hex << trt_strawid[k] << std::endl;
+*/
+
+}
diff --git a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py
index b143f5df1412ebccbcc14a4090663067feaaf336..f51709b523e30e1f6e0e1edb9efb9023a896a6cf 100644
--- a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py
+++ b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py
@@ -95,7 +95,7 @@ def makePublicTool(tool_creator) :
             if the_name != tool.name() :
                 raise Exception('Tool has not the exepected name %s but %s' % (the_name, tool.name()))
             if private is False :
-                print ('DEBUG add to ToolSvc %s' % (tool.name()))
+                log.debug ('DEBUG add to ToolSvc %s' % (tool.name()))
                 ToolSvc += tool
             return tool
         else :
diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/test/ut_TRTParametersTest.cxx b/InnerDetector/InDetG4/TRT_G4Utilities/test/ut_TRTParametersTest.cxx
index 67d27694ed89b2b92bcade0864aebfed6aa970f7..1cc6c05f33437104082e5895855438f498848e82 100644
--- a/InnerDetector/InDetG4/TRT_G4Utilities/test/ut_TRTParametersTest.cxx
+++ b/InnerDetector/InDetG4/TRT_G4Utilities/test/ut_TRTParametersTest.cxx
@@ -91,6 +91,7 @@ BOOST_AUTO_TEST_CASE(GetPartOfExistingDoubleArray, * utf::tolerance(0.01) ){
 BOOST_AUTO_TEST_SUITE_END()
 
 
+// cppcheck-suppress unknownMacro
 BOOST_FIXTURE_TEST_SUITE(Test_TRTOutputFile , setupOutputFile)
 BOOST_AUTO_TEST_CASE(OutputToFile  ){
   auto & f(p->GetReference());
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.cxx b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.cxx
index c5ca836bcee8b50e7dc54131ac97b5b0d434ff85..efb0fd16073d265f8273635322c2df6002c79ebc 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.cxx
+++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.cxx
@@ -154,7 +154,7 @@ void TRTParametersForBarrelHits::DefineParameters() const
 
 // Called by TRTParametersForBarrelHits
 
-void TRTParametersForBarrelHits::PrintParameters ATLAS_NOT_THREAD_SAFE () const // Thread unsafe TRTOutputFile is used.
+void TRTParametersForBarrelHits::PrintParameters() const
 {
 
   if (m_verboseLevel>5) { G4cout << "######### Method TRTParametersForBarrelHits::PrintParameters" << G4endl; }
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.h b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.h
index 04355929ff18f4983c99869c1f79213e46221b30..aef7f11f8458adf4b49d527a80c5c7f75a16e1af 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.h
+++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.h
@@ -10,7 +10,7 @@
 class TRTParameters;
 class TRTProcessingOfBarrelHits;
 
-class ATLAS_NOT_THREAD_SAFE TRTParametersForBarrelHits // Thread unsafe TRTParameters and TRTProcessingOfBarrelHits classes are used.
+class TRTParametersForBarrelHits
 {
 public:
   TRTParametersForBarrelHits(TRTProcessingOfBarrelHits*);
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.cxx b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.cxx
index 080e2776426c5268e4c8efc9442bc075a4616c08..545d8e624d6c0b0401b2c5dae5acf57904e61f31 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.cxx
+++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.cxx
@@ -102,7 +102,7 @@ void TRTParametersForEndCapHits::DefineParameters() const
 
 // Called by TRTParametersForEndCapHits
 
-void TRTParametersForEndCapHits::PrintParameters ATLAS_NOT_THREAD_SAFE () const // Thread unsafe TRTOutputFile class is used.
+void TRTParametersForEndCapHits::PrintParameters() const
 {
   if (m_verboseLevel>5) { G4cout << "######### Method TRTParametersForEndCapHits::PrintParameters" << G4endl; }
 
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.h b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.h
index f633561f31a56548364e7c52123cc7d9ed12e9ac..197081207fc35cf4024e9d46d65bd01ee396063f 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.h
+++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.h
@@ -10,7 +10,7 @@
 class TRTParameters;
 class TRTProcessingOfEndCapHits;
 
-class ATLAS_NOT_THREAD_SAFE TRTParametersForEndCapHits // Thread unsafe TRTParameters and TRTProcessingOfEndCapHits classes are used.
+class TRTParametersForEndCapHits
 {
 public:
   TRTParametersForEndCapHits(TRTProcessingOfEndCapHits*);
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTPrintingOfHits.h b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTPrintingOfHits.h
index abe80a0441e4f165e23cd9400330ab0ce5de9f98..834e0c3a7b2fe0de7f13e9f46ae8be4fc90e3708 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTPrintingOfHits.h
+++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTPrintingOfHits.h
@@ -12,7 +12,7 @@
 class TRTUncompressedHit;
 class TRTOutputFile;
 
-class ATLAS_NOT_THREAD_SAFE TRTPrintingOfHits // Thread unsafe TRTOutputFile class is used.
+class TRTPrintingOfHits
 {
   public:
     TRTPrintingOfHits();
@@ -20,7 +20,7 @@ class ATLAS_NOT_THREAD_SAFE TRTPrintingOfHits // Thread unsafe TRTOutputFile cla
 
     void PrintUncompressedHit(TRTUncompressedHit*);
 
-    MsgStream& msg (MSG::Level lvl) const { return m_msg << lvl; }
+    MsgStream& msg (MSG::Level lvl) { return m_msg << lvl; }
     bool msgLevel (MSG::Level lvl)    { return m_msg.get().level() <= lvl; }
 
   private:
@@ -31,8 +31,7 @@ class ATLAS_NOT_THREAD_SAFE TRTPrintingOfHits // Thread unsafe TRTOutputFile cla
 
     TRTOutputFile* m_pOutputFile;
 
-    mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
-
+    Athena::MsgStreamMember m_msg;
 };
 
 #endif //TRT_G4_SD_TRTPrintingOfHits_hh
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfBarrelHits.h b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfBarrelHits.h
index 1ef37d5cfa5d8df8fda5a81bb51a1a09a59c4367..41ff36832d5e5220631009d960c3d2a5654db7ca 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfBarrelHits.h
+++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfBarrelHits.h
@@ -12,7 +12,7 @@ class TRTSensitiveDetector;
 
 class G4Step;
 
-class ATLAS_NOT_THREAD_SAFE TRTProcessingOfBarrelHits // Thread unsafe TRTParameters and TRTSensitiveDetector classes are used.
+class TRTProcessingOfBarrelHits
 {
   friend class TRTParametersForBarrelHits;
 
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfEndCapHits.cxx b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfEndCapHits.cxx
index cb16877c6fb45c71f7aafc82badfc1e2e3a95c38..0301aab20f5e1031201e5116bebdc9a43a16e894 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfEndCapHits.cxx
+++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfEndCapHits.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // Class header
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfEndCapHits.h b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfEndCapHits.h
index ea4e0ce8ec5dcd8c10ce624c533b04fb6240e405..76ded35f0c328978c8bc1340f8f4904cb1ffd499 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfEndCapHits.h
+++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfEndCapHits.h
@@ -12,7 +12,7 @@ class TRTSensitiveDetector;
 
 class G4Step;
 
-class ATLAS_NOT_THREAD_SAFE TRTProcessingOfEndCapHits // Thread unsafe TRTParameters and TRTSensitiveDetector classes are used.
+class TRTProcessingOfEndCapHits
 {
   friend class TRTParametersForEndCapHits;
 
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.cxx b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.cxx
index 51765600f816753eadefd131e92d504c040c9487..86bf1ad85eb5e2b697494e19db5c3dc0e8dc143a 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.cxx
+++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.cxx
@@ -70,7 +70,7 @@ TRTSensitiveDetector::TRTSensitiveDetector(const std::string& name, const std::s
 // Called by TRTSensitiveDetector
 // Once per run
 
-void TRTSensitiveDetector::InitializeHitProcessing ATLAS_NOT_THREAD_SAFE () // Thread unsafe TRTParametersForBarrelHits, TRTParametersForEndCapHits  classes are used.
+void TRTSensitiveDetector::InitializeHitProcessing()
 {
   if(verboseLevel>4)
     {
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.h b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.h
index 0f811912fb9fd35d55c099813cca965d69677976..f195ea1ffdee85ceeb8e7eed02a15c3df8c50bd6 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.h
+++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.h
@@ -21,7 +21,7 @@ class G4HCofThisEvent;
 class G4Step;
 class G4TouchableHistory;
 
-class ATLAS_NOT_THREAD_SAFE TRTSensitiveDetector : public G4VSensitiveDetector // Thread unsafe TRTParameters, TRTProcessingOfBarrelHits, TRTProcessingOfEndCapHits classes is used.
+class TRTSensitiveDetector : public G4VSensitiveDetector
 {
  FRIEND_TEST( TRTSensitiveDetectortest, Initialize);
  FRIEND_TEST( TRTSensitiveDetectortest, ProcessHits );
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetectorTool.cxx b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetectorTool.cxx
index d2d769c6f438130aa4b98db6be7c07efe7c0c297..a16d587ee6681145a38d39395faef8dbbd9d4456 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetectorTool.cxx
+++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetectorTool.cxx
@@ -18,7 +18,7 @@ TRTSensitiveDetectorTool::TRTSensitiveDetectorTool(const std::string& type, cons
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
-G4VSensitiveDetector* TRTSensitiveDetectorTool::makeSD ATLAS_NOT_THREAD_SAFE () const // Thread unsafe TRTSensitiveDetector class is used.
+G4VSensitiveDetector* TRTSensitiveDetectorTool::makeSD() const
 {
 
   ATH_MSG_DEBUG( "Initializing SD" );
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/test/TRTSensitiveDetector_gtest.cxx b/InnerDetector/InDetG4/TRT_G4_SD/test/TRTSensitiveDetector_gtest.cxx
index d669dbf77d46febcfea4e4c8499b5b8215f59210..aaed580ea6b50a9429026019dab61339650e53de 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/test/TRTSensitiveDetector_gtest.cxx
+++ b/InnerDetector/InDetG4/TRT_G4_SD/test/TRTSensitiveDetector_gtest.cxx
@@ -32,7 +32,7 @@
 #include "G4AtlasTools/DerivedG4SensitiveDetectorTestSetting.h"
 #include "MCTruth/TrackHelper.h"
 
-ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // Thread unsafe TRTSensitiveDetector class is tested in this unit test.
+ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // googletest
 
 //set environment
 class GaudiEnvironment : public ::testing::Environment {
diff --git a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx
index 55c8e18d5f58aa7113d533e49094f36a075a31f9..4cd7b6f0df4c17367d0967b6d13c9111290df7ad 100644
--- a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx
+++ b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx
@@ -4,6 +4,7 @@
 
 #include <sstream>
 #include "GaudiKernel/PhysicalConstants.h"
+#include "AthContainers/ConstDataVector.h"
 
 #include "DiMuMon.h"
 
@@ -243,7 +244,7 @@ StatusCode DiMuMon::bookHistograms()
 }
 
 
-StatusCode DiMuMon::fillHistograms ATLAS_NOT_THREAD_SAFE () // const_cast is used.
+StatusCode DiMuMon::fillHistograms()
 {
 
   const double muonMass = 105.66*Gaudi::Units::MeV;
@@ -255,7 +256,7 @@ StatusCode DiMuMon::fillHistograms ATLAS_NOT_THREAD_SAFE () // const_cast is use
   } else ATH_MSG_DEBUG("Muon container successfully retrieved.");
 
   //make a new container
-  xAOD::MuonContainer* goodMuons = new xAOD::MuonContainer( SG::VIEW_ELEMENTS );
+  ConstDataVector<xAOD::MuonContainer> goodMuons( SG::VIEW_ELEMENTS );
 
   //pick out the good muon tracks and store in the new container
   for(const auto* muon : *muons ) {
@@ -287,15 +288,15 @@ StatusCode DiMuMon::fillHistograms ATLAS_NOT_THREAD_SAFE () // const_cast is use
     if (fabs(idTrkEta)>2.5) continue;
     m_stat->Fill("eta<2.5",1);
 
-    goodMuons->push_back(const_cast<xAOD::Muon*>(muon));
+    goodMuons.push_back(muon);
   }
 
   //pair up the tracks of the good muons and fill histograms
-  int nMuons = goodMuons->size();
+  int nMuons = goodMuons.size();
 
   if (nMuons>1){
-    xAOD::MuonContainer::const_iterator mu1 = goodMuons->begin();
-    xAOD::MuonContainer::const_iterator muEnd = goodMuons->end();
+    xAOD::MuonContainer::const_iterator mu1 = goodMuons.begin();
+    xAOD::MuonContainer::const_iterator muEnd = goodMuons.end();
     for (; mu1!=muEnd;mu1++){
       const xAOD::TrackParticle *id1 = (*mu1)->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
       xAOD::MuonContainer::const_iterator mu2 = mu1+1;
@@ -451,7 +452,7 @@ StatusCode DiMuMon::fillHistograms ATLAS_NOT_THREAD_SAFE () // const_cast is use
 }
 
 
-StatusCode DiMuMon::procHistograms ATLAS_NOT_THREAD_SAFE () // Thread unsafe DiMuMon::iterativeGausFit is used.
+StatusCode DiMuMon::procHistograms()
 {
 
 
@@ -483,7 +484,7 @@ StatusCode DiMuMon::procHistograms ATLAS_NOT_THREAD_SAFE () // Thread unsafe DiM
 }
 
 
-void DiMuMon::iterativeGausFit ATLAS_NOT_THREAD_SAFE (TH2F* hin, std::vector<TH1F*> hout, int mode){ // Global gStyle is used.
+void DiMuMon::iterativeGausFit (TH2F* hin, std::vector<TH1F*> hout, int mode){
   // a canvas may be needed when implmenting this into the post-processing file
   TString hname =  hin->GetName();
   TString psName = hname + m_triggerChainName + ".ps";
@@ -511,7 +512,7 @@ void DiMuMon::iterativeGausFit ATLAS_NOT_THREAD_SAFE (TH2F* hin, std::vector<TH1
 	sigma= fn->GetParameter(2);
 	fn->SetRange(mean-1.2*sigma,mean+1.2*sigma);
 	fn->SetParameters(float(htemp->GetEntries())/10.,mean,sigma);
-	gStyle->SetOptStat(1);
+	//gStyle->SetOptStat(1); // not thread-safe
 	if (m_doSaveFits) {
 	  htemp->Fit("fn","RML");
 	  ctemp->Print(psName);
diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt b/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt
index ca37b502fa8e2364c39bb826bda9b85110537a8d..ed109d04c803d8c547f1a236f90b626385dafca0 100644
--- a/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt
+++ b/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt
@@ -6,6 +6,7 @@ atlas_subdir( InDetOverlay )
 # External dependencies:
 find_package( CLHEP )
 find_package( GTest )
+find_package( GMock )
 
 # Helper variable(s):
 set( _jobOPath
@@ -29,6 +30,15 @@ atlas_add_test( SCTOverlay_test
                 LINK_LIBRARIES AthenaBaseComps IDC_OverlayBase GaudiKernel InDetRawData CxxUtils StoreGateLib SGtests GeneratorObjects InDetIdentifier InDetSimData TrkTrack IdDictParser ${GTEST_LIBRARIES}
                 ENVIRONMENT "JOBOPTSEARCHPATH=${_jobOPath}" )
 
+atlas_add_test( TRTOverlay_test
+                SOURCES src/TRTOverlay.cxx test/TRTOverlay_test.cxx
+                INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS}
+                LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps IDC_OverlayBase GaudiKernel InDetRawData StoreGateLib SGtests GeneratorObjects InDetIdentifier InDetSimData TrkTrack TRT_ConditionsServicesLib TRT_ElectronPidToolsLib IdDictParser ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES}
+                ENVIRONMENT "JOBOPTSEARCHPATH=${_jobOPath}" )
+
+# Needed for the plugin service to see the test components
+# defined in the test binary.
+set_target_properties( InDetOverlay_TRTOverlay_test PROPERTIES ENABLE_EXPORTS True )
 
 # Component(s) in the package:
 atlas_add_component( InDetOverlay
diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/InDetOverlay/TRTOverlay.h b/InnerDetector/InDetRawAlgs/InDetOverlay/InDetOverlay/TRTOverlay.h
index 07ed78bc47d89f91c29d9eb4bc5ee133331bd6e8..74b33959965484113667d7b241eccf600b8b78eb 100644
--- a/InnerDetector/InDetRawAlgs/InDetOverlay/InDetOverlay/TRTOverlay.h
+++ b/InnerDetector/InDetRawAlgs/InDetOverlay/InDetOverlay/TRTOverlay.h
@@ -20,10 +20,16 @@ namespace CLHEP {
   class HepRandomEngine;
 }
 
+namespace OverlayTesting {
+  class TRTOverlay_test;
+}
+
 class TRTOverlay : public AthReentrantAlgorithm
 {
 public:
 
+  friend class OverlayTesting::TRTOverlay_test;
+
   TRTOverlay(const std::string &name, ISvcLocator *pSvcLocator);
 
   virtual StatusCode initialize() override final;
@@ -53,12 +59,12 @@ private:
   // Following tools, services and configurables are there only for the correct of HT hits
   ServiceHandle<IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", "Random Number Service"};      // Random number service
 
-  double                                 m_HTOccupancyCorrectionB;
-  double                                 m_HTOccupancyCorrectionEC;
-  double                                 m_HTOccupancyCorrectionB_noE;
-  double                                 m_HTOccupancyCorrectionEC_noE;
-  ToolHandle<InDet::ITRT_LocalOccupancy> m_TRT_LocalOccupancyTool{this, "TRT_LocalOccupancyTool", "TRT_LocalOccupancy", ""};
-  ToolHandle<ITRT_StrawStatusSummaryTool>   m_TRTStrawSummaryTool{this, "TRTStrawSummaryTool", "TRT_StrawStatusSummaryTool", ""};
+  Gaudi::Property<double> m_HTOccupancyCorrectionB{this, "TRT_HT_OccupancyCorrectionBarrel", 0.110, ""};
+  Gaudi::Property<double> m_HTOccupancyCorrectionEC{this, "TRT_HT_OccupancyCorrectionEndcap", 0.090, ""};
+  Gaudi::Property<double> m_HTOccupancyCorrectionB_noE{this, "TRT_HT_OccupancyCorrectionBarrelNoE", 0.060, ""};
+  Gaudi::Property<double> m_HTOccupancyCorrectionEC_noE{this, "TRT_HT_OccupancyCorrectionEndcapNoE", 0.050, ""};
+  ToolHandle<InDet::ITRT_LocalOccupancy>  m_TRT_LocalOccupancyTool{this, "TRT_LocalOccupancyTool", "TRT_LocalOccupancy", ""};
+  ToolHandle<ITRT_StrawStatusSummaryTool> m_TRTStrawSummaryTool{this, "TRTStrawSummaryTool", "TRT_StrawStatusSummaryTool", ""};
 
 };
 
diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/src/TRTOverlay.cxx b/InnerDetector/InDetRawAlgs/InDetOverlay/src/TRTOverlay.cxx
index 0b6a8f1b013a685559468385154db13da03c5a10..a0a565fe4bfac8a1492adf02779345960ffe70cf 100644
--- a/InnerDetector/InDetRawAlgs/InDetOverlay/src/TRTOverlay.cxx
+++ b/InnerDetector/InDetRawAlgs/InDetOverlay/src/TRTOverlay.cxx
@@ -45,10 +45,6 @@ namespace Overlay
 TRTOverlay::TRTOverlay(const std::string &name, ISvcLocator *pSvcLocator)
   : AthReentrantAlgorithm(name, pSvcLocator)
 {
-  declareProperty("TRT_HT_OccupancyCorrectionBarrel", m_HTOccupancyCorrectionB=0.110);
-  declareProperty("TRT_HT_OccupancyCorrectionEndcap", m_HTOccupancyCorrectionEC=0.090);
-  declareProperty("TRT_HT_OccupancyCorrectionBarrelNoE", m_HTOccupancyCorrectionB_noE=0.060);
-  declareProperty("TRT_HT_OccupancyCorrectionEndcapNoE", m_HTOccupancyCorrectionEC_noE=0.050);
 }
 
 
diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/test/TRTOverlay_test.cxx b/InnerDetector/InDetRawAlgs/InDetOverlay/test/TRTOverlay_test.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..76a29520ee30bb260b9bbbcd91f85f608646b5ee
--- /dev/null
+++ b/InnerDetector/InDetRawAlgs/InDetOverlay/test/TRTOverlay_test.cxx
@@ -0,0 +1,946 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+ * @author John Chapman
+ * @brief Tests for TRTOverlay.
+ */
+
+#undef NDEBUG
+
+// Tested AthAlgorithm
+#include "../InDetOverlay/TRTOverlay.h"
+
+#include <vector>
+
+#include "InDetIdentifier/TRT_ID.h"
+#include "IdDictParser/IdDictParser.h"
+#include "GaudiKernel/MsgStream.h"
+
+// HepMC includes
+#include "HepMC/GenEvent.h"
+#include "HepMC/GenParticle.h"
+#include "HepMC/GenVertex.h"
+
+// CLHEP includes
+#include "CLHEP/Vector/LorentzVector.h"
+#include "CLHEP/Units/SystemOfUnits.h"
+
+#include "GeneratorObjects/McEventCollection.h"
+#include "InDetSimData/InDetSimData.h"
+#include "InDetSimData/InDetSimDataCollection.h"
+
+// Framework includes
+#include "AthenaBaseComps/AthService.h"
+#include "AthenaBaseComps/AthAlgTool.h"
+#include "GaudiKernel/IAppMgrUI.h"
+#include "GaudiKernel/IJobOptionsSvc.h"
+#include "GaudiKernel/SmartIF.h"
+#include "GaudiKernel/SystemOfUnits.h"
+#include "GaudiKernel/PhysicalConstants.h"
+
+// Google Test
+#include "gtest/gtest.h"
+// Google Mock
+#include "gmock/gmock.h"
+
+
+namespace OverlayTesting {
+
+  // Athena Tool to emulate TRT_LocalOccupancy Tool
+  //
+  const std::string mockTRT_LocalOccupancyName = "OverlayTesting::MockTRT_LocalOccupancy/MyTestLocalOccupancy";
+
+  class MockTRT_LocalOccupancy : public extends<AthAlgTool, InDet::ITRT_LocalOccupancy> {
+  public:
+    /// constructor
+    MockTRT_LocalOccupancy(const std::string& type, const std::string& name, const IInterface* parent)
+      : base_class(type,name,parent)
+    { };
+
+    /// destructor
+    virtual ~MockTRT_LocalOccupancy() = default;
+
+    /** Return a map of the occupancy in the barrel (-1,+1) and endcaps (-2,+2) */
+    MOCK_CONST_METHOD1(getDetectorOccupancy, std::map<int, double>(const TRT_RDO_Container*) );
+
+    // Dummy methods to confirm status
+    virtual StatusCode initialize() override final {
+      ATH_MSG_INFO ("initializing MockTRT_LocalOccupancy: " << name());
+      return StatusCode::SUCCESS;
+    };
+
+    // dummy methods implementing in pure virtual interface methods (to make class non-abstract)
+    /** Return the local occupancy for the sectors crossed by a given track */
+    virtual float LocalOccupancy( const Trk::Track& ) const { return 1.0; }; // not used - dummy implementation
+    virtual float LocalOccupancy(const double, const double) const  { return 1.0; }; // not used - dummy implementation
+
+    /** Return the global occupancy of the event*/
+    virtual std::vector<float> GlobalOccupancy( ) const { std::vector<float> dummyVect{}; return dummyVect; }; // not used - dummy implementation
+  };
+
+  DECLARE_COMPONENT( MockTRT_LocalOccupancy )
+
+  // Athena Service to emulate TRT_StrawStatusSummaryTool
+  //
+  const std::string mockTRT_StrawStatusSummaryToolName = "OverlayTesting::MockTRT_StrawStatusSummaryTool/MyTestTRT_StrawStatusSummaryTool";
+  class MockTRT_StrawStatusSummaryTool : public extends<AthAlgTool, ITRT_StrawStatusSummaryTool> {
+  public:
+
+    /// constructor
+    MockTRT_StrawStatusSummaryTool(const std::string& type, const std::string& name, const IInterface* parent)
+      : base_class(type,name,parent)
+    { };
+
+    /// destructor
+    virtual ~MockTRT_StrawStatusSummaryTool() = default;
+
+    // Dummy methods to confirm status
+    virtual StatusCode initialize() override final {
+      ATH_MSG_INFO ("initializing MockTRT_StrawStatusSummaryTool: " << name());
+      return StatusCode::SUCCESS;
+    };
+
+    virtual int getStatus(const Identifier ) const { return 1; }; // not used - dummy implementation
+    virtual int getStatusPermanent(const Identifier) const { return 1; }; // not used - dummy implementation
+    MOCK_CONST_METHOD1(getStatusHT, int(const Identifier)); // This is the only method that we actually need! <--------------
+    virtual bool get_status(const Identifier) const { return false; }; // not used - dummy implementation
+    virtual bool get_statusHT(const Identifier) const { return false; }; // not used - dummy implementation
+    virtual const StrawStatusContainer* getStrawStatusHTContainer() const {return nullptr;}; // not used - dummy implementation
+
+    virtual int getStatus(const Identifier, const EventContext&  ) const { return 1; }; // not used - dummy implementation
+    virtual int getStatusPermanent(const Identifier, const EventContext& ) const { return 1; }; // not used - dummy implementation
+    virtual int getStatusHT(const Identifier, const EventContext& ) const { return 1; }; // not used - dummy implementation
+    virtual bool get_status(const Identifier, const EventContext& ) const { return false; }; // not used - dummy implementation
+    virtual bool get_statusHT(const Identifier, const EventContext& ) const { return false; }; // not used - dummy implementation
+
+  };
+
+  DECLARE_COMPONENT( MockTRT_StrawStatusSummaryTool )
+
+
+  // Gaudi Test fixture that provides a clean Gaudi environment for
+  // each individual test case
+  class GaudiFixture {
+
+  protected:
+    GaudiFixture() {
+      SetUpGaudi();
+    }
+
+    ~GaudiFixture() {
+      TearDownGaudi();
+    }
+
+    void SetUpGaudi() {
+      m_appMgr = Gaudi::createApplicationMgr();
+      ASSERT_TRUE( m_appMgr!=nullptr );
+
+      m_svcLoc = m_appMgr;
+      ASSERT_TRUE( m_svcLoc.isValid() );
+
+      m_svcMgr = m_appMgr;
+      ASSERT_TRUE( m_svcMgr.isValid() );
+
+      m_propMgr = m_appMgr;
+      ASSERT_TRUE( m_propMgr.isValid() );
+      ASSERT_TRUE( m_propMgr->setProperty( "EvtSel",         "NONE" ).isSuccess() );
+      ASSERT_TRUE( m_propMgr->setProperty( "JobOptionsType", "FILE" ).isSuccess() );
+      ASSERT_TRUE( m_propMgr->setProperty( "JobOptionsPath", "StoreGateTestCommon.txt" ).isSuccess() );
+
+      m_toolSvc = m_svcLoc->service("ToolSvc");
+      ASSERT_TRUE( m_toolSvc.isValid() );
+
+      ASSERT_TRUE( m_appMgr->configure().isSuccess() );
+      ASSERT_TRUE( m_appMgr->initialize().isSuccess() );
+
+      m_jobOptionsSvc = m_svcLoc->service("JobOptionsSvc");
+      ASSERT_TRUE( m_jobOptionsSvc.isValid() );
+    }
+
+    void TearDownGaudi() {
+      ASSERT_TRUE( m_svcMgr->finalize().isSuccess() );
+      ASSERT_TRUE( m_appMgr->finalize().isSuccess() );
+      ASSERT_TRUE( m_appMgr->terminate().isSuccess() );
+      m_svcLoc->release();
+      m_svcMgr->release();
+      Gaudi::setInstance( static_cast<IAppMgrUI*>(nullptr) );
+    }
+
+    // protected member variables for Core Gaudi components
+    IAppMgrUI*               m_appMgr = nullptr;
+    SmartIF<ISvcLocator>     m_svcLoc;
+    SmartIF<ISvcManager>     m_svcMgr;
+    SmartIF<IJobOptionsSvc>  m_jobOptionsSvc;
+    SmartIF<IToolSvc>        m_toolSvc;
+    SmartIF<IProperty>       m_propMgr;
+  };
+
+
+  class TRTOverlay_test : public ::testing::Test, public GaudiFixture {
+
+  protected:
+    virtual void SetUp() override {
+      // DetectorStore and ID Helper
+      StoreGateSvc *detStore(nullptr);
+      ASSERT_TRUE( m_svcLoc->service("DetectorStore", detStore, true).isSuccess() );
+      if (detStore) {
+        if (not detStore->contains<TRT_ID>("TRT_ID")) {
+          auto trt_id = std::make_unique<TRT_ID>();
+          IdDictParser parser;
+          parser.register_external_entity ("InnerDetector",
+                                           "IdDictInnerDetector.xml");
+          IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml");
+          trt_id->initialize_from_dictionary (idd);
+          ASSERT_TRUE( detStore->record (std::move (trt_id), "TRT_ID").isSuccess() );
+        }
+      }
+      ASSERT_TRUE( m_svcLoc->service("StoreGateSvc", m_sg, true).isSuccess() );
+
+      // the tested Algorithm
+      m_alg = new TRTOverlay{"TRTOverlay", m_svcLoc};
+      m_alg->addRef();
+      ASSERT_TRUE( m_alg->setProperties().isSuccess() );
+      // ordering B, A, C, D is on purpose to test for unintended alphabetic ordering
+      std::string        inputSigPropertyValue = "'StoreGateSvc+TRT_RDOs_SIG'";
+      std::string        inputBkgPropertyValue = "'StoreGateSvc+TRT_RDOs_BKG'";
+      std::string          outputPropertyValue = "'StoreGateSvc+TRT_RDOs'";
+      std::string     inputSigSDOPropertyValue = "'StoreGateSvc+TRT_SDO_Map_SIG'";
+      ASSERT_TRUE( m_alg->setProperty( "SignalInputKey",   inputSigPropertyValue).isSuccess() );
+      ASSERT_TRUE( m_alg->setProperty( "BkgInputKey",   inputBkgPropertyValue).isSuccess() );
+      ASSERT_TRUE( m_alg->setProperty( "OutputKey", outputPropertyValue).isSuccess() );
+      ASSERT_TRUE( m_alg->setProperty( "SignalInputSDOKey",   inputSigSDOPropertyValue).isSuccess() );
+      ASSERT_TRUE( m_alg->setProperty( "TRT_LocalOccupancyTool", mockTRT_LocalOccupancyName).isSuccess() );
+      ASSERT_TRUE( m_alg->setProperty( "TRTStrawSummaryTool", mockTRT_StrawStatusSummaryToolName).isSuccess() );
+    }
+
+    virtual void TearDown() override {
+      // let the Gaudi ServiceManager finalize all services
+      ASSERT_TRUE( m_svcMgr->finalize().isSuccess() );
+      ASSERT_TRUE( m_alg->finalize().isSuccess() );
+      delete m_alg;
+    }
+
+    template<typename T>
+    T* retrieveService(const std::string& name) {
+      T* service = nullptr;
+      SmartIF<IService>& serviceSmartPointer = m_svcLoc->service(name);
+      service = dynamic_cast<T*>(serviceSmartPointer.get());
+      EXPECT_NE(nullptr, service);
+      if(!service) {
+        return nullptr;
+      }
+      EXPECT_TRUE( service->setProperties().isSuccess() );
+      EXPECT_TRUE( service->configure().isSuccess() );
+      EXPECT_TRUE( m_svcMgr->addService(service).isSuccess() );
+      // assert that finalize() gets called once per test case
+      EXPECT_CALL( *service, finalize() )
+        .Times(1)
+        .WillOnce(::testing::Return(StatusCode::SUCCESS));
+
+      return service;
+    }
+
+    template<typename T>
+    T* retrieveTool(const std::string& name) {
+      IAlgTool* toolInterface = nullptr;
+      EXPECT_TRUE( m_toolSvc->retrieveTool(name, toolInterface).isSuccess() );
+      EXPECT_NE(nullptr, toolInterface);
+
+      T* tool = dynamic_cast<T*>(toolInterface);
+      EXPECT_NE(nullptr, tool);
+      if(!tool) {
+        return nullptr;
+      }
+
+      EXPECT_TRUE( tool->setProperties().isSuccess() );
+      EXPECT_TRUE( tool->configure().isSuccess() );
+
+      // assert that finalize() gets called once per test case
+      EXPECT_CALL( *tool, finalize() )
+        .Times(1)
+        .WillOnce(::testing::Return(StatusCode::SUCCESS));
+
+      return tool;
+    }
+
+    unsigned int encodeDigit(const std::vector<unsigned int>& bits)
+    {
+      unsigned digit(0);
+      const unsigned one(1);
+      for (unsigned int bit=0; bit < bits.size(); ++bit) {
+        if (bits[bit]==1) {
+          digit += one << (31-bit);
+        }
+      }
+      return digit;
+    }
+
+    bool initMcEventCollection(std::vector<HepMC::GenParticle*>& genPartList)
+    {
+      // create dummy input McEventCollection with a name that
+      // HepMcParticleLink knows about
+      SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"};
+      inputTestDataHandle = std::make_unique<McEventCollection>();
+      // Add a dummy GenEvent
+      const int process_id1(20);
+      const int event_number1(17);
+      inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1));
+      HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0));
+      populateGenEvent(ge1,-11,11,genPartList);
+      populateGenEvent(ge1,-13,13,genPartList);
+      populateGenEvent(ge1,-11,11,genPartList);
+      populateGenEvent(ge1,-13,13,genPartList);
+      populateGenEvent(ge1,-11,11,genPartList);
+      populateGenEvent(ge1,22,22,genPartList);
+      return true;
+    }
+
+    void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<HepMC::GenParticle*>& genPartList)
+    {
+      CLHEP::HepLorentzVector myPos( 0.0, 0.0, 0.0, 0.0);
+      HepMC::GenVertex *myVertex = new HepMC::GenVertex( myPos, -1 );
+      HepMC::FourVector fourMomentum1( 0.0, 0.0, 1.0, 1.0*CLHEP::TeV);
+      HepMC::GenParticle* inParticle1 = new HepMC::GenParticle(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);
+      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);
+      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);
+      myVertex->add_particle_out(inParticle4);
+      genPartList.push_back(inParticle4);
+      ge.add_vertex( myVertex );
+      ge.set_signal_process_vertex( myVertex );
+      ge.set_beam_particles(inParticle1,inParticle2);
+    }
+
+    void setPrivateToolPointers()
+    {
+      m_mockTRT_StrawStatusSummaryTool = dynamic_cast<OverlayTesting::MockTRT_StrawStatusSummaryTool*>(&*(m_alg->m_TRTStrawSummaryTool));
+      m_mockTRT_LocalOccupancy = dynamic_cast<OverlayTesting::MockTRT_LocalOccupancy*>(&*(m_alg->m_TRT_LocalOccupancyTool));
+    }
+    // the tested AthAlgorithm
+    TRTOverlay* m_alg{};
+
+    StoreGateSvc* m_sg{};
+    // mocked Athena components
+    OverlayTesting::MockTRT_LocalOccupancy* m_mockTRT_LocalOccupancy = nullptr;
+    OverlayTesting::MockTRT_StrawStatusSummaryTool* m_mockTRT_StrawStatusSummaryTool = nullptr;
+    const std::map<int, double> m_empty_occupancy = {{-2,0.0},{-1,0.0},{1,0.0},{2,0.0}};
+    const std::map<int, double> m_full_occupancy = {{-2,1.0},{-1,1.0},{1,1.0},{2,1.0}};
+  };   // TRTOverlay_test fixture
+
+
+  TEST_F(TRTOverlay_test, missing_inputs_alg_execute) {
+    EventContext ctx(0,0);
+    ctx.setExtension( Atlas::ExtendedEventContext( m_sg, 0 ) );
+    ASSERT_TRUE( m_alg->initialize().isSuccess() );
+    ASSERT_TRUE( m_alg->execute(ctx).isFailure() ); //inputs don't exist
+  }
+
+  TEST_F(TRTOverlay_test, empty_containers_alg_execute) {
+    EventContext ctx(0,0);
+    ctx.setExtension( Atlas::ExtendedEventContext( m_sg, 0 ) );
+    SG::WriteHandle<TRT_RDO_Container> inputSigDataHandle{"StoreGateSvc+TRT_RDOs_SIG"};
+    const unsigned int containerSize(19008);
+    inputSigDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    SG::WriteHandle<TRT_RDO_Container> inputBkgDataHandle{"StoreGateSvc+TRT_RDOs_BKG"};
+    inputBkgDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    SG::WriteHandle<InDetSimDataCollection> inputSigSDODataHandle{"StoreGateSvc+TRT_SDO_Map_SIG"};
+    inputSigSDODataHandle = std::make_unique<InDetSimDataCollection>();
+
+    ASSERT_TRUE( m_alg->initialize().isSuccess() );
+    setPrivateToolPointers();
+    EXPECT_CALL( *m_mockTRT_LocalOccupancy, getDetectorOccupancy(::testing::_) )
+      .Times(1)
+      .WillOnce(::testing::Return(m_full_occupancy));
+    ASSERT_TRUE( m_alg->execute(ctx).isSuccess() );
+    // check output makes sense
+    SG::ReadHandle<TRT_RDO_Container> outputDataHandle{"StoreGateSvc+TRT_RDOs"};
+    ASSERT_TRUE( outputDataHandle.isValid() );
+    ASSERT_EQ( outputDataHandle->numberOfCollections(), 0 );
+  }
+
+  TEST_F(TRTOverlay_test, containers_with_matching_empty_collections) {
+    EventContext ctx(0,0);
+    ctx.setExtension( Atlas::ExtendedEventContext( m_sg, 0 ) );
+    SG::WriteHandle<TRT_RDO_Container> inputSigDataHandle{"StoreGateSvc+TRT_RDOs_SIG"};
+    const unsigned int containerSize(19008);
+    IdentifierHash sigElementHash(10026);
+    IdentifierHash bkgElementHash(10026);
+    inputSigDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> sigCollection = std::make_unique<TRT_RDO_Collection>(sigElementHash);
+    ASSERT_TRUE(inputSigDataHandle->addCollection(sigCollection.get(),sigElementHash).isSuccess());
+    sigCollection.release(); // Now owned by inputSigDataHandle
+    SG::WriteHandle<TRT_RDO_Container> inputBkgDataHandle{"StoreGateSvc+TRT_RDOs_BKG"};
+    inputBkgDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> bkgCollection = std::make_unique<TRT_RDO_Collection>(bkgElementHash);
+    ASSERT_TRUE(inputBkgDataHandle->addCollection(bkgCollection.get(),bkgElementHash).isSuccess());
+    bkgCollection.release(); // Now owned by inputBkgDataHandle
+    SG::WriteHandle<InDetSimDataCollection> inputSigSDODataHandle{"StoreGateSvc+TRT_SDO_Map_SIG"};
+    inputSigSDODataHandle = std::make_unique<InDetSimDataCollection>();
+
+    ASSERT_TRUE( m_alg->initialize().isSuccess() );
+    setPrivateToolPointers();
+    EXPECT_CALL( *m_mockTRT_LocalOccupancy, getDetectorOccupancy(::testing::_) )
+      .Times(1)
+      .WillOnce(::testing::Return(m_full_occupancy));
+    ASSERT_TRUE( m_alg->execute(ctx).isSuccess() );
+    // check output makes sense
+    SG::ReadHandle<TRT_RDO_Container> outputDataHandle{"StoreGateSvc+TRT_RDOs"};
+    ASSERT_TRUE( outputDataHandle.isValid() );
+    ASSERT_EQ( outputDataHandle->numberOfCollections(),1 );
+    const TRT_RDO_Collection *outputCollection = outputDataHandle->indexFindPtr(sigElementHash);
+    ASSERT_NE( outputCollection, nullptr );
+    ASSERT_TRUE( outputCollection->empty() );
+  }
+
+  TEST_F(TRTOverlay_test, containers_with_different_empty_collections) {
+    EventContext ctx(0,0);
+    ctx.setExtension( Atlas::ExtendedEventContext( m_sg, 0 ) );
+    SG::WriteHandle<TRT_RDO_Container> inputSigDataHandle{"StoreGateSvc+TRT_RDOs_SIG"};
+    const unsigned int containerSize(19008);
+    IdentifierHash sigElementHash(10026);
+    IdentifierHash bkgElementHash(10025);
+    inputSigDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> sigCollection = std::make_unique<TRT_RDO_Collection>(sigElementHash);
+    ASSERT_TRUE(inputSigDataHandle->addCollection(sigCollection.get(),sigElementHash).isSuccess());
+    sigCollection.release(); // Now owned by inputSigDataHandle
+    SG::WriteHandle<TRT_RDO_Container> inputBkgDataHandle{"StoreGateSvc+TRT_RDOs_BKG"};
+    inputBkgDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> bkgCollection = std::make_unique<TRT_RDO_Collection>(bkgElementHash);
+    ASSERT_TRUE(inputBkgDataHandle->addCollection(bkgCollection.get(),bkgElementHash).isSuccess());
+    bkgCollection.release(); // Now owned by inputBkgDataHandle
+    SG::WriteHandle<InDetSimDataCollection> inputSigSDODataHandle{"StoreGateSvc+TRT_SDO_Map_SIG"};
+    inputSigSDODataHandle = std::make_unique<InDetSimDataCollection>();
+
+    ASSERT_TRUE( m_alg->initialize().isSuccess() );
+    setPrivateToolPointers();
+    EXPECT_CALL( *m_mockTRT_LocalOccupancy, getDetectorOccupancy(::testing::_) )
+      .Times(1)
+      .WillOnce(::testing::Return(m_full_occupancy));
+    ASSERT_TRUE( m_alg->execute(ctx).isSuccess() );
+    // check output makes sense
+    SG::ReadHandle<TRT_RDO_Container> outputDataHandle{"StoreGateSvc+TRT_RDOs"};
+    ASSERT_TRUE( outputDataHandle.isValid() );
+    ASSERT_EQ( outputDataHandle->numberOfCollections(), 2 );
+    const TRT_RDO_Collection *outputCollection1 = outputDataHandle->indexFindPtr(sigElementHash);
+    ASSERT_NE( outputCollection1, nullptr );
+    ASSERT_TRUE( outputCollection1->empty() );
+    const TRT_RDO_Collection *outputCollection2 = outputDataHandle->indexFindPtr(bkgElementHash);
+    ASSERT_NE( outputCollection2, nullptr );
+    ASSERT_TRUE( outputCollection2->empty() );
+  }
+
+  TEST_F(TRTOverlay_test, containers_with_matching_collections_one_with_an_RDO) {
+    EventContext ctx(0,0);
+    ctx.setExtension( Atlas::ExtendedEventContext( m_sg, 0 ) );
+    SG::WriteHandle<TRT_RDO_Container> inputSigDataHandle{"StoreGateSvc+TRT_RDOs_SIG"};
+    const unsigned int containerSize(19008);
+    const IdentifierHash sigElementHash(10026);
+    const IdentifierHash bkgElementHash(10026);
+    Identifier::value_type value = 0x1612282000000000;
+    Identifier sigStrawID = Identifier(value); //Digit ID 2229569 Digit 2147483696
+    const std::vector<unsigned int> sigBits = {
+      1, // overlay flag
+      0,0,0,0, // msb and unused bits - always zero
+      0, // leading HT bit - always zero
+      0,0,0,0,0,0,0,0, // LT bits for leading BC
+      0, // In-time HT bit
+      0,0,0,0,0,0,0,0, // LT bits for in-time BC
+      0, // trailing HT bit - always zero
+      0,0,1,1,0,0,0,0  // LT bits for trailing BC (last 4 LT bits always zero)
+    };
+    const unsigned int sigWord = encodeDigit(sigBits);
+    const unsigned int checkWord(2147483696); //10000000000000000000000000110000
+    ASSERT_EQ( sigWord, checkWord ); // Cross-check of encodeDigit function
+    inputSigDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> sigCollection = std::make_unique<TRT_RDO_Collection>(sigElementHash);
+    //Add a TRT_LoLumRawData object
+    std::unique_ptr<TRT_LoLumRawData> sigDigit = std::make_unique<TRT_LoLumRawData>(sigStrawID,sigWord);
+    const auto sigHT=sigDigit->highLevel();
+    const auto sigTOT=sigDigit->timeOverThreshold();
+    const auto sigDriftTimeBin=sigDigit->driftTimeBin();
+    sigCollection->push_back(sigDigit.release());
+    ASSERT_TRUE(inputSigDataHandle->addCollection(sigCollection.get(),sigElementHash).isSuccess());
+    sigCollection.release(); // Now owned by inputSigDataHandle
+    SG::WriteHandle<TRT_RDO_Container> inputBkgDataHandle{"StoreGateSvc+TRT_RDOs_BKG"};
+    inputBkgDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> bkgCollection = std::make_unique<TRT_RDO_Collection>(bkgElementHash);
+    ASSERT_TRUE(inputBkgDataHandle->addCollection(bkgCollection.get(),bkgElementHash).isSuccess());
+    bkgCollection.release(); // Now owned by inputBkgDataHandle
+    SG::WriteHandle<InDetSimDataCollection> inputSigSDODataHandle{"StoreGateSvc+TRT_SDO_Map_SIG"};
+    inputSigSDODataHandle = std::make_unique<InDetSimDataCollection>();
+
+    ASSERT_TRUE( m_alg->initialize().isSuccess() );
+    setPrivateToolPointers();
+    EXPECT_CALL( *m_mockTRT_LocalOccupancy, getDetectorOccupancy(::testing::_) )
+      .Times(1)
+      .WillOnce(::testing::Return(m_full_occupancy));
+    ASSERT_TRUE( m_alg->execute(ctx).isSuccess() );
+    // check output makes sense
+    SG::ReadHandle<TRT_RDO_Container> outputDataHandle{"StoreGateSvc+TRT_RDOs"};
+    ASSERT_TRUE( outputDataHandle.isValid() );
+    ASSERT_EQ( outputDataHandle->numberOfCollections(), 1 );
+    const TRT_RDO_Collection *outputCollection1 = outputDataHandle->indexFindPtr(sigElementHash);
+    ASSERT_NE( outputCollection1, nullptr );
+    ASSERT_EQ( outputCollection1->size(), 1 );
+    const TRT_LoLumRawData* outputDigit1 = dynamic_cast<const TRT_LoLumRawData*>(outputCollection1->at(0));
+    ASSERT_NE( outputDigit1, nullptr );
+    ASSERT_EQ( outputDigit1->highLevel(), sigHT );
+    ASSERT_EQ( outputDigit1->timeOverThreshold(), sigTOT );
+    ASSERT_EQ( outputDigit1->driftTimeBin(), sigDriftTimeBin );
+  }
+
+  TEST_F(TRTOverlay_test, containers_with_different_collections_one_RDO_each) {
+    EventContext ctx(0,0);
+    ctx.setExtension( Atlas::ExtendedEventContext( m_sg, 0 ) );
+    SG::WriteHandle<TRT_RDO_Container> inputSigDataHandle{"StoreGateSvc+TRT_RDOs_SIG"};
+    const unsigned int containerSize(19008);
+    const IdentifierHash sigElementHash(10026);
+    const Identifier::value_type sigValue = 0x1612282000000000;
+    const Identifier sigStrawID = Identifier(sigValue);
+    const std::vector<unsigned int> sigBits = {
+      1, // overlay flag
+      0,0,0,0, // msb and unused bits - always zero
+      0, // leading HT bit - always zero
+      0,0,0,0,0,0,0,0, // LT bits for leading BC
+      0, // In-time HT bit
+      0,0,0,0,0,0,0,0, // LT bits for in-time BC
+      0, // trailing HT bit - always zero
+      0,0,1,1,0,0,0,0  // LT bits for trailing BC (last 4 LT bits always zero)
+    };
+    const unsigned int sigWord = encodeDigit(sigBits);
+    inputSigDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> sigCollection = std::make_unique<TRT_RDO_Collection>(sigElementHash);
+    //Add a TRT_LoLumRawData object
+    std::unique_ptr<TRT_LoLumRawData> sigDigit = std::make_unique<TRT_LoLumRawData>(sigStrawID,sigWord);
+    const auto sigHT=sigDigit->highLevel();
+    const auto sigTOT=sigDigit->timeOverThreshold();
+    const auto sigDriftTimeBin=sigDigit->driftTimeBin();
+    sigCollection->push_back(sigDigit.release());
+    ASSERT_TRUE(inputSigDataHandle->addCollection(sigCollection.get(),sigElementHash).isSuccess());
+    sigCollection.release(); // Now owned by inputSigDataHandle
+    SG::WriteHandle<TRT_RDO_Container> inputBkgDataHandle{"StoreGateSvc+TRT_RDOs_BKG"};
+    const IdentifierHash bkgElementHash(10027);
+    const Identifier::value_type bkgValue = 0x16122ce000000000;
+    const Identifier bkgStrawID = Identifier(bkgValue);
+    const std::vector<unsigned int> bkgBits = {
+      1, // overlay flag
+      0,0,0,0, // msb and unused bits - always zero
+      0, // leading HT bit - always zero
+      0,0,0,0,0,0,0,0, // LT bits for leading BC
+      0, // In-time HT bit
+      0,0,0,1,1,1,1,1, // LT bits for in-time BC
+      0, // trailing HT bit - always zero
+      1,1,0,0,0,0,0,0  // LT bits for trailing BC (last 4 LT bits always zero)
+    };
+    const unsigned int bkgWord = encodeDigit(bkgBits);
+    inputBkgDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> bkgCollection = std::make_unique<TRT_RDO_Collection>(bkgElementHash);
+    //Add a TRT_LoLumRawData object
+    std::unique_ptr<TRT_LoLumRawData> bkgDigit = std::make_unique<TRT_LoLumRawData>(bkgStrawID,bkgWord);
+    const auto bkgHT=bkgDigit->highLevel();
+    const auto bkgTOT=bkgDigit->timeOverThreshold();
+    const auto bkgDriftTimeBin=bkgDigit->driftTimeBin();
+    bkgCollection->push_back(bkgDigit.release());
+    ASSERT_TRUE(inputBkgDataHandle->addCollection(bkgCollection.get(),bkgElementHash).isSuccess());
+    bkgCollection.release(); // Now owned by inputBkgDataHandle
+    SG::WriteHandle<InDetSimDataCollection> inputSigSDODataHandle{"StoreGateSvc+TRT_SDO_Map_SIG"};
+    inputSigSDODataHandle = std::make_unique<InDetSimDataCollection>();
+
+    ASSERT_TRUE( m_alg->initialize().isSuccess() );
+    setPrivateToolPointers();
+    EXPECT_CALL( *m_mockTRT_LocalOccupancy, getDetectorOccupancy(::testing::_) )
+      .Times(1)
+      .WillOnce(::testing::Return(m_full_occupancy));
+    ASSERT_TRUE( m_alg->execute(ctx).isSuccess() );
+    // check output makes sense
+    SG::ReadHandle<TRT_RDO_Container> outputDataHandle{"StoreGateSvc+TRT_RDOs"};
+    ASSERT_TRUE( outputDataHandle.isValid() );
+    const TRT_RDO_Collection *outputCollection1 = outputDataHandle->indexFindPtr(sigElementHash);
+    ASSERT_NE( outputCollection1, nullptr );
+    ASSERT_EQ( outputCollection1->size(), 1 );
+    const TRT_LoLumRawData* outputDigit1 = dynamic_cast<const TRT_LoLumRawData*>(outputCollection1->at(0));
+    ASSERT_NE( outputDigit1, nullptr );
+    ASSERT_EQ( outputDigit1->highLevel(), sigHT );
+    ASSERT_EQ( outputDigit1->timeOverThreshold(), sigTOT );
+    ASSERT_EQ( outputDigit1->driftTimeBin(), sigDriftTimeBin );
+    const TRT_RDO_Collection *outputCollection2 = outputDataHandle->indexFindPtr(bkgElementHash);
+    ASSERT_NE( outputCollection2, nullptr );
+    ASSERT_EQ( outputCollection2->size(), 1 );
+    const TRT_LoLumRawData* outputDigit2 = dynamic_cast<const TRT_LoLumRawData*>(outputCollection2->at(0));
+    ASSERT_NE( outputDigit2, nullptr );
+    ASSERT_EQ( outputDigit2->highLevel(), bkgHT );
+    ASSERT_EQ( outputDigit2->timeOverThreshold(), bkgTOT );
+    ASSERT_EQ( outputDigit2->driftTimeBin(), bkgDriftTimeBin );
+  }
+
+  TEST_F(TRTOverlay_test, containers_with_matching_collections_with_matching_RDOs) {
+    EventContext ctx(0,0);
+    ctx.setExtension( Atlas::ExtendedEventContext( m_sg, 0 ) );
+    SG::WriteHandle<TRT_RDO_Container> inputSigDataHandle{"StoreGateSvc+TRT_RDOs_SIG"};
+    const unsigned int containerSize(19008);
+    const IdentifierHash sigElementHash(10027);
+    const Identifier::value_type sigValue = 0x16122ce000000000;
+    const Identifier sigStrawID = Identifier(sigValue);
+    const std::vector<unsigned int> sigBits = {
+      1, // overlay flag
+      0,0,0,0, // msb and unused bits - always zero
+      0, // leading HT bit - always zero
+      0,0,0,0,0,0,0,0, // LT bits for leading BC
+      0, // In-time HT bit
+      0,0,0,1,1,1,1,1, // LT bits for in-time BC
+      0, // trailing HT bit - always zero
+      1,1,0,0,0,0,0,0  // LT bits for trailing BC (last 4 LT bits always zero)
+    };
+    const unsigned int sigWord = encodeDigit(sigBits);
+    inputSigDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> sigCollection = std::make_unique<TRT_RDO_Collection>(sigElementHash);
+    //Add a TRT_LoLumRawData object
+    std::unique_ptr<TRT_LoLumRawData> sigDigit = std::make_unique<TRT_LoLumRawData>(sigStrawID,sigWord);
+    const auto sigHT=sigDigit->highLevel();
+    const auto sigTOT=sigDigit->timeOverThreshold();
+    const auto sigDriftTimeBin=sigDigit->driftTimeBin();
+    sigCollection->push_back(sigDigit.release());
+    ASSERT_TRUE(inputSigDataHandle->addCollection(sigCollection.get(),sigElementHash).isSuccess());
+    sigCollection.release(); // Now owned by inputSigDataHandle
+    SG::WriteHandle<TRT_RDO_Container> inputBkgDataHandle{"StoreGateSvc+TRT_RDOs_BKG"};
+    inputBkgDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> bkgCollection = std::make_unique<TRT_RDO_Collection>(sigElementHash);
+    //Add a TRT_LoLumRawData object
+    std::unique_ptr<TRT_LoLumRawData> bkgDigit = std::make_unique<TRT_LoLumRawData>(sigStrawID,sigWord);
+    bkgCollection->push_back(bkgDigit.release());
+    ASSERT_TRUE(inputBkgDataHandle->addCollection(bkgCollection.get(),sigElementHash).isSuccess());
+    bkgCollection.release(); // Now owned by inputBkgDataHandle
+
+    std::vector<HepMC::GenParticle*> genPartList;
+    initMcEventCollection(genPartList);
+    SG::WriteHandle<InDetSimDataCollection> inputSigSDODataHandle{"StoreGateSvc+TRT_SDO_Map_SIG"};
+    inputSigSDODataHandle = std::make_unique<InDetSimDataCollection>();
+    const HepMC::GenParticle* pGenParticle = genPartList.at(0);
+    HepMcParticleLink trkLink(pGenParticle->barcode(),pGenParticle->parent_event()->event_number());
+    InDetSimData::Deposit deposit( trkLink, 0.0 );
+    std::vector<InDetSimData::Deposit> depositVector(1);
+    depositVector.push_back(deposit);
+    inputSigSDODataHandle->insert(std::make_pair(sigStrawID, InDetSimData(depositVector)));
+
+    ASSERT_TRUE( m_alg->initialize().isSuccess() );
+    setPrivateToolPointers();
+    EXPECT_CALL( *m_mockTRT_LocalOccupancy, getDetectorOccupancy(::testing::_) )
+      .Times(1)
+      .WillOnce(::testing::Return(m_full_occupancy));
+    ASSERT_TRUE( m_alg->execute(ctx).isSuccess() );
+    // check output makes sense
+    SG::ReadHandle<TRT_RDO_Container> outputDataHandle{"StoreGateSvc+TRT_RDOs"};
+    ASSERT_TRUE( outputDataHandle.isValid() );
+    const TRT_RDO_Collection *outputCollection1 = outputDataHandle->indexFindPtr(sigElementHash);
+    ASSERT_NE( outputCollection1, nullptr );
+    ASSERT_EQ( outputCollection1->size(), 1 );
+    const TRT_LoLumRawData* outputDigit1 = dynamic_cast<const TRT_LoLumRawData*>(outputCollection1->at(0));
+    ASSERT_NE( outputDigit1, nullptr );
+    ASSERT_EQ( outputDigit1->highLevel(), sigHT );
+    ASSERT_EQ( outputDigit1->timeOverThreshold(), sigTOT );
+    ASSERT_EQ( outputDigit1->driftTimeBin(), sigDriftTimeBin );
+  }
+
+  TEST_F(TRTOverlay_test, containers_with_matching_collections_with_differing_RDOs_same_strawID) {
+    EventContext ctx(0,0);
+    ctx.setExtension( Atlas::ExtendedEventContext( m_sg, 0 ) );
+    SG::WriteHandle<TRT_RDO_Container> inputSigDataHandle{"StoreGateSvc+TRT_RDOs_SIG"};
+    const unsigned int containerSize(19008);
+    const IdentifierHash sigElementHash(10027);
+    const Identifier::value_type sigValue = 0x16122ce000000000;
+    const Identifier sigStrawID = Identifier(sigValue);
+    const std::vector<unsigned int> sigBits = {
+      1, // overlay flag
+      0,0,0,0, // msb and unused bits - always zero
+      0, // leading HT bit - always zero
+      0,0,0,0,0,0,1,1, // LT bits for leading BC
+      1, // In-time HT bit
+      1,1,1,1,1,1,1,1, // LT bits for in-time BC
+      0, // trailing HT bit - always zero
+      1,1,1,1,0,0,0,0  // LT bits for trailing BC (last 4 LT bits always zero)
+    };
+
+    const unsigned int sigWord = encodeDigit(sigBits);
+    const std::vector<unsigned int> bkgBits = {
+      0, // overlay flag
+      0,0,0,0, // msb and unused bits - always zero
+      0, // leading HT bit - always zero
+      0,0,0,0,0,1,1,1, // LT bits for leading BC
+      1, // In-time HT bit
+      1,1,1,1,0,0,0,0, // LT bits for in-time BC
+      0, // trailing HT bit - always zero
+      0,0,0,0,0,0,0,0  // LT bits for trailing BC (last 4 LT bits always zero)
+    };
+    const unsigned int bkgWord = encodeDigit(bkgBits);
+    inputSigDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> sigCollection = std::make_unique<TRT_RDO_Collection>(sigElementHash);
+    //Add a TRT_LoLumRawData object
+    std::unique_ptr<TRT_LoLumRawData> sigDigit = std::make_unique<TRT_LoLumRawData>(sigStrawID,sigWord);
+    const auto sigHT=sigDigit->highLevel();
+    sigCollection->push_back(sigDigit.release());
+    ASSERT_TRUE(inputSigDataHandle->addCollection(sigCollection.get(),sigElementHash).isSuccess());
+    sigCollection.release(); // Now owned by inputSigDataHandle
+    SG::WriteHandle<TRT_RDO_Container> inputBkgDataHandle{"StoreGateSvc+TRT_RDOs_BKG"};
+    inputBkgDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> bkgCollection = std::make_unique<TRT_RDO_Collection>(sigElementHash);
+    //Add a TRT_LoLumRawData object
+    std::unique_ptr<TRT_LoLumRawData> bkgDigit = std::make_unique<TRT_LoLumRawData>(sigStrawID,bkgWord);
+    bkgCollection->push_back(bkgDigit.release());
+    ASSERT_TRUE(inputBkgDataHandle->addCollection(bkgCollection.get(),sigElementHash).isSuccess());
+    bkgCollection.release(); // Now owned by inputBkgDataHandle
+
+    std::vector<unsigned int> outBits(32,0);
+    for(unsigned int i=0; i<32; ++i) {
+      outBits[i]=std::max(sigBits[i], bkgBits[i]);
+    }
+    const unsigned int outWord = encodeDigit(outBits);
+    const double outputTOT = TRT_LoLumRawData::timeOverThreshold(outWord);
+    const unsigned int outputDriftTimeBin = TRT_LoLumRawData::driftTimeBin(outWord);
+
+    std::vector<HepMC::GenParticle*> genPartList;
+    initMcEventCollection(genPartList);
+    SG::WriteHandle<InDetSimDataCollection> inputSigSDODataHandle{"StoreGateSvc+TRT_SDO_Map_SIG"};
+    inputSigSDODataHandle = std::make_unique<InDetSimDataCollection>();
+    const HepMC::GenParticle* pGenParticle = genPartList.at(0);
+    HepMcParticleLink trkLink(pGenParticle->barcode(),pGenParticle->parent_event()->event_number());
+    InDetSimData::Deposit deposit( trkLink, 0.0 );
+    std::vector<InDetSimData::Deposit> depositVector(1);
+    depositVector.push_back(deposit);
+    inputSigSDODataHandle->insert(std::make_pair(sigStrawID, InDetSimData(depositVector)));
+
+    ASSERT_TRUE( m_alg->initialize().isSuccess() );
+    setPrivateToolPointers();
+    EXPECT_CALL( *m_mockTRT_LocalOccupancy, getDetectorOccupancy(::testing::_) )
+      .Times(1)
+      .WillOnce(::testing::Return(m_full_occupancy));
+    ASSERT_TRUE( m_alg->execute(ctx).isSuccess() );
+    // check output makes sense
+    SG::ReadHandle<TRT_RDO_Container> outputDataHandle{"StoreGateSvc+TRT_RDOs"};
+    ASSERT_TRUE( outputDataHandle.isValid() );
+    const TRT_RDO_Collection *outputCollection1 = outputDataHandle->indexFindPtr(sigElementHash);
+    ASSERT_NE( outputCollection1, nullptr );
+    ASSERT_EQ( outputCollection1->size(), 1 );
+    const TRT_LoLumRawData* outputDigit1 = dynamic_cast<const TRT_LoLumRawData*>(outputCollection1->at(0));
+    ASSERT_NE( outputDigit1, nullptr );
+    ASSERT_EQ( outputDigit1->highLevel(), sigHT );
+    ASSERT_EQ( outputDigit1->timeOverThreshold(), outputTOT );
+    ASSERT_EQ( outputDigit1->driftTimeBin(), outputDriftTimeBin );
+  }
+
+  TEST_F(TRTOverlay_test, containers_with_matching_collections_with_differing_LT_RDOs_same_strawID) {
+
+    EventContext ctx(0,0);
+    ctx.setExtension( Atlas::ExtendedEventContext( m_sg, 0 ) );
+    SG::WriteHandle<TRT_RDO_Container> inputSigDataHandle{"StoreGateSvc+TRT_RDOs_SIG"};
+    const unsigned int containerSize(19008);
+    const IdentifierHash sigElementHash(10027);
+    const Identifier::value_type sigValue = 0x16122ce000000000;
+    const Identifier sigStrawID = Identifier(sigValue);
+    const std::vector<unsigned int> sigBits = {
+      0, // overlay flag
+      0,0,0,0, // msb and unused bits - always zero
+      0, // leading HT bit - always zero
+      0,0,0,0,0,0,1,1, // LT bits for leading BC
+      0, // In-time HT bit
+      1,1,1,1,1,1,1,1, // LT bits for in-time BC
+      0, // trailing HT bit - always zero
+      1,1,1,1,0,0,0,0  // LT bits for trailing BC (last 4 LT bits always zero)
+    };
+    const unsigned int sigWord = encodeDigit(sigBits);
+    // const std::vector<unsigned int> bkgBits = {
+    //   0,0,0,0,0, // msb and unused bits - always zero
+    //   0, // leading HT bit - always zero
+    //   1,1,1,1,1,1,1,1, // LT bits for leading BC
+    //   1, // In-time HT bit
+    //   1,1,1,1,0,0,0,0, // LT bits for in-time BC
+    //   0, // trailing HT bit - always zero
+    //   0,0,0,0,0,0,0,0  // LT bits for trailing BC (last 4 LT bits always zero)
+    // };
+    const std::vector<unsigned int> bkgBits = {
+      0, // overlay flag
+      0,0,0,0, // msb and unused bits - always zero
+      0, // leading HT bit - always zero
+      0,0,0,0,0,1,1,1, // LT bits for leading BC
+      0, // In-time HT bit
+      1,1,1,1,0,0,0,0, // LT bits for in-time BC
+      0, // trailing HT bit - always zero
+      0,0,0,0,0,0,0,0  // LT bits for trailing BC (last 4 LT bits always zero)
+    };
+    const unsigned int bkgWord = encodeDigit(bkgBits);
+    inputSigDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> sigCollection = std::make_unique<TRT_RDO_Collection>(sigElementHash);
+    //Add a TRT_LoLumRawData object
+    std::unique_ptr<TRT_LoLumRawData> sigDigit = std::make_unique<TRT_LoLumRawData>(sigStrawID,sigWord);
+    const auto sigHT=sigDigit->highLevel();
+    sigCollection->push_back(sigDigit.release());
+    ASSERT_TRUE(inputSigDataHandle->addCollection(sigCollection.get(),sigElementHash).isSuccess());
+    sigCollection.release(); // Now owned by inputSigDataHandle
+    SG::WriteHandle<TRT_RDO_Container> inputBkgDataHandle{"StoreGateSvc+TRT_RDOs_BKG"};
+    inputBkgDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> bkgCollection = std::make_unique<TRT_RDO_Collection>(sigElementHash);
+    //Add a TRT_LoLumRawData object
+    std::unique_ptr<TRT_LoLumRawData> bkgDigit = std::make_unique<TRT_LoLumRawData>(sigStrawID,bkgWord);
+    bkgCollection->push_back(bkgDigit.release());
+    ASSERT_TRUE(inputBkgDataHandle->addCollection(bkgCollection.get(),sigElementHash).isSuccess());
+    bkgCollection.release(); // Now owned by inputBkgDataHandle
+
+    std::vector<unsigned int> outBits(32,0);
+    for(unsigned int i=0; i<32; ++i) {
+      outBits[i]=std::max(sigBits[i], bkgBits[i]);
+    }
+    const unsigned int outWord = encodeDigit(outBits);
+    const double outputTOT = TRT_LoLumRawData::timeOverThreshold(outWord);
+    const unsigned int outputDriftTimeBin = TRT_LoLumRawData::driftTimeBin(outWord);
+
+    std::vector<HepMC::GenParticle*> genPartList;
+    initMcEventCollection(genPartList);
+    SG::WriteHandle<InDetSimDataCollection> inputSigSDODataHandle{"StoreGateSvc+TRT_SDO_Map_SIG"};
+    inputSigSDODataHandle = std::make_unique<InDetSimDataCollection>();
+    const HepMC::GenParticle* pGenParticle = genPartList.at(0);
+    HepMcParticleLink trkLink(pGenParticle->barcode(),pGenParticle->parent_event()->event_number());
+    ASSERT_EQ(trkLink.cptr()->pdg_id(), -11); // Sanity check to confirm that we are linking to a positron as expected
+    InDetSimData::Deposit deposit( trkLink, 0.0 );
+    std::vector<InDetSimData::Deposit> depositVector(1);
+    depositVector.push_back(deposit);
+    inputSigSDODataHandle->insert(std::make_pair(sigStrawID, InDetSimData(depositVector)));
+    ASSERT_TRUE( m_alg->initialize().isSuccess() );
+    setPrivateToolPointers();
+    EXPECT_CALL( *m_mockTRT_StrawStatusSummaryTool, getStatusHT(::testing::_) )
+      .Times(1)
+      .WillOnce(::testing::Return(TRTCond::StrawStatus::Good));
+    EXPECT_CALL( *m_mockTRT_LocalOccupancy, getDetectorOccupancy(::testing::_) )
+      .Times(1)
+      .WillOnce(::testing::Return(m_full_occupancy));
+    ASSERT_TRUE( m_alg->execute(ctx).isSuccess() );
+    // check output makes sense
+    SG::ReadHandle<TRT_RDO_Container> outputDataHandle{"StoreGateSvc+TRT_RDOs"};
+    ASSERT_TRUE( outputDataHandle.isValid() );
+    const TRT_RDO_Collection *outputCollection1 = outputDataHandle->indexFindPtr(sigElementHash);
+    ASSERT_NE( outputCollection1, nullptr );
+    ASSERT_EQ( outputCollection1->size(), 1 );
+    const TRT_LoLumRawData* outputDigit1 = dynamic_cast<const TRT_LoLumRawData*>(outputCollection1->at(0));
+    ASSERT_NE( outputDigit1, nullptr );
+    ASSERT_EQ( outputDigit1->highLevel(), sigHT );
+    ASSERT_EQ( outputDigit1->timeOverThreshold(), outputTOT );
+    ASSERT_EQ( outputDigit1->driftTimeBin(), outputDriftTimeBin );
+  }
+
+  TEST_F(TRTOverlay_test, containers_with_matching_collections_with_differing_LT_RDOs_same_strawID_ForceHTbit) {
+
+    EventContext ctx(0,0);
+    ctx.setExtension( Atlas::ExtendedEventContext( m_sg, 0 ) );
+    SG::WriteHandle<TRT_RDO_Container> inputSigDataHandle{"StoreGateSvc+TRT_RDOs_SIG"};
+    const unsigned int containerSize(19008);
+    const IdentifierHash sigElementHash(10027);
+    const Identifier::value_type sigValue = 0x16122ce000000000;
+    const Identifier sigStrawID = Identifier(sigValue);
+    const std::vector<unsigned int> sigBits = {
+      0, // overlay flag
+      0,0,0,0, // msb and unused bits - always zero
+      0, // leading HT bit - always zero
+      0,0,0,0,0,0,1,1, // LT bits for leading BC
+      0, // In-time HT bit
+      1,1,1,1,1,1,1,1, // LT bits for in-time BC
+      0, // trailing HT bit - always zero
+      1,1,1,1,0,0,0,0  // LT bits for trailing BC (last 4 LT bits always zero)
+    };
+    const unsigned int sigWord = encodeDigit(sigBits);
+
+    const std::vector<unsigned int> bkgBits = {
+      0, // overlay flag
+      0,0,0,0, // msb and unused bits - always zero
+      0, // leading HT bit - always zero
+      0,0,0,0,0,1,1,1, // LT bits for leading BC
+      0, // In-time HT bit
+      1,1,1,1,0,0,0,0, // LT bits for in-time BC
+      0, // trailing HT bit - always zero
+      0,0,0,0,0,0,0,0  // LT bits for trailing BC (last 4 LT bits always zero)
+    };
+    const unsigned int bkgWord = encodeDigit(bkgBits);
+
+    std::vector<unsigned int> outBits(32,0);
+    for(unsigned int i=0; i<32; ++i) {
+      outBits[i]=std::max(sigBits[i], bkgBits[i]);
+    }
+    outBits[17]=1;    // force in-time HT bit to be true
+
+    const unsigned int outWord = encodeDigit(outBits);
+    const double outputTOT = TRT_LoLumRawData::timeOverThreshold(outWord);
+    const unsigned int outputDriftTimeBin = TRT_LoLumRawData::driftTimeBin(outWord);
+
+    inputSigDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> sigCollection = std::make_unique<TRT_RDO_Collection>(sigElementHash);
+    //Add a TRT_LoLumRawData object
+    std::unique_ptr<TRT_LoLumRawData> sigDigit = std::make_unique<TRT_LoLumRawData>(sigStrawID,sigWord);
+    sigCollection->push_back(sigDigit.release());
+    ASSERT_TRUE(inputSigDataHandle->addCollection(sigCollection.get(),sigElementHash).isSuccess());
+    sigCollection.release(); // Now owned by inputSigDataHandle
+    SG::WriteHandle<TRT_RDO_Container> inputBkgDataHandle{"StoreGateSvc+TRT_RDOs_BKG"};
+    inputBkgDataHandle = std::make_unique<TRT_RDO_Container>(containerSize);
+    std::unique_ptr<TRT_RDO_Collection> bkgCollection = std::make_unique<TRT_RDO_Collection>(sigElementHash);
+    //Add a TRT_LoLumRawData object
+    std::unique_ptr<TRT_LoLumRawData> bkgDigit = std::make_unique<TRT_LoLumRawData>(sigStrawID,bkgWord);
+    bkgCollection->push_back(bkgDigit.release());
+    ASSERT_TRUE(inputBkgDataHandle->addCollection(bkgCollection.get(),sigElementHash).isSuccess());
+    bkgCollection.release(); // Now owned by inputBkgDataHandle
+
+    std::vector<HepMC::GenParticle*> genPartList;
+    initMcEventCollection(genPartList);
+    SG::WriteHandle<InDetSimDataCollection> inputSigSDODataHandle{"StoreGateSvc+TRT_SDO_Map_SIG"};
+    inputSigSDODataHandle = std::make_unique<InDetSimDataCollection>();
+    const HepMC::GenParticle* pGenParticle = genPartList.at(0);
+    HepMcParticleLink trkLink(pGenParticle->barcode(),pGenParticle->parent_event()->event_number());
+    ASSERT_EQ(trkLink.cptr()->pdg_id(), -11); // Sanity check to confirm that we are linking to a positron as expected
+    InDetSimData::Deposit deposit( trkLink, 0.0 );
+    std::vector<InDetSimData::Deposit> depositVector(1);
+    depositVector.push_back(deposit);
+    inputSigSDODataHandle->insert(std::make_pair(sigStrawID, InDetSimData(depositVector)));
+
+    // Override Occupancy correction, so that HT bit will always be set
+    ASSERT_TRUE( m_alg->setProperty( "TRT_HT_OccupancyCorrectionBarrel", 1.0).isSuccess() );
+    ASSERT_TRUE( m_alg->setProperty( "TRT_HT_OccupancyCorrectionEndcap", 1.0).isSuccess() );
+    ASSERT_TRUE( m_alg->initialize().isSuccess() );
+    setPrivateToolPointers();
+    EXPECT_CALL( *m_mockTRT_StrawStatusSummaryTool, getStatusHT(::testing::_) )
+      .Times(1)
+      .WillOnce(::testing::Return(TRTCond::StrawStatus::Good));
+    EXPECT_CALL( *m_mockTRT_LocalOccupancy, getDetectorOccupancy(::testing::_) )
+      .Times(1)
+      .WillOnce(::testing::Return(m_full_occupancy));
+    ASSERT_TRUE( m_alg->execute(ctx).isSuccess() );
+
+    // check output makes sense
+    SG::ReadHandle<TRT_RDO_Container> outputDataHandle{"StoreGateSvc+TRT_RDOs"};
+    ASSERT_TRUE( outputDataHandle.isValid() );
+    const TRT_RDO_Collection *outputCollection1 = outputDataHandle->indexFindPtr(sigElementHash);
+    ASSERT_NE( outputCollection1, nullptr );
+    ASSERT_EQ( outputCollection1->size(), 1 );
+    const TRT_LoLumRawData* outputDigit1 = dynamic_cast<const TRT_LoLumRawData*>(outputCollection1->at(0));
+    ASSERT_NE( outputDigit1, nullptr );
+    ASSERT_EQ( outputDigit1->highLevel(), true );
+    ASSERT_EQ( outputDigit1->timeOverThreshold(), outputTOT );
+    ASSERT_EQ( outputDigit1->driftTimeBin(), outputDriftTimeBin );
+  }
+
+} // <-- namespace OverlayTesting
+
+
+int main(int argc, char *argv[])
+{
+  ::testing::InitGoogleTest( &argc, argv );
+
+  //return RUN_ALL_TESTS();
+  // if the above gets stuck forever while trying to finalize Boost stuff
+  // inside SGTools, try to use the following:
+  // skips proper finalization:
+  std::quick_exit( RUN_ALL_TESTS() );
+}
diff --git a/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool.h b/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool.h
index 1f5483216a5caaf849f41a6938374c9a3cd2f528..4e6fbbe456a5b3049cb06a52bd3e6ffe924e62b1 100755
--- a/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool.h
+++ b/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool.h
@@ -1,7 +1,7 @@
 // -*- C++ -*-
 
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -57,7 +57,8 @@ namespace InDet
     /** standard Athena-Algorithm method */
     virtual StatusCode finalize() override;
 
-    virtual std::tuple<Trk::Track*,bool> getCleanedOutTrack(const Trk::Track *track, const Trk::TrackScore score, Trk::PRDtoTrackMap &prd_to_track_map) const override;
+    virtual std::tuple<Trk::Track*,bool> getCleanedOutTrack ATLAS_NOT_THREAD_SAFE
+      (const Trk::Track *track, const Trk::TrackScore score, Trk::PRDtoTrackMap &prd_to_track_map) const override;
 
   private:
       
diff --git a/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool/InDetDenseEnvAmbiTrackSelectionTool.h b/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool/InDetDenseEnvAmbiTrackSelectionTool.h
index 4a8ce5c7fefc99016021699a390b7af2ec269cc4..062edc8c302d69cb1fbb2ffb94549edd2c47fa65 100755
--- a/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool/InDetDenseEnvAmbiTrackSelectionTool.h
+++ b/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool/InDetDenseEnvAmbiTrackSelectionTool.h
@@ -28,6 +28,8 @@
 #include "TrkToolInterfaces/IPRDtoTrackMapTool.h"
 #include "TrkEventUtils/PRDtoTrackMap.h"
 
+#include "CxxUtils/checker_macros.h"
+
 #include "GaudiKernel/ToolHandle.h"
 
 #include <cmath> //for std::fabs in implementation of structs in this header
@@ -69,9 +71,10 @@ namespace InDet
     /** standard Athena-Algorithm method */
     virtual StatusCode finalize() override;
 
-    virtual std::tuple<Trk::Track*,bool> getCleanedOutTrack(const Trk::Track*,
-                                                            const Trk::TrackScore score,
-                                                            Trk::PRDtoTrackMap &prd_to_track_map) const override;
+    virtual std::tuple<Trk::Track*,bool> getCleanedOutTrack ATLAS_NOT_THREAD_SAFE
+      (const Trk::Track*,
+       const Trk::TrackScore score,
+       Trk::PRDtoTrackMap &prd_to_track_map) const override;
 
   private:
     
@@ -286,7 +289,7 @@ namespace InDet
                                CacheEntry* ent) const;
 
     /** Update the pixel clusters split information*/
-    void updatePixelClusterInformation(TSoS_Details& tsosDetails) const;
+    void updatePixelClusterInformation ATLAS_NOT_THREAD_SAFE (TSoS_Details& tsosDetails) const;
       
     /** Check if the cluster is compatible with a hadronic cluster*/
     bool isHadCaloCompatible(const Trk::TrackParameters& Tp, CacheEntry* ent) const;
diff --git a/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool.h b/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool.h
index c6f3291b1d10beffbb3bf9401f7bab6e41f47a8f..7909befc4727a1b07b5be19fa3fcc26973c02f24 100644
--- a/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool.h
+++ b/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool.h
@@ -39,7 +39,7 @@ namespace InDet {
 
     /// Create a proper constructor for Athena
     ASG_TOOL_CLASS2( InDetSecVtxTrackSelectionTool,
-		     CP::ISelectionTool,
+		     IAsgSelectionTool,
 		     InDet::IInDetTrackSelectionTool )
     
   public:
diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/IInDetTrackSelectionTool.h b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/IInDetTrackSelectionTool.h
index 1a92b89c762b0eca6df72d7135cb22318e1a786a..773d9ca2129583602c94b81f1c8232234d56bf6b 100644
--- a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/IInDetTrackSelectionTool.h
+++ b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/IInDetTrackSelectionTool.h
@@ -8,7 +8,7 @@
 #define INDETTRACKSELECTIONTOOL_IINDETTRACKSELECTIONTOOL_H
 
 // Framework include(s):
-#include "AsgAnalysisInterfaces/ISelectionTool.h"
+#include "PATCore/IAsgSelectionTool.h"
 #include "PATCore/AcceptData.h"
 #include "PATCore/AcceptInfo.h"
 
@@ -48,7 +48,7 @@ namespace InDet {
   /// @author Michael Clark <michael.ryan.clark@cern.ch>
   /// 
   ///
-  class IInDetTrackSelectionTool : public virtual CP::ISelectionTool
+  class IInDetTrackSelectionTool : public virtual IAsgSelectionTool
 { 
     /// Declare the interface that the class provides
     ASG_TOOL_INTERFACE( InDet::IInDetTrackSelectionTool )
diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/InDetTrackSelectionTool.h b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/InDetTrackSelectionTool.h
index 26cb7d8096788c96f1c0ac37bf6862a5bbca37df..f29f1343228391cc9e712337a28ac9be22cafe34 100644
--- a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/InDetTrackSelectionTool.h
+++ b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/InDetTrackSelectionTool.h
@@ -40,7 +40,7 @@ namespace InDet {
 
     /// Create a proper constructor for Athena
     ASG_TOOL_CLASS2( InDetTrackSelectionTool,
-		     CP::ISelectionTool,
+		     IAsgSelectionTool,
 		     InDet::IInDetTrackSelectionTool )
     
   public:
diff --git a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/CMakeLists.txt b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/CMakeLists.txt
index d610f999664d6ed90183a061fa945e6f7dba8bdf..06f807baf05aa72fda842aaed4d8a2af773b11ad 100644
--- a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/CMakeLists.txt
+++ b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/CMakeLists.txt
@@ -25,17 +25,20 @@ atlas_depends_on_subdirs(
    Event/xAOD/xAODTracking
    PRIVATE
    Event/xAOD/xAODEventInfo
+   Tools/PathResolver
    ${extra_deps} )
 
 # External dependencies:
 find_package( ROOT COMPONENTS Core Hist RIO )
+find_package( lwtnn REQUIRED )
 
 # Libraries in the package:
 atlas_add_library( TrackVertexAssociationToolLib
    Root/*.cxx
    PUBLIC_HEADERS TrackVertexAssociationTool
-   LINK_LIBRARIES AthContainers AthLinks AsgTools xAODCore xAODTracking AsgDataHandlesLib
-   PRIVATE_LINK_LIBRARIES xAODEventInfo )
+   INCLUDE_DIRS ${LWTNN_INCLUDE_DIRS}
+   LINK_LIBRARIES AthContainers AthLinks AsgTools xAODCore xAODTracking AsgDataHandlesLib ${LWTNN_LIBRARIES}
+   PRIVATE_LINK_LIBRARIES xAODEventInfo PathResolver )
 
 if( NOT XAOD_STANDALONE )
    atlas_add_component( TrackVertexAssociationTool
diff --git a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/MVAInputEvaluator.cxx b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/MVAInputEvaluator.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..a2742eb20f70228b3cb280b6948ad79efc20ed17
--- /dev/null
+++ b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/MVAInputEvaluator.cxx
@@ -0,0 +1,450 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "TrackVertexAssociationTool/MVAInputEvaluator.h"
+
+#include "AthLinks/ElementLink.h"
+
+#include "xAODTracking/TrackParticleContainer.h"
+#include "xAODTracking/TrackParticlexAODHelpers.h"
+#include "xAODTracking/Vertex.h"
+
+#include <cmath>
+#include <stdexcept>
+#include <vector>
+
+// Private
+namespace {
+
+using MiniEvaluator = CP::MVAInputEvaluator::MiniEvaluator;
+
+class Pt: public MiniEvaluator {
+public:
+  Pt() {};
+  ~Pt() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return trk.pt();
+  }
+};
+
+class Eta: public MiniEvaluator {
+public:
+  Eta() {};
+  ~Eta() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return trk.eta();
+  }
+};
+
+class M: public MiniEvaluator {
+public:
+  M() {};
+  ~M() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return trk.m();
+  }
+};
+
+class D0: public MiniEvaluator {
+public:
+  D0() {};
+  ~D0() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return trk.d0();
+  }
+};
+
+class ErrD0: public MiniEvaluator {
+public:
+  ErrD0() {};
+  ~ErrD0() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return std::sqrt(trk.definingParametersCovMatrix()(0, 0));
+  }
+};
+
+class Z0: public MiniEvaluator {
+public:
+  Z0() {};
+  ~Z0() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return trk.z0();
+  }
+};
+
+class ErrZ0: public MiniEvaluator {
+public:
+  ErrZ0() {};
+  ~ErrZ0() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return std::sqrt(trk.definingParametersCovMatrix()(1, 1));
+  }
+};
+
+class Phi: public MiniEvaluator {
+public:
+  Phi() {};
+  ~Phi() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return trk.phi();
+  }
+};
+
+class ErrPhi: public MiniEvaluator {
+public:
+  ErrPhi() {};
+  ~ErrPhi() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return std::sqrt(trk.definingParametersCovMatrix()(2, 2));
+  }
+};
+
+class Theta: public MiniEvaluator {
+public:
+  Theta() {};
+  ~Theta() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return trk.theta();
+  }
+};
+
+class ErrTheta: public MiniEvaluator {
+public:
+  ErrTheta() {};
+  ~ErrTheta() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return std::sqrt(trk.definingParametersCovMatrix()(3, 3));
+  }
+};
+
+class QOverP: public MiniEvaluator {
+public:
+  QOverP() {};
+  ~QOverP() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return trk.qOverP();
+  }
+};
+
+class ErrQOverP: public MiniEvaluator {
+public:
+  ErrQOverP() {};
+  ~ErrQOverP() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return std::sqrt(trk.definingParametersCovMatrix()(4, 4));
+  }
+};
+
+class ChiSq: public MiniEvaluator {
+public:
+  ChiSq() {};
+  ~ChiSq() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return trk.chiSquared();
+  }
+};
+
+class RedChiSq: public MiniEvaluator {
+public:
+  RedChiSq() {};
+  ~RedChiSq() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return (trk.chiSquared() / trk.numberDoF());
+  }
+};
+
+class D0Sig: public MiniEvaluator {
+public:
+  D0Sig() {};
+  ~D0Sig() override final {};
+  float eval(const xAOD::TrackParticle& trk, __attribute__((unused)) const xAOD::Vertex& vx, const xAOD::EventInfo& evt) const override final {
+    return xAOD::TrackingHelpers::d0significance(&trk, evt.beamPosSigmaX(), evt.beamPosSigmaY(), evt.beamPosSigmaXY());
+  }
+};
+
+class DZ: public MiniEvaluator {
+public:
+  DZ() {};
+  ~DZ() override final {};
+  float eval(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return (trk.z0() + trk.vz() - vx.z());
+  }
+};
+
+class ErrDZ: public MiniEvaluator {
+public:
+  ErrDZ() {};
+  ~ErrDZ() override final {};
+  float eval(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return std::sqrt(trk.definingParametersCovMatrix()(1, 1) + vx.covariancePosition()(2, 2));
+  }
+};
+
+class DZSinTheta: public MiniEvaluator {
+public:
+  DZSinTheta() {};
+  ~DZSinTheta() override final {};
+  float eval(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return (trk.z0() + trk.vz() - vx.z()) * std::sin(trk.theta());
+  }
+};
+
+class ErrDZSinTheta: public MiniEvaluator {
+public:
+  ErrDZSinTheta() {};
+  ~ErrDZSinTheta() override final {};
+  float eval(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    float dz         = (trk.z0() + trk.vz() - vx.z());
+    float sinTheta   = std::sin(trk.theta());
+    float cosTheta   = std::cos(trk.theta());
+    float errSqDZ    = trk.definingParametersCovMatrix()(1, 1) + vx.covariancePosition()(2, 2);
+    float errSqTheta = trk.definingParametersCovMatrix()(3, 3);
+    float covZ0Theta = trk.definingParametersCovMatrix()(1, 3);
+    return std::sqrt(errSqDZ * std::pow(sinTheta, 2) + std::pow(dz * cosTheta, 2) * errSqTheta + 2 * sinTheta * dz * cosTheta * covZ0Theta);
+  }
+};
+
+std::vector<const xAOD::TrackParticle*> toVector(const std::vector<ElementLink<xAOD::TrackParticleContainer>>& inTrks) {
+  std::vector<const xAOD::TrackParticle*> outTrks;
+  for (const auto& trkLink : inTrks) {
+    if (trkLink.isValid()) {
+      outTrks.push_back((const xAOD::TrackParticle*)(*trkLink));
+    }
+  }
+  return outTrks;
+}
+
+int inVector(const xAOD::TrackParticle* trk, const std::vector<const xAOD::TrackParticle*>& vec) {
+  int i = 0;
+  for (const auto& ele : vec) {
+    if (trk == ele) {
+      return i;
+    }
+    i++;
+  }
+  return -1;
+}
+
+class FitWeight: public MiniEvaluator {
+public:
+  FitWeight() {};
+  ~FitWeight() override final {};
+  float eval(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    std::vector<const xAOD::TrackParticle*> fitTrks = toVector(vx.trackParticleLinks());
+    float weight = 0.0;
+    int pos = inVector(&trk, fitTrks);
+    if (pos != -1) {
+      weight = vx.trackWeights().at(pos);
+    }
+    return weight;
+  }
+};
+
+class VxX: public MiniEvaluator {
+public:
+  VxX() {};
+  ~VxX() override final {};
+  float eval(__attribute__((unused)) const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return vx.x();
+  }
+};
+
+class ErrVxX: public MiniEvaluator {
+public:
+  ErrVxX() {};
+  ~ErrVxX() override final {};
+  float eval(__attribute__((unused)) const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return std::sqrt(vx.covariancePosition()(0, 0));
+  }
+};
+
+class VxY: public MiniEvaluator {
+public:
+  VxY() {};
+  ~VxY() override final {};
+  float eval(__attribute__((unused)) const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return vx.y();
+  }
+};
+
+class ErrVxY: public MiniEvaluator {
+public:
+  ErrVxY() {};
+  ~ErrVxY() override final {};
+  float eval(__attribute__((unused)) const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return std::sqrt(vx.covariancePosition()(1, 1));
+  }
+};
+
+class VxZ: public MiniEvaluator {
+public:
+  VxZ() {};
+  ~VxZ() override final {};
+  float eval(__attribute__((unused)) const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return vx.z();
+  }
+};
+
+class ErrVxZ: public MiniEvaluator {
+public:
+  ErrVxZ() {};
+  ~ErrVxZ() override final {};
+  float eval(__attribute__((unused)) const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, __attribute__((unused)) const xAOD::EventInfo& evt) const override final {
+    return std::sqrt(vx.covariancePosition()(2, 2));
+  }
+};
+
+} // namespace
+
+namespace CP {
+
+MVAInputEvaluator::~MVAInputEvaluator() {
+  clear();
+}
+
+void MVAInputEvaluator::add(const std::string& name, const MVAInputEvaluator::Input& type) {
+  using Input = MVAInputEvaluator::Input;
+  for (const auto& kv : m_evalMap) {
+    if (name == kv.first) {
+      throw std::runtime_error("ERROR in CP::MVAInputEvaluator::add : input name is already present in map: " + name);
+    }
+  }
+  switch (type) {
+    case Input::Pt: {
+      m_evalMap[name] = std::make_unique<::Pt>(::Pt());
+      break;
+    }
+    case Input::Eta: {
+      m_evalMap[name] = std::make_unique<::Eta>(::Eta());
+      break;
+    }
+    case Input::M: {
+      m_evalMap[name] = std::make_unique<::M>(::M());
+      break;
+    }
+    case Input::D0: {
+      m_evalMap[name] = std::make_unique<::D0>(::D0());
+      break;
+    }
+    case Input::ErrD0: {
+      m_evalMap[name] = std::make_unique<::ErrD0>(::ErrD0());
+      break;
+    }
+    case Input::Z0: {
+      m_evalMap[name] = std::make_unique<::Z0>(::Z0());
+      break;
+    }
+    case Input::ErrZ0: {
+      m_evalMap[name] = std::make_unique<::ErrZ0>(::ErrZ0());
+      break;
+    }
+    case Input::Phi: {
+      m_evalMap[name] = std::make_unique<::Phi>(::Phi());
+      break;
+    }
+    case Input::ErrPhi: {
+      m_evalMap[name] = std::make_unique<::ErrPhi>(::ErrPhi());
+      break;
+    }
+    case Input::Theta: {
+      m_evalMap[name] = std::make_unique<::Theta>(::Theta());
+      break;
+    }
+    case Input::ErrTheta: {
+      m_evalMap[name] = std::make_unique<::ErrTheta>(::ErrTheta());
+      break;
+    }
+    case Input::QOverP: {
+      m_evalMap[name] = std::make_unique<::QOverP>(::QOverP());
+      break;
+    }
+    case Input::ErrQOverP: {
+      m_evalMap[name] = std::make_unique<::ErrQOverP>(::ErrQOverP());
+      break;
+    }
+    case Input::ChiSq: {
+      m_evalMap[name] = std::make_unique<::ChiSq>(::ChiSq());
+      break;
+    }
+    case Input::RedChiSq: {
+      m_evalMap[name] = std::make_unique<::RedChiSq>(::RedChiSq());
+      break;
+    }
+    case Input::D0Sig: {
+      m_evalMap[name] = std::make_unique<::D0Sig>(::D0Sig());
+      break;
+    }
+    case Input::DZ: {
+      m_evalMap[name] = std::make_unique<::DZ>(::DZ());
+      break;
+    }
+    case Input::ErrDZ: {
+      m_evalMap[name] = std::make_unique<::ErrDZ>(::ErrDZ());
+      break;
+    }
+    case Input::DZSinTheta: {
+      m_evalMap[name] = std::make_unique<::DZSinTheta>(::DZSinTheta());
+      break;
+    }
+    case Input::ErrDZSinTheta: {
+      m_evalMap[name] = std::make_unique<::ErrDZSinTheta>(::ErrDZSinTheta());
+      break;
+    }
+    case Input::FitWeight: {
+      m_evalMap[name] = std::make_unique<::FitWeight>(::FitWeight());
+      break;
+    }
+    case Input::VxX: {
+      m_evalMap[name] = std::make_unique<::VxX>(::VxX());
+      break;
+    }
+    case Input::ErrVxX: {
+      m_evalMap[name] = std::make_unique<::ErrVxX>(::ErrVxX());
+      break;
+    }
+    case Input::VxY: {
+      m_evalMap[name] = std::make_unique<::VxY>(::VxY());
+      break;
+    }
+    case Input::ErrVxY: {
+      m_evalMap[name] = std::make_unique<::ErrVxY>(::ErrVxY());
+      break;
+    }
+    case Input::VxZ: {
+      m_evalMap[name] = std::make_unique<::VxZ>(::VxZ());
+      break;
+    }
+    case Input::ErrVxZ: {
+      m_evalMap[name] = std::make_unique<::ErrVxZ>(::ErrVxZ());
+      break;
+    }
+    default: {
+      throw std::runtime_error("ERROR in CP::MVAInputEvaluator::add : unknown input enum: " + std::to_string(type));
+    }
+  }
+  return;
+}
+
+void MVAInputEvaluator::load(const MVAInputEvaluator::InputSelectionMap& selection) {
+  clear();
+  for (const auto& kv : selection) {
+    add(kv.first, kv.second);
+  }
+  return;
+}
+
+void MVAInputEvaluator::eval(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, const xAOD::EventInfo& evt, std::map<std::string, double>& input) const {
+  input.clear();
+  for (const auto& kv : m_evalMap) {
+    input[kv.first] = kv.second->eval(trk, vx, evt);
+  }
+  return;
+}
+
+void MVAInputEvaluator::clear() {
+  m_evalMap.clear();
+  return;
+}
+
+} // namespace CP
diff --git a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/MVATrackVertexAssociationTool.cxx b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/MVATrackVertexAssociationTool.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..3c7563ab8dce30872b895fbdeccb1b1cb38b3324
--- /dev/null
+++ b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/MVATrackVertexAssociationTool.cxx
@@ -0,0 +1,282 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "TrackVertexAssociationTool/MVATrackVertexAssociationTool.h"
+
+#include "AsgDataHandles/ReadHandle.h"
+#include "xAODTracking/TrackParticle.h"
+#include "xAODTracking/TrackParticleContainer.h"
+#include "xAODTracking/Vertex.h"
+#include "xAODTracking/VertexContainer.h"
+#include "xAODTracking/TrackingPrimitives.h"
+
+#include "PathResolver/PathResolver.h"
+
+#include "lwtnn/NNLayerConfig.hh"
+#include "lwtnn/parse_json.hh"
+
+#include <fstream>
+#include <iterator>
+#include <stdexcept>
+
+namespace CP {
+
+MVATrackVertexAssociationTool::MVATrackVertexAssociationTool(const std::string& name) :
+  AsgTool(name)
+{
+  // For AnalysisBase
+  #ifdef XAOD_STANDALONE
+  declareProperty("NetworkFileName", m_fileName,        "Name of the input lwtnn network file."                                                              );
+  declareProperty("InputNames",      m_inputNames,      "Vector of the network's input variable names (std::vector<std::string>)."                           );
+  declareProperty("InputTypes",      m_inputTypes,      "Vector of the network's input variable evaluator types (std::vector<CP::MVAEvaluatorInput::Input>).");
+  declareProperty("OutputNodeName",  m_outputName,      "Name of the output node to cut on for TVA."                                                         );
+  declareProperty("IsSequential",    m_isSequential,    "Is the network sequential (true) or functional (false)."                                            );
+  declareProperty("WorkingPoint",    m_wp,              "TVA working point to apply."                                                                        );
+  declareProperty("OutputCut",       m_cut,             "TVA cut value on the output value (set manually with \"Custom\" WP)."                               );
+  declareProperty("UsePathResolver", m_usePathResolver, "Use the PathResolver for finding the input lwtnn network file."                                     );
+  #endif
+}
+
+StatusCode MVATrackVertexAssociationTool::initialize() {
+
+  ATH_MSG_INFO("Initializing MVATrackVertexAssociationTool.");
+
+  // Init EventInfo
+  ATH_CHECK(m_eventInfo.initialize());
+
+  // Init network
+  StatusCode initNetworkStatus = initializeNetwork();
+  if (initNetworkStatus != StatusCode::SUCCESS) {
+    return initNetworkStatus;
+  }
+
+  // Map our working point to a cut on the MVA output discriminant
+  if (m_wp == "Tight") {
+    m_cut = 0.85;
+  }
+  else if (m_wp == "Custom") {
+    // Nothing to do here
+  }
+  else {
+    ATH_MSG_ERROR("Invalid TVA working point \"" << m_wp << "\" - for a custom configuration, please provide \"Custom\" for the \"WorkingPoint\" property.");
+    return StatusCode::FAILURE;
+  }
+
+  // Some extra printout for Custom
+  if (m_wp == "Custom") {
+    ATH_MSG_INFO("TVA working point \"Custom\" provided - tool properties are initialized to default values unless explicitly set by the user.");
+  }
+  else {
+    ATH_MSG_INFO("TVA working point \"" << m_wp << "\" provided - tool properties have been configured accordingly.");
+  }
+
+  ATH_MSG_INFO("Cut on MVA output discriminant: " << m_cut);
+
+  return StatusCode::SUCCESS;
+}
+
+// For Athena
+#ifndef XAOD_STANDALONE
+StatusCode MVATrackVertexAssociationTool::finalize() {
+  ATH_MSG_INFO("Finalizing MVATrackVertexAssociationTool.");
+  return StatusCode::SUCCESS;
+}
+#endif
+
+bool MVATrackVertexAssociationTool::isCompatible(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx) const {
+  float mvaOutput;
+  return isMatch(trk, vx, mvaOutput);
+}
+
+xAOD::TrackVertexAssociationMap MVATrackVertexAssociationTool::getMatchMap(std::vector<const xAOD::TrackParticle*>& trk_list, std::vector<const xAOD::Vertex*>& vx_list) const {
+  return getMatchMapInternal(trk_list, vx_list);
+}
+
+xAOD::TrackVertexAssociationMap MVATrackVertexAssociationTool::getMatchMap(const xAOD::TrackParticleContainer& trkCont, const xAOD::VertexContainer& vxCont) const {
+  return getMatchMapInternal(trkCont, vxCont);
+}
+
+const xAOD::Vertex* MVATrackVertexAssociationTool::getUniqueMatchVertex(const xAOD::TrackParticle& trk, std::vector<const xAOD::Vertex*>& vx_list) const {
+  return getUniqueMatchVertexInternal(trk, vx_list);
+}
+
+ElementLink<xAOD::VertexContainer> MVATrackVertexAssociationTool::getUniqueMatchVertexLink(const xAOD::TrackParticle& trk, const xAOD::VertexContainer& vxCont) const {
+  ElementLink<xAOD::VertexContainer> vx_link_tmp;
+  const xAOD::Vertex* vx_tmp = getUniqueMatchVertexInternal(trk, vxCont);
+  if (vx_tmp) {
+    vx_link_tmp.toContainedElement(vxCont, vx_tmp);
+  }
+  return vx_link_tmp;
+}
+
+xAOD::TrackVertexAssociationMap MVATrackVertexAssociationTool::getUniqueMatchMap(std::vector<const xAOD::TrackParticle*>& trk_list, std::vector<const xAOD::Vertex*>& vx_list) const {
+  return getUniqueMatchMapInternal(trk_list, vx_list);
+}
+
+xAOD::TrackVertexAssociationMap MVATrackVertexAssociationTool::getUniqueMatchMap(const xAOD::TrackParticleContainer& trkCont, const xAOD::VertexContainer& vxCont) const {
+  return getUniqueMatchMapInternal(trkCont, vxCont);
+}
+
+// --------------- //
+// Private methods //
+// --------------- //
+
+bool MVATrackVertexAssociationTool::isMatch(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, float& mvaOutput) const {
+
+  // Fake vertex, return false
+  if (vx.vertexType() == xAOD::VxType::NoVtx) {
+    return false;
+  }
+
+  // Retrieve our EventInfo
+  SG::ReadHandle<xAOD::EventInfo> evt(m_eventInfo);
+  if (!evt.isValid()) {
+    throw std::runtime_error("ERROR in CP::MVATrackVertexAssociationTool::isMatch : could not retrieve xAOD::EventInfo.");
+  }
+
+  // Evaluate our network and compare against our TVA cut (">= cut" := associated)
+  mvaOutput = this->evaluateNetwork(trk, vx, *evt);
+  return (mvaOutput >= m_cut);
+}
+
+template <typename T, typename V>
+xAOD::TrackVertexAssociationMap MVATrackVertexAssociationTool::getMatchMapInternal(const T& trk_list, const V& vx_list) const {
+
+  xAOD::TrackVertexAssociationMap trktovxmap;
+
+  for (const auto& vertex : vx_list) {
+    xAOD::TrackVertexAssociationList trktovxlist;
+    trktovxlist.reserve(100);
+    for (const auto& track : trk_list) {
+      if (isCompatible(*track, *vertex)) {
+        trktovxlist.push_back(track);
+      }
+    }
+    trktovxmap[vertex] = trktovxlist;
+  }
+
+  return trktovxmap;
+}
+
+template <typename T>
+const xAOD::Vertex* MVATrackVertexAssociationTool::getUniqueMatchVertexInternal(const xAOD::TrackParticle& trk, const T& vx_list) const {
+
+  bool match;
+  float mvaOutput;
+  float maxValue = -1.0; // MVA output ranges between 0 and 1
+  const xAOD::Vertex* bestMatchVertex = nullptr;
+
+  for (const auto& vertex : vx_list) {
+    match = isMatch(trk, *vertex, mvaOutput);
+    if (match && (maxValue < mvaOutput)) {
+      maxValue = mvaOutput;
+      bestMatchVertex = vertex;
+    }
+  }
+
+  // check if get the matched Vertex, for the tracks not used in vertex fit
+  if (!bestMatchVertex) {
+    ATH_MSG_DEBUG("Could not find any matched vertex for this track.");
+  }
+
+  return bestMatchVertex;
+}
+
+template <typename T, typename V>
+xAOD::TrackVertexAssociationMap MVATrackVertexAssociationTool::getUniqueMatchMapInternal(const T& trk_list, const V& vx_list) const {
+
+  xAOD::TrackVertexAssociationMap trktovxmap;
+
+  // Initialize map
+  for (const auto& vertex : vx_list) {
+    xAOD::TrackVertexAssociationList trktovxlist;
+    trktovxlist.clear();
+    trktovxmap[vertex] = trktovxlist;
+  }
+
+  // Perform matching
+  for (const auto& track : trk_list) {
+    const xAOD::Vertex* vx_match = getUniqueMatchVertexInternal(*track, vx_list);
+    if (vx_match) {
+      // Found matched vertex
+      trktovxmap[vx_match].push_back(track);
+    }
+  }
+
+  return trktovxmap;
+}
+
+StatusCode MVATrackVertexAssociationTool::initializeNetwork() {
+
+  // Load our input evaluator
+  if (m_inputNames.size() != m_inputTypes.size()) {
+    ATH_MSG_ERROR("Size of input variable names (" + std::to_string(m_inputNames.size()) + ") does not equal size of input variable types (" + std::to_string(m_inputTypes.size()) + ").");
+    return StatusCode::FAILURE;
+  }
+  m_inputMap.clear();
+  for (size_t i = 0; i < m_inputNames.size(); i++) {
+    m_inputMap[m_inputNames[i]] = static_cast<MVAInputEvaluator::Input>(m_inputTypes[i]);
+  }
+  m_inputEval.load(m_inputMap);
+
+  // Load our input file
+  std::string fileName; 
+  if (m_usePathResolver) {
+    fileName = PathResolverFindCalibFile(m_fileName);
+    if (fileName.empty()) {
+      ATH_MSG_ERROR("Could not find input network file: " + m_fileName);
+      return StatusCode::FAILURE;
+    }
+  }
+  else {
+    fileName = m_fileName;
+  }
+  std::ifstream netFile(fileName);
+  if (!netFile) {
+    ATH_MSG_ERROR("Could not properly open input network file: " + fileName);
+    return StatusCode::FAILURE;
+  }
+
+  // For sequential:
+  if (m_isSequential) {
+    lwt::JSONConfig netDef = lwt::parse_json(netFile);
+    m_network = std::move(std::unique_ptr<lwt::LightweightNeuralNetwork>(new lwt::LightweightNeuralNetwork(netDef.inputs, netDef.layers, netDef.outputs)));
+  }
+  // For functional:
+  else {
+    lwt::GraphConfig netDef = lwt::parse_json_graph(netFile);
+    if (netDef.inputs.size() != 1) {
+      ATH_MSG_ERROR("Network in file \"" + fileName + "\" has more than 1 input node: # of input nodes = " + std::to_string(netDef.inputs.size()));
+      return StatusCode::FAILURE;
+    }
+    m_inputNodeName = netDef.inputs[0].name;
+    m_graph = std::move(std::unique_ptr<lwt::LightweightGraph>(new lwt::LightweightGraph(netDef)));
+  }
+
+  return StatusCode::SUCCESS;
+}
+
+float MVATrackVertexAssociationTool::evaluateNetwork(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, const xAOD::EventInfo& evt) const {
+
+  // Evaluate our inputs
+  std::map<std::string, double> input;
+  m_inputEval.eval(trk, vx, evt, input);
+
+  // Evaluate our network
+  std::map<std::string, double> output;
+  // For sequential:
+  if (m_isSequential) {
+    output = m_network->compute(input);
+  }
+  // For functional:
+  else {
+    std::map<std::string, std::map<std::string, double>> wrappedInput;
+    wrappedInput[m_inputNodeName] = input;
+    output = m_graph->compute(wrappedInput);
+  }
+
+  return output[m_outputName];
+}
+
+} // namespace CP
diff --git a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/MVAInputEvaluator.h b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/MVAInputEvaluator.h
new file mode 100644
index 0000000000000000000000000000000000000000..741343fd6489b7261fe618dcc688383b56a597a7
--- /dev/null
+++ b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/MVAInputEvaluator.h
@@ -0,0 +1,78 @@
+#ifndef MVAINPUTEVALUATOR_H
+#define MVAINPUTEVALUATOR_H
+
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODTracking/TrackParticleFwd.h"
+#include "xAODTracking/VertexFwd.h"
+
+#include <iterator>
+#include <map>
+#include <memory>
+#include <string>
+
+namespace CP {
+
+class MVAInputEvaluator {
+public:
+  MVAInputEvaluator() {};
+  ~MVAInputEvaluator();
+
+  // Nested class for evaluating single input features
+  class MiniEvaluator {
+  public:
+    MiniEvaluator() {};
+    virtual ~MiniEvaluator() {};
+    virtual float eval(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, const xAOD::EventInfo& evt) const = 0;
+  };
+
+  // Enumerate the different possible inputs
+  enum Input {
+    Pt,
+    Eta,
+    M,
+    D0,
+    ErrD0,
+    Z0,
+    ErrZ0,
+    Phi,
+    ErrPhi,
+    Theta,
+    ErrTheta,
+    QOverP,
+    ErrQOverP,
+    ChiSq,
+    RedChiSq,
+    D0Sig,
+    DZ,
+    ErrDZ,
+    DZSinTheta,
+    ErrDZSinTheta,
+    FitWeight,
+    VxX,
+    ErrVxX,
+    VxY,
+    ErrVxY,
+    VxZ,
+    ErrVxZ
+  };
+
+  // Handy typedefs
+  // Defines the mapping of strings to Inputs:
+  typedef std::map<std::string, Input> InputSelectionMap;
+  // Defines the mapping of those same strings to MiniEvaluators:
+  typedef std::map<std::string, std::unique_ptr<MiniEvaluator>> InputEvaluatorMap;
+
+  void add(const std::string& name, const MVAInputEvaluator::Input& type);
+  void load(const MVAInputEvaluator::InputSelectionMap& selection);
+  void eval(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, const xAOD::EventInfo& evt, std::map<std::string, double>& input) const;
+  void clear();
+
+private:
+  // Loaded evaluator map
+  InputEvaluatorMap m_evalMap = {};
+
+};
+
+} // namepace CP
+
+#endif // MVAINPUTEVALUATOR_H
diff --git a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/MVATrackVertexAssociationTool.h b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/MVATrackVertexAssociationTool.h
new file mode 100644
index 0000000000000000000000000000000000000000..91ee4575fcbc566786a143153650f6c46fa3e360
--- /dev/null
+++ b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/MVATrackVertexAssociationTool.h
@@ -0,0 +1,147 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MVATRACKVERTEXASSOCIATIONTOOL_H
+#define MVATRACKVERTEXASSOCIATIONTOOL_H
+
+#include "AsgTools/AsgTool.h"
+#include "AthLinks/ElementLink.h"
+#include "AsgDataHandles/ReadHandleKey.h"
+
+#include "TrackVertexAssociationTool/ITrackVertexAssociationTool.h"
+#include "TrackVertexAssociationTool/MVAInputEvaluator.h"
+
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODTracking/TrackParticleFwd.h"
+#include "xAODTracking/TrackParticleContainerFwd.h"
+#include "xAODTracking/VertexFwd.h"
+#include "xAODTracking/VertexContainerFwd.h"
+
+#include "lwtnn/LightweightNeuralNetwork.hh"
+#include "lwtnn/LightweightGraph.hh"
+
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace CP {
+
+class MVATrackVertexAssociationTool : public asg::AsgTool, virtual public ITrackVertexAssociationTool
+{
+  ASG_TOOL_CLASS(MVATrackVertexAssociationTool, ITrackVertexAssociationTool)
+public:
+
+  MVATrackVertexAssociationTool(const std::string& name);
+
+  virtual StatusCode initialize() override;
+  // For Athena
+  #ifndef XAOD_STANDALONE
+  virtual StatusCode finalize() override;
+  #endif
+
+  virtual bool isCompatible(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx) const override;
+
+  virtual xAOD::TrackVertexAssociationMap getMatchMap(std::vector<const xAOD::TrackParticle*>& trk_list, std::vector<const xAOD::Vertex*>& vx_list) const override;
+  virtual xAOD::TrackVertexAssociationMap getMatchMap(const xAOD::TrackParticleContainer& trk_cont, const xAOD::VertexContainer& vx_cont) const override;
+
+  virtual ElementLink<xAOD::VertexContainer> getUniqueMatchVertexLink(const xAOD::TrackParticle& trk, const xAOD::VertexContainer& vx_cont) const override;
+  virtual const xAOD::Vertex* getUniqueMatchVertex(const xAOD::TrackParticle& trk, std::vector<const xAOD::Vertex*>& vx_list) const override;
+
+  virtual xAOD::TrackVertexAssociationMap getUniqueMatchMap(std::vector<const xAOD::TrackParticle*>& trk_list, std::vector<const xAOD::Vertex*>& vx_list) const override;
+  virtual xAOD::TrackVertexAssociationMap getUniqueMatchMap(const xAOD::TrackParticleContainer& trk_cont, const xAOD::VertexContainer& vx_cont) const override;
+
+private:
+
+  bool isMatch(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, float& mvaOutput) const;
+
+  template <typename T, typename V>
+  xAOD::TrackVertexAssociationMap getMatchMapInternal(const T& trk_list, const V& vx_list) const;
+
+  template <typename T, typename V>
+  xAOD::TrackVertexAssociationMap getUniqueMatchMapInternal(const T& trk_list, const V& vx_list) const;
+
+  template <typename T>
+  const xAOD::Vertex* getUniqueMatchVertexInternal(const xAOD::TrackParticle& trk, const T& vx_list) const;
+
+  StatusCode initializeNetwork();
+  float evaluateNetwork(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, const xAOD::EventInfo& evt) const;
+
+  // For AnalysisBase
+  #ifdef XAOD_STANDALONE
+
+  // Input lwtnn network file
+  std::string m_fileName = "";
+
+  // Vector of input variable names
+  std::vector<std::string> m_inputNames = {};
+
+  // Vector of input variable types
+  std::vector<int> m_inputTypes = {};
+
+  // Name of the output node to cut on
+  std::string m_outputName = "";
+
+  // Is the network sequential or functional
+  bool m_isSequential = true;
+
+  // TVA working point
+  std::string m_wp = "Tight";
+
+  // TVA cut value on the output discriminant
+  float m_cut = -1.0;
+
+  // Use the PathResolver to find our input file
+  bool m_usePathResolver = true;
+
+  // For Athena
+  #else
+
+  // Input lwtnn network file
+  StringProperty m_fileName {this, "NetworkFileName", "", "Name of the input lwtnn network file."};
+
+  // Vector of input variable names
+  StringArrayProperty m_inputNames {this, "InputNames", {}, "Vector of the network's input variable names (std::vector<std::string>)."};
+
+  // Vector of input variable types
+  IntegerArrayProperty m_inputTypes {this, "InputTypes", {}, "Vector of the network's input variable evaluator types (std::vector<CP::MVAEvaluatorInput::Input>)."};
+
+  // Name of the output node to cut on
+  StringProperty m_outputName {this, "OutputNodeName", "", "Name of the output node to cut on for TVA."};
+
+  // Is the network sequential or functional
+  BooleanProperty m_isSequential {this, "IsSequential", true, "Is the network sequential (true) or functional (false)."};
+
+  // TVA working point
+  StringProperty m_wp {this, "WorkingPoint", "Tight", "TVA working point to apply."};
+
+  // TVA cut value on the output discriminant
+  FloatProperty m_cut {this, "OutputCut", -1.0, "TVA cut value on the output value (set manually with \"Custom\" WP)."};
+
+  // Use the PathResolver to find our input file
+  BooleanProperty m_usePathResolver {this, "UsePathResolver", true, "Use the PathResolver for finding the input lwtnn network file."};
+
+  #endif
+
+  // Input variable name/type map
+  MVAInputEvaluator::InputSelectionMap m_inputMap;
+
+  // Input variable evaluator
+  MVAInputEvaluator m_inputEval;
+
+  // EventInfo key
+  SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo {this, "EventInfo", "EventInfo", "EventInfo key"};
+
+  // Name of the input node (for functional modes)
+  std::string m_inputNodeName = ""; //!
+
+  // Network as implemented using lwtnn
+  std::unique_ptr<lwt::LightweightNeuralNetwork> m_network; //!
+  std::unique_ptr<lwt::LightweightGraph>         m_graph;   //!
+
+};
+
+} // namespace CP
+
+#endif // MVATRACKVERTEXASSOCIATIONTOOL_H
diff --git a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationToolDict.h b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationToolDict.h
index 252ba8881f1225f8234335979c5f12b6c59bde28..d7745a294ec8768f504bed6751292cf71be634fd 100644
--- a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationToolDict.h
+++ b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationToolDict.h
@@ -14,5 +14,6 @@
 #include "TrackVertexAssociationTool/BaseTrackVertexAssociationTool.h"
 #include "TrackVertexAssociationTool/ElectronTrackVertexAssociationTool.h"
 #include "TrackVertexAssociationTool/MuonTrackVertexAssociationTool.h"
+#include "TrackVertexAssociationTool/MVATrackVertexAssociationTool.h"
 
 #endif //TrackVertexAssociationTool
diff --git a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/selection.xml b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/selection.xml
index 457a3ebfd5bd5eae3042a8b0d75bbaed013a232b..29a9e40a43b5ac199fa527d3b7f66fc3e952fa02 100644
--- a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/selection.xml
+++ b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/selection.xml
@@ -3,4 +3,5 @@
   <class name="CP::BaseTrackVertexAssociationTool" />
   <class name="CP::ElectronTrackVertexAssociationTool" />
   <class name="CP::MuonTrackVertexAssociationTool" />
+  <class name="CP::MVATrackVertexAssociationTool" />
 </lcgdict>
diff --git a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/src/components/TrackVertexAssociationTool_entries.cxx b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/src/components/TrackVertexAssociationTool_entries.cxx
index 1bc9a64064344d86ec36ab4149df54c13878a07d..31eda59b3a3a55c199b9b710a56483529681f475 100644
--- a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/src/components/TrackVertexAssociationTool_entries.cxx
+++ b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/src/components/TrackVertexAssociationTool_entries.cxx
@@ -2,6 +2,7 @@
 #include "TrackVertexAssociationTool/BaseTrackVertexAssociationTool.h"
 #include "TrackVertexAssociationTool/ElectronTrackVertexAssociationTool.h"
 #include "TrackVertexAssociationTool/MuonTrackVertexAssociationTool.h"
+#include "TrackVertexAssociationTool/MVATrackVertexAssociationTool.h"
 
 #include "../TrackVertexAssoTestAlg.h"
 
@@ -11,5 +12,6 @@ DECLARE_COMPONENT( CP::TrackVertexAssociationTool )
 DECLARE_COMPONENT( CP::BaseTrackVertexAssociationTool )
 DECLARE_COMPONENT( CP::ElectronTrackVertexAssociationTool )
 DECLARE_COMPONENT( CP::MuonTrackVertexAssociationTool )
+DECLARE_COMPONENT( CP::MVATrackVertexAssociationTool )
 DECLARE_COMPONENT( TrackVertexAssoTestAlg )
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysVal_jobOptions.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysVal_jobOptions.py
index 007395fc9d28058a2b534e1761779b210dec05cb..02bd8e2dfb598fb02bec16247e7e58375b17e9ec 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysVal_jobOptions.py
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysVal_jobOptions.py
@@ -8,19 +8,11 @@ FNAME = "AOD.pool.root"
 mode = "Fwd" #Set this to "Back" for backtracking
 usingTrackSelection = False
 #
-#options for Max to explore backtracking
-if (getpass.getuser())=="mbaugh":
-  mode="Back"
-  FNAME = "../command/target.pool.root"
-  '''
-  The following sets an environment variable to enable backtracking debug messages.
-  To use in C++:
-  const char * debugBacktracking = std::getenv("BACKTRACKDEBUG");
-  '''
-  os.environ["BACKTRACKDEBUG"] = "1"
-  #
-include( "AthenaPython/iread_file.py" )
+from InDetRecExample.InDetJobProperties import InDetFlags
+InDetFlags.doSlimming.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(False);
 
+include( "AthenaPython/iread_file.py" )
 # Access the algorithm sequence:
 from AthenaCommon.AlgSequence import AlgSequence
 topSequence = AlgSequence()
@@ -36,42 +28,21 @@ for decorator in InDetPhysValMonitoring.InDetPhysValDecoration.getDecorators() :
   topSequence += decorator
 
 from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-monMan = AthenaMonManager( "PhysValMonManager" )
-monMan.ManualDataTypeSetup = True
-monMan.DataType            = "monteCarlo"
-monMan.Environment         = "altprod"
-monMan.ManualRunLBSetup    = True
-monMan.Run                 = 1
-monMan.LumiBlock           = 1
-monMan.FileKey = "M_output"
+monMan = AthenaMonManager( "PhysValMonManager",
+  FileKey = "M_output",
+  Environment = "altprod",
+  ManualDataTypeSetup = True,
+  DataType = "monteCarlo",
+  ManualRunLBSetup = True,
+  Run = 1,
+  LumiBlock = 1  )
+  
+print (monMan)
+
 topSequence += monMan
 
 
-#this works:
-'''
-from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
-InDetTrackSelectorTool = InDet__InDetTrackSelectionTool(name = "InDetTrackSelectorTool",
-                                                        CutLevel = InDetPrimaryVertexingCuts.TrackCutLevel(),
-                                                        minPt = InDetPrimaryVertexingCuts.minPT(),
-                                                        maxD0 = InDetPrimaryVertexingCuts.IPd0Max(),
-                                                        maxZ0 = InDetPrimaryVertexingCuts.z0Max(),
-                                                        maxZ0SinTheta = InDetPrimaryVertexingCuts.IPz0Max(),
-                                                        maxSigmaD0 = InDetPrimaryVertexingCuts.sigIPd0Max(),
-                                                        maxSigmaZ0SinTheta = InDetPrimaryVertexingCuts.sigIPz0Max(),
-                                                        # maxChiSqperNdf = InDetPrimaryVertexingCuts.fitChi2OnNdfMax(), # Seems not to be implemented?
-                                                        maxAbsEta = InDetPrimaryVertexingCuts.etaMax(),
-                                                        minNInnermostLayerHits = InDetPrimaryVertexingCuts.nHitInnermostLayer(),
-                                                        minNPixelHits = InDetPrimaryVertexingCuts.nHitPix(),
-                                                        maxNPixelHoles = InDetPrimaryVertexingCuts.nHolesPix(),
-                                                        minNSctHits = InDetPrimaryVertexingCuts.nHitSct(),
-                                                        minNTrtHits = InDetPrimaryVertexingCuts.nHitTrt(),
-                                                        minNSiHits = InDetPrimaryVertexingCuts.nHitSi(),
-                                                        TrackSummaryTool = InDetTrackSummaryTool,
-                                                        Extrapolator = InDetExtrapolator)
 
-
-ToolSvc += InDetTrackSelectorTool
-'''
 from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
 InDetTrackSelectorTool=InDet__InDetTrackSelectionTool()
 ToolSvc += InDetTrackSelectorTool
@@ -90,8 +61,7 @@ if mode=="Back":
   AthTruthSelectionTool.poselectronfromgamma = True
   os.environ["BACKTRACKDEBUG"] = "1"
 
-print AthTruthSelectionTool
-#ToolSvc += AthTruthSelectionTool
+print (AthTruthSelectionTool)
 
 from InDetPhysValMonitoring.InDetPhysValMonitoringConf import InDetPhysValMonitoringTool
 tool1 = InDetPhysValMonitoringTool()
@@ -99,8 +69,10 @@ tool1.TruthSelectionTool = AthTruthSelectionTool
 tool1.useTrackSelection = usingTrackSelection
 tool1.TrackSelectionTool=InDetTrackSelectorTool
 tool1.FillTrackInJetPlots = True
-print tool1
-#ToolSvc += tool1
+print (tool1)
+tool1.ManagerName = 'PhysValMonManager'
+
+
 
 monMan.AthenaMonTools += [tool1]
 
@@ -113,7 +85,7 @@ ToolSvc += InDetBoundaryCheckTool
 from InDetTrackHoleSearch.InDetTrackHoleSearchConf import InDet__InDetTrackHoleSearchTool
 InDetHoleSearchTool = InDet__InDetTrackHoleSearchTool(name = "InDetHoleSearchTool", Extrapolator = InDetExtrapolator, BoundaryCheckTool=InDetBoundaryCheckTool, CountDeadModulesAfterLastHit = True)
 ToolSvc += InDetHoleSearchTool
-print InDetHoleSearchTool
+print (InDetHoleSearchTool)
 
 from GaudiSvc.GaudiSvcConf import THistSvc
 ServiceMgr += THistSvc()
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/getSomeData.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/getSomeData.sh
old mode 100644
new mode 100755
index 060c2d8da9d7b398d8816a91badd894de3240140..e1949268b37ec554eae7fdbaa6c050567412b18a
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/getSomeData.sh
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/getSomeData.sh
@@ -8,7 +8,7 @@
 #Itk
 #rucio download mc15_14TeV.117050.PowhegPythia_P2011C_ttbar.recon.DAOD_IDTRKVALID.e2176_s2897_s2901_r8209
 rm -f ~$USER/run/AOD.pool.root
-ln -s ~npetters/workDir/public/OUT.ESD.pool.root ~$USER/run/AOD.pool.root
+ln -s ~npetters/workDir/public/forShaun/group.perf-idtracking.21564941.EXT0._000008.RDO.pool.root ~$USER/run/AOD.pool.root
 rm -f ~$USER/run/*.xml
 
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ParameterErrDecoratorAlg.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ParameterErrDecoratorAlg.cxx
index b0c825494765cdb870ac0b6dc7e067dbe361b41c..f382935c788b7274be716cb243b0b33864e84fda 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ParameterErrDecoratorAlg.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ParameterErrDecoratorAlg.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -23,18 +23,22 @@ ParameterErrDecoratorAlg::~ParameterErrDecoratorAlg() {
 
 StatusCode
 ParameterErrDecoratorAlg::initialize() {
-  ATH_CHECK( m_trkParticleName.initialize() );
+  ATH_CHECK( m_trkParticleKey.initialize() );
 
-  std::vector<std::string> decor_names(kNDecorators);
-  decor_names[kDecorD0err]="d0err";
-  decor_names[kDecorZ0err]="z0err";
-  decor_names[kDecorPhierr]="phierr";
-  decor_names[kDecorThetaerr]="thetaerr";
-  decor_names[kDecorQopterr]="qopterr";
-
-  IDPVM::createDecoratorKeys(*this, m_trkParticleName, m_prefix, decor_names, m_decor);
+  std::vector<std::string> decorationNames(kNDecorators);
+  decorationNames[kDecorD0err]="d0err";
+  decorationNames[kDecorZ0err]="z0err";
+  decorationNames[kDecorPhierr]="phierr";
+  decorationNames[kDecorThetaerr]="thetaerr";
+  decorationNames[kDecorQopterr]="qopterr";
+  std::string message{"The following decorations should be added by ParameterErrDecoratorAlg:\n"};
+  for (const auto & thisName: decorationNames){
+    message += thisName+"\n";
+  }
+  ATH_MSG_INFO(message);
+  IDPVM::createDecoratorKeys(*this, m_trkParticleKey, m_prefix, decorationNames, m_decor);
   assert( m_decor.size() == kNDecorators);
-
+  
   return StatusCode::SUCCESS;
 }
 
@@ -45,23 +49,25 @@ ParameterErrDecoratorAlg::finalize() {
 
 StatusCode
 ParameterErrDecoratorAlg::execute(const EventContext &ctx) const {
-  SG::ReadHandle<xAOD::TrackParticleContainer> ptracks(m_trkParticleName, ctx);
+  SG::ReadHandle<xAOD::TrackParticleContainer> ptracks(m_trkParticleKey, ctx);
   if ((not ptracks.isValid())) {
+    ATH_MSG_ERROR("The track particle container '"<< m_trkParticleKey.key()<<"' could not be read.");
     return StatusCode::FAILURE;
   }
-
   std::vector< SG::WriteDecorHandle<xAOD::TrackParticleContainer,float> >
-    float_decor( IDPVM::createDecorators<xAOD::TrackParticleContainer,float>(m_decor, ctx) );
-
-  for (const xAOD::TrackParticle *trk_particle : *ptracks) {
-    if (not decorateTrack(*trk_particle, float_decor) ) return StatusCode::FAILURE;
+    floatDecoration( IDPVM::createDecorators<xAOD::TrackParticleContainer,float>(m_decor, ctx) );
+  for (const xAOD::TrackParticle *pTrkParticle : *ptracks) {
+    if (not decorateTrack(*pTrkParticle, floatDecoration) ) {
+      ATH_MSG_ERROR("Decoration failed in ParameterErrDecoratorAlg::execute.");
+      return StatusCode::FAILURE;
+    }
   }
   return StatusCode::SUCCESS;
 }
 
 bool
 ParameterErrDecoratorAlg::decorateTrack(const xAOD::TrackParticle& particle,
-                                         std::vector< SG::WriteDecorHandle<xAOD::TrackParticleContainer,float> > &float_decor) const {
+                                         std::vector< SG::WriteDecorHandle<xAOD::TrackParticleContainer,float> > &floatDecoration) const {
   ATH_MSG_VERBOSE("Decorate track with errors ");
   bool success(true);
   const AmgSymMatrix(5)  errorMat = particle.definingParametersCovMatrix();
@@ -70,42 +76,10 @@ ParameterErrDecoratorAlg::decorateTrack(const xAOD::TrackParticle& particle,
   Trk::JacobianThetaPToCotThetaPt TheJac(mtheta, mqp);
   AmgSymMatrix(5) covVert;
   covVert = errorMat.similarity(TheJac);
-  float_decor[kDecorD0err](particle)=Amg::error(covVert, 0);
-  float_decor[kDecorZ0err](particle)=Amg::error(covVert, 1);
-  float_decor[kDecorPhierr](particle)=Amg::error(covVert, 2);
-  float_decor[kDecorThetaerr](particle)=Amg::error(errorMat, Trk::theta);
-  float_decor[kDecorQopterr](particle)=Amg::error(covVert, 4) * 1000.;
+  floatDecoration[kDecorD0err](particle)=Amg::error(covVert, 0);
+  floatDecoration[kDecorZ0err](particle)=Amg::error(covVert, 1);
+  floatDecoration[kDecorPhierr](particle)=Amg::error(covVert, 2);
+  floatDecoration[kDecorThetaerr](particle)=Amg::error(errorMat, Trk::theta);
+  floatDecoration[kDecorQopterr](particle)=Amg::error(covVert, 4) * 1000.;
   return success;
 }
-
-/**
-   AmgVector(5) perigeeParams = startPerigee->parameters();
-      trkd0    = perigeeParams[Trk::d0];
-      trkz0    = perigeeParams[Trk::z0];
-      trkphi   = perigeeParams[Trk::phi0];
-      trktheta = perigeeParams[Trk::theta];
-      //trkcot   = 1./tan(trktheta);
-      trketa   = - log(tan(trktheta / 2.0));
-      trkqOverPt  = perigeeParams[Trk::qOverP]*1000./sin(trktheta);
-      trkpt    = abs(1.0 / trkqOverPt);
-      if (trkqOverPt<0) charge=-1;
-      else charge=+1;
-      const AmgSymMatrix(5) * ErrorMat = startPerigee->covariance();
-      double mtheta = (startPerigee->parameters())[Trk::theta];
-      double mqp = (startPerigee->parameters())[Trk::qOverP];
-      Trk::JacobianThetaPToCotThetaPt TheJac(mtheta,mqp);
-      AmgSymMatrix(5) covVert;
-      covVert = ErrorMat->similarity(TheJac);
-      // trkd0err = sqrt(covVert[0][0]);
-      // trkz0err = sqrt(covVert[1][1]);
-      // trkphierr = sqrt(covVert[2][2]);
-      // trkcoterr = sqrt(covVert[3][3]);
-      // trkqopterr = sqrt(covVert[4][4])*1000.;
-      // trkthetaerr = ErrorMat->error(Trk::theta);
-      trkd0err = Amg::error(covVert,0);
-      trkz0err = Amg::error(covVert,1);
-      trkphierr = Amg::error(covVert,2);
-      //trkcoterr = Amg::error(covVert,3);
-      trkqopterr = Amg::error(covVert,4)*1000.;
-      trkthetaerr = Amg::error((*ErrorMat),Trk::theta);
- **/
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ParameterErrDecoratorAlg.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ParameterErrDecoratorAlg.h
index 02ad809325d407a51bcac8acb3cd10e668d9d6aa..302a6cca336fa477d19f9b82a124c368138320b3 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ParameterErrDecoratorAlg.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ParameterErrDecoratorAlg.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 INDETPHYSVALMONITORING_ParameterErrDecoratorAlg_H
@@ -37,7 +37,7 @@ private:
     {this, "Prefix", "", "Decoration prefix to avoid clashes."};
 
   // need tracks particle key, to compose decoration keys
-  SG::ReadHandleKey<xAOD::TrackParticleContainer>  m_trkParticleName
+  SG::ReadHandleKey<xAOD::TrackParticleContainer>  m_trkParticleKey
     {this,"TrackParticleContainerName", "InDetTrackParticles",""};
 
   enum EDecorations {
diff --git a/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonTrackingGeometryBuilder.cxx b/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonTrackingGeometryBuilder.cxx
index c481613211d08187d8dee4046417f2dc3d8a56ac..a36167934d7a38c12a9b3eb1e3e80638f628566f 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonTrackingGeometryBuilder.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonTrackingGeometryBuilder.cxx
@@ -178,7 +178,7 @@ const Trk::TrackingGeometry* Muon::MuonTrackingGeometryBuilder::trackingGeometry
   RZPairVector envelopeDefs;
   if (m_enclosingEnvelopeSvc) {
     // get the dimensions from the envelope service
-    RZPairVector& envelopeDefsIn = m_enclosingEnvelopeSvc->getMuonRZValues();
+    const RZPairVector& envelopeDefsIn = m_enclosingEnvelopeSvc->getMuonRZBoundary();
 
     // find the max,max pair
     unsigned int ii=0;
@@ -379,7 +379,7 @@ const Trk::TrackingGeometry* Muon::MuonTrackingGeometryBuilder::trackingGeometry
     
   } else {     // no input, create the enclosed volume
     if (m_loadMSentry && m_enclosingEnvelopeSvc ) {
-      RZPairVector& envelopeDefs = m_enclosingEnvelopeSvc->getCaloRZValues();
+      const RZPairVector& envelopeDefs = m_enclosingEnvelopeSvc->getCaloRZBoundary();
       // to be implemented in detail - for the moment, take just maximal extent
       ATH_MSG_DEBUG( " m_loadMSentry " << m_loadMSentry << " m_enclosingEnvelopeSvc " << m_enclosingEnvelopeSvc );
       double rmax = 0.; double zmax = 0.;
diff --git a/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonTrackingGeometryBuilderCond.cxx b/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonTrackingGeometryBuilderCond.cxx
index 4b4dfeb861e7da1ea92326c8a4a702d308468c99..eee3037e4e40ae25b290052206e3546038e9f981 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonTrackingGeometryBuilderCond.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonTrackingGeometryBuilderCond.cxx
@@ -185,7 +185,7 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Muon::MuonTrackingGeometry
   RZPairVector envelopeDefs;
   if (m_enclosingEnvelopeSvc) {
     // get the dimensions from the envelope service
-    RZPairVector& envelopeDefsIn = m_enclosingEnvelopeSvc->getMuonRZValues();
+    const RZPairVector& envelopeDefsIn = m_enclosingEnvelopeSvc->getMuonRZBoundary();
 
     // find the max,max pair
     unsigned int ii=0;
@@ -386,7 +386,7 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Muon::MuonTrackingGeometry
     
   } else {     // no input, create the enclosed volume
     if (m_loadMSentry && m_enclosingEnvelopeSvc ) {
-      RZPairVector& envelopeDefs = m_enclosingEnvelopeSvc->getCaloRZValues();
+      const RZPairVector& envelopeDefs = m_enclosingEnvelopeSvc->getCaloRZBoundary();
       // to be implemented in detail - for the moment, take just maximal extent
       ATH_MSG_DEBUG( " m_loadMSentry " << m_loadMSentry << " m_enclosingEnvelopeSvc " << m_enclosingEnvelopeSvc );
       double rmax = 0.; double zmax = 0.;
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/CscClusterOnTrackCreator.cxx b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/CscClusterOnTrackCreator.cxx
index 2a4595e3883e3b6d549884b0eb1ee0e82844d81d..6e4323af41a1065c1b3ed8f3566b9331163d8c07 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/CscClusterOnTrackCreator.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/CscClusterOnTrackCreator.cxx
@@ -331,7 +331,7 @@ namespace Muon {
       results = m_clusterUtilTool->getRefitCluster(MClus,tantheta);
       results0 = m_clusterUtilTool->getRefitCluster(MClus,0);
 
-      if(&results[0]==nullptr || &results0[0]==nullptr){
+      if(results.empty() || results0.empty()){
 	ATH_MSG_VERBOSE("No fit result");
 	return new CscClusterOnTrack(MClus,locpar,loce,positionAlongStrip,MClus->status(),MClus->timeStatus(),MClus->time());
       }
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecTools.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecTools.py
index 65f39261428b6ecd5a26a5c477a021d9db04e6b1..f967c9556df00edbce6a1156d2dfa54f22ef99ad 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecTools.py
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecTools.py
@@ -156,8 +156,6 @@ class MuonRotCreator(Trk__RIO_OnTrackCreator,ConfiguredBase):
         kwargs.setdefault("ToolMuonDriftCircle", "MdtDriftCircleOnTrackCreator")
         kwargs.setdefault("ToolMuonCluster", "MuonClusterOnTrackCreator")
         kwargs.setdefault("Mode", 'muon' )
-        from InDetRecExample.TrackingCommon import getInDetPixelClusterOnTrackToolDigital
-        kwargs.setdefault("ToolPixelCluster", getInDetPixelClusterOnTrackToolDigital( "PixelClusterOnTrackTool" ) )
         super(MuonRotCreator,self).__init__(name,**kwargs)
 # end of class MuonRotCreator
 
@@ -499,4 +497,4 @@ def MuonLayerSegmentFinderTool(name='MuonLayerSegmentFinderTool',extraFlags=None
     kwargs.setdefault("Csc4DSegmentMaker", getPublicTool("Csc4dSegmentMaker") if MuonGeometryFlags.hasCSC() else "")
     kwargs.setdefault("MuonClusterSegmentFinder",getPublicTool("MuonClusterSegmentFinder"))
 
-    return CfgMgr.Muon__MuonLayerSegmentFinderTool(name,**kwargs)
\ No newline at end of file
+    return CfgMgr.Muon__MuonLayerSegmentFinderTool(name,**kwargs)
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring/MMRawDataMonitoring/ATLAS_CHECK_THREAD_SAFETY b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring/MMRawDataMonitoring/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..8d1faf319c618962e30357a576288d7bdfd3226e
--- /dev/null
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring/MMRawDataMonitoring/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring/MMRawDataMonitoring/MMRawDataMonAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring/MMRawDataMonitoring/MMRawDataMonAlg.h
index 23e6a4682269e95641fdee6265c78e49d9ce110b..d63ec4b50663df5cb625041bed78081925517d40 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring/MMRawDataMonitoring/MMRawDataMonAlg.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring/MMRawDataMonitoring/MMRawDataMonAlg.h
@@ -18,33 +18,21 @@
 #include "AthenaMonitoringKernel/Monitored.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h" 
-#include "AsgTools/ToolHandleArray.h"
-
 //Helper Includes
 
 #include "MuonAnalysisInterfaces/IMuonSelectionTool.h"
-#include "MuonDQAUtils/MuonDQAHistMap.h"
-#include "MuonPrepRawData/MuonCluster.h"
 #include "MuonPrepRawData/MuonPrepDataContainer.h"
 #include "MuonPrepRawData/MMPrepDataCollection.h"
 #include "MuonIdHelpers/IMuonIdHelperSvc.h"
 #include "MuonReadoutGeometry/MuonDetectorManager.h"
-#include "TrkSegment/SegmentCollection.h"
 #include "AthenaMonitoring/DQAtlasReadyFilterTool.h"
-#include "EventInfo/EventInfo.h"
-#include "EventInfo/EventID.h"
 #include "xAODTrigger/MuonRoIContainer.h"
 #include "xAODMuon/MuonContainer.h"
 #include "MuonPrepRawData/MuonPrepDataContainer.h"
 #include "MuonPrepRawData/MMPrepDataContainer.h"
 #include "MuonPrepRawData/MMPrepData.h"
-#include "xAODEventInfo/EventInfo.h"
 #include "StoreGate/ReadHandleKey.h"
 
-//standard library includes
-#include <fstream> 
-#include <cstdlib>
-#include <iostream>
 
 namespace Muon {
   class MMPrepData;
@@ -56,15 +44,7 @@ namespace {
 }
 
 //stl includes                                                                                              
-                                                                    
-#include <sstream>
 #include <string>
-#include <vector>
-#include <map>
-#include <set>
-
-//root includes
-class TString;
 
 class MMRawDataMonAlg: public AthMonitorAlgorithm {
  public:
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring/src/MMRawDataMonAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring/src/MMRawDataMonAlg.cxx
index aa2187a5f2a540c5f527dd7717c7eccbdf974b05..f7c30ff74ee0096fee0c91a8db3ca1bcb70da339 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring/src/MMRawDataMonAlg.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring/src/MMRawDataMonAlg.cxx
@@ -15,36 +15,20 @@
 #include "MuonReadoutGeometry/MMReadoutElement.h"
 #include "MuonDQAUtils/MuonChamberNameConverter.h"
 #include "MuonDQAUtils/MuonChambersRange.h"
-#include "MuonDQAUtils/MuonDQAHistMap.h"
 #include "MuonCalibIdentifier/MuonFixedId.h"
-#include "MuonSegment/MuonSegment.h"
 
 #include "MMRawDataMonitoring/MMRawDataMonAlg.h"
-#include "TrkEventPrimitives/FitQuality.h"
 
-#include "AnalysisTriggerEvent/LVL1_ROI.h"
-#include "xAODMuon/Muon.h"
 #include "xAODTracking/TrackParticleContainer.h"
 #include "xAODTracking/TrackParticle.h"
 #include "xAODTracking/TrackingPrimitives.h"
 #include "MuonPrepRawData/MuonPrepDataContainer.h"
 #include "MuonRIO_OnTrack/MMClusterOnTrack.h"
-#include "TrkTrack/TrackCollection.h"
-#include "TrkTrack/Track.h"
-#include "GaudiKernel/MsgStream.h"
 #include "AthenaMonitoring/AthenaMonManager.h"
 #include "MuonPrepRawData/MMPrepData.h"
 
-//root includes
-#include <TMath.h>
-#include <math.h>
-#include <sstream>
-#include <TH2F.h>
-#include <cmath>
-
 namespace {
 
-  int PCB;
   static constexpr double const toDeg = 180/M_PI;
 
   //1e=1.6X10-4 fC                                                                                          
@@ -212,11 +196,10 @@ StatusCode MMRawDataMonAlg::fillMMOverviewVects( const Muon::MMPrepData* prd, MM
   float mu_TPC_chi2=prd->chisqProb();
 
   Amg::Vector3D pos    = prd->globalPosition();
-  TVector3 v (pos.x(),pos.y(),pos.z());
   
   float R=std::hypot(pos.x(),pos.y());
 
-  PCB=get_PCB_from_channel(channel);
+  int PCB=get_PCB_from_channel(channel);
 
   //MM gaps are back to back, so the direction of the drift (time) is different for the even and odd gaps -> flip for the even gaps
 
@@ -466,7 +449,7 @@ void MMRawDataMonAlg::clusterFromTrack(const xAOD::TrackParticleContainer*  muon
 		
 		int sectorPhi=get_sectorPhi_from_stationPhi_stName(stPhi,stName);
 		
-		PCB=get_PCB_from_channel(ch);
+		int PCB=get_PCB_from_channel(ch);
 		
 		auto& vects=overviewPlots;
 		
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring/src/MMRawDataUtils.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring/src/MMRawDataUtils.cxx
index d9d32f063b5082f9e17db21f2a7d7099739805b5..1da4f3cf651d3a067b71705e4d9f1258a53c080c 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring/src/MMRawDataUtils.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MMRawDataMonitoring/src/MMRawDataUtils.cxx
@@ -17,14 +17,7 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
          
 
 #include "MMRawDataMonitoring/MMRawDataMonAlg.h"
-#include <TError.h>
 #include <string>
-#include <TBox.h>
-#include <TList.h>
-#include <TLine.h>
-#include <TColor.h>
-#include <TString.h>
-#include <TRegexp.h>
 #include <stdexcept>
 
 int MMRawDataMonAlg::get_PCB_from_channel(int channel) const {
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RPCStandaloneTracksMon.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RPCStandaloneTracksMon.h
index 7be2ebd9963b7e6c66a76be1802669c7636fa4a1..369b985a1f3d891e197e00b05189868c8abafee8 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RPCStandaloneTracksMon.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RPCStandaloneTracksMon.h
@@ -85,7 +85,6 @@ class RPCStandaloneTracksMon: public ManagedMonitorToolBase {
   
   ActiveStoreSvc* m_activeStore;
 
-  std::string m_muonSegmentsName;
   std::string m_muonTracksName;
   std::string m_msVertexCollection;
   std::string m_muonExtrapTracksName;
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCStandaloneTracksMon.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCStandaloneTracksMon.cxx
index 9e120ac8ebddc38879a32c0f44e0d4cf9a2a150d..6f395b80a8302d2b6ecad5cf1f2bffbe45a8c146 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCStandaloneTracksMon.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCStandaloneTracksMon.cxx
@@ -103,14 +103,11 @@ RPCStandaloneTracksMon::RPCStandaloneTracksMon( const std::string & type, const
   declareProperty("Muon_Trigger_Items",   m_muon_triggers);
   declareProperty("TriggerDecisionTool",  m_trigDecTool);
   
-  declareProperty("MuonSegmentCollection",	     m_muonSegmentsName     = "MuonSegments");
   declareProperty("MuonTrackCollection",	     m_muonTracksName	    = "MuonSpectrometerTrackParticles");
   declareProperty("MuonExtrapolatedTrackCollection", m_muonExtrapTracksName = "ExtrapolatedMuonTrackParticles");
   declareProperty("InDetTrackParticles",	     m_innerTracksName      = "InDetTrackParticles");
   declareProperty("MSVertexCollection",              m_msVertexCollection   = "MSDisplacedVertex");
   
-  
-  
   declareProperty("MuonDeltaRMatching"          , m_MuonDeltaRMatching         =   0.15 ); 
   declareProperty("requireMuonCombinedTight"    , m_requireMuonCombinedTight   = false  );
   declareProperty("StandAloneMatchedWithTrack"  , m_StandAloneMatchedWithTrack = true   );
@@ -289,26 +286,15 @@ StatusCode RPCStandaloneTracksMon::fillHistograms()
       }
   }
     
-   //Muon tracks
-     
-//       // retrieve containers
-//       const xAOD::MuonSegmentContainer*     MuonSegments = evtStore()->retrieve< const xAOD::MuonSegmentContainer >        (m_muonSegmentsName);       
-//       const xAOD::TrackParticleContainer*   tracksMS     = evtStore()->retrieve< const xAOD::TrackParticleContainer >        (m_muonTracksName);      
-         SG::ReadHandle<xAOD::MuonContainer> Muons(m_muonsName);
+   //Muon tracks   
+   SG::ReadHandle<xAOD::MuonContainer> Muons(m_muonsName);
 	 ATH_MSG_DEBUG ("Muon container with key: " << m_muonsName.key()<<" found");
-//       const xAOD::VertexContainer*	       MSVertices   = evtStore()->retrieve< const xAOD::VertexContainer >           (m_msVertexCollection);
-//       const xAOD::TrackParticleContainer*   METracks     = evtStore()->retrieve< const xAOD::TrackParticleContainer >( m_muonExtrapTracksName );
-//       const xAOD::TrackParticleContainer*   IDTracks     = evtStore()->retrieve< const xAOD::TrackParticleContainer >     ( m_innerTracksName );
-  
-      
-      
+
       SG::ReadHandle<Muon::RpcPrepDataContainer> rpc_container(m_key_rpc);
       ATH_MSG_DEBUG ( "RpcPrepDataContainer " << m_key_rpc.key() <<" found");
 
       SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfo);
 
-      //int RunNumber = eventInfo->runNumber();
-      //long int EventNumber = eventInfo->eventNumber();
       long int BCID   =  eventInfo->       bcid()  ;
       int lumiBlock   =  eventInfo->  lumiBlock()  ; 
       
diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_eljob.py b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_eljob.py
index ffcf2f3e48d094cfd01f7a222259706ee2cfa53c..4ac99cd0b355a9b992f3f3080329de19f92a7fe9 100755
--- a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_eljob.py
+++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_eljob.py
@@ -54,7 +54,7 @@ job.options().setString( ROOT.EL.Job.optSubmitDirMode, "unique" )
 
 from TriggerAnalysisAlgorithms.TriggerAnalysisAlgorithmsTest 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/D3PDMaker/TrigCostD3PDMaker/CMakeLists.txt b/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/CMakeLists.txt
deleted file mode 100644
index 64a102198686e2c74fb52f6e90c30879b5cfc582..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-################################################################################
-# Package: TrigCostD3PDMaker
-################################################################################
-
-# Declare the package name:
-atlas_subdir( TrigCostD3PDMaker )
-
-# Component(s) in the package:
-atlas_add_library( TrigCostD3PDMakerLib
-                   src/*.cxx
-                   NO_PUBLIC_HEADERS
-                   LINK_LIBRARIES StoreGateLib SGtests
-                   PRIVATE_LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel TrigConfHLTData TrigConfL1Data TrigMonitoringEvent D3PDMakerInterfaces TrigConfInterfaces )
-
-atlas_add_component( TrigCostD3PDMaker
-                     src/components/*.cxx
-                     LINK_LIBRARIES AthenaBaseComps AthenaKernel StoreGateLib SGtests GaudiKernel TrigConfHLTData TrigConfL1Data TrigMonitoringEvent TrigCostD3PDMakerLib D3PDMakerInterfaces TrigConfInterfaces )
-
-# Install files from the package:
-atlas_install_python_modules( python/*.py )
-atlas_install_joboptions( share/*.py )
-
diff --git a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/python/TrigCostConfMetadata.py b/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/python/TrigCostConfMetadata.py
deleted file mode 100644
index e6d11edbef3676d92b1e9d1739441f380d8a5a83..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/python/TrigCostConfMetadata.py
+++ /dev/null
@@ -1,84 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-# $Id: TrigConfMetadata.py 618376 2014-09-24 15:33:35Z tamartin $
-#
-# This module holds the code that should be used to add trigger configuration
-# metadata to the D3PD.
-#
-
-def addTrigCostConfMetadata( d3pdalg = None, doCostL2 = False, doCostEF = False, doCostHLT = False, tuplePath = "" ):
-
-    """Helper function that adds the necessary tool(s) and service(s) to the
-       job to save the trigger configuration metadata to the output D3PD
-       file.
-
-        Arguments:
-          d3pdalg: The D3PD::MakerAlg that is creating the D3PD. If not specified,
-                   the configuration is saved in a file called TrigConfig.root
-          useTrigConfEventSummaries:	Set true when running in AtlasP1HLT or trigger BS
-                   to gather detailed configuration from TrigConfEvent
-                   summary objects (TrigCost running). 
-    """
-
-    # Create a logger for the function:
-    if "logger" in dir(): orig_logger = logger
-    from AthenaCommon.Logging import logging
-    logger = logging.getLogger( "addTrigConfMetadata" )
-
-    # Let the user know what we're doing:
-    logger.info( "Adding trigger configuration metadata to the D3PD" )
-
-    # The tool needs a special D3PDSvc in which the indexing is turned off
-    # for the TTree-s:
-    _d3pdSvcName = "TrigConfD3PDSvc"
-    from AthenaCommon.AppMgr import ServiceMgr
-    if not hasattr( ServiceMgr, _d3pdSvcName ):
-        from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc
-        ServiceMgr += D3PD__RootD3PDSvc( _d3pdSvcName )
-        ServiceMgr.TrigConfD3PDSvc.MasterTree = ""
-        ServiceMgr.TrigConfD3PDSvc.IndexMajor = ""
-    else:
-        logger.info( "The private D3PDSvc for the metadata TTree already exists" )
-    _d3pdSvc = getattr( ServiceMgr, _d3pdSvcName )
-
-    # If no D3PD::MakerAlg has been provided, create a dummy one:
-    if d3pdalg == None:
-        logger.warning( "No D3PD MakerAlg given to function!" )
-        logger.warning( "The trigger configuration will be saved into file: " +
-                        "\"TrigConfig.root\"" )
-        from AthenaCommon.AlgSequence import AlgSequence
-        theJob = AlgSequence()
-        import D3PDMakerCoreComps
-        d3pdalg = D3PDMakerCoreComps.MakerAlg( "trigConf", theJob, file = "TrigConfig.root",
-                                               D3PDSvc = _d3pdSvc )
-
-    # Add the metadata tool:
-    _d3pdToolName = "TrigCostConfMetadataTool"
-    if not _d3pdToolName in [ t.name() for t in d3pdalg.MetadataTools ]:
-        import TrigCostD3PDMaker
-        if (tuplePath == ""):
-          tuplePath = d3pdalg.TuplePath
-        _trigConfTool = TrigCostD3PDMaker.TrigCostConfMetadataTool( _d3pdToolName,
-                                                                   D3PDSvc = _d3pdSvc,
-                                                                   ConfigDir = tuplePath + "Meta" )
-        # Figure out if old or new style HLT if using CostMon to get correct storegate key
-        # Old key fomat was HLT_OPI_HLT_monitoring_config
-        if (doCostL2 == True or doCostEF == True or doCostHLT == True):
-          logger.info( "TrigCostConfMetadataTool will use passed arguments [L2="+str(doCostL2)+",EF="+str(doCostEF)+",HLT="+str(doCostHLT)+"]" )
-          if (doCostL2 == True or doCostEF == True):
-            _trigConfTool.keyConfig = "HLT_TrigMonConfigCollection_OPI_EF_monitoring_config"
-          elif (doCostHLT == True):
-            _trigConfTool.keyConfig = "HLT_TrigMonConfigCollection_OPI_HLT_monitoring_config"
-        else: 
-          logger.info( "TrigCostConfMetadataTool will use TriggerFlags flags for config" )
-          from TriggerJobOpts.TriggerFlags import TriggerFlags
-          if TriggerFlags.doHLT() and not (TriggerFlags.doEF() or TriggerFlags.doLVL2()):
-            _trigConfTool.keyConfig = "HLT_TrigMonConfigCollection_OPI_HLT_monitoring_config"
-          elif TriggerFlags.doEF() or TriggerFlags.doLVL2():
-            _trigConfTool.keyConfig = "HLT_TrigMonConfigCollection_OPI_EF_monitoring_config"
-        logger.info( "TrigConfMetadataTool will use the StoreGate key " + _trigConfTool.keyConfig )
-        d3pdalg.MetadataTools += [ _trigConfTool ]
-    else:
-      logger.info( "TrigCostConfMetadataTool was already added to the D3PD::MakerAlg" )
-
-    return
diff --git a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/python/__init__.py b/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/python/__init__.py
deleted file mode 100644
index 1cb74541566b7993be87dc69a4e2685ca7cc34ba..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/python/__init__.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-# $Id$
-#
-# @file TriggerD3PDMaker/python/__init__.py
-# @author scott snyder <snyder@bnl.gov>
-# @date Sep, 2009
-# @brief Define shortcuts for referencing configurables in this package.
-#
-# With this, instead of writing
-#
-#   TrigCostD3PDMaker.TrigCostD3PDMakerConf.D3PD__FourMomFillerTool
-#
-# we can write
-#
-#   TrigCostD3PDMaker.FourMomFillerTool
-#
-
-import TrigCostD3PDMaker.TrigCostD3PDMakerConf
-for k, v in TrigCostD3PDMakerConf.__dict__.items():
-    if k.startswith ('D3PD__'):
-        globals()[k[6:]] = v
-
diff --git a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/python/addTrigCostData.py b/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/python/addTrigCostData.py
deleted file mode 100644
index bfff78e7939a055c42c17f67c9b2fbcad8689782..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/python/addTrigCostData.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-# $Id: addTrigCostD3PD.py tamartin
-#
-# Add a trig cost D3PD output stream
-
-def addTrigCostData(mode = "COST", fileName = "trig_cost.root", costConfigL2 = False, costConfigEF = False, costConfigHLT = True):
-
-    # Set up a logger:
-    from AthenaCommon.Logging import logging
-    addTrigCostData_msg = logging.getLogger( 'addTrigCostData' )
-
-    # Construct the stream and file names for the Trigger D3PD:
-    streamName = "StreamNTUP_TRIG" + mode
-    addTrigCostData_msg.info( "Configuring Trigger Cost D3PD from bytestream with streamName '%s' and fileName '%s'" % ( streamName, fileName ) )
-
-    # Create the D3PD stream(s):
-    # We dont actually use the default stream! 
-    from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
-    d3pdalg = MSMgr.NewRootStream( streamName, fileName, "dummy" )
-      
-    # As we are running from bytestream, need to disable data headers.
-    from AthenaCommon.AlgSequence import AlgSequence
-    theJob = AlgSequence()
-    fullStreamName = "StreamNTUP_TRIG" + mode + "AANTStream"
-    if hasattr(theJob, fullStreamName):
-        streamRef = getattr( theJob, fullStreamName )
-        streamRef.ExistDataHeader = False
-        streamRef.WriteInputDataHeader = False
-
-    # The tool needs a special D3PDSvc in which the indexing is turned off for the TTree-s:
-    _costD3PDSvcName = "TrigCostD3PDSvc_" + mode
-    from AthenaCommon.AppMgr import ServiceMgr
-    if not hasattr( ServiceMgr, _costD3PDSvcName ):
-        from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc
-        ServiceMgr += D3PD__RootD3PDSvc( _costD3PDSvcName )
-    else:
-        addTrigCostData_msg.info( "The private D3PDSvc for the cost monitoring TTree already exists" )
-    _costD3PDSvc = getattr( ServiceMgr, _costD3PDSvcName )
-    _costD3PDSvc.MasterTree = ""
-    _costD3PDSvc.IndexMajor = ""
-
-    # Add the tool:
-    _costD3PDToolName = "TrigCostD3PDMakerTool_" + mode
-    _tuplePath = "/StreamNTUP_TRIG" + mode + "/trig_cost"
-    if not _costD3PDToolName in [ t.name() for t in d3pdalg.MetadataTools ]:
-        import TrigCostD3PDMaker
-        _trigCostTool = TrigCostD3PDMaker.TrigCostD3PDMakerTool( _costD3PDToolName, D3PDSvc = _costD3PDSvc, dir = _tuplePath )
-        _trigCostTool.mode = mode
-        if (costConfigL2 == True):
-            _trigCostTool.keyEvent = "HLT_TrigMonEventCollection_OPI_L2_monitoring_event"
-            _trigCostTool.prefix = "TrigCostL2_"
-        elif (costConfigEF == True):
-            _trigCostTool.keyEvent = "HLT_TrigMonEventCollection_OPI_EF_monitoring_event"
-            _trigCostTool.prefix = "TrigCostEF_"
-        elif (costConfigHLT == True):
-            _trigCostTool.keyEvent = "HLT_TrigMonEventCollection_OPI_HLT_monitoring_event"
-            _trigCostTool.prefix = "TrigCostHLT_"
-        d3pdalg.MetadataTools += [ _trigCostTool ]
-
-    if (mode != "EBWEIGHT"):
-      from TrigCostD3PDMaker.TrigCostConfMetadata import addTrigCostConfMetadata
-      addTrigCostConfMetadata( d3pdalg, costConfigL2, costConfigEF, costConfigHLT, _tuplePath )
diff --git a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/share/TrigCostD3PDMaker_prodJobOFragment.py b/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/share/TrigCostD3PDMaker_prodJobOFragment.py
deleted file mode 100644
index 224ac76003a47032163fc162e0a186edfc96a340..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/share/TrigCostD3PDMaker_prodJobOFragment.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# $Id: TrigCostD3PD_prodJobOFragment.py tamartin
-#
-# Top jobO fragment setting up the common Trig Cost (NTUP_TRIG_COST).
-
-# This jobO should not be included more than once:
-include.block( "TrigCost3PDMaker/TrigCostD3PDMaker_prodJobOFragment.py" )
-
-from AthenaCommon.Logging import logging
-TrigCostD3PDStream_msg = logging.getLogger( 'TrigCostD3PDMaker_prodJobOFragment' )
-
-costConfigL2 = False
-costConfigEF = False
-costConfigHLT = False
-if ('costD3PD_doL2' in dir() or 'costD3PD_doEF' in dir() or 'costD3PD_doHLT' in dir()):
-    TrigCostD3PDStream_msg.info( "Configuring via cosD3PD flags" );
-    if ('costD3PD_doL2' in dir() and bool(costD3PD_doL2) == True):   costConfigL2 = True
-    if ('costD3PD_doEF' in dir() and bool(costD3PD_doEF) == True):   costConfigEF = True
-    if ('costD3PD_doHLT' in dir() and bool(costD3PD_doHLT) == True): costConfigHLT = True
-else:
-    TrigCostD3PDStream_msg.info( "Configuring via TriggerFlags" );
-    from TriggerJobOpts.TriggerFlags import TriggerFlags
-    if TriggerFlags.doLVL2(): costConfigL2 = True
-    if TriggerFlags.doEF():   costConfigEF = True
-    if TriggerFlags.doHLT():  costConfigHLT = True
-
-from TrigCostD3PDMaker.addTrigCostData import addTrigCostData
-addTrigCostData("COST", "trig_cost.root", costConfigL2, costConfigEF, costConfigHLT);
\ No newline at end of file
diff --git a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/share/TrigEBWeightD3PDMaker_prodJobOFragment.py b/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/share/TrigEBWeightD3PDMaker_prodJobOFragment.py
deleted file mode 100644
index 52c81eb68ec8fd28138e627ccec6964ea7f9645e..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/share/TrigEBWeightD3PDMaker_prodJobOFragment.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# $Id: TrigCostD3PD_prodJobOFragment.py tamartin
-#
-# Top jobO fragment setting up the common Trig Cost (NTUP_TRIG_COST).
-
-# This jobO should not be included more than once:
-include.block( "TrigCost3PDMaker/TrigEBWeightD3PDMaker_prodJobOFragment.py" )
-
-from AthenaCommon.Logging import logging
-TrigEBWeightD3PDStream_msg = logging.getLogger( 'TrigEBWeightD3PDMaker_prodJobOFragment' )
-
-costConfigL2 = False
-costConfigEF = False
-costConfigHLT = False
-if ('costD3PD_doL2' in dir() or 'costD3PD_doEF' in dir() or 'costD3PD_doHLT' in dir()):
-    TrigEBWeightD3PDStream_msg.info( "Configuring via cosD3PD flags" );
-    if ('costD3PD_doL2' in dir() and bool(costD3PD_doL2) == True):   costConfigL2 = True
-    if ('costD3PD_doEF' in dir() and bool(costD3PD_doEF) == True):   costConfigEF = True
-    if ('costD3PD_doHLT' in dir() and bool(costD3PD_doHLT) == True): costConfigHLT = True
-else:
-    TrigEBWeightD3PDStream_msg.info( "Configuring via TriggerFlags" );
-    from TriggerJobOpts.TriggerFlags import TriggerFlags
-    if TriggerFlags.doLVL2(): costConfigL2 = True
-    if TriggerFlags.doEF():   costConfigEF = True
-    if TriggerFlags.doHLT():  costConfigHLT = True
-
-from TrigCostD3PDMaker.addTrigCostData import addTrigCostData
-addTrigCostData("EBWEIGHT", "trig_ebweight.root", costConfigL2, costConfigEF, costConfigHLT);
\ No newline at end of file
diff --git a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/share/TrigRateD3PDMaker_prodJobOFragment.py b/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/share/TrigRateD3PDMaker_prodJobOFragment.py
deleted file mode 100644
index cc0f28d2514722aec91a373e4636d9d20f7346a1..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/share/TrigRateD3PDMaker_prodJobOFragment.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# $Id: TrigCostD3PD_prodJobOFragment.py tamartin
-#
-# Top jobO fragment setting up the common Trig Cost (NTUP_TRIG_COST).
-
-# This jobO should not be included more than once:
-include.block( "TrigCost3PDMaker/TrigRateD3PDMaker_prodJobOFragment.py" )
-
-from AthenaCommon.Logging import logging
-TrigRateD3PDStream_msg = logging.getLogger( 'TrigRateD3PDMaker_prodJobOFragment' )
-
-costConfigL2 = False
-costConfigEF = False
-costConfigHLT = False
-if ('costD3PD_doL2' in dir() or 'costD3PD_doEF' in dir() or 'costD3PD_doHLT' in dir()):
-    TrigRateD3PDStream_msg.info( "Configuring via cosD3PD flags" );
-    if ('costD3PD_doL2' in dir() and bool(costD3PD_doL2) == True):   costConfigL2 = True
-    if ('costD3PD_doEF' in dir() and bool(costD3PD_doEF) == True):   costConfigEF = True
-    if ('costD3PD_doHLT' in dir() and bool(costD3PD_doHLT) == True): costConfigHLT = True
-else:
-    TrigRateD3PDStream_msg.info( "Configuring via TriggerFlags" );
-    from TriggerJobOpts.TriggerFlags import TriggerFlags
-    if TriggerFlags.doLVL2(): costConfigL2 = True
-    if TriggerFlags.doEF():   costConfigEF = True
-    if TriggerFlags.doHLT():  costConfigHLT = True
-
-from TrigCostD3PDMaker.addTrigCostData import addTrigCostData
-addTrigCostData("RATE", "trig_rate.root", costConfigL2, costConfigEF, costConfigHLT);
\ No newline at end of file
diff --git a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/src/TrigCostConfMetadataTool.cxx b/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/src/TrigCostConfMetadataTool.cxx
deleted file mode 100644
index d58388207065d6eef70b3ec85ededf0e948f0978..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/src/TrigCostConfMetadataTool.cxx
+++ /dev/null
@@ -1,510 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: TrigConfMetadataTool.cxx 729020 2016-03-10 17:55:29Z tamartin $
-
-// Athena/Gaudi include(s):
-#include "AthenaKernel/errorcheck.h"
-
-// STL include(s):
-#include "limits.h"
-
-// Trigger configuration include(s):
-#include "TrigConfL1Data/CTPConfig.h"
-#include "TrigConfL1Data/Menu.h"
-#include "TrigConfL1Data/TriggerItem.h"
-#include "TrigConfL1Data/PrescaleSet.h"
-#include "TrigConfHLTData/HLTChainList.h"
-#include "TrigConfHLTData/HLTChain.h"
-
-// Trigger [TrigMonConfig] data include(s):
-#include "TrigMonitoringEvent/TrigMonConfigCollection.h"
-#include "TrigMonitoringEvent/TrigMonEventCollection.h"
-#include "TrigMonitoringEvent/TrigConfChain.h"
-#include "TrigMonitoringEvent/TrigConfSeq.h"
-#include "TrigMonitoringEvent/TrigConfSig.h"
-#include "TrigMonitoringEvent/TrigConfAlg.h"
-
-// D3PDMaker include(s):
-#include "D3PDMakerInterfaces/ID3PD.h"
-
-// Local include(s):
-#include "TrigCostConfMetadataTool.h"
-
-namespace D3PD {
-
-   TrigCostConfMetadataTool::TrigCostConfMetadataTool( const std::string& type,
-                                               const std::string& name,
-                                               const IInterface* parent )
-      : AthAlgTool( type, name, parent ),
-        m_configDir( "" ),
-        m_trigConfSvc( "TrigConf::TrigConfigSvc/TrigConfigSvc", name ),
-        m_incidentSvc( "IncidentSvc", name ),
-        m_d3pdSvc( "D3PD::RootD3PDSvc/TrigConfD3PDSvc", name ),
-        m_storeGate( "StoreGateSvc", name),
-        m_configKeyCache(),
-        m_configTree( 0 ), m_smk( 0 ), m_l1psk( 0 ), m_hltpsk( 0 ),
-        m_lvl1ConfigNameMap( 0 ), m_lvl1ConfigPSKMap( 0 ),
-        m_hltConfigNameMap( 0 ), m_hltConfigPSKMap( 0 ),
-        m_hltConfigRPSKMap( 0 ), m_hltConfigPTMap( 0 ),
-        m_hltConfigLowerChainNameMap( 0 ),
-
-        m_chainN (nullptr),
-        m_chainID (nullptr),
-        m_chainCounter (nullptr),
-        m_chainName (nullptr),
-        m_chainLowerID (nullptr),
-        m_chainLowerIDs (nullptr),
-        m_chainLowerName (nullptr),
-        m_chainLowerCounter (nullptr),
-        m_chainLevel (nullptr),
-        m_chainPrescale (nullptr),
-        m_chainPassthrough (nullptr),
-        m_chainStreamNames (nullptr),
-        m_chainStreamPrescales (nullptr),
-        m_chainGroupNames (nullptr),
-        m_chainEBHypoNames (nullptr),
-        m_chainSigN (nullptr),
-        m_chainSigCounter (nullptr),
-        m_chainSigLogic (nullptr),
-        m_chainSigLabel (nullptr),
-        m_chainSigOutputTEn (nullptr),
-        m_chainSigOutputTEIndex (nullptr),
-        m_chainSigOutputTEs (nullptr),
-        m_seqN (nullptr),
-        m_seqID (nullptr),
-        m_seqIndex (nullptr),
-        m_seqName (nullptr),
-        m_seqTopoTEID (nullptr),
-        m_seqInputTEs (nullptr),
-        m_seqAlgN (nullptr),
-        m_seqAlgIndex (nullptr),
-        m_seqAlgPosition (nullptr),
-        m_seqAlgNameID (nullptr),
-        m_seqAlgTypeID (nullptr),
-        m_seqAlgName (nullptr),
-        m_seqAlgTypeName (nullptr),
-        m_confVarKey (nullptr),
-        m_confVarVal (nullptr),
-        m_confStringKey (nullptr),
-        m_confStringVal (nullptr)
-   {
-
-      declareProperty( "ConfigDir", m_configDir = "/D3PD/d3pdMeta" );
-      declareProperty( "TrigConfigSvc", m_trigConfSvc );
-      declareProperty( "IncidentSvc", m_incidentSvc );
-      declareProperty( "D3PDSvc", m_d3pdSvc );
-      declareProperty( "keyConfig", m_keyConfig = "HLT_OPI_HLT_monitoring_config"); ///< [TrigMonConfig] Name of TrigerConfigurationObject
-   }
-
-   StatusCode TrigCostConfMetadataTool::initialize() {
-
-      ATH_MSG_INFO( "Initializing. Package version: " << PACKAGE_VERSION );
-
-      // Retrieve the needed services:
-      CHECK( m_trigConfSvc.retrieve() );
-      CHECK( m_incidentSvc.retrieve() );
-      CHECK( m_d3pdSvc.retrieve() );
-      CHECK( m_storeGate.retrieve() );
-
-      // Set up the tool to listen to a few incidents:
-       m_incidentSvc->addListener( this, IncidentType::EndEvent );
-
-      // Create the configuration objects through the D3PD service:
-      CHECK( m_d3pdSvc->make( m_configDir + "/TrigConfTree", m_configTree ) );
-
-      // Add the variables to the configuration "tree":
-      CHECK( m_configTree->addVariable( "SMK",    m_smk,
-                                        "Super Master Key" ) );
-      CHECK( m_configTree->addVariable( "L1PSK",  m_l1psk,
-                                        "LVL1 PreScale Key" ) );
-      CHECK( m_configTree->addVariable( "HLTPSK", m_hltpsk,
-                                        "HLT PreScale Key" ) );
-
-      CHECK( m_configTree->addVariable( "LVL1NameMap", m_lvl1ConfigNameMap,
-                                        "LVL1 item name -> CTP ID mapping" ) );
-      CHECK( m_configTree->addVariable( "LVL1PrescaleMap", m_lvl1ConfigPSKMap,
-                                        "LVL1 item name -> Prescale value mapping" ) );
-      CHECK( m_configTree->addVariable( "HLTNameMap", m_hltConfigNameMap,
-                                        "HLT chain name -> Chain ID mapping" ) );
-      CHECK( m_configTree->addVariable( "HLTPrescaleMap", m_hltConfigPSKMap,
-                                        "HLT chain name -> Prescale value mapping" ) );
-      CHECK( m_configTree->addVariable( "HLTRerunPrescaleMap", m_hltConfigRPSKMap,
-                                        "HLT chain name -> Re-run prescale value mapping" ) );
-      CHECK( m_configTree->addVariable( "HLTPassthroughMap", m_hltConfigPTMap,
-                                        "HLT chain name -> Passthrough value mapping" ) );
-      CHECK( m_configTree->addVariable( "HLTLowerChainNameMap",
-                                        m_hltConfigLowerChainNameMap,
-                                        "HLT chain name -> Lower chain/item name mapping" ) );
-                                        
-      // variables for CHAIN
-      CHECK( m_configTree->addVariable( "chainConfig_n", m_chainN, "Number of chains (including L1)" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_ID", m_chainID, "Hash value of chain name" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_counter", m_chainCounter, "HLT chain counter or L1 CTPID" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_name", m_chainName, "Chain name" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_lowerID", m_chainLowerID, "Hash of lower seeding chain name" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_lowerChainIDs", m_chainLowerIDs, "Vector of hashes of lower seeding chain names for multi-seeded chains" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_lowerName", m_chainLowerName, "Name of lower seeding chain(s), comma separated" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_lowerCounter", m_chainLowerCounter, "Counter of lower seeding chain" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_level", m_chainLevel, "Level of chain (1,2,3)" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_prescale", m_chainPrescale, "Chain prescale setting" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_passthrough", m_chainPassthrough, "Chain passthrough setting" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_streamNames", m_chainStreamNames, "Vector of chain stream names" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_streamPrescales", m_chainStreamPrescales, "Vector of stream prescales for chain" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_groupNames", m_chainGroupNames, "Vector of group names for chain" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_EBHypoNames", m_chainEBHypoNames, "Vector of L1 items from EB Hypo" ) );
-      // variables for CHAIN -> SIGNATURE
-      CHECK( m_configTree->addVariable( "chainConfig_sig_n", m_chainSigN, "Number of signatures in chain" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_sig_counter", m_chainSigCounter, "Signature position in chain" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_sig_logic", m_chainSigLogic, "Singmature logic" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_sig_label", m_chainSigLabel, "Singature label" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_sig_outputTE_n", m_chainSigOutputTEn, "Number of output Trigger Elements from signature" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_sig_outputTE_index", m_chainSigOutputTEIndex, "Index in vector containing Trigger Element outputs" ) );
-      CHECK( m_configTree->addVariable( "chainConfig_sigOutputTEs", m_chainSigOutputTEs, "Vector of vector<TE_Outputs>, use outputTE_index to locate the correct entry" ) );
-                                   
-      // variables for SEQUENCE
-      CHECK( m_configTree->addVariable( "seqConfig_n", m_seqN, "Number of sequences in configuration" ) );
-      CHECK( m_configTree->addVariable( "seqConfig_outputTEID", m_seqID, "ID of trigger element output" ) );
-      CHECK( m_configTree->addVariable( "seqConfig_outputTEIndex", m_seqIndex, "Index of output TE" ) );
-      CHECK( m_configTree->addVariable( "seqConfig_outputTEName", m_seqName, "Name of output TE" ) );
-      CHECK( m_configTree->addVariable( "seqConfig_topoTEID", m_seqTopoTEID, "ID of topo start TE" ) );
-      CHECK( m_configTree->addVariable( "seqConfig_inputTEs", m_seqInputTEs, "Vector of input TE IDs" ) );
-      // variables for SEQUENCE -> ALG
-      CHECK( m_configTree->addVariable( "seqConfig_alg_n", m_seqAlgN, "Number of algorithms in sequence" ) );
-      CHECK( m_configTree->addVariable( "seqConfig_alg_index", m_seqAlgIndex, "Unique algorithm index in current configuration" ) );
-      CHECK( m_configTree->addVariable( "seqConfig_alg_position", m_seqAlgPosition, "Position of algorithm in sequence" ) );
-      CHECK( m_configTree->addVariable( "seqConfig_alg_nameID", m_seqAlgNameID, "Hash of alg name" ) );
-      CHECK( m_configTree->addVariable( "seqConfig_alg_typeID", m_seqAlgTypeID, "Hash of class name" ) );
-      CHECK( m_configTree->addVariable( "seqConfig_alg_name", m_seqAlgName, "Algorithm instance name" ) );
-      CHECK( m_configTree->addVariable( "seqConfig_alg_typeName", m_seqAlgTypeName, "Algorithm base class name" ) );
-      // variables for misc other config data
-      CHECK( m_configTree->addVariable( "config_miscVarKey", m_confVarKey, "Key to misc additional config int payload" ) );
-      CHECK( m_configTree->addVariable( "config_miscVarVal", m_confVarVal, "Value of additional config int payload" ) );
-      CHECK( m_configTree->addVariable( "config_miscStringKey", m_confStringKey, "Key to misc additional config string payload" ) );
-      CHECK( m_configTree->addVariable( "config_miscStringVal", m_confStringVal, "alue of additional config string payload" ) );
-            
-      // Clear the cache, just to be sure:
-      m_configKeyCache.clear();
-
-      return StatusCode::SUCCESS;
-   }
-
-   StatusCode TrigCostConfMetadataTool::queryInterface( const InterfaceID& riid,
-                                                    void** ppvIf ) {
-
-      if( riid == IMetadataTool::interfaceID() ) {
-         *ppvIf = static_cast< IMetadataTool* >( this );
-         addRef();
-         return StatusCode::SUCCESS;
-      } else if( riid == IIncidentListener::interfaceID() ) {
-         *ppvIf = static_cast< IIncidentListener* >( this );
-         addRef();
-         return StatusCode::SUCCESS;
-      }
-
-      return AthAlgTool::queryInterface( riid, ppvIf );
-   }
-
-   /**
-    * The function is actually empty. The metadata should already be in the output
-    * file at this point...
-    */
-   StatusCode TrigCostConfMetadataTool::writeMetadata( ID3PD* ) {
-
-      ATH_MSG_INFO( "Trigger configuration available in the D3PD in directory: \""
-                    << m_configDir << "\"" );
-
-      return StatusCode::SUCCESS;
-   }
-
-   /**
-    * This function is called whenever an incident happens that the tool
-    * was set up to listen to. The function has to decide what kind of
-    * incident it was, and the call the appropriate internal function to
-    * handle that incident.
-    *
-    * @param inc The incident that happened
-    */
-   void TrigCostConfMetadataTool::handle( const Incident& inc ) {
-
-      //
-      // Handle trigger configuration change incidents:
-      //
-      if( inc.type() == IncidentType::EndEvent ) { 
-         handleNewTrigConfFromDataStore( inc );
-         return;
-      }
-
-      ATH_MSG_WARNING( "Received incident not recognised" );
-      return;
-   }
-   
-   
-    /**
-    * This function translates a *full* trigger configuration into a ROOT 
-    * native format, instead of Oracle - it uses TrigConfEvent objects
-    * from the trigger cost monitor as its source of summarised trigger
-    * configuration data.
-    *
-    * To get this full summary, set UseTrigConfEventSummaries=True and
-    * ensure that the cost monitoring infrastructure is enabled.
-    */
-   void TrigCostConfMetadataTool::handleNewTrigConfFromDataStore( const Incident& ) {
-      
-      const TrigMonConfigCollection *configCol = 0;
- 
-      if( !m_storeGate->contains<TrigMonConfigCollection>(m_keyConfig) ) {
-         ATH_MSG_DEBUG( "No TrigMonConfigCollection in this event Key:" << m_keyConfig );
-         return;
-      } else {
-         ATH_MSG_INFO( "TrigMonConfigCollection in this event Key:" << m_keyConfig << ". The configs will be saved." );
-      }
-   
-      if( m_storeGate->retrieve(configCol, m_keyConfig).isFailure() || !configCol) {
-         ATH_MSG_WARNING( "TrigMonConfigCollection present, however failed to retrieve from SG. Key:" << m_keyConfig );
-         return;
-      }
-      
-      ATH_MSG_DEBUG( "Got TrigMonConfigCollection: " << m_keyConfig << " Size:" << configCol->size() );
-
-      for( TrigMonConfigCollection::const_iterator it = configCol->begin(); it != configCol->end(); ++it) {
-         const TrigMonConfig* tmc = *it;
-         if(!tmc) continue;
-
-         Keys config_keys;
-
-         // Find out if the configuration that's just been loaded by the
-         // configuration service, has been already translated in this job.
-         // In that case there's no reason to translate it again.
-         // TimM - now use the info from the object
-         config_keys.first = tmc->getMasterKey();
-         config_keys.second.first = tmc->getLV1PrescaleKey();
-         config_keys.second.second = tmc->getHLTPrescaleKey();
-         if( m_configKeyCache.find( config_keys ) != m_configKeyCache.end() ) {
-            ATH_MSG_INFO( "Configuration with keys from triggerKeyTool SMK: "
-                           << config_keys.first << ", L1PSK: "
-                           << config_keys.second.first
-                           << ", HLT PSK: "
-                           << config_keys.second.second
-                           << " already translated" );
-            continue;
-         }
-
-         // Let the user know what we're doing:
-         // Use keys from tool as keys stored in object appear to be wrong
-         // Object keys are tmc->getMasterKey(), tmc->getLV1PrescaleKey(), mc->getHLTPrescaleKey()
-         ATH_MSG_INFO( "Translating trigger configuration from TrigMonConfig source" );
-         ATH_MSG_INFO( "  SMK: " << config_keys.first
-                    << ", L1 PSK: " << config_keys.second.first
-                    << ", HLT PSK: " << config_keys.second.second ); 
-  
-         /// Save detailed Sequence and Algorithm details
-         const std::vector<TrigConfSeq> configSeqs   = tmc->getVec<TrigConfSeq>();
-         *m_seqN          = configSeqs.size();
-         // variables for SEQUENCE
-         m_seqID          ->clear();
-         m_seqIndex       ->clear();
-         m_seqName        ->clear();
-         m_seqTopoTEID    ->clear();
-         m_seqInputTEs    ->clear();
-         //
-         m_seqID          ->resize( configSeqs.size() );
-         m_seqIndex       ->resize( configSeqs.size() );
-         m_seqName        ->resize( configSeqs.size() );
-         m_seqTopoTEID    ->resize( configSeqs.size() );
-         m_seqInputTEs    ->resize( configSeqs.size() );
-         // variables for SEQUENCE -> ALG
-         m_seqAlgN        ->clear();
-         m_seqAlgIndex    ->clear();
-         m_seqAlgPosition ->clear();
-         m_seqAlgNameID   ->clear();
-         m_seqAlgTypeID   ->clear();
-         m_seqAlgName     ->clear();
-         m_seqAlgTypeName ->clear();
-         //
-         m_seqAlgN        ->resize( configSeqs.size() );
-         m_seqAlgIndex    ->resize( configSeqs.size() );
-         m_seqAlgPosition ->resize( configSeqs.size() );
-         m_seqAlgNameID   ->resize( configSeqs.size() );
-         m_seqAlgTypeID   ->resize( configSeqs.size() );
-         m_seqAlgName     ->resize( configSeqs.size() );
-         m_seqAlgTypeName ->resize( configSeqs.size() );
-         for(unsigned int i = 0; i < configSeqs.size(); ++i) {
-            m_seqID       ->at(i) = configSeqs.at(i).getId();
-            m_seqIndex    ->at(i) = configSeqs.at(i).getIndex();
-            m_seqName     ->at(i) = configSeqs.at(i).getName();
-            m_seqTopoTEID ->at(i) = configSeqs.at(i).getTopoTE();
-            m_seqInputTEs ->at(i) = configSeqs.at(i).getInputTEs(); //Direct fetch vector
-            // Loop over Alg items
-            const std::vector<TrigConfAlg> configSeqAlgs = configSeqs.at(i).getAlg();
-            m_seqAlgN         ->at(i)  = configSeqAlgs.size();
-            (m_seqAlgIndex    ->at(i)).resize( configSeqAlgs.size() );
-            (m_seqAlgPosition ->at(i)).resize( configSeqAlgs.size() );
-            (m_seqAlgNameID   ->at(i)).resize( configSeqAlgs.size() );
-            (m_seqAlgTypeID   ->at(i)).resize( configSeqAlgs.size() );
-            (m_seqAlgName     ->at(i)).resize( configSeqAlgs.size() );
-            (m_seqAlgTypeName ->at(i)).resize( configSeqAlgs.size() );
-            for (unsigned int j = 0; j < configSeqAlgs.size(); ++j) {
-               (m_seqAlgIndex    ->at(i)).at(j) = configSeqAlgs.at(j).getIndex();    
-               (m_seqAlgPosition ->at(i)).at(j) = configSeqAlgs.at(j).getPosition();
-               (m_seqAlgNameID   ->at(i)).at(j) = configSeqAlgs.at(j).getNameId();
-               (m_seqAlgTypeID   ->at(i)).at(j) = configSeqAlgs.at(j).getTypeId();
-               (m_seqAlgName     ->at(i)).at(j) = configSeqAlgs.at(j).getName();
-               (m_seqAlgTypeName ->at(i)).at(j) = configSeqAlgs.at(j).getType();
-            }
-         }
-         
-         /// Save Chain and Sig details
-         int TEIndex = 0;
-         const std::vector<TrigConfChain> configChains = tmc->getVec<TrigConfChain>();
-         *m_chainN               = configChains.size();
-         /// variables for CHAIN
-         m_chainID               ->clear();
-         m_chainCounter          ->clear();
-         m_chainName             ->clear();
-         m_chainLowerID          ->clear();
-         m_chainLowerIDs         ->clear();
-         m_chainLowerName        ->clear();
-         m_chainLowerCounter     ->clear();
-         m_chainLevel            ->clear();
-         m_chainPrescale         ->clear();
-         m_chainPassthrough      ->clear();
-         m_chainStreamNames      ->clear();
-         m_chainStreamPrescales  ->clear();
-         m_chainGroupNames       ->clear();
-         m_chainEBHypoNames      ->clear();
-         //
-         m_chainID               ->resize( configChains.size() );
-         m_chainCounter          ->resize( configChains.size() );
-         m_chainName             ->resize( configChains.size() );
-         m_chainLowerID          ->resize( configChains.size() );
-         m_chainLowerIDs         ->resize( configChains.size() );
-         m_chainLowerName        ->resize( configChains.size() );
-         m_chainLowerCounter     ->resize( configChains.size() );
-         m_chainLevel            ->resize( configChains.size() );
-         m_chainPrescale         ->resize( configChains.size() );
-         m_chainPassthrough      ->resize( configChains.size() );
-         m_chainStreamNames      ->resize( configChains.size() );
-         m_chainStreamPrescales  ->resize( configChains.size() );
-         m_chainGroupNames       ->resize( configChains.size() );
-         m_chainEBHypoNames      ->resize( configChains.size() );
-         /// variables for CHAIN -> SIGNATURE
-         m_chainSigN             ->clear();
-         m_chainSigCounter       ->clear();
-         m_chainSigLogic         ->clear();
-         m_chainSigLabel         ->clear();
-         m_chainSigOutputTEn     ->clear();
-         m_chainSigOutputTEIndex ->clear(); 
-         m_chainSigOutputTEs     ->clear();
-         //
-         m_chainSigN             ->resize( configChains.size() );
-         m_chainSigCounter       ->resize( configChains.size() );
-         m_chainSigLogic         ->resize( configChains.size() );
-         m_chainSigLabel         ->resize( configChains.size() );
-         m_chainSigOutputTEn     ->resize( configChains.size() );
-         m_chainSigOutputTEIndex ->resize( configChains.size() );
-         // We cannot resize m_chainSigOutputTEs as we don't know a priori how big it'll be.
-         for(unsigned int i = 0; i < configChains.size(); ++i) {
-            m_chainID             ->at(i) = configChains.at(i).getId();
-            m_chainCounter        ->at(i) = configChains.at(i).getCounter();
-            m_chainName           ->at(i) = configChains.at(i).getChainName();
-            m_chainLowerID        ->at(i) = configChains.at(i).getLowerId();
-            m_chainLowerIDs       ->at(i) = configChains.at(i).getLowerIds(); //Direct vector fetch
-            m_chainLowerName      ->at(i) = configChains.at(i).getLowerName();
-            m_chainLowerCounter   ->at(i) = configChains.at(i).getLowerCounter();
-            m_chainLevel          ->at(i) = configChains.at(i).getLevelId();
-            m_chainPrescale       ->at(i) = configChains.at(i).getPrescale();
-            m_chainPassthrough    ->at(i) = configChains.at(i).getPassThrough();
-            m_chainStreamNames    ->at(i) = configChains.at(i).getStream();
-            //m_chainStreamPrescales->at(i) = configChains.at(i).getStreamPS();
-            m_chainGroupNames     ->at(i) = configChains.at(i).getGroup();
-            m_chainEBHypoNames    ->at(i) = configChains.at(i).getEBHypo();
-            // Loop over Sig items
-            const std::vector<TrigConfSig> configChainSigs = configChains.at(i).getSignature();
-            m_chainSigN->at(i)       = configChainSigs.size();
-            (m_chainSigCounter       ->at(i)).resize( configChainSigs.size() );
-            (m_chainSigLogic         ->at(i)).resize( configChainSigs.size() );
-            (m_chainSigLabel         ->at(i)).resize( configChainSigs.size() );
-            (m_chainSigOutputTEn     ->at(i)).resize( configChainSigs.size() );
-            (m_chainSigOutputTEIndex ->at(i)).resize( configChainSigs.size() );
-            for (unsigned int j = 0; j < configChainSigs.size(); ++j) {
-               (m_chainSigCounter         ->at(i)).at(j) = configChainSigs.at(j).getCounter();
-               (m_chainSigLogic           ->at(i)).at(j) = configChainSigs.at(j).getLogic();
-               (m_chainSigLabel           ->at(i)).at(j) = configChainSigs.at(j).getLabel();
-               // We shall not go deeper than vector<vector<int> >, so store this vector<int> "up one level"
-               // and make a note of its position in the branch (TEIndex)
-               (m_chainSigOutputTEn       ->at(i)).at(j) = configChainSigs.at(j).getOutputTEs().size();
-               (m_chainSigOutputTEIndex   ->at(i)).at(j) = TEIndex++;
-               m_chainSigOutputTEs        ->push_back( configChainSigs.at(j).getOutputTEs() ); //Direct vector fetch
-            }      
-         }
-
-         // Save misc data
-         m_confVarKey   ->clear();
-         m_confVarVal   ->clear();
-         m_confStringKey->clear();
-         m_confStringVal->clear();
-         m_confVarKey    ->assign( tmc->getVarName().begin(),tmc->getVarName().end() );
-         m_confVarVal    ->assign( tmc->getVarId().begin()  ,tmc->getVarId().end()   );
-         m_confStringKey ->assign( tmc->getPairKey().begin(),tmc->getPairKey().end() );
-         m_confStringVal ->assign( tmc->getPairVal().begin(),tmc->getPairVal().end() );
- 
-         // Fill the information into the "classic" map format for compatability with other tools which utilise this data
-         *m_smk    = config_keys.first;
-         *m_l1psk  = config_keys.second.first;
-         *m_hltpsk = config_keys.second.second;
-
-         // Fill the LVL1 maps:
-         ATH_MSG_DEBUG( "Filling config maps" );
-         m_lvl1ConfigNameMap->clear();
-         m_lvl1ConfigPSKMap->clear();
-         // Fill the HLT maps:
-         m_hltConfigNameMap->clear();
-         m_hltConfigPSKMap->clear();
-         m_hltConfigRPSKMap->clear();
-         m_hltConfigPTMap->clear();
-         m_hltConfigLowerChainNameMap->clear();
-         for(unsigned int i = 0; i < configChains.size(); ++i) {
-            if( configChains.at(i).getLevelId() == 1 ) {
-
-               ( *m_lvl1ConfigNameMap )[ configChains.at(i).getChainName() ] = configChains.at(i).getCounter();
-               ( *m_lvl1ConfigPSKMap )[ configChains.at(i).getChainName() ] = configChains.at(i).getPrescale();
-
-                REPORT_MESSAGE( MSG::VERBOSE )
-                   << "   \"" << configChains.at(i).getChainName()
-                   << "\" CTP id = " << configChains.at(i).getCounter()
-                   << ", prescale = "
-                   << configChains.at(i).getPrescale();
-            } else {
-
-               // "classic" tool maps
-               ( *m_hltConfigNameMap )[ configChains.at(i).getChainName() ]           = configChains.at(i).getCounter();
-               ( *m_hltConfigPSKMap )[ configChains.at(i).getChainName() ]            = configChains.at(i).getPrescale();
-               ( *m_hltConfigRPSKMap )[ configChains.at(i).getChainName() ]           = 0; // This information is not present in the summary
-               ( *m_hltConfigPTMap )[ configChains.at(i).getChainName() ]             = configChains.at(i).getPassThrough();
-               ( *m_hltConfigLowerChainNameMap )[ configChains.at(i).getChainName() ] = configChains.at(i).getLowerName();
-
-               REPORT_MESSAGE( MSG::VERBOSE )
-                  << "   \"" << configChains.at(i).getChainName()
-                  << "\" Chain counter = "
-                  << configChains.at(i).getCounter()
-                  << ", prescale = "
-                  << configChains.at(i).getPrescale();
-            }
-         }
-       
-         // Fill the configuration into the output:
-         if( m_configTree->capture().isFailure() ) {
-            ATH_MSG_ERROR( "Couldn't save the configuration." );
-            return;
-         } else {
-            ATH_MSG_INFO( "Trigger configuration from TrigMonConfig source successfully saved." );
-         }
-
-         // Update the book-keeping variable:
-         m_configKeyCache.insert( config_keys );
-      }   
-   }
-
-} // namespace D3PD
diff --git a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/src/TrigCostConfMetadataTool.h b/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/src/TrigCostConfMetadataTool.h
deleted file mode 100644
index 946afbbece5cd0feafbfc87219df353c150ee919..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/src/TrigCostConfMetadataTool.h
+++ /dev/null
@@ -1,168 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: TrigConfMetadataTool.h 603620 2014-06-25 17:55:37Z tamartin $
-#ifndef TRIGGERD3PDMAKER_TRIGCOSTCONFMETADATATOOL_H
-#define TRIGGERD3PDMAKER_TRIGCOSTCONFMETADATATOOL_H
-
-// STL include(s):
-#include <map>
-#include <string>
-#include <set>
-
-// Gaudi/Athena include(s):
-#include "GaudiKernel/IIncidentListener.h"
-#include "GaudiKernel/IIncidentSvc.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "StoreGate/StoreGateSvc.h"
-
-// Trigger configuration include(s):
-#include "TrigConfInterfaces/ITrigConfigSvc.h"
-
-// D3PDMaker include(s):
-#include "D3PDMakerInterfaces/IMetadataTool.h"
-#include "D3PDMakerInterfaces/ID3PDSvc.h"
-
-namespace D3PD {
-
-   // Forward declaration(s):
-   class ID3PD;
-
-   /**
-    *  @short Tool for dumping trigger configuration information into D3PDs
-    *
-    *         This tool can be used to save the trigger configuration information
-    *         into D3PDs. It collects the information that may be needed to analyze
-    *         the events that are processed during the job, and saves this information
-    *         gradually during the job.
-    *
-    *         The tool implements two interfaces. It is a D3PD::IMetadataTool to
-    *         be able to add it to the D3PD::MakerAlg as a metadata tool, and it's
-    *         also an IIncidentListener. This latter interface allows it to listen
-    *         to various "incidents" during the job. This is how the tool keeps
-    *         track of which configurations were used during the job, and of which
-    *         luminosity blocks are described by which configuration.
-    *
-    * @author Attila Krasznahorkay Jr.
-    *
-    * $Revision: 603620 $
-    * $Date: 2014-06-25 19:55:37 +0200 (Wed, 25 Jun 2014) $
-    */
-   class TrigCostConfMetadataTool : public AthAlgTool,
-                                public IMetadataTool,
-                                public IIncidentListener {
-
-   public:
-      /// Regular AlgTool constructor
-      TrigCostConfMetadataTool( const std::string& type, const std::string& name,
-                            const IInterface* parent );
-
-      /// AlgTool initialization function
-      virtual StatusCode initialize();
-      /// Gaudi function describing which interfaces the tool implements
-      virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvIf );
-
-      /// Function writing the configuration information to the D3PD
-      virtual StatusCode writeMetadata( ID3PD* d3pd );
-
-      /// Function called when a relevant incident happened
-      virtual void handle( const Incident& inc );
-
-   private:
-      
-      /// Function handling new trigger configurations using [TrigMonConfig] summary objects
-      void handleNewTrigConfFromDataStore( const Incident& inc );
-
-      /// Directory in which to store the configuration
-      std::string m_configDir;
-
-      /// Handle for the trigger configuration service
-      ServiceHandle< TrigConf::ITrigConfigSvc > m_trigConfSvc;
-      /// Handle for the incident service
-      ServiceHandle< IIncidentSvc > m_incidentSvc;
-      /// Handle for the D3PDSvc:
-      ServiceHandle< ID3PDSvc > m_d3pdSvc;
-      /// Handle for the StoreGate service used by [TrigMonConfig]:
-      ServiceHandle< StoreGateSvc > m_storeGate;  
-      
-      /// Storegate key for [TrigMonConfig] trigger configuration summary
-      std::string m_keyConfig;
-      
-      /// Cache of which trigger configurations have been "translated"
-      typedef std::pair<int, std::pair<int, int> > Keys;
-      std::set<Keys> m_configKeyCache;
-
-      //
-      // The configuration variables:
-      //
-      ID3PD* m_configTree; ///< D3PD object holding the configuration description
-      int* m_smk; ///< Super Master Key
-      int* m_l1psk; ///< LVL1 Prescale Key
-      int* m_hltpsk; ///< HLT Prescale key
-      std::map< std::string, int >*   m_lvl1ConfigNameMap; ///< LVL1 name -> CTP ID map
-      std::map< std::string, float >* m_lvl1ConfigPSKMap; ///< LVL1 name -> prescale map
-      std::map< std::string, int >*   m_hltConfigNameMap; ///< HLT name -> counter map
-      std::map< std::string, float >* m_hltConfigPSKMap; ///< HLT name -> prescale map
-      std::map< std::string, float >* m_hltConfigRPSKMap; ///< HLT name -> rerun prescale map
-      std::map< std::string, float >* m_hltConfigPTMap; ///< HLT name -> passthrough map
-      std::map< std::string, std::string >* m_hltConfigLowerChainNameMap; ///< HLT name -> seed name map
-      
-      //
-      // The detailed configuration variables [TrigMonConfig]:  
-      //     
-      // variables for CHAIN
-      uint16_t*                                  m_chainN;
-      std::vector< uint32_t >*                   m_chainID;
-      std::vector< uint16_t >*                   m_chainCounter;
-      std::vector< std::string >*                m_chainName;
-      std::vector< uint32_t >*                   m_chainLowerID;
-      std::vector< std::vector< uint32_t > >*    m_chainLowerIDs;
-      std::vector< std::string >*                m_chainLowerName;
-      std::vector< uint16_t >*                   m_chainLowerCounter;
-      std::vector< uint8_t >*                    m_chainLevel;
-      std::vector< float >*                      m_chainPrescale;
-      std::vector< float >*                      m_chainPassthrough;
-      std::vector< std::vector< std::string > >* m_chainStreamNames;
-      std::vector< std::vector< float > >*       m_chainStreamPrescales;
-      std::vector< std::vector< std::string > >* m_chainGroupNames;
-      std::vector< std::vector< std::string > >* m_chainEBHypoNames;
-      // variables for CHAIN -> SIGNATURE
-      std::vector< uint16_t >*                   m_chainSigN;
-      std::vector< std::vector< uint32_t > >*    m_chainSigCounter;
-      std::vector< std::vector< uint32_t > >*    m_chainSigLogic;
-      std::vector< std::vector< std::string > >* m_chainSigLabel;
-      std::vector< std::vector< uint16_t > >*    m_chainSigOutputTEn;
-      std::vector< std::vector< uint32_t > >*    m_chainSigOutputTEIndex;
-      std::vector< std::vector< uint32_t > >*    m_chainSigOutputTEs;
-      // variables for SEQUENCE
-      uint16_t* m_seqN;
-      std::vector< uint32_t >*                   m_seqID;
-      std::vector< uint16_t >*                   m_seqIndex;
-      std::vector< std::string >*                m_seqName;
-      std::vector< uint32_t >*                   m_seqTopoTEID;
-      std::vector< std::vector< uint32_t > >*    m_seqInputTEs;
-      // variables for SEQUENCE -> ALG
-      std::vector< uint16_t >*                   m_seqAlgN;
-      std::vector< std::vector< uint16_t > >*    m_seqAlgIndex;
-      std::vector< std::vector< uint8_t > >*     m_seqAlgPosition;
-      std::vector< std::vector< uint32_t > >*    m_seqAlgNameID;
-      std::vector< std::vector< uint32_t > >*    m_seqAlgTypeID;
-      std::vector< std::vector< std::string > >* m_seqAlgName;
-      std::vector< std::vector< std::string > >* m_seqAlgTypeName;
-      // variables for additional configuration data
-      std::vector<std::string>*                  m_confVarKey;
-      std::vector<uint32_t>*                     m_confVarVal;
-      std::vector<std::string>*                  m_confStringKey;
-      std::vector<std::string>*                  m_confStringVal;
-
-
-   }; // class TrigConfMetadataTool
-
-} // namespace D3PD
-
-#endif // TRIGGERD3PDMAKER_TRIGCOSTCONFMETADATATOOL_H
diff --git a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/src/TrigCostD3PDMakerTool.cxx b/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/src/TrigCostD3PDMakerTool.cxx
deleted file mode 100644
index f8da8a29ee06dbe472e7a75e98a03541eb9fb964..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/src/TrigCostD3PDMakerTool.cxx
+++ /dev/null
@@ -1,1214 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: TrigCostD3PDMakerTool.cxx 2014-09-23 12:48:32Z tamartin $
-
-// Athena/Gaudi include(s):
-#include "AthenaKernel/errorcheck.h"
-
-// STL include(s):
-#include "limits.h"
-
-// Trigger [TrigMonConfig] data include(s):
-#include "TrigMonitoringEvent/TrigMonEventCollection.h"
-#include "TrigMonitoringEvent/TrigMonEvent.h"
-
-// D3PDMaker include(s):
-#include "D3PDMakerInterfaces/ID3PD.h"
-
-// Local include(s):
-#include "TrigCostD3PDMakerTool.h"
-
-namespace D3PD {
-
-  TrigCostD3PDMakerTool::TrigCostD3PDMakerTool( const std::string& type,
-                                                const std::string& name,
-                                                const IInterface* parent )
-    : AthAlgTool( type, name, parent ),
-      m_dir( "" ),
-      m_incidentSvc( "IncidentSvc", name ),
-      m_d3pdSvc( "D3PD::RootD3PDSvc/TrigConfD3PDSvc", name ),
-      m_tree( nullptr ),
-      m_onlySaveCostEvents( true ),
-      m_doBasic (false),
-      m_doExtra (false),
-      m_doChain (false),
-      m_doL1 (false),
-      m_doROS (false),
-      m_doROSSum (false),
-      m_doRoI (false),
-      m_doSeq (false),
-      m_doTE (false),
-      m_doDBKey (false),
-      m_doEB (false),
-
-      m_event (nullptr),
-      m_lumi (nullptr),
-      m_lumiLength (nullptr),
-      m_bunch_id (nullptr),
-      m_run (nullptr),
-      m_sec (nullptr),
-      m_nsec (nullptr),
-      m_timer (nullptr),
-      m_ebWeight (nullptr),
-      m_ebWeightBG (nullptr),
-      m_ebUnbiased (nullptr),
-      m_ranScaleTools(nullptr),
-      m_appId (nullptr),
-      m_chainN (nullptr),
-      m_chainCounter (nullptr),
-      m_chainLevel (nullptr),
-      m_chainTimer (nullptr),
-      m_chainIsPassed (nullptr),
-      m_chainIsPassedRaw (nullptr),
-      m_chainIsPassthrough (nullptr),
-      m_chainIsResurrected (nullptr),
-      m_chainIsPrescaled (nullptr),
-      m_chainWasL1AfterVeto (nullptr),
-      m_chainWasL1BeforePrescale (nullptr),
-      m_chainWasL1AfterPrescale (nullptr),
-      m_chainIsExpressStream (nullptr),
-      m_timerTrigCost (nullptr),
-      m_timerEndSteer (nullptr),
-      m_timerChainProcess (nullptr),
-      m_timerResultBuilder (nullptr),
-      m_timerMon (nullptr),
-      m_costEvent (nullptr),
-      m_costRunSec (nullptr),
-      m_costRunNsec (nullptr),
-      m_l1N (nullptr),
-      m_l1CtpId (nullptr),
-      m_l1PassedBeforePrescale (nullptr),
-      m_l1PassedAfterPrescale (nullptr),
-      m_l1PassedAfterVeto (nullptr),
-      m_l1Passed (nullptr),
-      m_l1Prescaled (nullptr),
-      m_l1Vetoed (nullptr),
-      m_robN (nullptr),
-      m_robRequestorId (nullptr),
-      m_robTimer (nullptr),
-      m_robTimeStartSec (nullptr),
-      m_robTimeStartMicroSec (nullptr),
-      m_robTimeStopSec (nullptr),
-      m_robTimeStopMicroSec (nullptr),
-      m_robDataN (nullptr),
-      m_robDataRobId (nullptr),
-      m_robDataRobSize (nullptr),
-      m_robDataIsUnclassified (nullptr),
-      m_robDataIsCached (nullptr),
-      m_robDataIsRetrieved (nullptr),
-      m_robDataIsIgnored (nullptr),
-      m_robDataIsDisabled (nullptr),
-      m_robDataIsStatusOk (nullptr),
-      m_robDataIsPrefetched (nullptr),
-      m_robSumDataN (nullptr),
-      m_robSumDataSize (nullptr),
-      m_robSumDataNRob (nullptr),
-      m_robSumDataSubDet (nullptr),
-      m_robSumDataIsUnclassified (nullptr),
-      m_robSumDataIsCached (nullptr),
-      m_robSumDataIsRetrieved (nullptr),
-      m_robSumDataIsIgnored (nullptr),
-      m_robSumDataIsDisabled (nullptr),
-      m_roiN (nullptr),
-      m_roiIsNoneType (nullptr),
-      m_roiIsMuonType (nullptr),
-      m_roiIsEmTauType (nullptr),
-      m_roiIsTau (nullptr),
-      m_roiIsJetType (nullptr),
-      m_roiIsJetEtType (nullptr),
-      m_roiIsEnergyType (nullptr),
-      m_roiId (nullptr),
-      m_roiNL1thresholds (nullptr),
-      m_roiEta (nullptr),
-      m_roiPhi (nullptr),
-      m_roiArea (nullptr),
-      m_roiEt (nullptr),
-      m_roiEtLarge (nullptr),
-      m_roiMuCharge (nullptr),
-      m_roiIsolationBits (nullptr),
-      m_roiVectorEX (nullptr),
-      m_roiVectorEY (nullptr),
-      m_roiOverflowEX (nullptr),
-      m_roiOverflowEY (nullptr),
-      m_roiOverflowET (nullptr),
-      m_seqN (nullptr),
-      m_seqIsInitial (nullptr),
-      m_seqIsExecuted (nullptr),
-      m_seqIsAlreadyExecuted (nullptr),
-      m_seqIsPrevious (nullptr),
-      m_seqLevel (nullptr),
-      m_seqChannelCounter (nullptr),
-      m_seqIndex (nullptr),
-      m_seqSequenceTimer (nullptr),
-      m_seqAlgTimerTot (nullptr),
-      m_seqAlgN (nullptr),
-      m_seqAlgPosition (nullptr),
-      m_seqAlgNRoIs (nullptr),
-      m_seqAlgRoIIndex (nullptr),
-      m_seqRoI (nullptr),
-      m_seqAlgIsCached (nullptr),
-      m_seqAlgIsCalled (nullptr),
-      m_seqAlgTimer (nullptr),
-      m_seqAlgTimeStartSec (nullptr),
-      m_seqAlgTimeStartMicroSec (nullptr),
-      m_seqAlgTimeStopSec (nullptr),
-      m_seqAlgTimeStopMicroSec (nullptr),
-      m_teN (nullptr),
-      m_teId (nullptr),
-      m_teIndex (nullptr),
-      m_teIsRegularTE (nullptr),
-      m_teIsInitialTE (nullptr),
-      m_teIsRoITE (nullptr),
-      m_teIsL1ThreshTE (nullptr),
-      m_teActiveState (nullptr),
-      m_teErrorState (nullptr),
-      m_teIsTerminalNode (nullptr),
-      m_teIsOutputL2Node (nullptr),
-      m_teIsOutputEFNode (nullptr),
-      m_teIsTopologicalTE (nullptr),
-      m_teChildIndex (nullptr),
-      m_teParentIndex (nullptr),
-      m_teRoiId (nullptr),
-      m_teClid (nullptr),
-      m_DB_SMK (nullptr),
-      m_DB_L1PSK (nullptr),
-      m_DB_HLTPSK (nullptr)
-  {
-
-    declareProperty( "dir", m_dir = "/StreamNTUP_TRIGCOST/trig_cost" );
-    declareProperty( "IncidentSvc", m_incidentSvc );
-    declareProperty( "D3PDSvc", m_d3pdSvc );
-    declareProperty( "prefix", m_prefix = "TrigCostHLT_" );
-    declareProperty( "keyEvent", m_keyEvent = "HLT_TrigMonEventCollection_OPI_HLT_monitoring_event");
-    declareProperty( "mode", m_writeMode = "COST");
-    declareProperty( "onlySaveCostEvents", m_onlySaveCostEvents = true, "Export only events which ran the full suite of Cost tools online"); 
-  }
-
-  StatusCode TrigCostD3PDMakerTool::initialize() {
-
-    ATH_MSG_INFO( "Initializing. Package version: " << PACKAGE_VERSION );
-
-    // Retrieve the needed services:
-    CHECK( m_incidentSvc.retrieve() );
-    CHECK( m_d3pdSvc.retrieve() );
-
-    // Set up the tool to listen to a few incidents:
-    m_incidentSvc->addListener( this, IncidentType::EndEvent );
-
-    // Create the configuration objects through the D3PD service:
-    CHECK( m_d3pdSvc->make( m_dir, m_tree ) );
-
-    if (m_writeMode == "COST") {
-      m_doBasic = true;
-      m_doExtra = true;
-      m_doChain = true;
-      m_doL1    = true;
-      m_doROS   = true;
-      m_doROSSum= false;
-      m_doRoI   = true;
-      m_doSeq   = true;
-      m_doTE    = true;
-      m_doDBKey = true;
-      m_doEB    = false;
-    } else if (m_writeMode == "RATE") {
-      m_doBasic = true;
-      m_doExtra = false;
-      m_doChain = true;
-      m_doL1    = true;
-      m_doROS   = false;
-      m_doROSSum= false;
-      m_doRoI   = true;
-      m_doSeq   = false;
-      m_doTE    = false;
-      m_doDBKey = true;
-      m_doEB    = false;
-    } else if (m_writeMode == "EBWEIGHT") {
-      m_doBasic = false;
-      m_doExtra = false;
-      m_doChain = false;
-      m_doL1    = false;
-      m_doROS   = false;
-      m_doROSSum= false;
-      m_doRoI   = false;
-      m_doSeq   = false;
-      m_doTE    = false;
-      m_doDBKey = false;
-      m_doEB    = true;
-    } else {
-      ATH_MSG_ERROR("Unrecognised write mode " << m_writeMode << " given. Options are COST, RATE or EBWEIGHT.");
-    }
-
-    //////////////
-    //BASIC DATA//
-    //////////////
-    if (m_doBasic) {
-      CHECK( m_tree->addVariable( m_prefix + "eventNumber", m_event, "Event number" ) );
-      CHECK( m_tree->addVariable( m_prefix + "lumi", m_lumi, "Lumi block number for this event" ) );
-      CHECK( m_tree->addVariable( m_prefix + "lumiLength", m_lumiLength, "Length in s of this lumi block" ) );
-      CHECK( m_tree->addVariable( m_prefix + "bunchCrossingId", m_bunch_id, "BCID for this event" ) );
-      CHECK( m_tree->addVariable( m_prefix + "runNumber", m_run, "Run number for this event" ) );
-      CHECK( m_tree->addVariable( m_prefix + "seconds", m_sec, "Start of the event in seconds" ) );
-      CHECK( m_tree->addVariable( m_prefix + "nanoSeconds", m_nsec, "Start of the event nanoseconds" ) );
-      CHECK( m_tree->addVariable( m_prefix + "timer", m_timer, "Nominal time for this event" ) );
-      CHECK( m_tree->addVariable( m_prefix + "appId", m_appId, "Hash of AppId of the XPU node processing this event." ) );
-      CHECK( m_tree->addVariable( m_prefix + "ranScaleTools", m_ranScaleTools, "If this was a monitored event (did we run the scale tools online)" ) );
-      CHECK( m_tree->addVariable( m_prefix + "costRunSec", m_costRunSec, "Second the data were saved by CostMon" ) );
-      CHECK( m_tree->addVariable( m_prefix + "costRunNsec", m_costRunNsec, "Nanosecond the data were saved by CostMon" ) );
-      CHECK( m_tree->addVariable( m_prefix + "costEvent", m_costEvent, "Sequential number of cost events processed" ) );
-    }
-
-    if (m_doEB && !m_doBasic) {
-      CHECK( m_tree->addVariable( m_prefix + "eventNumber", m_event, "Event number" ) );
-      CHECK( m_tree->addVariable( m_prefix + "ebWeight", m_ebWeight, "Enhanced bias weighting factor." ) );
-      CHECK( m_tree->addVariable( m_prefix + "ebWeightBG", m_ebWeightBG, "Enhanced bias bunch group identifier." ) );
-      CHECK( m_tree->addVariable( m_prefix + "ebUnbiased", m_ebUnbiased, "If EB event was unbiased online." ) );
-    }
-
-    //////////////
-    //EXTRA DATA//
-    //////////////
-    if (m_doExtra) {
-      CHECK( m_tree->addVariable( m_prefix + "timerTrigCost", m_timerTrigCost, "Detailed: Time to run the OPI trig cost tools" ) );
-      CHECK( m_tree->addVariable( m_prefix + "timerEndSteer", m_timerEndSteer, "Detailed: Time to end of steering" ) );
-      CHECK( m_tree->addVariable( m_prefix + "timerChainProcess", m_timerChainProcess, "Detailed: Time of chain execution" ) );
-      CHECK( m_tree->addVariable( m_prefix + "timerResultBuilder", m_timerResultBuilder, "Detailed: Time of ResultBuilder tool execution" ) );
-      CHECK( m_tree->addVariable( m_prefix + "timerMon", m_timerMon, "Detailed: Total time of monitoring tool(s) execution" ) );
-    }
-
-    //////////////
-    //CHAIN DATA//
-    //////////////
-    if (m_doChain) {
-      CHECK( m_tree->addVariable( m_prefix + "chain_n", m_chainN, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "chain_counter", m_chainCounter, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "chain_level", m_chainLevel, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "chain_timer", m_chainTimer, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "chain_isPassed", m_chainIsPassed, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "chain_isPassedRaw", m_chainIsPassedRaw, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "chain_isPassthrough", m_chainIsPassthrough, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "chain_isResurrected", m_chainIsResurrected, "" ) ); 
-      CHECK( m_tree->addVariable( m_prefix + "chain_isPrescaled", m_chainIsPrescaled, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "chain_wasL1AfterVeto", m_chainWasL1AfterVeto, "" ) );     
-      CHECK( m_tree->addVariable( m_prefix + "chain_wasL1BeforePrescale", m_chainWasL1BeforePrescale, "" ) );  
-      CHECK( m_tree->addVariable( m_prefix + "chain_wasL1AfterPrescale", m_chainWasL1AfterPrescale, "" ) );  
-      CHECK( m_tree->addVariable( m_prefix + "chain_isExpressStream", m_chainIsExpressStream, "" ) );
-    }
-
-    ///////////
-    //L1 DATA//
-    ///////////
-    if (m_doL1) {
-      CHECK( m_tree->addVariable( m_prefix + "l1_n", m_l1N, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "l1_ctpId", m_l1CtpId, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "l1_passedBeforePrescale", m_l1PassedBeforePrescale, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "l1_passedAfterPrescale", m_l1PassedAfterPrescale, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "l1_passedAfterVeto", m_l1PassedAfterVeto, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "l1_passed", m_l1Passed, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "l1_isPrescaled", m_l1Prescaled, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "l1_isVetoed", m_l1Vetoed, "" ) ); 
-    }
-
-    ////////////
-    //ROS DATA//
-    ////////////
-    if (m_doROS) {
-      CHECK( m_tree->addVariable( m_prefix + "rob_n", m_robN, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_requestorId", m_robRequestorId, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_timer", m_robTimer, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_timeStartSec", m_robTimeStartSec, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_timeStartMicroSec", m_robTimeStartMicroSec, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_timeStopSec", m_robTimeStopSec, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_timeStopMicroSec", m_robTimeStopMicroSec, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_data_n", m_robDataN, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_data_id", m_robDataRobId, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_data_size", m_robDataRobSize, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_data_isUnclassified", m_robDataIsUnclassified, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_data_isCached", m_robDataIsCached, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_data_isRetrieved", m_robDataIsRetrieved, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_data_isIgnored", m_robDataIsIgnored, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_data_isDisabled", m_robDataIsDisabled, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_data_isStatusOk", m_robDataIsStatusOk, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_data_isStatusPrefetched", m_robDataIsPrefetched, "" ) );
-    }
-
-    ////////////////
-    //ROS SUM DATA//
-    ////////////////
-    if (m_doROSSum) {
-      CHECK( m_tree->addVariable( m_prefix + "rob_sum_n", m_robSumDataN, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_sum_size", m_robSumDataSize, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_sum_nRob", m_robSumDataNRob, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_sum_subDet", m_robSumDataSubDet, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_sum_isUnclassified", m_robSumDataIsUnclassified, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_sum_isCached", m_robSumDataIsCached, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_sum_isRetrieved", m_robSumDataIsRetrieved, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_sum_isIgnored", m_robSumDataIsIgnored, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "rob_sum_isDisabled", m_robSumDataIsDisabled, "" ) );
-    }
-
-
-    ////////////
-    //RoI DATA//
-    ////////////
-    if (m_doRoI) {
-      CHECK( m_tree->addVariable( m_prefix + "roi_n", m_roiN, "Number of L1 RoI" ) );
-      CHECK( m_tree->addVariable( m_prefix + "roi_isTypeNone", m_roiIsNoneType, "Flag RoI has no type" ) );
-      CHECK( m_tree->addVariable( m_prefix + "roi_isTypeMuon", m_roiIsMuonType, "Flag RoI was MUON" ) );
-      CHECK( m_tree->addVariable( m_prefix + "roi_isTypeEmTau", m_roiIsEmTauType, "Flag RoI was EMTAU (see isTau)" ) );
-      CHECK( m_tree->addVariable( m_prefix + "roi_isTau", m_roiIsTau, "Flag, disambiguity between EM and TAU" ) );
-      CHECK( m_tree->addVariable( m_prefix + "roi_isTypeJet", m_roiIsJetType, "Flag RoI was Jet" ) );
-      CHECK( m_tree->addVariable( m_prefix + "roi_isTypeJetEt", m_roiIsJetEtType, "Floag RoI was JetET" ) );
-      CHECK( m_tree->addVariable( m_prefix + "roi_isTypeEnergy", m_roiIsEnergyType, "Flag RoI was Energy" ) );
-      CHECK( m_tree->addVariable( m_prefix + "roi_id", m_roiId, "RoI ID for matching to algorithms" ) );
-      CHECK( m_tree->addVariable( m_prefix + "roi_nL1Thresholds", m_roiNL1thresholds, "Number of thresholds passed, depends on config" ) );
-      CHECK( m_tree->addVariable( m_prefix + "roi_eta", m_roiEta, "RoI eta coordinate" ) );
-      CHECK( m_tree->addVariable( m_prefix + "roi_phi", m_roiPhi, "RoI phi coordinate" ) );
-      CHECK( m_tree->addVariable( m_prefix + "roi_area", m_roiArea, "RoI area in eta x phi" ) ); 
-      // Extra RoI
-      CHECK( m_tree->addVariable( m_prefix + "roi_et", m_roiEt, "RoI ET for EMTAU, ETSmall for Jet, pT for muon, scalar sum ET for ENERGY" ) ); 
-      CHECK( m_tree->addVariable( m_prefix + "roi_etLarge", m_roiEtLarge, "RoI ET Large for jets only" ) ); 
-      CHECK( m_tree->addVariable( m_prefix + "roi_muCharge", m_roiMuCharge, "RoI muon charge, muons only" ) ); 
-      CHECK( m_tree->addVariable( m_prefix + "roi_isoBits", m_roiIsolationBits, "RoI isolation bits, EMTAU only" ) ); 
-      CHECK( m_tree->addVariable( m_prefix + "roi_vectorEX", m_roiVectorEX, "RoI signed vector sum ET in X, ENERGY only" ) ); 
-      CHECK( m_tree->addVariable( m_prefix + "roi_vectorEY", m_roiVectorEY, "RoI signed vector sum ET in Y, ENEGY only" ) ); 
-      CHECK( m_tree->addVariable( m_prefix + "roi_overflowEX", m_roiOverflowEX, "RoI vector sum ET X overflow bit" ) ); 
-      CHECK( m_tree->addVariable( m_prefix + "roi_overflowEY", m_roiOverflowEY, "RoI vector sum ET Y overflow bit" ) ); 
-      CHECK( m_tree->addVariable( m_prefix + "roi_overflowET", m_roiOverflowET, "RoI scalar sum ET overflow bit" ) ); 
-    }
-
-    ////////////////
-    //SEQ/ALG DATA//
-    ////////////////
-    if (m_doSeq) {
-      CHECK( m_tree->addVariable( m_prefix + "seq_n", m_seqN, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "seq_level", m_seqLevel, "" ) ); 
-      CHECK( m_tree->addVariable( m_prefix + "seq_isInitial", m_seqIsInitial, "" ) ); 
-      CHECK( m_tree->addVariable( m_prefix + "seq_isExecuted", m_seqIsExecuted, "" ) ); 
-      CHECK( m_tree->addVariable( m_prefix + "seq_isAlreadyExecuted", m_seqIsAlreadyExecuted, "" ) ); 
-      CHECK( m_tree->addVariable( m_prefix + "seq_isPrevious", m_seqIsPrevious, "" ) ); 
-      CHECK( m_tree->addVariable( m_prefix + "seq_channelCounter", m_seqChannelCounter, "" ) );         
-      CHECK( m_tree->addVariable( m_prefix + "seq_index", m_seqIndex, "" ) );         
-      CHECK( m_tree->addVariable( m_prefix + "seq_timer", m_seqSequenceTimer, "" ) );         
-      CHECK( m_tree->addVariable( m_prefix + "seq_algTotalTime", m_seqAlgTimerTot, "" ) );         
-      CHECK( m_tree->addVariable( m_prefix + "seq_alg_n", m_seqAlgN, "" ) );         
-      CHECK( m_tree->addVariable( m_prefix + "seq_alg_position", m_seqAlgPosition, "" ) );  
-      CHECK( m_tree->addVariable( m_prefix + "seq_alg_roi_n", m_seqAlgNRoIs, "How many RoIs this alg has." ) );   
-      CHECK( m_tree->addVariable( m_prefix + "seq_alg_roi_index", m_seqAlgRoIIndex, "Index where to find these RoI IDs" ) );
-      CHECK( m_tree->addVariable( m_prefix + "seq_roi", m_seqRoI, "Look at this index to get the vector<RoI ID>" ) ); 
-      CHECK( m_tree->addVariable( m_prefix + "seq_alg_isCached", m_seqAlgIsCached, "" ) );       
-      CHECK( m_tree->addVariable( m_prefix + "seq_alg_isCalled", m_seqAlgIsCalled, "" ) );       
-      CHECK( m_tree->addVariable( m_prefix + "seq_alg_timer", m_seqAlgTimer, "" ) );    
-      CHECK( m_tree->addVariable( m_prefix + "seq_alg_timeStartSec", m_seqAlgTimeStartSec, "" ) );  
-      CHECK( m_tree->addVariable( m_prefix + "seq_alg_timeStartMicroSec", m_seqAlgTimeStartMicroSec, "" ) );  
-      CHECK( m_tree->addVariable( m_prefix + "seq_alg_timeStopSec", m_seqAlgTimeStopSec, "" ) );  
-      CHECK( m_tree->addVariable( m_prefix + "seq_alg_timeStopMicroSec", m_seqAlgTimeStopMicroSec, "" ) ); 
-    }
-
-    ///////////
-    //TE DATA//
-    ///////////
-    if (m_doTE) {
-      CHECK( m_tree->addVariable( m_prefix + "te_n", m_teN, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_id", m_teId, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_index", m_teIndex, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_isRegularTe", m_teIsRegularTE, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_isInitialTe", m_teIsInitialTE, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_isRoITe", m_teIsRoITE, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_isL1ThresholdTe", m_teIsL1ThreshTE, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_isActiveState", m_teActiveState, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_isErrorState", m_teErrorState, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_isTerminalNode", m_teIsTerminalNode, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_isOutputL2Node", m_teIsOutputL2Node, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_isOutputEFNode", m_teIsOutputEFNode, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_isTopologicalTe", m_teIsTopologicalTE, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_childIndex", m_teChildIndex, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_parentIndex", m_teParentIndex, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_roiId", m_teRoiId, "" ) );
-      CHECK( m_tree->addVariable( m_prefix + "te_clid", m_teClid, "" ) );  
-    }
-
-    ///////////
-    //DB DATA//
-    ///////////
-    if (m_doDBKey) {
-      CHECK( m_tree->addVariable( "trig_DB_SMK", m_DB_SMK, "" ) );
-      CHECK( m_tree->addVariable( "trig_DB_L1PSK", m_DB_L1PSK, "" ) );
-      CHECK( m_tree->addVariable( "trig_DB_HLTPSK", m_DB_HLTPSK, "" ) );
-    }
-
-    return StatusCode::SUCCESS;
-  }
-
-  StatusCode TrigCostD3PDMakerTool::queryInterface( const InterfaceID& riid,
-                                                    void** ppvIf ) {
-
-    if( riid == IMetadataTool::interfaceID() ) {
-       *ppvIf = static_cast< IMetadataTool* >( this );
-       addRef();
-       return StatusCode::SUCCESS;
-    } else if( riid == IIncidentListener::interfaceID() ) {
-       *ppvIf = static_cast< IIncidentListener* >( this );
-       addRef();
-       return StatusCode::SUCCESS;
-    }
-
-    return AthAlgTool::queryInterface( riid, ppvIf );
-  }
-
-   /**
-    * The function is actually empty. The metadata should already be in the output
-    * file at this point...
-    */
-  StatusCode TrigCostD3PDMakerTool::writeMetadata( ID3PD* ) {
-
-    ATH_MSG_INFO( "Trig cost information available in the D3PD in directory: \""
-                  << m_dir << "\"" );
-
-    return StatusCode::SUCCESS;
-  }
-
-   /**
-    * This function is called whenever an incident happens that the tool
-    * was set up to listen to. The function has to decide what kind of
-    * incident it was, and the call the appropriate internal function to
-    * handle that incident.
-    *
-    * @param inc The incident that happened
-    */
-  void TrigCostD3PDMakerTool::handle( const Incident& inc ) {
-    //
-    // Handle trigger configuration change incidents:
-    //
-    if( inc.type() == IncidentType::EndEvent ) { 
-       handleNewEvent( inc );
-       return;
-    }
-
-    ATH_MSG_WARNING( "Received incident not recognised" );
-    return;
-  }
-   
-   
-  /**
-  * Save all events in the TrigMonEventCollection to the D3PD
-  * Note magic numbers come from TrigMonVar.h
-  */
-  void TrigCostD3PDMakerTool::handleNewEvent( const Incident& ) {
-      
-    const TrigMonEventCollection *eventCol = 0;
- 
-    if( !evtStore()->contains<TrigMonEventCollection>(m_keyEvent) ) {
-      ATH_MSG_DEBUG( "No TrigMonEventCollection in this event Key:" << m_keyEvent );
-      return;
-    } else {
-      ATH_MSG_DEBUG( "TrigMonEventCollection in this event Key:" << m_keyEvent << ". Exporting to D3PD." );
-    }
-   
-    if( evtStore()->retrieve(eventCol, m_keyEvent).isFailure() || !eventCol) {
-      ATH_MSG_WARNING( "TrigMonEventCollection present, however failed to retrieve from SG. Key:" << m_keyEvent );
-      return;
-    }
-      
-    ATH_MSG_DEBUG( "Got TrigMonEventCollection: " << m_keyEvent << " Size:" << eventCol->size() );
-
-    for( TrigMonEventCollection::const_iterator it = eventCol->begin(); it != eventCol->end(); ++it) {
-      const TrigMonEvent* event = *it;
-      if(!event) {
-        ATH_MSG_WARNING( "Could not resolve TrigMonEvent pointer." );
-        continue;
-      }
-
-      // Do we want to save this event?
-      if (m_onlySaveCostEvents == true) {
-        float result = 0.;
-        event->getVar(Trig::kIsCostEvent, result); // 47, is the magic number in this case. 
-        // Bool stored as float. Test for 0
-        if (result < 0.5) {
-          ATH_MSG_DEBUG( "Not a Cost Event (scale tools were not run, but L1 result info still there). Skipping event due to m_onlySaveCostEvents == true" );
-          continue;
-        }
-      }
-
-      // Zero before new event
-      clear();
-	
-      //////////////
-      //BASIC DATA//
-      //////////////
-      if (m_doBasic) {
-        *m_event    = event->getEvent();
-        *m_lumi     = event->getLumi();
-        *m_bunch_id = event->getBunchId();
-        *m_run      = event->getRun();
-        *m_sec      = event->getSec();
-        *m_nsec     = event->getNanoSec();
-        *m_timer    = event->getTimer();
-
-        for (unsigned i=0; i < event->getWord().size(); ++i) {
-          switch (i) {
-            case 0:
-              *m_costRunSec = event->getWord().at(i);
-              break;
-            case 1:
-              *m_costRunNsec = event->getWord().at(i);
-              break;
-            case 2:
-              *m_appId = event->getWord().at(i);
-              break;
-            default:
-              break;
-          }
-        }  
-        for (unsigned i=0; i < event->getVarKey().size(); ++i) {
-          switch (event->getVarKey().at(i)) {
-            case Trig::kIsCostEvent:
-              *m_ranScaleTools = (uint8_t) event->getVarVal().at(i);
-              break;
-            case Trig::kEventLumiBlockLength:
-              *m_lumiLength = event->getVarVal().at(i);
-              break;
-            case Trig::kEventNumber:
-              *m_costEvent = event->getVarVal().at(i);
-              break;
-            default:
-              break;
-          }
-        }
-      }
-
-      //////////////
-      //EXTRA DATA//
-      //////////////
-      if (m_doExtra) {
-        // Check and save additonal payload relating to the event
-        if ( event->getVarKey().size() != event->getVarVal().size() ) {
-          REPORT_MESSAGE( MSG::WARNING ) << "Trigger cost monitor additional integer payload size different to key size, skipping.";
-        } else {
-          for (unsigned i=0; i < event->getVarKey().size(); ++i) {
-            switch (event->getVarKey().at(i)) {
-              case Trig::kTimeCostMonitoring:
-                *m_timerTrigCost = event->getVarVal().at(i);
-                break;
-              case Trig::kTimeExec:
-                *m_timerEndSteer = event->getVarVal().at(i);
-                break;
-              case Trig::kTimeProc:
-                *m_timerChainProcess = event->getVarVal().at(i);
-                break;
-              case Trig::kTimeRes:
-                *m_timerResultBuilder = event->getVarVal().at(i);
-                break;
-              case Trig::kTimeMon:
-                *m_timerMon = event->getVarVal().at(i);
-                break;
-              default:
-                break;
-            } // Switch
-          } // Key loop
-        } // Size check
-      } // m_doExtra
-
-      ///////////
-      //EB DATA//
-      ///////////
-      if (m_doEB && !m_doBasic) {
-        *m_event = event->getEvent();
-        for (unsigned i=0; i < event->getVarKey().size(); ++i) {
-          switch (event->getVarKey().at(i)) {
-            case Trig::kEBWeight:
-              *m_ebWeight = event->getVarVal().at(i);
-              break;
-            case Trig::kEBBunchGroup:
-              *m_ebWeightBG = (uint32_t) event->getVarVal().at(i);
-              break;
-            case Trig::kEBIsUnbiasedFlag:
-              *m_ebUnbiased = (uint8_t) event->getVarVal().at(i);
-              break;
-            default:
-              break;
-          }
-        }
-      }
-
-      //////////////
-      //CHAIN DATA//
-      //////////////
-      const std::vector<TrigMonChain> eventChains = event->getChains();
-      if (m_doChain && eventChains.size() > 0) {
-        *m_chainN = eventChains.size();
-        //Save details about the chain
-        m_chainCounter            ->resize( eventChains.size() );
-        m_chainLevel              ->resize( eventChains.size() );         
-        m_chainTimer              ->resize( eventChains.size() );         
-        m_chainIsPassed           ->resize( eventChains.size() );
-        m_chainIsPassedRaw        ->resize( eventChains.size() );
-        m_chainIsPassthrough      ->resize( eventChains.size() );    
-        m_chainIsResurrected      ->resize( eventChains.size() );
-        m_chainIsPrescaled        ->resize( eventChains.size() );
-        m_chainWasL1AfterVeto     ->resize( eventChains.size() );
-        m_chainWasL1BeforePrescale->resize( eventChains.size() );
-        m_chainWasL1AfterPrescale ->resize( eventChains.size() );
-        m_chainIsExpressStream    ->resize( eventChains.size() );
-        for(unsigned int i = 0; i < eventChains.size(); ++i) {
-          m_chainCounter            ->at(i) = eventChains.at(i).getCounter();     
-          m_chainLevel              ->at(i) = eventChains.at(i).getLevel();
-          m_chainTimer              ->at(i) = eventChains.at(i).getTimer();
-          m_chainIsPassed           ->at(i) = (uint8_t) eventChains.at(i).isPassed( TrigMonChain::kPassed );
-          m_chainIsPassedRaw        ->at(i) = (uint8_t) eventChains.at(i).isPassed( TrigMonChain::kPassedRaw );
-          m_chainIsPassthrough      ->at(i) = (uint8_t) eventChains.at(i).isPassed( TrigMonChain::kPassedThrough );
-          m_chainIsResurrected      ->at(i) = (uint8_t) eventChains.at(i).isPassed( TrigMonChain::kResurrected );
-          m_chainIsPrescaled        ->at(i) = (uint8_t) eventChains.at(i).isPassed( TrigMonChain::kPrescaled );
-          m_chainWasL1AfterVeto     ->at(i) = (uint8_t) eventChains.at(i).isPassed( TrigMonChain::kL1AfterVeto );
-          m_chainWasL1BeforePrescale->at(i) = (uint8_t) eventChains.at(i).isPassed( TrigMonChain::kL1BeforePrescale );
-          m_chainWasL1AfterPrescale ->at(i) = (uint8_t) eventChains.at(i).isPassed( TrigMonChain::kL1AfterPrescale );
-          m_chainIsExpressStream    ->at(i) = (uint8_t) eventChains.at(i).isPassed( TrigMonChain::kExpressStream );
-
-          // Check and save additonal payload 
-          if ( eventChains.at(i).getVarKey().size() != eventChains.at(i).getVarVal().size() ) {
-            REPORT_MESSAGE( MSG::WARNING ) << "Trigger chain float payload size different to key size, skipping.";
-          } else {
-            for (unsigned j=0; j < eventChains.at(i).getVarKey().size(); ++j) {
-              REPORT_MESSAGE( MSG::DEBUG ) << "Got a CHAIN["<<i<<"] int=>float pair. Currently not saved. " << eventChains.at(i).getVarKey().at(j) << " => " << eventChains.at(i).getVarVal().at(j);
-            }
-          }  
-        }
-      }
-
-      ///////////
-      //L1 DATA//
-      ///////////
-      const std::vector<TrigMonL1Item> eventL1Items = event->getL1Items();
-      if (m_doL1 && eventL1Items.size() > 0) {
-        *m_l1N = eventL1Items.size();
-        m_l1CtpId               ->resize( eventL1Items.size() );
-        m_l1PassedBeforePrescale->resize( eventL1Items.size() );    
-        m_l1PassedAfterPrescale ->resize( eventL1Items.size() );    
-        m_l1PassedAfterVeto     ->resize( eventL1Items.size() );
-        m_l1Passed              ->resize( eventL1Items.size() );
-        m_l1Prescaled           ->resize( eventL1Items.size() );
-        m_l1Vetoed              ->resize( eventL1Items.size() );  
-        for (unsigned int i = 0; i < eventL1Items.size(); ++i) {
-          m_l1CtpId               ->at(i) = eventL1Items.at(i).getCtpId();
-          m_l1PassedBeforePrescale->at(i) = (uint8_t) eventL1Items.at(i).isPassedBeforePrescale();
-          m_l1PassedAfterPrescale ->at(i) = (uint8_t) eventL1Items.at(i).isPassedAfterPrescale();
-          m_l1PassedAfterVeto     ->at(i) = (uint8_t) eventL1Items.at(i).isPassedAfterVeto();
-          m_l1Passed              ->at(i) = (uint8_t) eventL1Items.at(i).isPassed();
-          m_l1Prescaled           ->at(i) = (uint8_t) eventL1Items.at(i).isPrescaled();
-          m_l1Vetoed              ->at(i) = (uint8_t) eventL1Items.at(i).isVeto();
-        }
-      }
-
-      ////////////
-      //ROS DATA//
-      ////////////
-      const std::vector<TrigMonROB> eventROBs = event->getVec<TrigMonROB>();
-      if (m_doROS && eventROBs.size() > 0) {
-        *m_robN = eventROBs.size();
-        m_robRequestorId          ->resize( eventROBs.size() );
-        m_robTimer                ->resize( eventROBs.size() ); 
-        m_robTimeStartSec         ->resize( eventROBs.size() );
-        m_robTimeStartMicroSec    ->resize( eventROBs.size() );
-        m_robTimeStopSec           ->resize( eventROBs.size() );
-        m_robTimeStopMicroSec      ->resize( eventROBs.size() );
-        m_robDataN                ->resize( eventROBs.size() );
-        m_robDataRobId            ->resize( eventROBs.size() );
-        m_robDataRobSize          ->resize( eventROBs.size() );
-        m_robDataIsUnclassified   ->resize( eventROBs.size() );
-        m_robDataIsCached         ->resize( eventROBs.size() );
-        m_robDataIsRetrieved      ->resize( eventROBs.size() );
-        m_robDataIsIgnored        ->resize( eventROBs.size() );
-        m_robDataIsDisabled       ->resize( eventROBs.size() );
-        m_robDataIsStatusOk       ->resize( eventROBs.size() );
-        m_robDataIsPrefetched     ->resize( eventROBs.size() );   
-        for(unsigned int i = 0; i < eventROBs.size(); ++i) { 
-          m_robRequestorId      ->at(i) = eventROBs.at(i).getRequestorId();
-          m_robTimer            ->at(i) = eventROBs.at(i).getTimer();
-          m_robTimeStartSec     ->at(i) = eventROBs.at(i).start().getSec();
-          m_robTimeStartMicroSec->at(i) = eventROBs.at(i).start().getMicroSec();
-          m_robTimeStopSec      ->at(i) = eventROBs.at(i).stop().getSec();
-          m_robTimeStopMicroSec ->at(i) = eventROBs.at(i).stop().getMicroSec();
-          //Loop over ROB data items
-          const std::vector<TrigMonROBData> robData = eventROBs.at(i).getData(); 
-          m_robDataN->at(i) = robData.size();
-          (m_robDataRobId         ->at(i)).resize( robData.size() );
-          (m_robDataRobSize       ->at(i)).resize( robData.size() );
-          (m_robDataIsUnclassified->at(i)).resize( robData.size() );
-          (m_robDataIsCached      ->at(i)).resize( robData.size() );
-          (m_robDataIsRetrieved   ->at(i)).resize( robData.size() );
-          (m_robDataIsIgnored     ->at(i)).resize( robData.size() );
-          (m_robDataIsDisabled    ->at(i)).resize( robData.size() );
-          (m_robDataIsStatusOk    ->at(i)).resize( robData.size() );
-          (m_robDataIsPrefetched  ->at(i)).resize( robData.size() ); 
-          for (unsigned int j = 0; j < robData.size(); ++j) {
-            (m_robDataRobId         ->at(i)).at(j) = robData.at(j).getROBId();
-            (m_robDataRobSize       ->at(i)).at(j) = robData.at(j).getROBSize();
-            (m_robDataIsUnclassified->at(i)).at(j) = (uint8_t) robData.at(j).isUnclassified();
-            (m_robDataIsCached      ->at(i)).at(j) = (uint8_t) robData.at(j).isCached();
-            (m_robDataIsRetrieved   ->at(i)).at(j) = (uint8_t) robData.at(j).isRetrieved();
-            (m_robDataIsIgnored     ->at(i)).at(j) = (uint8_t) robData.at(j).isIgnored();
-            (m_robDataIsDisabled    ->at(i)).at(j) = (uint8_t) robData.at(j).isDisabled();
-            (m_robDataIsStatusOk    ->at(i)).at(j) = (uint8_t) robData.at(j).isStatusOk();
-            (m_robDataIsPrefetched  ->at(i)).at(j) = (uint8_t) robData.at(j).isStatusPrefetched(); 
-          }
-        }
-      }
-
-      ////////////////
-      //ROS SUM DATA//
-      ////////////////
-      if (m_doROSSum && eventROBs.size() > 0) {
-        m_robSumDataN             ->resize( eventROBs.size() );
-        m_robSumDataSize          ->resize( eventROBs.size() );
-        m_robSumDataNRob          ->resize( eventROBs.size() );
-        m_robSumDataSubDet        ->resize( eventROBs.size() );   
-        m_robSumDataIsUnclassified->resize( eventROBs.size() );
-        m_robSumDataIsCached      ->resize( eventROBs.size() );
-        m_robSumDataIsRetrieved   ->resize( eventROBs.size() );
-        m_robSumDataIsIgnored     ->resize( eventROBs.size() );
-        m_robSumDataIsDisabled    ->resize( eventROBs.size() );
-        for(unsigned int i = 0; i < eventROBs.size(); ++i) { 
-          //Loop over ROB SUM data items
-          const std::vector<TrigMonROBSum> robSum = eventROBs.at(i).getSum();
-          m_robSumDataN->at(i) = robSum.size();
-          (m_robSumDataSize          ->at(i)).resize( robSum.size() );
-          (m_robSumDataNRob          ->at(i)).resize( robSum.size() );
-          (m_robSumDataSubDet        ->at(i)).resize( robSum.size() );   
-          (m_robSumDataIsUnclassified->at(i)).resize( robSum.size() );
-          (m_robSumDataIsCached      ->at(i)).resize( robSum.size() );
-          (m_robSumDataIsRetrieved   ->at(i)).resize( robSum.size() );
-          (m_robSumDataIsIgnored     ->at(i)).resize( robSum.size() );
-          (m_robSumDataIsDisabled    ->at(i)).resize( robSum.size() );
-          for (unsigned int j = 0; j < robSum.size(); ++j) {
-            (m_robSumDataSize          ->at(i)).at(j) = robSum.at(j).getSize();
-            (m_robSumDataNRob          ->at(i)).at(j) = robSum.at(j).getNROB();
-            (m_robSumDataSubDet        ->at(i)).at(j) = robSum.at(j).getSubDet();
-            (m_robSumDataIsUnclassified->at(i)).at(j) = (uint8_t) (robSum.at(j).getHistory() == TrigMonROBData::kUNCLASSIFIED);
-            (m_robSumDataIsCached      ->at(i)).at(j) = (uint8_t) (robSum.at(j).getHistory() == TrigMonROBData::kCACHED);
-            (m_robSumDataIsRetrieved   ->at(i)).at(j) = (uint8_t) (robSum.at(j).getHistory() == TrigMonROBData::kRETRIEVED);
-            (m_robSumDataIsIgnored     ->at(i)).at(j) = (uint8_t) (robSum.at(j).getHistory() == TrigMonROBData::kIGNORED);
-            (m_robSumDataIsDisabled    ->at(i)).at(j) = (uint8_t) (robSum.at(j).getHistory() == TrigMonROBData::kDISABLED);
-          }
-        }
-      }
-
-      ////////////
-      //RoI DATA//
-      ////////////
-      const std::vector<TrigMonRoi> eventRoIs = event->getVec<TrigMonRoi>();
-      if (m_doRoI && eventRoIs.size() > 0) {
-        *m_roiN = eventRoIs.size();
-        m_roiIsNoneType     ->resize( eventRoIs.size() );
-        m_roiIsMuonType     ->resize( eventRoIs.size() );
-        m_roiIsEmTauType    ->resize( eventRoIs.size() );
-        m_roiIsTau          ->resize( eventRoIs.size() );
-        m_roiIsJetType      ->resize( eventRoIs.size() );
-        m_roiIsJetEtType    ->resize( eventRoIs.size() );
-        m_roiIsEnergyType   ->resize( eventRoIs.size() );
-        m_roiId             ->resize( eventRoIs.size() );
-        m_roiNL1thresholds  ->resize( eventRoIs.size() );
-        m_roiEta            ->resize( eventRoIs.size() );
-        m_roiPhi            ->resize( eventRoIs.size() );
-        m_roiArea           ->resize( eventRoIs.size() );
-        m_roiEt             ->resize( eventRoIs.size() );
-        m_roiEtLarge        ->resize( eventRoIs.size() );
-        m_roiMuCharge       ->resize( eventRoIs.size() );
-        m_roiIsolationBits  ->resize( eventRoIs.size() );
-        m_roiVectorEX       ->resize( eventRoIs.size() );
-        m_roiVectorEY       ->resize( eventRoIs.size() );
-        m_roiOverflowEX     ->resize( eventRoIs.size() );
-        m_roiOverflowEY     ->resize( eventRoIs.size() );
-        m_roiOverflowET     ->resize( eventRoIs.size() );
-        for(unsigned int i = 0; i < eventRoIs.size(); ++i) {
-          m_roiIsNoneType   ->at(i) = (uint8_t) (eventRoIs.at(i).getRoiType() == TrigMonRoi::kNone);
-          m_roiIsMuonType   ->at(i) = (uint8_t) (eventRoIs.at(i).getRoiType() == TrigMonRoi::kMuon);
-          m_roiIsEmTauType  ->at(i) = (uint8_t) (eventRoIs.at(i).getRoiType() == TrigMonRoi::kEmTau);
-          m_roiIsTau        ->at(i) = (uint8_t) (eventRoIs.at(i).getVarVal(Trig::kRoIIsTau)); // Resolve ambiguity
-          m_roiIsJetType    ->at(i) = (uint8_t) (eventRoIs.at(i).getRoiType() == TrigMonRoi::kJet);
-          m_roiIsJetEtType  ->at(i) = (uint8_t) (eventRoIs.at(i).getRoiType() == TrigMonRoi::kJetEt);
-          m_roiIsEnergyType ->at(i) = (uint8_t) (eventRoIs.at(i).getRoiType() == TrigMonRoi::kEnergy);
-          m_roiId           ->at(i) = eventRoIs.at(i).getRoiId();
-          m_roiNL1thresholds->at(i) = eventRoIs.at(i).getNL1th();
-          m_roiEta          ->at(i) = eventRoIs.at(i).getEta();
-          m_roiPhi          ->at(i) = eventRoIs.at(i).getPhi();
-          m_roiArea         ->at(i) = eventRoIs.at(i).getRoIArea();
-          m_roiEt           ->at(i) = eventRoIs.at(i).getVarVal(Trig::kRoIET); //EMTAU=ET, muon=pT, jet=ETSmall, energy=scaler total energy
-          m_roiEtLarge      ->at(i) = eventRoIs.at(i).getVarVal(Trig::kRoIETLarge); //Only for jets
-          m_roiMuCharge     ->at(i) = (uint8_t) eventRoIs.at(i).getVarVal(Trig::kRoIMuonCharge); //Only for muons
-          m_roiIsolationBits->at(i) = (uint32_t) eventRoIs.at(i).getVarVal(Trig::kRoIIsolationBits); //Only for EMTAU
-          m_roiVectorEX     ->at(i) = eventRoIs.at(i).getVarVal(Trig::kRoIEnergyVectorX); //Only for ENERGY
-          m_roiVectorEY     ->at(i) = eventRoIs.at(i).getVarVal(Trig::kRoIEnergyVectorY); //Only for ENERGY
-          m_roiOverflowEX   ->at(i) = (uint8_t) eventRoIs.at(i).getVarVal(Trig::kRoIEnergyOverflowX); //Only for ENERGY
-          m_roiOverflowEY   ->at(i) = (uint8_t) eventRoIs.at(i).getVarVal(Trig::kRoIEnergyOverflowY); //Only for ENERGY
-          m_roiOverflowET   ->at(i) = (uint8_t) eventRoIs.at(i).getVarVal(Trig::kRoIEnergyOverflowT); //Only for ENERGY
-        }
-      }
-
-      ////////////////
-      //SEQ/ALG DATA//
-      ////////////////
-      const std::vector<TrigMonSeq> eventSeqs = event->getVec<TrigMonSeq>();
-      if (m_doSeq && eventSeqs.size() > 0) {
-        int RoIIndex = 0;
-        *m_seqN = eventSeqs.size();
-        
-        m_seqLevel               ->resize( eventSeqs.size() );
-        m_seqIsInitial           ->resize( eventSeqs.size() );
-        m_seqIsExecuted          ->resize( eventSeqs.size() );
-        m_seqIsAlreadyExecuted   ->resize( eventSeqs.size() );
-        m_seqIsPrevious          ->resize( eventSeqs.size() );
-        m_seqChannelCounter      ->resize( eventSeqs.size() ); 
-        m_seqIndex               ->resize( eventSeqs.size() );
-        m_seqSequenceTimer       ->resize( eventSeqs.size() ); 
-        m_seqAlgTimerTot         ->resize( eventSeqs.size() );
-        m_seqAlgN                ->resize( eventSeqs.size() ); 
-        m_seqAlgPosition         ->resize( eventSeqs.size() );
-        m_seqAlgNRoIs            ->resize( eventSeqs.size() );
-        m_seqAlgRoIIndex         ->resize( eventSeqs.size() );
-        // We do not resize m_seqRoI as we don't yet know how big it will be
-        m_seqAlgIsCached         ->resize( eventSeqs.size() );
-        m_seqAlgIsCalled         ->resize( eventSeqs.size() );
-        m_seqAlgTimer            ->resize( eventSeqs.size() );
-        m_seqAlgTimeStartSec     ->resize( eventSeqs.size() );
-        m_seqAlgTimeStartMicroSec->resize( eventSeqs.size() );
-        m_seqAlgTimeStopSec      ->resize( eventSeqs.size() );
-        m_seqAlgTimeStopMicroSec ->resize( eventSeqs.size() ); 
-        
-        for(unsigned int i = 0; i < eventSeqs.size(); ++i) {
-          m_seqLevel            ->at(i) = eventSeqs.at(i).getLevel();
-          m_seqIsInitial        ->at(i) = (uint8_t) eventSeqs.at(i).isInitial();
-          m_seqIsExecuted       ->at(i) = (uint8_t) eventSeqs.at(i).isExecuted();
-          m_seqIsAlreadyExecuted->at(i) = (uint8_t) eventSeqs.at(i).isAlreadyExecuted();
-          m_seqIsPrevious       ->at(i) = (uint8_t) eventSeqs.at(i).isPrevious();
-          m_seqChannelCounter   ->at(i) = eventSeqs.at(i).getChnCounter();
-          m_seqIndex            ->at(i) = eventSeqs.at(i).getSeqIndex();
-          m_seqSequenceTimer    ->at(i) = eventSeqs.at(i).getSeqTimer();
-          m_seqAlgTimerTot      ->at(i) = eventSeqs.at(i).getAlgTimer();
-          //Loop over sequence algorithms
-          const std::vector<TrigMonAlg> seqAlgs = eventSeqs.at(i).getAlg();
-          m_seqAlgN->at(i) = seqAlgs.size();
-          (m_seqAlgPosition         ->at(i)).resize( seqAlgs.size() );
-          (m_seqAlgNRoIs            ->at(i)).resize( seqAlgs.size() );
-          (m_seqAlgRoIIndex         ->at(i)).resize( seqAlgs.size() );
-          (m_seqAlgIsCached         ->at(i)).resize( seqAlgs.size() );
-          (m_seqAlgIsCalled         ->at(i)).resize( seqAlgs.size() );
-          (m_seqAlgTimer            ->at(i)).resize( seqAlgs.size() );
-          (m_seqAlgTimeStartSec     ->at(i)).resize( seqAlgs.size() );
-          (m_seqAlgTimeStartMicroSec->at(i)).resize( seqAlgs.size() );
-          (m_seqAlgTimeStopSec      ->at(i)).resize( seqAlgs.size() );
-          (m_seqAlgTimeStopMicroSec ->at(i)).resize( seqAlgs.size() );
-          for (unsigned int j = 0; j < seqAlgs.size(); ++j) {
-            (m_seqAlgPosition   ->at(i)).at(j) = seqAlgs.at(j).getPosition();
-            // We shall not go deeper than vector<vector< bla > >, so store this vector<uint8_t> "up one level"
-            (m_seqAlgNRoIs            ->at(i)).at(j) = seqAlgs.at(j).getNRoi();
-            (m_seqAlgRoIIndex         ->at(i)).at(j) = RoIIndex++;
-            // We need to go via a vector, but this class gives us a set. Need to convert
-            std::vector< uint8_t > RoIIdSet;
-            RoIIdSet.clear();
-            RoIIdSet.resize( seqAlgs.at(j).getNRoi() );
-            for (unsigned int roi = 0; roi < seqAlgs.at(j).getNRoi(); ++roi) {
-              RoIIdSet.at(roi) = seqAlgs.at(j).getRoiId( roi );
-            }
-            m_seqRoI                  ->push_back( RoIIdSet );
-            (m_seqAlgIsCached         ->at(i)).at(j) = (uint8_t) seqAlgs.at(j).isCached();
-            (m_seqAlgIsCalled         ->at(i)).at(j) = (uint8_t) seqAlgs.at(j).isCalled();
-            (m_seqAlgTimer            ->at(i)).at(j) = seqAlgs.at(j).getTimer();
-            (m_seqAlgTimeStartSec     ->at(i)).at(j) = seqAlgs.at(j).start().getSec();
-            (m_seqAlgTimeStartMicroSec->at(i)).at(j) = seqAlgs.at(j).start().getMicroSec();
-            (m_seqAlgTimeStopSec      ->at(i)).at(j) = seqAlgs.at(j).stop().getSec();
-            (m_seqAlgTimeStopMicroSec ->at(i)).at(j) = seqAlgs.at(j).stop().getMicroSec();
-          }
-
-          // Check for additonal payload 
-          if ( eventSeqs.at(i).getVarKey().size() != eventSeqs.at(i).getVarVal().size() ) {
-            REPORT_MESSAGE( MSG::WARNING ) << "Trigger sequences additional float payload size different to key size, skipping.";
-          } else {
-            for (unsigned j=0; j < eventSeqs.at(i).getVarKey().size(); ++j) {
-              REPORT_MESSAGE( MSG::DEBUG ) << "Got a SEQ["<<i<<"] int=>float pair. " << eventSeqs.at(i).getVarKey().at(j) << " => " << eventSeqs.at(i).getVarVal().at(j);
-            }
-          }  
-        }
-      }
-
-      ///////////
-      //TE DATA//
-      ///////////
-      const std::vector<TrigMonTE> eventTEs = event->getVec<TrigMonTE>();
-      if (m_doTE && eventTEs.size() > 0) {  
-        *m_teN = eventTEs.size();
-        m_teId             ->resize( eventTEs.size() );
-        m_teIndex          ->resize( eventTEs.size() );
-        m_teIsRegularTE    ->resize( eventTEs.size() );
-        m_teIsInitialTE    ->resize( eventTEs.size() );
-        m_teIsRoITE        ->resize( eventTEs.size() );
-        m_teIsL1ThreshTE   ->resize( eventTEs.size() );
-        m_teActiveState    ->resize( eventTEs.size() );
-        m_teErrorState     ->resize( eventTEs.size() );
-        m_teIsTerminalNode ->resize( eventTEs.size() );
-        m_teIsOutputL2Node ->resize( eventTEs.size() );
-        m_teIsOutputEFNode ->resize( eventTEs.size() );
-        m_teIsTopologicalTE->resize( eventTEs.size() );
-        m_teChildIndex     ->resize( eventTEs.size() ); 
-        m_teParentIndex    ->resize( eventTEs.size() );
-        m_teRoiId          ->resize( eventTEs.size() );
-        m_teClid           ->resize( eventTEs.size() ); 
-        for(unsigned int i = 0; i < eventTEs.size(); ++i) {
-          m_teId             ->at(i) = eventTEs.at(i).getId();
-          m_teIndex          ->at(i) = eventTEs.at(i).getIndex();
-          m_teIsRegularTE    ->at(i) = (uint8_t) (eventTEs.at(i).getType() == TrigMonTE::kELEM);
-          m_teIsInitialTE    ->at(i) = (uint8_t) (eventTEs.at(i).getType() == TrigMonTE::kINIT);
-          m_teIsRoITE        ->at(i) = (uint8_t) (eventTEs.at(i).getType() == TrigMonTE::kROI);
-          m_teIsL1ThreshTE   ->at(i) = (uint8_t) (eventTEs.at(i).getType() == TrigMonTE::kL1TH);
-          m_teActiveState    ->at(i) = (uint8_t) eventTEs.at(i).getActiveState();
-          m_teErrorState     ->at(i) = (uint8_t) eventTEs.at(i).getErrorState();
-          m_teIsTerminalNode ->at(i) = (uint8_t) eventTEs.at(i).isTerminalNode();
-          m_teIsOutputL2Node ->at(i) = (uint8_t) eventTEs.at(i).isOutputL2Node();
-          m_teIsOutputEFNode ->at(i) = (uint8_t) eventTEs.at(i).isOutputEFNode();
-          m_teIsTopologicalTE->at(i) = (uint8_t) eventTEs.at(i).isTopologicalTE();
-          //Get inner vectors direct from the TE
-          m_teChildIndex ->at(i) = eventTEs.at(i).getChildIndex();
-          m_teParentIndex->at(i) = eventTEs.at(i).getParentIndex();
-          m_teRoiId      ->at(i) = eventTEs.at(i).getRoiId();
-          m_teClid       ->at(i) = eventTEs.at(i).getClid();
-
-          // Check additonal payload 
-          if ( eventTEs.at(i).getVarKey().size() != eventTEs.at(i).getVarVal().size() ) {
-            REPORT_MESSAGE( MSG::WARNING ) << "Trigger TE additional float payload size different to key size, skipping.";
-          } else {
-            for (unsigned j=0; j < eventTEs.at(i).getVarKey().size(); ++j) {
-              REPORT_MESSAGE( MSG::DEBUG ) << "Got a TE["<<i<<"] int=>float pair. " << eventTEs.at(i).getVarKey().at(j) << " => " << eventTEs.at(i).getVarVal().at(j);
-            }
-          }  
-        }
-      }
-
-      ///////////
-      //DB DATA//
-      ///////////
-      if (m_doDBKey) {
-        for (unsigned i=0; i < event->getVarKey().size(); ++i) {
-          switch (event->getVarKey().at(i)) {
-            case Trig::kSMK:
-              *m_DB_SMK = event->getVarVal().at(i);
-              break;
-            case Trig::kL1PSK:
-              *m_DB_L1PSK = event->getVarVal().at(i);
-              break;
-            case Trig::kHLTPSK:
-              *m_DB_HLTPSK = event->getVarVal().at(i);
-              break;
-            default:
-              break;
-          } // Switch
-        }
-      } 
-
-      if( m_tree->capture().isFailure() ) {
-        ATH_MSG_ERROR( "Couldn't save the TrigMonEvent." );
-        return;
-      } else {
-        ATH_MSG_DEBUG( "Trigger monitoring event from TrigMonEvent source successfully saved." );
-      }
-
-    } // Loop over TrigMonEventCollection DataVector
-  } // TrigCostD3PDMakerTool::handleNewEvent
-
-  void TrigCostD3PDMakerTool::clear() {
-    if (m_doBasic) {
-      *m_event = 0;
-      *m_lumi = 0;
-      *m_lumiLength = 0;
-      *m_bunch_id = 0;
-      *m_run = 0;
-      *m_sec = 0;
-      *m_nsec = 0;
-      *m_timer = 0;
-      *m_ranScaleTools= 0;
-      *m_appId = 0;
-      *m_costEvent = 0;
-      *m_costRunSec = 0;
-      *m_costRunNsec = 0;
-    }
-
-    if (m_doEB && !m_doBasic) {
-      *m_event = 0;
-      *m_ebWeight = 0;
-      *m_ebWeightBG = 0;
-      *m_ebUnbiased = 0;
-    }
-
-    //////////////
-    //EXTRA DATA//
-    //////////////
-    if (m_doExtra) {
-      *m_timerTrigCost = 0;
-      *m_timerEndSteer = 0;
-      *m_timerChainProcess = 0;
-      *m_timerResultBuilder = 0;
-      *m_timerMon = 0;
-    }
-
-    //////////////
-    //CHAIN DATA//
-    //////////////
-    if (m_doChain) {
-      *m_chainN = 0;
-      m_chainCounter->clear();
-      m_chainLevel->clear();
-      m_chainTimer->clear();
-      m_chainIsPassed->clear();
-      m_chainIsPassedRaw->clear();
-      m_chainIsPassthrough->clear();
-      m_chainIsResurrected->clear();
-      m_chainIsPrescaled->clear();
-      m_chainWasL1AfterVeto->clear();
-      m_chainWasL1BeforePrescale->clear();
-      m_chainWasL1AfterPrescale->clear();
-      m_chainIsExpressStream->clear();
-    }
-
-    ///////////
-    //L1 DATA//
-    ///////////
-    if (m_doL1) {
-      *m_l1N = 0;
-      m_l1CtpId ->clear();
-      m_l1PassedBeforePrescale ->clear();
-      m_l1PassedAfterPrescale->clear();
-      m_l1PassedAfterVeto->clear();
-      m_l1Passed->clear();
-      m_l1Prescaled->clear();
-      m_l1Vetoed->clear();
-    }
-
-    ////////////
-    //ROS DATA//
-    ////////////
-    if (m_doROS) {
-      *m_robN = 0;
-      m_robRequestorId->clear();
-      m_robTimer->clear();
-      m_robTimeStartSec->clear();
-      m_robTimeStartMicroSec->clear();
-      m_robTimeStopSec->clear();
-      m_robTimeStopMicroSec->clear();
-      m_robDataN->clear();
-      m_robDataRobId->clear();
-      m_robDataRobSize->clear();
-      m_robDataIsUnclassified->clear();
-      m_robDataIsCached->clear();
-      m_robDataIsRetrieved->clear();
-      m_robDataIsIgnored->clear();
-      m_robDataIsDisabled->clear();
-      m_robDataIsStatusOk->clear();
-      m_robDataIsPrefetched->clear();
-    }
-
-    ////////////////
-    //ROS SUM DATA//
-    ////////////////
-    if (m_doROSSum) {
-      m_robSumDataN->clear();
-      m_robSumDataSize->clear();
-      m_robSumDataNRob->clear();
-      m_robSumDataSubDet->clear();
-      m_robSumDataIsUnclassified->clear();
-      m_robSumDataIsCached->clear();
-      m_robSumDataIsRetrieved->clear();
-      m_robSumDataIsIgnored->clear();
-      m_robSumDataIsDisabled->clear();
-    }
-
-
-    ////////////
-    //RoI DATA//
-    ////////////
-    if (m_doRoI) {
-      *m_roiN = 0;
-      m_roiIsNoneType->clear();
-      m_roiIsMuonType->clear();
-      m_roiIsEmTauType->clear();
-      m_roiIsTau->clear();
-      m_roiIsJetType->clear();
-      m_roiIsJetEtType->clear();
-      m_roiIsEnergyType->clear();
-      m_roiId->clear();
-      m_roiNL1thresholds->clear();
-      m_roiEta->clear();
-      m_roiPhi->clear();
-      m_roiArea->clear();
-      //
-      m_roiEt->clear();
-      m_roiEtLarge->clear();
-      m_roiMuCharge->clear();
-      m_roiIsolationBits->clear();
-      m_roiVectorEX->clear();
-      m_roiVectorEY->clear();
-      m_roiOverflowEX->clear();
-      m_roiOverflowEY->clear();
-      m_roiOverflowET->clear();
-    }
-
-    ////////////////
-    //SEQ/ALG DATA//
-    ////////////////
-    if (m_doSeq) {
-      *m_seqN = 0;
-      m_seqIsInitial->clear();
-      m_seqIsExecuted->clear();
-      m_seqIsAlreadyExecuted->clear();
-      m_seqIsPrevious->clear();
-      m_seqLevel->clear();
-      m_seqChannelCounter->clear();
-      m_seqIndex->clear();
-      m_seqSequenceTimer->clear();
-      m_seqAlgTimerTot->clear();
-      m_seqAlgN->clear();
-      m_seqAlgPosition->clear();
-      m_seqAlgNRoIs->clear();
-      m_seqAlgRoIIndex->clear();
-      m_seqRoI->clear();
-      m_seqAlgIsCached->clear();
-      m_seqAlgIsCalled->clear();
-      m_seqAlgTimer->clear();
-      m_seqAlgTimeStartSec->clear();
-      m_seqAlgTimeStartMicroSec->clear();
-      m_seqAlgTimeStopSec->clear();
-      m_seqAlgTimeStopMicroSec->clear();
-    }
-
-    ///////////
-    //TE DATA//
-    ///////////
-    if (m_doTE) {
-      *m_teN = 0;
-      m_teId->clear();
-      m_teIndex->clear();
-      m_teIsRegularTE->clear();
-      m_teIsInitialTE->clear();
-      m_teIsRoITE->clear();
-      m_teIsL1ThreshTE->clear();
-      m_teActiveState->clear();
-      m_teErrorState->clear();
-      m_teIsTerminalNode->clear();
-      m_teIsOutputL2Node->clear();
-      m_teIsOutputEFNode->clear();
-      m_teIsTopologicalTE->clear();
-      m_teChildIndex->clear();
-      m_teParentIndex->clear();
-      m_teRoiId->clear();
-      m_teClid->clear(); 
-    }
-
-    ///////////
-    //DB DATA//
-    ///////////
-    if (m_doDBKey) {
-      *m_DB_SMK = 0;
-      *m_DB_L1PSK = 0;
-      *m_DB_HLTPSK = 0;
-    }
-  }
-
-} // namespace D3PD
diff --git a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/src/TrigCostD3PDMakerTool.h b/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/src/TrigCostD3PDMakerTool.h
deleted file mode 100644
index 4913a1470b62aa10d0825c8bc038d3b92694315f..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/src/TrigCostD3PDMakerTool.h
+++ /dev/null
@@ -1,272 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: TrigCostD3PDMakerTool.h 603620 2014-06-25 17:55:37Z tamartin $
-#ifndef TRIGGERD3PDMAKER_TRIGCOSTD3PDMAKERTOOL_H
-#define TRIGGERD3PDMAKER_TRIGCOSTD3PDMAKERTOOL_H
-
-// STL include(s):
-#include <map>
-#include <string>
-#include <set>
-
-// Gaudi/Athena include(s):
-#include "GaudiKernel/IIncidentListener.h"
-#include "GaudiKernel/IIncidentSvc.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "StoreGate/StoreGateSvc.h"
-
-// D3PDMaker include(s):
-#include "D3PDMakerInterfaces/IMetadataTool.h"
-#include "D3PDMakerInterfaces/ID3PDSvc.h"
-
-namespace D3PD {
-
-    // Forward declaration(s):
-    class ID3PD;
-
-    /**
-    * @short D3PDMaker package to write out TrigMonEvent objects to flat ntuple.
-    * As these are written out to the bytestream en-bulk, have to use tricks from the 
-    * TrigConfMetadata writer and manually write out the TTree with the D3PD metadata tools
-    * rather than using a standard D3PDMaker alg.
-    *
-    * Hence we do not get one entry per event, we get one entry for every TrigMonEvent object 
-    * (represnets an event in the HLT).
-    */
-    class TrigCostD3PDMakerTool : public AthAlgTool,
-                                  public IMetadataTool,
-                                  public IIncidentListener {
-
-      public:
-        /// Regular AlgTool constructor
-        TrigCostD3PDMakerTool( const std::string& type, const std::string& name,
-        const IInterface* parent );
-
-        /// AlgTool initialization function
-        virtual StatusCode initialize();
-        /// Gaudi function describing which interfaces the tool implements
-        virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvIf );
-
-        /// Function writing the configuration information to the D3PD
-        virtual StatusCode writeMetadata( ID3PD* d3pd );
-
-        /// Function called when a relevant incident happened
-        virtual void handle( const Incident& inc );
-
-      private:
-        /// Function handling new trigger configurations
-        void handleNewEvent( const Incident& inc );
-
-        void clear();
-
-        /// Directory in which to store the data
-        std::string m_dir;
-
-        /// Handle for the incident service
-        ServiceHandle< IIncidentSvc > m_incidentSvc;
-        /// Handle for the D3PDSvc:
-        ServiceHandle< ID3PDSvc > m_d3pdSvc;
-
-        /// Storegate key for TrigMonEvent objects
-        std::string m_keyEvent;
-        /// D3PD prefix
-        std::string m_prefix;
-
-        //
-        // The configuration variables:
-        //
-        ID3PD* m_tree; ///< D3PD object holding the configuration description
-        bool m_onlySaveCostEvents; //!< Export non cost events?
-        std::string m_writeMode; //!< What to export
-        bool m_doBasic;
-        bool m_doExtra;
-        bool m_doChain;
-        bool m_doL1;
-        bool m_doROS;
-        bool m_doROSSum;
-        bool m_doRoI;
-        bool m_doSeq;
-        bool m_doTE;
-        bool m_doDBKey;
-        bool m_doEB;
-
-        //////////////
-        //BASIC DATA//
-        //////////////
-        uint32_t* m_event;              // Event number
-        uint32_t* m_lumi;               // Lumi block (low 16 bits of TrigMonEvent.m_lumi) 
-        float*    m_lumiLength;         // Lumi block length in seconds
-        uint32_t* m_bunch_id;           // bunch crossing id (high 16 bits of TrigMonEvent.m_lumi)
-        uint32_t* m_run;                // Run number
-        uint32_t* m_sec;                // Event second
-        uint32_t* m_nsec;               // Event ns
-        float*    m_timer;              // Event timer
-        float*    m_ebWeight;           // Enhanced bias weighting factor
-        uint32_t* m_ebWeightBG;         // Enhanced bias weight bunch group
-        uint8_t*  m_ebUnbiased;         // Enhanced Bias flag for unbiased online events
-        uint8_t*  m_ranScaleTools;      // If this was a monitoring event
-        uint32_t* m_appId;              // Application ID - hash of trigger XPU node
-
-        //////////////
-        //CHAIN DATA//
-        //////////////
-        uint16_t*                m_chainN; 
-        std::vector< uint16_t >* m_chainCounter;
-        std::vector< uint16_t >* m_chainLevel;    
-        std::vector< float >*    m_chainTimer;         
-        std::vector< uint8_t >*  m_chainIsPassed;   
-        std::vector< uint8_t >*  m_chainIsPassedRaw;
-        std::vector< uint8_t >*  m_chainIsPassthrough;
-        std::vector< uint8_t >*  m_chainIsResurrected;
-        std::vector< uint8_t >*  m_chainIsPrescaled;
-        std::vector< uint8_t >*  m_chainWasL1AfterVeto;
-        std::vector< uint8_t >*  m_chainWasL1BeforePrescale;
-        std::vector< uint8_t >*  m_chainWasL1AfterPrescale;
-        std::vector< uint8_t >*  m_chainIsExpressStream;
-
-        //////////////
-        //EXTRA DATA//
-        //////////////
-        float*    m_timerTrigCost;      // Detailed time - Time to process TrigCost OPI tools
-        float*    m_timerEndSteer;      // Detailed time - End of OPI steering
-        float*    m_timerChainProcess;  // Detailed time - chain processing
-        float*    m_timerResultBuilder; // Detailed time - result building
-        float*    m_timerMon;           // Detailed time - monitoring 
-        float*    m_costEvent;          // Sequential cost event number
-        uint32_t* m_costRunSec;         // Cost processing time second
-        uint32_t* m_costRunNsec;        // Cost processing time ns
-
-        ///////////
-        //L1 DATA//
-        ///////////
-        uint16_t*                m_l1N; 
-        std::vector< uint16_t >* m_l1CtpId;
-        std::vector< uint8_t >*  m_l1PassedBeforePrescale;    
-        std::vector< uint8_t >*  m_l1PassedAfterPrescale;    
-        std::vector< uint8_t >*  m_l1PassedAfterVeto;
-        std::vector< uint8_t >*  m_l1Passed;
-        std::vector< uint8_t >*  m_l1Prescaled;
-        std::vector< uint8_t >*  m_l1Vetoed; 
-
-        ////////////
-        //ROS DATA//
-        ////////////
-        uint16_t*                               m_robN;
-        std::vector< uint32_t >*                m_robRequestorId;
-        std::vector< double >*                  m_robTimer;
-        std::vector< uint32_t >*                m_robTimeStartSec;
-        std::vector< uint32_t >*                m_robTimeStartMicroSec;
-        std::vector< uint32_t >*                m_robTimeStopSec;
-        std::vector< uint32_t >*                m_robTimeStopMicroSec;
-        std::vector< uint16_t >*                m_robDataN;
-        std::vector< std::vector< uint32_t > >* m_robDataRobId;
-        std::vector< std::vector< uint32_t > >* m_robDataRobSize;
-        std::vector< std::vector< uint8_t > >*  m_robDataIsUnclassified;
-        std::vector< std::vector< uint8_t > >*  m_robDataIsCached;
-        std::vector< std::vector< uint8_t > >*  m_robDataIsRetrieved;
-        std::vector< std::vector< uint8_t > >*  m_robDataIsIgnored;
-        std::vector< std::vector< uint8_t > >*  m_robDataIsDisabled;
-        std::vector< std::vector< uint8_t > >*  m_robDataIsStatusOk;
-        std::vector< std::vector< uint8_t > >*  m_robDataIsPrefetched;   
-        std::vector< uint16_t >*                m_robSumDataN;
-        std::vector< std::vector< uint32_t > >* m_robSumDataSize;
-        std::vector< std::vector< uint32_t > >* m_robSumDataNRob;
-        std::vector< std::vector< uint32_t > >* m_robSumDataSubDet;  
-        std::vector< std::vector< uint8_t > >*  m_robSumDataIsUnclassified; 
-        std::vector< std::vector< uint8_t > >*  m_robSumDataIsCached;
-        std::vector< std::vector< uint8_t > >*  m_robSumDataIsRetrieved;
-        std::vector< std::vector< uint8_t > >*  m_robSumDataIsIgnored;
-        std::vector< std::vector< uint8_t > >*  m_robSumDataIsDisabled;
-
-        ////////////
-        //RoI DATA//
-        ////////////
-        uint16_t*                 m_roiN;
-        std::vector< uint8_t >*   m_roiIsNoneType;
-        std::vector< uint8_t >*   m_roiIsMuonType;
-        std::vector< uint8_t >*   m_roiIsEmTauType;
-        std::vector< uint8_t >*   m_roiIsTau;
-        std::vector< uint8_t >*   m_roiIsJetType;
-        std::vector< uint8_t >*   m_roiIsJetEtType;
-        std::vector< uint8_t >*   m_roiIsEnergyType;
-        std::vector< uint32_t >*  m_roiId;
-        std::vector< uint8_t >*   m_roiNL1thresholds;
-        std::vector< float >*     m_roiEta;
-        std::vector< float >*     m_roiPhi;
-        std::vector< float >*     m_roiArea;
-        //
-        std::vector< float >*     m_roiEt;
-        std::vector< float >*     m_roiEtLarge;
-        std::vector< uint8_t >*   m_roiMuCharge;
-        std::vector< uint32_t >*  m_roiIsolationBits;
-        std::vector< float >*     m_roiVectorEX;
-        std::vector< float >*     m_roiVectorEY;
-        std::vector< uint8_t >*   m_roiOverflowEX;
-        std::vector< uint8_t >*   m_roiOverflowEY;
-        std::vector< uint8_t >*   m_roiOverflowET;
-
-        ////////////////
-        //SEQ/ALG DATA//
-        ////////////////
-        uint16_t*                               m_seqN;
-        std::vector< uint8_t >*                 m_seqIsInitial;
-        std::vector< uint8_t >*                 m_seqIsExecuted;
-        std::vector< uint8_t >*                 m_seqIsAlreadyExecuted;
-        std::vector< uint8_t >*                 m_seqIsPrevious;
-        std::vector< uint16_t >*                m_seqLevel;
-        std::vector< uint16_t >*                m_seqChannelCounter;
-        std::vector< uint16_t >*                m_seqIndex; 
-        std::vector< float >*                   m_seqSequenceTimer; 
-        std::vector< double >*                  m_seqAlgTimerTot; 
-        std::vector< uint16_t >*                m_seqAlgN; 
-        std::vector< std::vector< uint8_t > >*  m_seqAlgPosition; 
-        std::vector< std::vector< uint8_t > >*  m_seqAlgNRoIs; // RoI's are held in another varaible
-        std::vector< std::vector< uint32_t > >* m_seqAlgRoIIndex;
-        std::vector< std::vector< uint8_t > >*  m_seqRoI; // Hold the RoI data
-        std::vector< std::vector< uint8_t > >*  m_seqAlgIsCached;
-        std::vector< std::vector< uint8_t > >*  m_seqAlgIsCalled;
-        std::vector< std::vector< double > >*   m_seqAlgTimer; 
-        std::vector< std::vector< uint32_t > >* m_seqAlgTimeStartSec; 
-        std::vector< std::vector< uint32_t > >* m_seqAlgTimeStartMicroSec; 
-        std::vector< std::vector< uint32_t > >* m_seqAlgTimeStopSec; 
-        std::vector< std::vector< uint32_t > >* m_seqAlgTimeStopMicroSec; 
-
-        ///////////
-        //TE DATA//
-        ///////////
-        uint16_t*                                 m_teN; 
-        std::vector< uint16_t >*                  m_teId;
-        std::vector< uint16_t >*                  m_teIndex;
-        std::vector< uint8_t >*                   m_teIsRegularTE;
-        std::vector< uint8_t >*                   m_teIsInitialTE;
-        std::vector< uint8_t >*                   m_teIsRoITE;
-        std::vector< uint8_t >*                   m_teIsL1ThreshTE;
-        std::vector< uint8_t >*                   m_teActiveState;
-        std::vector< uint8_t >*                   m_teErrorState;
-        std::vector< uint8_t >*                   m_teIsTerminalNode;
-        std::vector< uint8_t >*                   m_teIsOutputL2Node;
-        std::vector< uint8_t >*                   m_teIsOutputEFNode;
-        std::vector< uint8_t >*                   m_teIsTopologicalTE;
-        std::vector< std::vector< uint16_t > >*   m_teChildIndex;
-        std::vector< std::vector< uint16_t > >*   m_teParentIndex;
-        std::vector< std::vector< uint8_t > >*    m_teRoiId;
-        std::vector< std::vector< uint32_t > >*   m_teClid;
-
-        ///////////
-        //DB DATA//
-        ///////////
-        uint32_t* m_DB_SMK;
-        uint32_t* m_DB_L1PSK;
-        uint32_t* m_DB_HLTPSK;
-
-    }; // class TrigCostD3PDMakerTool
-
-} // namespace D3PD
-
-#endif // TRIGGERD3PDMAKER_TRIGCOSTD3PDMAKERTOOL_H
diff --git a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/src/components/TrigCostD3PDMaker_entries.cxx b/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/src/components/TrigCostD3PDMaker_entries.cxx
deleted file mode 100644
index 86fcac335e115c8ec38e1b8e080e7bd5c69b6088..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/D3PDMaker/TrigCostD3PDMaker/src/components/TrigCostD3PDMaker_entries.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "../TrigCostD3PDMakerTool.h"
-#include "../TrigCostConfMetadataTool.h"
-
-DECLARE_COMPONENT( D3PD::TrigCostD3PDMakerTool )
-DECLARE_COMPONENT( D3PD::TrigCostConfMetadataTool )
-
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ElectronEfficiencyCorrection/IAsgElectronEfficiencyCorrectionTool.h b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ElectronEfficiencyCorrection/IAsgElectronEfficiencyCorrectionTool.h
deleted file mode 100644
index ea8aeb75e81543ebe1d7c4f5a3a8da1861687e7b..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ElectronEfficiencyCorrection/IAsgElectronEfficiencyCorrectionTool.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//IAsgElectronEfficiencyCorrection.h to be used in the tool.
-#ifndef __IASGELECTRONEFFICIENCYCORRECTION__
-#define __IASGELECTRONEFFICIENCYCORRECTION__
-
-#include "EgammaAnalysisInterfaces/IAsgElectronEfficiencyCorrectionTool.h"
-#pragma message "In the process of moving the Interface part under PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces"
-
-#endif
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/EleChargeAlg.cxx b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/EleChargeAlg.cxx
deleted file mode 100644
index 3ccf4efa02c9de89e0014dbbe0ddf3d6fd287116..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/EleChargeAlg.cxx
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-// ElectronChargeCorrection includes
-#include "EleChargeAlg.h"
-#include "xAODEventInfo/EventInfo.h"
-#include "xAODEgamma/ElectronContainer.h"
-// #include "xAODTruth/TruthEventContainer.h"
-// #include "xAODTruth/TruthVertex.h"
-// #include "xAODEgamma/EgammaTruthxAODHelpers.h"
-#include "GaudiKernel/ITHistSvc.h"
-#include "PATInterfaces/ISystematicsTool.h"
-
-#include "EgammaAnalysisInterfaces/IAsgElectronEfficiencyCorrectionTool.h"
-
-
-
-EleChargeAlg::EleChargeAlg( const std::string& name, ISvcLocator* pSvcLocator ) :
-  AthAlgorithm( name, pSvcLocator ),
-  m_syst(),
-  m_eccTool("CP::ElectronChargeEfficiencyCorrectionTool/ElectronChargeEfficiencyCorrectionTool", this),
-  m_eleContName("Electrons")
-{
-  declareProperty("ElectronChargeEfficiencyCorrectionTool",  m_eccTool, "The private ElectronChargeEfficiencyCorrectionTool" );
-  declareProperty("ElectronContainerName",         m_eleContName, "The name of the input electron container");
-}
-
-
-EleChargeAlg::~EleChargeAlg() {}
-
-
-StatusCode EleChargeAlg::initialize() {
-
-  ATH_MSG_INFO ("Initializing " << name() << "...");
-  ATH_CHECK( m_eccTool.retrieve() );
-  m_syst = m_eccTool->affectingSystematics();
-  for( const auto& variation : m_syst ) {
-    ATH_MSG_INFO(" Affecting systematics: " << variation.name());
-  }
-  return StatusCode::SUCCESS;
-}
-
-StatusCode EleChargeAlg::finalize() {
-  ATH_MSG_INFO ("Finalizing " << name() << "...");
-  ATH_CHECK( m_eccTool.release() );
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode EleChargeAlg::execute() {
-
-  //----------------------------
-  // Event information
-  //---------------------------
-
-  const xAOD::EventInfo* eventInfo = nullptr; //NOTE: Everything that comes from the storegate direct from the input files is const!
-
-  // ask the event store to retrieve the xAOD EventInfo container
-
-  CHECK( evtStore()->retrieve( eventInfo) );
-  // if there is only one container of that type in the xAOD (as with the EventInfo container), you do not need to pass
-  // the key name, the default will be taken as the only key name in the xAOD
-
-  // check if data or MC
-  if(!eventInfo->eventType(xAOD::EventInfo::IS_SIMULATION ) ){
-    ATH_MSG_DEBUG( "DATA. Will stop processing this algorithm for the current event.");
-    return StatusCode::SUCCESS; // stop this algorithms execute() for this event, here only interested in MC
-  }
-
-
-  //---------
-  // electrons
-  //---------
-
-  const xAOD::ElectronContainer* electrons = nullptr;
-  CHECK( evtStore()->retrieve( electrons, m_eleContName.value() ) );
-
-  ATH_MSG_VERBOSE ("Executing " << name() << "... in event with: " << electrons->size() << " electrons");
-
-  // Loop over all electrons in this container
-  for ( const auto* electron : *electrons ) {
-
-    if ( electron->pt() < 25000 ) continue;
-    if ( std::abs(electron->eta()) > 2.5 ) continue;
-
-    ATH_MSG_DEBUG("-------------------------------------------------------------------" );
-    ATH_MSG_DEBUG(" ...  electron with pt = " << electron->pt() << " , eta: " << fabs(electron->eta()) );
-
-    double sf=-999;
-    //float rate=-999;
-    CP::SystematicSet syst_set;
-
-    CP::SystematicCode tmpSysResult = m_eccTool->applySystematicVariation(syst_set);
-    ATH_MSG_DEBUG("applySystematicVariation returned CP::SystematicCode = " << tmpSysResult);
-    if ( tmpSysResult != CP::SystematicCode::Ok ) {
-      ATH_MSG_ERROR("ElectronChargeEfficiencyCorrectionTool did NOT report a CP::SystematicCode::Ok when calling applySystematicVariation");
-      return StatusCode::FAILURE;
-    }
-
-    CP::CorrectionCode tmpResult = m_eccTool->getEfficiencyScaleFactor(*electron,sf);
-    ATH_MSG_DEBUG("Nominal value SF = " << sf << " and CP::CorrectionCode = " << tmpResult);
-    if ( tmpResult == CP::CorrectionCode::Error ) {
-      ATH_MSG_ERROR("ElectronChargeEfficiencyCorrectionTool reported a CP::CorrectionCode::Error");
-      return StatusCode::FAILURE;
-    }
-
-    for( const auto& variation : m_syst ) {
-      double tmpSF=0;
-      ///float tmprate=0;
-      CP::SystematicSet syst_set1;
-      syst_set1.insert( variation );
-
-      tmpSysResult = m_eccTool->applySystematicVariation(syst_set1);
-      ATH_MSG_DEBUG("applySystematicVariation (second time) returned CP::SystematicCode = " << tmpSysResult);
-      if ( tmpSysResult != CP::SystematicCode::Ok ) {
-        ATH_MSG_ERROR("ElectronChargeEfficiencyCorrectionTool did NOT report a CP::SystematicCode::Ok when calling applySystematicVariation");
-        return StatusCode::FAILURE;
-      }
-      tmpResult = m_eccTool->getEfficiencyScaleFactor(*electron, tmpSF);
-      ATH_MSG_DEBUG("getEfficiencyScaleFactor returned CP::CorrectionCode = " << tmpResult);
-      if ( tmpResult == CP::CorrectionCode::Error ) {
-        ATH_MSG_ERROR("ElectronChargeEfficiencyCorrectionTool reported a CP::CorrectionCode::Error when calling getEfficiencyScaleFactor");
-        return StatusCode::FAILURE;
-      }
-      //   //m_eccTool->getDataEfficiency(*electron, tmprate);
-      ATH_MSG_DEBUG("   Systematic "<< variation.name() << ":" << " SF-> " << tmpSF);
-      //   //ATH_MSG_DEBUG("Systematic "<< variation.name() << ":" << " data rate-> " << tmprate);
-    }
-
-
-  } // end for loop over electrons
-
-
-  return StatusCode::SUCCESS;
-
-} //-------end of execute
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/EleChargeAlg.h b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/EleChargeAlg.h
deleted file mode 100644
index adf091bf941ce47ce3bf4eefd5b3325b89ef3bdd..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/EleChargeAlg.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef ELECTRONCHARGECORRECTION_ELECHARGEALG_H
-#define ELECTRONCHARGECORRECTION_ELECHARGEALG_H 1
-
-#include "AthenaBaseComps/AthAlgorithm.h"
-#include "GaudiKernel/ToolHandle.h"
-// #include "xAODTruth/TruthParticle.h"
-
-#include "TTree.h"
-#include "TLorentzVector.h"
-
-#include <vector>
-
-// #include "MCTruthClassifier/IMCTruthClassifier.h"
-#include "PATInterfaces/SystematicSet.h"
-
-class IAsgElectronEfficiencyCorrectionTool;
-
-class EleChargeAlg: public ::AthAlgorithm {
- public:
-  EleChargeAlg( const std::string& name, ISvcLocator* pSvcLocator);
-
-  virtual ~EleChargeAlg();
-
-  virtual StatusCode  initialize();
-  virtual StatusCode  execute();
-  virtual StatusCode  finalize();
-
-
- private:
-  /// The systematics set that will contain all the systematic variations
-  CP::SystematicSet m_syst;
-
-  /// The handle to the charge-misid scale-factor tool
-  ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_eccTool;
-
-  /// The name of the input electron container
-  StringProperty m_eleContName;
-};
-
-#endif //> !ELECTRONCHARGECORRECTION_ELECHARGEALG_H
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/components/ElectronEfficiencyCorrection_entries.cxx b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/components/ElectronEfficiencyCorrection_entries.cxx
index ec72b97a27778b834f7474ad3a0fa35bff89cc51..13672c9891b52b18d10f4bd62da52fe3ff668852 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/components/ElectronEfficiencyCorrection_entries.cxx
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/components/ElectronEfficiencyCorrection_entries.cxx
@@ -1,9 +1,5 @@
 #include "ElectronEfficiencyCorrection/AsgElectronEfficiencyCorrectionTool.h"
 #include "ElectronEfficiencyCorrection/ElectronChargeEfficiencyCorrectionTool.h"
-#include "../testAthenaElectronAlg.h"
 
 DECLARE_COMPONENT( AsgElectronEfficiencyCorrectionTool )
 DECLARE_COMPONENT( CP::ElectronChargeEfficiencyCorrectionTool )
-
-DECLARE_COMPONENT( testAthenaElectronAlg )
-
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/testAthenaElectronAlg.cxx b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/testAthenaElectronAlg.cxx
deleted file mode 100644
index 2d0318c8fd86db230940dacafc8fb457af34c0df..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/testAthenaElectronAlg.cxx
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-// ElectronEfficiencyCorrection includes
-#include "testAthenaElectronAlg.h"
-
-#include "xAODEventInfo/EventInfo.h"
-#include "xAODEgamma/ElectronContainer.h"
-#include "xAODEgamma/ElectronAuxContainer.h"
-#include "xAODCore/ShallowCopy.h"
-#include "PATInterfaces/SystematicsTool.h"
-#include "EgammaAnalysisInterfaces/IAsgElectronEfficiencyCorrectionTool.h"
-
-testAthenaElectronAlg::testAthenaElectronAlg( const std::string& name, ISvcLocator* pSvcLocator ) : 
-  AthAlgorithm( name, pSvcLocator ),  
-  m_electronSF("AsgElectronEfficiencyCorrectionTool/AsgElectronEfficiencyCorrectionTool",this){
-  //declareProperty( "Property", m_nProperty ); //example property declaration
-  declareProperty( "ElectronEfficiencyCorrectionTool", m_electronSF );
-}
-//
-testAthenaElectronAlg::~testAthenaElectronAlg() {}
-
-
-StatusCode testAthenaElectronAlg::initialize() {
-  ATH_MSG_INFO ("Initializing " << name() << "...");
-  // Retrieve the tool
-  ATH_CHECK( m_electronSF.retrieve() );
-  return StatusCode::SUCCESS;
-}
-
-StatusCode testAthenaElectronAlg::finalize() {
-  ATH_MSG_INFO ("Finalizing " << name() << "...");
-  // Clean up
-  ATH_CHECK( m_electronSF.release() );
-  return StatusCode::SUCCESS;
-}
-
-StatusCode testAthenaElectronAlg::execute() {  
-  ATH_MSG_DEBUG ("Executing " << name() << "...");
-
-  //----------------------------
-  // Event information
-  //--------------------------- 
-  const xAOD::EventInfo* eventInfo = nullptr; //NOTE: Everything that comes from the storegate direct from the input files is const!
-
-  // ask the event store to retrieve the xAOD EventInfo container
-  //ATH_CHECK( evtStore()->retrieve( eventInfo, "EventInfo") );  // the second argument ("EventInfo") is the key name
-  ATH_CHECK( evtStore()->retrieve( eventInfo) );
-  // if there is only one container of that type in the xAOD (as with the EventInfo container), you do not need to pass
-  // the key name, the default will be taken as the only key name in the xAOD 
- 
-  //---------
-  // electrons
-  //---------
-  const xAOD::ElectronContainer* electrons = nullptr;
-  ATH_CHECK( evtStore()->retrieve( electrons, "Electrons") );
- 
-  // Let's create a shallow copy of the const electron container, and decorate it with the obtained SF
-  auto inContShallowCopy = xAOD::shallowCopyContainer( *electrons );
-
-  //creates a new electron container to hold the subset as well as the needed auxiliary container
-  xAOD::ElectronContainer* myelectrons = new xAOD::ElectronContainer;
-  xAOD::ElectronAuxContainer* myelectronsAux = new xAOD::ElectronAuxContainer;
-  // You need to tell the jet container in which auxiliary container it should write its member variables
-  myelectrons->setStore( myelectronsAux ); //gives it a new associated aux container
-  // Also record to storegate: you must record both the container and the auxcontainer.
-  // Note that storegate takes ownership of these objects, i.e., you must not try to delete them yourself.
-  ATH_CHECK( evtStore()->record(myelectrons,  "MyElectrons" ) );
-  ATH_CHECK( evtStore()->record(myelectronsAux, "MyElectronsAux" ) );
-
-  // Loop over all Electrons in the shallow-copy container, decorate it with SF, and store in new xAOD file, in addition print out all SF (with get* function)
-
-  CP::SystematicSet mySysSet;
-  //mySysSet.insert(CP::SystematicVariation("EL_EFF_UncorrUncertainty", 1));
-  m_electronSF->applySystematicVariation(mySysSet);
-
-  for ( xAOD::Electron* el : *(inContShallowCopy.first) ) {
-
-    if ( el->pt()<7000. ) continue;
-    ATH_MSG_DEBUG( "  electron pt = " << el->pt() <<", electron eta = " << el->eta() );
-
-    double SF; // for electron SF 
-    if( m_electronSF->getEfficiencyScaleFactor(*el,SF) != CP::CorrectionCode::Ok){
-      ATH_MSG_WARNING( "Couldn't get electron scale factor!" );
-      continue;
-    }
-
-    if ( m_electronSF->applyEfficiencyScaleFactor(*el) == CP::CorrectionCode::Error ) {
-      ATH_MSG_ERROR("ElectronEfficiencyCorrectionTool reported a CP::CorrectionCode::Error");
-      return StatusCode::FAILURE;
-    }
-
-    //m_electronSF->applyEfficiencyScaleFactor(*el);
-    ATH_MSG_DEBUG( "  electron SF, from get function = " << SF <<", electron SF from apply function " << el->auxdata< float >("SF") );
-    
-    myelectrons->push_back(el); // add it to a new electron container which will be writed to a new file
-  }// and loop on electrons
- 
-  return StatusCode::SUCCESS;
-}
-
-
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/testAthenaElectronAlg.h b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/testAthenaElectronAlg.h
deleted file mode 100644
index 85b2b800425557c19bd667f7dd7cd460ca84d00f..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/src/testAthenaElectronAlg.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef ELECTRONEFFICIENCYCORRECTION_TESTATHENAELECTRONALG_H
-#define ELECTRONEFFICIENCYCORRECTION_TESTATHENAELECTRONALG_H 
-
-#include "AthenaBaseComps/AthAlgorithm.h"
-#include "GaudiKernel/ToolHandle.h"
-
-// forward declarations
-class IAsgElectronEfficiencyCorrectionTool;
-
-class testAthenaElectronAlg: public ::AthAlgorithm { 
- public: 
-  testAthenaElectronAlg( const std::string& name, ISvcLocator* pSvcLocator );
-  virtual ~testAthenaElectronAlg(); 
-
-  virtual StatusCode  initialize();
-  virtual StatusCode  execute();
-  virtual StatusCode  finalize();
-
- private: 
- /// The tool handles our electron efficiency corrections
- ToolHandle< IAsgElectronEfficiencyCorrectionTool > m_electronSF;
-}; 
-
-#endif //> !ELECTRONEFFICIENCYCORRECTION_TESTATHENAELECTRONALG_H
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgElectronIsEMSelector.h b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgElectronIsEMSelector.h
index 97044e4e07a5d41bf62ffd55a4cdcbcebccf4055..b964df708a5ae78cd1da4f92a8776f7367d2fe18 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgElectronIsEMSelector.h
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgElectronIsEMSelector.h
@@ -39,7 +39,7 @@ class AsgElectronIsEMSelector :  public asg::AsgTool,
 {
 
   ASG_TOOL_CLASS3(AsgElectronIsEMSelector, IAsgElectronIsEMSelector,
-		  IAsgEGammaIsEMSelector, CP::ISelectionTool)
+		  IAsgEGammaIsEMSelector, IAsgSelectionTool)
 
   public:
   /** Standard constructor */
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h
index 5cedcbe49b91434d72ebbc8dead8515e2899126e..09b86500901ee33fd527edd92fead1d2ed82a602 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h
@@ -27,7 +27,7 @@ namespace Root{
 class AsgElectronLikelihoodTool : public asg::AsgTool, 
 				  virtual public IAsgElectronLikelihoodTool
 {
-  ASG_TOOL_CLASS2(AsgElectronLikelihoodTool, IAsgElectronLikelihoodTool, CP::ISelectionTool)
+  ASG_TOOL_CLASS2(AsgElectronLikelihoodTool, IAsgElectronLikelihoodTool, IAsgSelectionTool)
 
 public:
   /** Standard constructor */
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgForwardElectronIsEMSelector.h b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgForwardElectronIsEMSelector.h
index 9dcc1f33bc552b5fe919b9bc0286d7ecd29d8550..2bb1a3a9bb22b9fac53a432b9a3a4474e2f56263 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgForwardElectronIsEMSelector.h
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgForwardElectronIsEMSelector.h
@@ -42,7 +42,7 @@ class AsgForwardElectronIsEMSelector : public asg::AsgTool,
 {
 
   ASG_TOOL_CLASS3(AsgForwardElectronIsEMSelector, IAsgForwardElectronIsEMSelector,
-		  IAsgEGammaIsEMSelector, CP::ISelectionTool)
+		  IAsgEGammaIsEMSelector, IAsgSelectionTool)
 
   public:
   /** Standard constructor */
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgPhotonIsEMSelector.h b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgPhotonIsEMSelector.h
index 24d90cbdb3fb42096f66777b627a0dd7e38c12c1..e6bed435ecaf8659080ef5e03027849f423c06e0 100755
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgPhotonIsEMSelector.h
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgPhotonIsEMSelector.h
@@ -39,7 +39,7 @@ class AsgPhotonIsEMSelector : public asg::AsgTool,
 
 {
   ASG_TOOL_CLASS3(AsgPhotonIsEMSelector, IAsgPhotonIsEMSelector,
-		  IAsgEGammaIsEMSelector, CP::ISelectionTool)
+		  IAsgEGammaIsEMSelector, IAsgSelectionTool)
 
   public:
 
diff --git a/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/AsgAnalysisInterfacesDict.h b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/AsgAnalysisInterfacesDict.h
index 441fcfa14dc51604afae4c913e6b9c9cab3f33ee..21f21bd13040f03d5c1a6cfd8f138e5f93bac3f8 100644
--- a/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/AsgAnalysisInterfacesDict.h
+++ b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/AsgAnalysisInterfacesDict.h
@@ -11,7 +11,6 @@
 // Local include(s):
 #include "AsgAnalysisInterfaces/IClassificationTool.h"
 #include "AsgAnalysisInterfaces/IEfficiencyScaleFactorTool.h"
-#include "AsgAnalysisInterfaces/ISelectionTool.h"
 #include "AsgAnalysisInterfaces/IGoodRunsListSelectionTool.h"
 #include "AsgAnalysisInterfaces/IObservableTool.h"
 #include "AsgAnalysisInterfaces/IPileupReweightingTool.h"
diff --git a/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/ISelectionTool.h b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/ISelectionTool.h
deleted file mode 100644
index cff312a53a75908e8c1c457ac024278b98ddd8a4..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/ISelectionTool.h
+++ /dev/null
@@ -1,66 +0,0 @@
-///////////////////////// -*- C++ -*- /////////////////////////////
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// IAsgSelectionTool.h 
-// Header file for class IAsgSelectionTool
-// Author: Karsten Koeneke <karsten.koeneke@cern.ch>
-/////////////////////////////////////////////////////////////////// 
-#ifndef ASGANALYSISINTERFACES_IASGMTSELECTIONTOOL_H
-#define ASGANALYSISINTERFACES_IASGMTSELECTIONTOOL_H
-
-// STL includes
-
-
-// FrameWork includes
-#include <AsgTools/IAsgTool.h>
-
-namespace asg {
-  class AcceptInfo;
-  class AcceptData;
-}
-
-// Forward declaration
-namespace xAOD{
-  class IParticle;
-}
-
-namespace CP {
-
-  class ISelectionTool
-    : virtual public asg::IAsgTool
-  { 
-    /// Declare the interface ID for this pure-virtual interface class to the Athena framework
-    ASG_TOOL_INTERFACE(ISelectionTool)
-
-
-    /////////////////////////////////////////////////////////////////// 
-    // Public methods: 
-    /////////////////////////////////////////////////////////////////// 
-    public: 
-
-    /////////////////////////////////////////////////////////////////// 
-    // Const methods: 
-    ///////////////////////////////////////////////////////////////////
-
-    /** Method to get the plain AcceptInfo.
-        This is needed so that one can already get the AcceptInfo 
-        and query what cuts are defined before the first object 
-        is passed to the tool. */
-    virtual const asg::AcceptInfo& getAcceptInfo() const = 0;
-
-    /** Backward compatibility method */
-    [[deprecated("please use getAcceptInfo() instead")]]
-    inline const asg::AcceptInfo& getTAccept () const {
-      return getAcceptInfo();};
-
-    /** The main accept method: the actual cuts are applied here */
-    virtual asg::AcceptData accept( const xAOD::IParticle* /*part*/ ) const = 0;
-
-
-  }; 
-}
-
-#endif //> !PATCORE_IASGSELECTIONTOOL_H
diff --git a/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/selection.xml b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/selection.xml
index dd85df090701f832862bb1a9e20204aaedf7c564..4272830e0d79a4f1632a6675a83d74027977d1df 100644
--- a/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/selection.xml
+++ b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/selection.xml
@@ -3,7 +3,6 @@
   <namespace name="CP"/>
   <class name="CP::IClassificationTool" />
   <class name="CP::IEfficiencyScaleFactorTool" />
-  <class name="CP::ISelectionTool" />
   <class name="CP::IPileupReweightingTool" />
   <class name="IGoodRunsListSelectionTool" />
   <class name="IObservableTool" />
diff --git a/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgEGammaIsEMSelector.h b/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgEGammaIsEMSelector.h
index b1da503644a391c6a9afc798eff1a69fc8817c24..949abe831a1005e196b4bd4bb5e9bdeb911ff241 100644
--- a/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgEGammaIsEMSelector.h
+++ b/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgEGammaIsEMSelector.h
@@ -18,24 +18,24 @@
 */
 
 // Include the interfaces
-#include "AsgAnalysisInterfaces/ISelectionTool.h"
+#include "PATCore/IAsgSelectionTool.h"
 #include "xAODEgamma/EgammaFwd.h"
 #include "xAODEgamma/PhotonFwd.h"
 #include "xAODEgamma/ElectronFwd.h"
 
 class EventContext;
 
-class IAsgEGammaIsEMSelector : virtual public CP::ISelectionTool
+class IAsgEGammaIsEMSelector : virtual public IAsgSelectionTool
 {
 
   ASG_TOOL_INTERFACE(IAsgEGammaIsEMSelector)
 
 public:
 
-  /// @name IAsgEGammaIsEMSelector methods in Addition to the ISelectionTool
+  /// @name IAsgEGammaIsEMSelector methods in Addition to the IAsgSelectionTool
   /// @{
 
-  /// accept with pointer to  IParticle  so as to not hide the ISelectionTool one
+  /// accept with pointer to  IParticle  so as to not hide the IAsgSelectionTool one
   virtual asg::AcceptData accept( const xAOD::IParticle* part ) const = 0;
   virtual asg::AcceptData accept( const EventContext& ctx, const xAOD::IParticle* part ) const = 0;
 
diff --git a/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgElectronChargeIDSelectorTool.h b/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgElectronChargeIDSelectorTool.h
index d39775c815e8abea599a3a602d70581208cd6ac5..da1817cb6778ced9a14d77640d97e7496642802d 100644
--- a/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgElectronChargeIDSelectorTool.h
+++ b/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgElectronChargeIDSelectorTool.h
@@ -14,23 +14,23 @@
 */
 
 // Include the interfaces
-#include "AsgAnalysisInterfaces/ISelectionTool.h"
+#include "PATCore/IAsgSelectionTool.h"
 #include "xAODEgamma/ElectronFwd.h"
 #include "xAODEgamma/EgammaFwd.h"
 #include "GaudiKernel/EventContext.h"
 
-class IAsgElectronChargeIDSelectorTool : virtual public CP::ISelectionTool
+class IAsgElectronChargeIDSelectorTool : virtual public IAsgSelectionTool
 {
 
   ASG_TOOL_INTERFACE(IAsgElectronChargeIDSelectorTool)
 
  public:
 
-  /// @name IAsgElectronChargeIDSelectorTool  methods in Addition to the ISelectionTool ones
+  /// @name IAsgElectronChargeIDSelectorTool  methods in Addition to the IAsgSelectionTool ones
   /// Some are there to mainly support the calls done from the online/Trigger side 
   /// @{
 
-  /// accept with pointer to  IParticle  so as to not hide the ISelectionTool one
+  /// accept with pointer to  IParticle  so as to not hide the IAsgSelectionTool one
   virtual asg::AcceptData accept( const xAOD::IParticle* part ) const = 0;
   /// accept method with pointer to electron 
   virtual asg::AcceptData accept( const xAOD::Electron* part ) const = 0;
diff --git a/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgElectronLikelihoodTool.h b/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgElectronLikelihoodTool.h
index 541d726d71a16eebf78d8cca45fc95b962e0b9f8..384ae2e083187e606fe7c8654e53b229bdc34021 100644
--- a/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgElectronLikelihoodTool.h
+++ b/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgElectronLikelihoodTool.h
@@ -15,24 +15,24 @@
 */
 
 // Include the interfaces
-#include "AsgAnalysisInterfaces/ISelectionTool.h"
+#include "PATCore/IAsgSelectionTool.h"
 #include "xAODEgamma/ElectronFwd.h"
 #include "xAODEgamma/EgammaFwd.h"
 
 class EventContext;
 
-class IAsgElectronLikelihoodTool : virtual public CP::ISelectionTool
+class IAsgElectronLikelihoodTool : virtual public IAsgSelectionTool
 {
 
   ASG_TOOL_INTERFACE(IAsgElectronLikelihoodTool)
 
  public:
 
-  /// @name IAsgElectronLikelihoodTool  methods in Addition to the ISelectionTool ones
+  /// @name IAsgElectronLikelihoodTool  methods in Addition to the IAsgSelectionTool ones
   /// Some are there to mainly support the calls done from the online/Trigger side 
   /// @{
 
-  /// accept with pointer to  IParticle  so as to not hide the ISelectionTool one
+  /// accept with pointer to  IParticle  so as to not hide the IAsgSelectionTool one
   virtual asg::AcceptData accept( const xAOD::IParticle* part ) const = 0;
   virtual asg::AcceptData accept( const EventContext& ctx, const xAOD::IParticle* part ) const = 0;
   /// accept method with pointer to electron 
diff --git a/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgElectronMultiLeptonSelector.h b/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgElectronMultiLeptonSelector.h
index 2cf4643eaa5b23081aae5ed85d2d1ca7ce2fa9ae..1a0fd9ff7b594a023336e21cbec0f9fe88a83b44 100644
--- a/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgElectronMultiLeptonSelector.h
+++ b/PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces/EgammaAnalysisInterfaces/IAsgElectronMultiLeptonSelector.h
@@ -13,20 +13,20 @@
 
 */
 // Include the interfaces
-#include "AsgAnalysisInterfaces/ISelectionTool.h"
+#include "PATCore/IAsgSelectionTool.h"
 #include "xAODEgamma/ElectronFwd.h"
 
-class IAsgElectronMultiLeptonSelector : virtual public CP::ISelectionTool
+class IAsgElectronMultiLeptonSelector : virtual public IAsgSelectionTool
 {
 
   ASG_TOOL_INTERFACE(IAsgElectronMultiLeptonSelector)
 
 public:
 
-  /// @name IAsgElectronMultiLeptonSelector methods in addition to the ISelectionTool ones
+  /// @name IAsgElectronMultiLeptonSelector methods in addition to the IAsgSelectionTool ones
   ///{@
 
-  /// accept with pointer to  IParticle  so as to not hide the ISelectionTool one
+  /// accept with pointer to  IParticle  so as to not hide the IAsgSelectionTool one
   virtual asg::AcceptData accept( const xAOD::IParticle* part ) const = 0;
 
   /// accept method with pointer to electron */
diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetMonitoringAlg.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetMonitoringAlg.h
index bab697afa22e0b80a7cafcad5e8a54006cc90755..0a058ed241d4eeb1d61b18e9fec20decace28194 100644
--- a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetMonitoringAlg.h
+++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetMonitoringAlg.h
@@ -39,6 +39,7 @@ private:
   ToolHandleArray<IJetHistoFiller> m_jetFillerTools;
 
   bool m_failureOnMissingContainer;
-  
+  bool m_onlyPassingJets;
+
 };
 #endif
diff --git a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py
index 3fcd54da34b19dd3936dac6dad4488b1e4b8eb36..df7a618cb4f3fd57c57342cf309a139359aa2cbb 100644
--- a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py
+++ b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py
@@ -515,6 +515,7 @@ class JetMonAlgSpec(ConfigDict):
         args.setdefault('topLevelDir', 'Jets/')
         args.setdefault('bottomLevelDir', '')
         args.setdefault('failureOnMissingContainer', True)
+        args.setdefault('onlyPassingJets', True)
         ConfigDict.__init__(self, defaultPath=defaultPath, TriggerChain=TriggerChain, **args)
         tmpL = self.FillerTools
         self.FillerTools = []
@@ -530,6 +531,7 @@ class JetMonAlgSpec(ConfigDict):
         alg.TriggerChain = self.TriggerChain
         alg.JetContainerName = self.JetContainerName
         alg.FailureOnMissingContainer = self.failureOnMissingContainer
+        alg.OnlyPassingJets = self.onlyPassingJets
         
         path = self.defaultPath
         tools = []
diff --git a/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py b/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py
index 9f9702635b916a266b8c9f1e394de13848b8b19f..59b2cbcafb19d740cd36c83df8ab5de89697a6cb 100644
--- a/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py
+++ b/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py
@@ -32,7 +32,15 @@ knownEventVar = dict(
     njetsPt50 = ToolSpec('NumJetVarTool', 'njetsPt50', PtCut=50.),
     njetsEt20 = ToolSpec('NumJetVarTool', 'njetsEt20', EtCut=20.),
     njetsEt50 = ToolSpec('NumJetVarTool', 'njetsEt50', EtCut=50.),
-    njetsEt40Eta1_2 = ToolSpec('NumJetVarTool', 'njetsEt40Eta1_2', EtCut=50., EtaMin=1., EtaMax=2.),
+    njetsEt20Eta0_32 = ToolSpec('NumJetVarTool', 'njetsEt20Eta0_32', EtCut=20., EtaMin=0., EtaMax=3.2),
+    njetsEt50Eta0_32 = ToolSpec('NumJetVarTool', 'njetsEt50Eta0_32', EtCut=50., EtaMin=0., EtaMax=3.2),
+    njetsEt70Eta0_24 = ToolSpec('NumJetVarTool', 'njetsEt70Eta0_24', EtCut=70., EtaMin=0., EtaMax=2.4),
+    njetsEt60Eta0_32 = ToolSpec('NumJetVarTool', 'njetsEt60Eta0_32', EtCut=60., EtaMin=0., EtaMax=3.2),
+    njetsEt100Eta0_32 = ToolSpec('NumJetVarTool', 'njetsEt100Eta0_32', EtCut=100., EtaMin=0., EtaMax=3.2),
+    njetsEt260Eta32_49 = ToolSpec('NumJetVarTool', 'njetsEt260Eta32_49', EtCut=260., EtaMin=3.2, EtaMax=4.9),
+    njetsEt200Eta0_32 = ToolSpec('NumJetVarTool', 'njetsEt200Eta0_32', EtCut=200., EtaMin=0., EtaMax=3.2),
+    njetsEt330Eta0_32 = ToolSpec('NumJetVarTool', 'njetsEt330Eta0_32', EtCut=330., EtaMin=0., EtaMax=3.2),
+
 )
 
 # ***************************************
@@ -50,9 +58,9 @@ _knownHistos = [
     HistoSpec( 'eta',  (50,-5,5) , title='#eta;#eta;Entries'),
     HistoSpec( 'phi',  (50,-3.3,3.3) , title='#phi;#phi;Entries'),
     # Same but we indicate that the variable is to be plotted in GeV by appending ':GeV'
-    HistoSpec( 'pt:GeV',  (100,0,200) , title='p_{T};p_{T} [GeV];'),    
+    HistoSpec( 'pt:GeV',  (100,0,750) , title='p_{T};p_{T} [GeV];'),    
     HistoSpec( 'm:GeV',  (100,0,300) , title='mass;mass [GeV];'),
-    HistoSpec( 'e:GeV',  (100,0,500) , title='E;E [GeV];'),    
+    HistoSpec( 'e:GeV',  (100,0,750) , title='E;E [GeV];'),    
     HistoSpec( 'et:GeV', (100,0,750), title='E_{T};E_{T} [GeV],'),
 
     # We want an other pT histo, with different bins.
@@ -61,22 +69,22 @@ _knownHistos = [
 
     #EventHistoSpec( 'njets', (30,0,30), title='Jet Multiplicity;Njets;Entries' ),
     # When the jet variable is not a simple float, use the xvar argument to refer to a detailed variable spec in 'knownVar'
-    HistoSpec( 'JVF',  (100,0,1.2) , title='Jet Vtx Frac;JVF;', xvar='JVF'),    
+    HistoSpec( 'JVF',  (100,0,1.2) , title='Jet Vtx Frac;JVF;Entries', xvar='JVF'),    
     # if the var name contains '[N]' the system will assume the variable is a vector<float> and setup tools accordingly (so we don't need to specify 'xvar')
-    HistoSpec( 'JVF[0]',  (100,0,1.2) , title='JVF for vtx 0;JVF[0];', ), 
-    HistoSpec( 'JVF[1]',  (100,0,1.2) , title='JVF for vtx 1;JVF[1];', ),
+    HistoSpec( 'JVF[0]',  (100,0,1.2) , title='JVF for vtx 0;JVF[0];Entries', ), 
+    HistoSpec( 'JVF[1]',  (100,0,1.2) , title='JVF for vtx 1;JVF[1];Entries', ),
 
 
     # full list
     HistoSpec('ptN', (250, 0.0, 5000.0), title='Jet Pt;Pt [GeV];', xvar='pt:GeV'),
 
-    HistoSpec('EMFrac', (50, -0.1, 1.4), title='EM Fraction;EM fraction;', ),
-    HistoSpec('LArQuality', (50, -0.4, 1.2), title='LAr quality;Energy;', ),
-    HistoSpec('HECQuality', (50, -0.1, 1.4), title='HEC Quality;HEC Quality;', ),
-    HistoSpec('HECFrac', (50, -0.1, 1.4), title='HEC Fraction;HEC fraction;', ),
-    HistoSpec('AverageLArQF', (100, 0, 65535), title='Average LAr QF;AverageLArQF;', ),
-    HistoSpec('FracSamplingMaxIndex', (24, 0, 24), title='FracSamplingMaxIndex; FracSamplingMaxIndex;', xvar=VarSpec('FracSamplingMaxIndex','int')),
-    HistoSpec('FracSamplingMax', (50, -0.1, 1.2), title='FracSamplingMax; FracSamplingMax;', ),
+    HistoSpec('EMFrac', (50, -0.1, 1.4), title='EM Fraction;EM Fraction;Entries', ),
+    HistoSpec('LArQuality', (50, -0.4, 1.2), title='LAr quality;Energy;Entries', ),
+    HistoSpec('HECQuality', (50, -0.1, 1.4), title='HEC Quality;HEC Quality;Entries', ),
+    HistoSpec('HECFrac', (50, -0.1, 1.4), title='HEC Fraction;HEC Fraction;Entries', ),
+    HistoSpec('AverageLArQF', (100, 0, 65535), title='Average LAr QF;AverageLArQF;Entries', ),
+    HistoSpec('FracSamplingMaxIndex', (24, 0, 24), title='FracSamplingMaxIndex; FracSamplingMaxIndex;Entries', xvar=VarSpec('FracSamplingMaxIndex','int')),
+    HistoSpec('FracSamplingMax', (50, -0.1, 1.2), title='FracSamplingMax; FracSamplingMax;Entries', ),
     HistoSpec('Timing', (40, -20, 20), title='Jet Time info;Time;', ),
 
     
@@ -85,9 +93,9 @@ _knownHistos = [
     HistoSpec('OotFracClusters5', (50, -0.1, 1.2), title='OotFracClusters5; OotFracClusters5;', ),
     HistoSpec('OotFracClusters10', (50, -0.1, 1.2), title='OotFracClusters10; OotFracClusters10;', ),
     
-    HistoSpec('Jvt', (70, -0.2, 1.2), title='Jet JVT;JVT;',  ),
-    HistoSpec('JVFCorr', (120, -1.2, 1.2), title='Jet JVT; JVFCorr;', ),
-    HistoSpec('JvtRpt', (75, 0, 1.5), title='Jet JVT Rpt; JVTRpt;', ),
+    HistoSpec('Jvt', (70, -0.2, 1.2), title='Jet JVT;JVT;Entries',  ),
+    HistoSpec('JVFCorr', (120, -1.2, 1.2), title='Jet JVT; JVFCorr;Entries', ),
+    HistoSpec('JvtRpt', (75, 0, 1.5), title='Jet JVT Rpt; JVTRpt;Entries', ),
     HistoSpec('EM3Frac', (50,-0.1,1.0), title="EM3 fraction;EM3 fraction;Entries"),
     HistoSpec('Tile0Frac', (50,-0.1,1.0), title="Tile0 fraction;Tile0 fraction;Entries"),
 
@@ -178,8 +186,9 @@ _knownHistos = [
 
     HistoSpec('Charge', (100, -2, 2), title='Charge;Charge;', ),
 
-    HistoSpec('ActiveArea', (80, 0, 0.8), title='Active Area;Area;', ),
-    HistoSpec('ActiveArea15', (80, 0, 1.5), title='Active Area;Area;', xvar='ActiveArea'),
+    HistoSpec('DetectorEta', (100,-5,5), title="DetectorEta;Detector #eta;Entries" ), 
+    HistoSpec('ActiveArea', (80,0,0.8), title="ActiveArea;Active Area;Entries" ), 
+    HistoSpec('ActiveArea15', (80, 0, 1.5), title='Active Area;Active Area;Entries', xvar='ActiveArea'),
 
     HistoSpec('PullPhi', (100, -6.3, 6.3), title='PullPhi;PullPhi;', ),
     HistoSpec('PullMag', (100, 0, 100), title='PullMag;PullMag;', ),
@@ -300,3 +309,4 @@ for h in _knownHistos:
 knownSelector = dict(
     LooseBad = ToolSpec('JetCleaningTool' ,  "LooseBadJets" , CutLevel = "LooseBad")
 )
+
diff --git a/Reconstruction/Jet/JetMonitoring/src/JetMonitoringAlg.cxx b/Reconstruction/Jet/JetMonitoring/src/JetMonitoringAlg.cxx
index f46b43c076999e88359f9169397b6c463aaf8c5e..7d4f2ef4ab7b28251dee4f1be06fdbb879787cd3 100644
--- a/Reconstruction/Jet/JetMonitoring/src/JetMonitoringAlg.cxx
+++ b/Reconstruction/Jet/JetMonitoring/src/JetMonitoringAlg.cxx
@@ -6,15 +6,14 @@
 
 #include "xAODJet/Jet.h"
 
-
 JetMonitoringAlg::JetMonitoringAlg( const std::string& name, ISvcLocator* pSvcLocator )
 :AthMonitorAlgorithm(name,pSvcLocator)
-,m_jetContainerKey("AntiKt4LCTopoJets"), m_jetFillerTools(this), m_failureOnMissingContainer(true)
+,m_jetContainerKey("AntiKt4LCTopoJets"), m_jetFillerTools(this), m_failureOnMissingContainer(true), m_onlyPassingJets(true)
 {
-
     declareProperty("JetContainerName",m_jetContainerKey);
     declareProperty("FillerTools", m_jetFillerTools);
     declareProperty("FailureOnMissingContainer", m_failureOnMissingContainer);
+    declareProperty("OnlyPassingJets", m_onlyPassingJets);
 }
 
 
@@ -28,7 +27,7 @@ StatusCode JetMonitoringAlg::initialize() {
   ATH_CHECK( m_jetFillerTools.retrieve() );
 
   // print out what we have 
-  ATH_MSG_INFO( " Scheduled Histo fillers/selectors : ");
+  ATH_MSG_INFO( "Scheduled Histo fillers/selectors : ");
   for(const auto& t: m_jetFillerTools){
     ATH_MSG_INFO( "--> "<< t->name() );
   }
@@ -40,6 +39,33 @@ StatusCode JetMonitoringAlg::initialize() {
 
 StatusCode JetMonitoringAlg::fillHistograms( const EventContext& ctx ) const {
 
+  if (m_triggerChainString != "" && m_onlyPassingJets) {
+    ATH_MSG_DEBUG("JetMonitoringAlg::fillHistograms(const EventContext&) -> enter triggerChainString = "<<m_triggerChainString);
+    std::list<const xAOD::Jet*> tmpList;
+    const std::vector< TrigCompositeUtils::LinkInfo<xAOD::JetContainer> > fc = getTrigDecisionTool()->features<xAOD::JetContainer>( m_triggerChainString );
+    for(const auto& jetLinkInfo : fc) {
+      if (!jetLinkInfo.isValid()) {
+        ATH_MSG_ERROR("Invalid ElementLink to online jet");
+        continue;
+      }
+      ElementLink<xAOD::JetContainer> j = jetLinkInfo.link;
+      const xAOD::Jet *trigjet = dynamic_cast<const xAOD::Jet*>(*j);
+      tmpList.push_back( trigjet );
+    }
+    auto sort = [this] (const xAOD::Jet * j1, const xAOD::Jet * j2) {return j1->p4().Et() > j2->p4().Et(); } ;
+    tmpList.sort( sort );
+    ConstDataVector< xAOD::JetContainer > tmpCont(SG::VIEW_ELEMENTS);
+    for(const xAOD::Jet* jet : tmpList ) tmpCont.push_back(jet);
+    const xAOD::JetContainer * trigJetsCont = tmpCont.asDataVector();
+    if (trigJetsCont->empty()) {
+      ATH_MSG_WARNING("Empty trigger jet container for chain "<<m_triggerChainString);
+      return StatusCode::SUCCESS;
+    }
+    for(const auto& t: m_jetFillerTools){
+      ATH_MSG_DEBUG( " now run "<< t->name() );
+      ATH_CHECK( t->processJetContainer(*this, *trigJetsCont, ctx) );
+    }
+  } else {
   // retrieve the jet container
   SG::ReadHandle<xAOD::JetContainer> jets(m_jetContainerKey, ctx);    
   if (! jets.isValid() ) {
@@ -51,13 +77,13 @@ StatusCode JetMonitoringAlg::fillHistograms( const EventContext& ctx ) const {
       return StatusCode::SUCCESS;
     }
   }
-
+ 
   // call each histograming tool on the container
   for(const auto& t: m_jetFillerTools){
     ATH_MSG_DEBUG( " now run "<< t->name() );
     ATH_CHECK( t->processJetContainer(*this, *jets, ctx) );
   }
-  
+ }
   return StatusCode::SUCCESS;
 }
 
diff --git a/Reconstruction/Jet/JetMonitoring/src/NumJetVarTool.cxx b/Reconstruction/Jet/JetMonitoring/src/NumJetVarTool.cxx
index 86d189d2c3bb79fa3e24e4a8f052cf5c72766e2e..a586839c7aaa8501bf0d9b5ba34fc99faae0f450 100644
--- a/Reconstruction/Jet/JetMonitoring/src/NumJetVarTool.cxx
+++ b/Reconstruction/Jet/JetMonitoring/src/NumJetVarTool.cxx
@@ -30,7 +30,7 @@ float NumJetVarTool::value(const xAOD::EventInfo & /*eventinfo not used in this
       ATH_MSG_ERROR("Input JetContainer could not be found or is empty");
       return 0.;
     } else {
-      ATH_MSG_WARNING("Input JetContainer could not be found or is empty");
+      ATH_MSG_DEBUG("Input JetContainer could not be found or is empty");
       return 0.;
     }
   }
diff --git a/Reconstruction/Jet/JetRecTools/JetRecTools/ConstituentSubtractorTool.h b/Reconstruction/Jet/JetRecTools/JetRecTools/ConstituentSubtractorTool.h
index de414b56a7035448347ab2ed827383d489e1e6a7..84ffc633a302af572d215886e819fcb7ea1cc193 100644
--- a/Reconstruction/Jet/JetRecTools/JetRecTools/ConstituentSubtractorTool.h
+++ b/Reconstruction/Jet/JetRecTools/JetRecTools/ConstituentSubtractorTool.h
@@ -35,6 +35,7 @@ private:
 
   float m_maxDeltaR;
   float m_alpha;
+  float m_ghostArea;
   float m_maxEta;
   bool m_ignoreChargedPFOs;
 
diff --git a/Reconstruction/Jet/JetRecTools/Root/ConstituentSubtractorTool.cxx b/Reconstruction/Jet/JetRecTools/Root/ConstituentSubtractorTool.cxx
index 857d9f1f908e3b338bd31f1e822f8f8e9c8db977..63f69e7f8abb82d3ab58055f37caff8de2c69f53 100644
--- a/Reconstruction/Jet/JetRecTools/Root/ConstituentSubtractorTool.cxx
+++ b/Reconstruction/Jet/JetRecTools/Root/ConstituentSubtractorTool.cxx
@@ -20,6 +20,7 @@ ConstituentSubtractorTool::ConstituentSubtractorTool(const std::string & name):
 
   declareProperty("MaxDeltaR", m_maxDeltaR=0.25);
   declareProperty("Alpha", m_alpha=0.);
+  declareProperty("GhostArea", m_ghostArea=0.01);
   declareProperty("MaxEta", m_maxEta=2.5);
 
   // Option to disregard cPFOs in the weight calculation
@@ -51,7 +52,7 @@ StatusCode ConstituentSubtractorTool::process_impl(xAOD::IParticleContainer* con
   contrib::ConstituentSubtractor subtractor;
   subtractor.set_max_standardDeltaR(m_maxDeltaR); // free parameter for the maximal allowed distance sqrt((y_i-y_k)^2+(phi_i-phi_k)^2) between particle i and ghost k
   subtractor.set_alpha(m_alpha);  // free parameter for the distance measure (the exponent of particle pt). The larger the parameter alpha, the more are favoured the lower pt particles in the subtraction process
-  subtractor.set_ghost_area(0.01); // free parameter for the density of ghosts. The smaller, the better - but also the computation is slower.
+  subtractor.set_ghost_area(m_ghostArea); // free parameter for the density of ghosts. The smaller, the better - but also the computation is slower.
 
   // prepare PseudoJet input from
   std::vector<PseudoJet>  full_event; full_event.reserve( cont->size() );
diff --git a/Reconstruction/RecExample/RecExCommon/share/CombinedRec_config.py b/Reconstruction/RecExample/RecExCommon/share/CombinedRec_config.py
index 3ea4098ff55bbe40081831542ca51a1e2bbff3b0..b788aea37e9dd2965714154125f6907b7d68c925 100755
--- a/Reconstruction/RecExample/RecExCommon/share/CombinedRec_config.py
+++ b/Reconstruction/RecExample/RecExCommon/share/CombinedRec_config.py
@@ -29,7 +29,7 @@ pdr.flag_domain('CaloExtensionBuilder')
 if (rec.doESD()) and (recAlgs.doEFlow() or rec.doTau() or rec.doEgamma()) : #   or rec.readESD()
     try:        
         from TrackToCalo.CaloExtensionBuilderAlgConfig import CaloExtensionBuilder
-        CaloExtensionBuilder("NoCut", 500.) #Arguments are cutLevel and minPt for track selection
+        CaloExtensionBuilder() 
     except Exception:
         treatException("Cannot include CaloExtensionBuilder !")
 
diff --git a/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_egamma_fromESD.py b/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_egamma_fromESD.py
index 9562a1025f4429a1a7dae04a21b436f9e8f94491..544e960c4fbb18e3914682b675c7dea5a4360298 100644
--- a/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_egamma_fromESD.py
+++ b/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_egamma_fromESD.py
@@ -159,7 +159,7 @@ except Exception:
 include( "McParticleAlgs/TruthParticleBuilder_jobOptions.py" )
 
 from TrackToCalo.CaloExtensionBuilderAlgConfig import CaloExtensionBuilder
-CaloExtensionBuilder("NoCut", 500.) 
+CaloExtensionBuilder() 
 
 from egammaRec.egammaRecFlags import jobproperties
 
diff --git a/Reconstruction/RecoTools/TrackToCalo/python/CaloExtensionBuilderAlgCfg.py b/Reconstruction/RecoTools/TrackToCalo/python/CaloExtensionBuilderAlgCfg.py
index 3d02a50f0cd71ef4bfffbb3fe48e80ef2a939110..576e4c5c6ac1379d5db391ca627f8b30c621f0f3 100644
--- a/Reconstruction/RecoTools/TrackToCalo/python/CaloExtensionBuilderAlgCfg.py
+++ b/Reconstruction/RecoTools/TrackToCalo/python/CaloExtensionBuilderAlgCfg.py
@@ -1,7 +1,7 @@
 # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 from AthenaConfiguration.ComponentFactory import CompFactory
 
-def getCaloExtenstionBuilderAlgorithm(inputFlags, cutLevel = "TightPrimary", minPT = 100.0):
+def getCaloExtenstionBuilderAlgorithm(inputFlags):
     from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg    
     Trk__ParticleCaloExtensionTool = CompFactory.Trk.ParticleCaloExtensionTool
     extrapPFlowCfg = AtlasExtrapolatorCfg(inputFlags)
@@ -9,9 +9,5 @@ def getCaloExtenstionBuilderAlgorithm(inputFlags, cutLevel = "TightPrimary", min
         
     CaloExtensionBuilderAlg = CompFactory.Trk.CaloExtensionBuilderAlg 
     CaloExtensionBuilderAlg = CaloExtensionBuilderAlg(LastCaloExtentionTool = pcExtensionTool)
-
-    InDet__InDetTrackSelectionTool = CompFactory.InDet.InDetTrackSelectionTool    
-    TrackSelectionToolHC = InDet__InDetTrackSelectionTool(name = "CaloExtensionBuilderTrackSelectionTool",minPt = minPT, CutLevel = cutLevel, minNSiHits = 7) # SiHits = PixelHits + SCTHits + PixelDeadSensors + SCTDeadSensors    
-    CaloExtensionBuilderAlg.TrkSelection = TrackSelectionToolHC
      
     return CaloExtensionBuilderAlg
diff --git a/Reconstruction/RecoTools/TrackToCalo/python/CaloExtensionBuilderAlgConfig.py b/Reconstruction/RecoTools/TrackToCalo/python/CaloExtensionBuilderAlgConfig.py
index 1f7f5c57901e2df8d037b93d45b3b40400c70aca..4dfed02938ff9425924d518e0edcc2ed45afb25f 100644
--- a/Reconstruction/RecoTools/TrackToCalo/python/CaloExtensionBuilderAlgConfig.py
+++ b/Reconstruction/RecoTools/TrackToCalo/python/CaloExtensionBuilderAlgConfig.py
@@ -1,13 +1,11 @@
 ## CaloExtensionBuilderAlg Stuff
-# Defined as function such that the user can change the cut level and minPt
 
-
-def CaloExtensionBuilder( cutLevel = "TightPrimary", minPT = 100.0 ):
+def CaloExtensionBuilder():
     try: 
         from TrkExTools.AtlasExtrapolator import AtlasExtrapolator
         from TrackToCalo.TrackToCaloConf import Trk__ParticleCaloExtensionTool
     except:
-        mlog.error("could not import TrackToCaloConf.Trk__ParticleCaloExtensionTool")
+        mlog.error("could not import" "TrackToCaloConf.Trk__ParticleCaloExtensionTool")
         mlog.error("could not import TrkExTools.AtlasExtrapolator")
         mlog.error (traceback.format_exc())
     try:
@@ -15,12 +13,6 @@ def CaloExtensionBuilder( cutLevel = "TightPrimary", minPT = 100.0 ):
     except:
         mlog.error("could not import TrackToCaloConf.Trk__CaloExtensionBuilderAlg")
         mlog.error (traceback.format_exc())
-    try:
-        from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
-        from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool
-    except:
-        mlog.error("could not import InDetTrackSelectionTool.InDet__InDetTrackSelectionTool")
-        mlog.error (traceback.format_exc())
     try:
         from AthenaCommon.AppMgr import ToolSvc
     except:
@@ -43,15 +35,6 @@ def CaloExtensionBuilder( cutLevel = "TightPrimary", minPT = 100.0 ):
     CaloExtensionBuilderTool = CaloExtensionBuilderAlg(LastCaloExtentionTool = pcExtensionTool)
 
     from AthenaCommon.BeamFlags import jobproperties
-
-    TrackSelectionToolHC = InDet__InDetTrackSelectionTool(name            = "CaloExtensionBuilderTrackSelectionTool",
-                                                           minPt           = minPT,
-                                                           CutLevel        = cutLevel,
-                                                           minNSiHits      = 7) # PixelHits + SCTHits + PixelDeadSensors + SCTDeadSensors
-    
-        
-    CaloExtensionBuilderTool.TrkSelection         = TrackSelectionToolHC    
-
     ToolSvc += CaloExtensionBuilderTool.LastCaloExtentionTool
 
     topSequence += CaloExtensionBuilderTool
diff --git a/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.cxx b/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.cxx
index d38034896abbe0b8eef716bf7ddf1316fd6e46c2..b55feae8f45802212559504a24d78bad5e82f300 100644
--- a/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.cxx
+++ b/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.cxx
@@ -6,7 +6,8 @@
 NAME:     CaloExtensionBuilderAlg
 PACKAGE:  offline/Reconstruction/RecoTools/TrackToCalo/CaloExtensionBuilderAlg
 
-Based on: offline/Reconstruction/egamma/egammaTrackTools/EMGSFCaloExtensionBuilder
+Based on:
+offline/Reconstruction/egamma/egammaTrackTools/EMGSFCaloExtensionBuilder
 
 AUTHORS:  Anastopoulos/Capriles
 PURPOSE:  Performs Calo Extension for all selected tracks
@@ -34,45 +35,58 @@ PURPOSE:  Performs Calo Extension for all selected tracks
 StatusCode
 Trk::CaloExtensionBuilderAlg::initialize()
 {
-
-  ATH_CHECK(m_TrkSelection.retrieve());
   ATH_CHECK(m_particleCaloExtensionTool.retrieve());
-
   ATH_CHECK(m_ParticleCacheKey.initialize());
   ATH_CHECK(m_TrkPartContainerKey.initialize());
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode
-Trk::CaloExtensionBuilderAlg::CaloExtensionBuilderAlg::finalize()
-{
   return StatusCode::SUCCESS;
 }
 
 StatusCode
-Trk::CaloExtensionBuilderAlg::execute_r(const EventContext& ctx) const
+Trk::CaloExtensionBuilderAlg::execute(const EventContext& ctx) const
 {
 
-  SG::ReadHandle<xAOD::TrackParticleContainer> tracks(m_TrkPartContainerKey, ctx);
+  SG::ReadHandle<xAOD::TrackParticleContainer> tracks(m_TrkPartContainerKey,
+                                                      ctx);
   if (!tracks.isValid()) {
-    ATH_MSG_FATAL("Failed to retrieve TrackParticle container: " << m_TrkPartContainerKey.key());
+    ATH_MSG_FATAL("Failed to retrieve TrackParticle container: "
+                  << m_TrkPartContainerKey.key());
     return StatusCode::FAILURE;
   }
 
   // creating and saving the calo extension collection
-  SG::WriteHandle<CaloExtensionCollection> lastCache(m_ParticleCacheKey,ctx);
+  SG::WriteHandle<CaloExtensionCollection> lastCache(m_ParticleCacheKey, ctx);
   ATH_CHECK(lastCache.record(std::make_unique<CaloExtensionCollection>()));
 
   const xAOD::TrackParticleContainer* ptrTracks = tracks.cptr();
   CaloExtensionCollection* ptrPart = lastCache.ptr();
   std::vector<bool> mask(ptrTracks->size(), false);
   for (auto track : *tracks) {
-    if (static_cast<bool>(m_TrkSelection->accept(*track, nullptr)))
-      mask[track->index()] = true;
+    if (track->pt() < 500) {
+      continue;
+    }
+    uint8_t dummy(0);
+    uint8_t nSiHits(0);
+    if (track->summaryValue(dummy, xAOD::numberOfPixelHits)) {
+      nSiHits += dummy;
+    }
+    if (track->summaryValue(dummy, xAOD::numberOfPixelDeadSensors)) {
+      nSiHits += dummy;
+    }
+    if (track->summaryValue(dummy, xAOD::numberOfSCTHits)) {
+      nSiHits += dummy;
+    }
+    if (track->summaryValue(dummy, xAOD::numberOfSCTDeadSensors)) {
+      nSiHits += dummy;
+    }
+    // Cut out TRT alone, but do it for all else
+    if (nSiHits < 4) {
+      continue;
+    }
+    mask[track->index()] = true;
   }
 
-  ATH_CHECK(m_particleCaloExtensionTool->caloExtensionCollection(ctx, *ptrTracks, mask, *ptrPart));
+  ATH_CHECK(m_particleCaloExtensionTool->caloExtensionCollection(
+    ctx, *ptrTracks, mask, *ptrPart));
 
   return StatusCode::SUCCESS;
 }
diff --git a/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.h b/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.h
index 3c79ad3fbc282ba51502a3956ef4739b073a0330..12288abb11632123ab3656733075b358709319ed 100644
--- a/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.h
+++ b/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.h
@@ -11,20 +11,14 @@
   Track Particles
   */
 
-#include "AthenaBaseComps/AthAlgorithm.h"
+#include "AthenaBaseComps/AthReentrantAlgorithm.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "StoreGate/ReadHandleKey.h"
 #include "StoreGate/WriteHandleKey.h"
 
 #include "RecoToolInterfaces/IParticleCaloExtensionTool.h"
 #include "TrkCaloExtension/CaloExtensionCollection.h"
-
-#include "ITrackToVertex/ITrackToVertex.h"
-#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h"
-#include "TrkToolInterfaces/ITrackSelectorTool.h"
-
 #include "xAODTracking/TrackParticleContainer.h"
-#include "xAODTracking/VertexContainer.h"
 
 #include "InDetReadoutGeometry/SiDetectorElementCollection.h"
 #include "TRT_ReadoutGeometry/TRT_DetElementContainer.h"
@@ -57,20 +51,12 @@ to be done: `uniqueExtension = theTrackExtrapolatorTool->caloExtension(*track);`
 theTrackExtrapolatorTool->caloExtension(*track).get();` as it has unpredictable
 behavior.
 */
-class CaloExtensionBuilderAlg : public AthAlgorithm
+class CaloExtensionBuilderAlg : public AthReentrantAlgorithm
 {
 public:
-  using AthAlgorithm::AthAlgorithm;
-
+  using AthReentrantAlgorithm::AthReentrantAlgorithm;
   virtual StatusCode initialize() override final;
-  virtual StatusCode finalize() override final;
-  virtual StatusCode execute() override final
-  {
-    return execute_r(Algorithm::getContext());
-  }
-  // This will become the normal execute when
-  // inheriting from AthReentrantAlgorithm
-  StatusCode execute_r(const EventContext& ctx) const;
+  virtual StatusCode execute(const EventContext& ctx) const override final;
 
 private:
   /** @brief the Calo Extension tool*/
@@ -80,15 +66,6 @@ private:
     "Trk::CaloExtensionBuilderTool"
   };
 
-  /// Manages the track selection. It should be able to handle both pflow and
-  /// tau selections
-  ToolHandle<InDet::IInDetTrackSelectionTool> m_TrkSelection{
-    this,
-    "TrkSelection",
-    "TrkSelectionCaloExtensionBuilder",
-    "Tool that handles the track selection"
-  };
-
   /// output particle calo extension collection
   SG::WriteHandleKey<CaloExtensionCollection> m_ParticleCacheKey{
     this,
diff --git a/Reconstruction/eflowRec/eflowRec/PFEGamFlowElementAssoc.h b/Reconstruction/eflowRec/eflowRec/PFEGamFlowElementAssoc.h
new file mode 100644
index 0000000000000000000000000000000000000000..6c95a5121f2c0361962e2629dcd104612186bbbf
--- /dev/null
+++ b/Reconstruction/eflowRec/eflowRec/PFEGamFlowElementAssoc.h
@@ -0,0 +1,80 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+/*
+ * PFEGamFlowElementAssoc.h
+ * Header file for class PFEGamFlowElementAssoc
+ *                                                                                                                                                                                     
+ *  Created on: 13.03.19                                                                                                                                                            
+ *      Author: J. C. MacDonald & Upgraded by M.T. Anthony                                                                                                                                                      
+ */
+
+#ifndef PFEGAMFLOWELEMENTASSOC_H
+#define PFEGAMFLOWELEMENTASSOC_H
+
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "AthenaBaseComps/AthReentrantAlgorithm.h"
+#include "GaudiKernel/ToolHandle.h"
+#include "StoreGate/DataHandle.h"
+
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODEgamma/PhotonContainer.h"
+
+#include "StoreGate/WriteDecorHandle.h"
+#include "xAODPFlow/FlowElementContainer.h"
+/**                                                                                                                                                                                     
+This is the algorithm, which inherits from AthReentrantAlgorithm, that adds element links between particle flow objects (Flow Elements) and Egamma objects. The algorithm associates charged (c) Flow Elements to all electron and converted photon tracks, and neutral (n) Flow Elements to all electron and photon clusters. 
+
+This is done by adding decorations to the "Electron" and "Photon" container, for charged Charged Flow Elements and Neutral Flow Elements separately, in the form of vectors of element links to the associated Flow Elements. 
+The algorithm also adds decorations to the "JetETMissNeutralFlowElements" and 
+"JetETMissChargedParticleFlowElements" containers, in the form of vectors of element links to the associated electrons and photons.
+
+**/
+class PFEGamFlowElementAssoc : public AthReentrantAlgorithm {
+
+public:
+  using AthReentrantAlgorithm::AthReentrantAlgorithm;
+
+  PFEGamFlowElementAssoc(const std::string& name, ISvcLocator* pSvcLocator);
+  
+  virtual ~PFEGamFlowElementAssoc();
+
+  virtual StatusCode initialize();
+  virtual StatusCode execute(const EventContext & ctx) const;
+  virtual StatusCode finalize();
+  
+private:
+  //instantiate ReadHandle for the Photon/Electron
+  SG::ReadHandleKey<xAOD::ElectronContainer>m_electronReadHandleKey{this,"ElectronContainer","Electrons","ReadHandleKey for ElectronContainer"};
+
+  SG::ReadHandleKey<xAOD::PhotonContainer>m_photonReadHandleKey{this,"PhotonContainer","Photons","ReadHandleKey for PhotonContainer"};
+
+  //Readhandles for FlowElements.
+  SG::ReadHandleKey<xAOD::FlowElementContainer> m_neutralFEReadHandleKey{this,"JetEtMissNeutralFlowElementContainer","JetETMissNeutralFlowElements","ReadHandleKey for neutral FlowElements"};
+  
+  SG::ReadHandleKey<xAOD::FlowElementContainer> m_chargedFEReadHandleKey{this,"JetEtMissChargedFlowElementContainer","JetETMissChargedFlowElements","ReadHandleKey for charged FlowElements"};
+
+
+  /** The write key for adding Neutral Flow Element element link decorations to electrons */ 
+  SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_electronNeutralFEWriteDecorKey;
+  /** The write key for adding Charged Flow Element element link decorations to electrons */
+  SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_electronChargedFEWriteDecorKey;
+  /** The write key for adding electron element link decorations to Neutral Flow Elements */
+  SG::WriteDecorHandleKey<xAOD::FlowElementContainer> m_neutralFEElectronWriteDecorKey;
+  /** The write key for adding electron element link decorations to Charged Flow Elements */
+  SG::WriteDecorHandleKey<xAOD::FlowElementContainer> m_chargedFEElectronWriteDecorKey;
+
+  /** The write key for adding Neutral Flow Element element link decorations to photons */
+  SG::WriteDecorHandleKey<xAOD::PhotonContainer> m_photonNeutralFEWriteDecorKey;
+  /** The write key for adding Charged Flow Element element link decorations to photons */
+  SG::WriteDecorHandleKey<xAOD::PhotonContainer> m_photonChargedFEWriteDecorKey;
+  /** The write key for adding photon element link decorations to Neutral Flow Elements */
+  SG::WriteDecorHandleKey<xAOD::FlowElementContainer> m_neutralFEPhotonWriteDecorKey;
+  /** The write key for adding photon element link decorations to Charged Flow Elements */
+  SG::WriteDecorHandleKey<xAOD::FlowElementContainer> m_chargedFEPhotonWriteDecorKey;
+
+ 
+};
+
+#endif // PFEGamFlowElementAssoc
diff --git a/Reconstruction/eflowRec/share/PFlowMTConfig.py b/Reconstruction/eflowRec/share/PFlowMTConfig.py
index bf6780e54b77664f55577eb354d67adfb6119ea8..edd98bf0749f3fb7f105888d0a1d6d295059910e 100644
--- a/Reconstruction/eflowRec/share/PFlowMTConfig.py
+++ b/Reconstruction/eflowRec/share/PFlowMTConfig.py
@@ -13,7 +13,7 @@ TrackCaloExtensionTool=eflowTrackCaloExtensionTool(TrackCaloExtensionTool=pcExte
 
 #If reading from ESD we not create a cache of extrapolations to the calorimeter, so we should signify this by setting the cache key to a null string
 from RecExConfig.RecFlags import rec
-if True == rec.readESD:
+if rec.readESD==True:
    TrackCaloExtensionTool.PFParticleCache = ""
 
 PFTrackSelector.trackExtrapolatorTool = TrackCaloExtensionTool
@@ -243,15 +243,18 @@ if True == jobproperties.eflowRecFlags.provideShowerSubtractedClusters:
     PFONeutralCreatorAlgorithm.AddShowerSubtractedClusters = True
 
 topSequence += PFONeutralCreatorAlgorithm
+from eflowRec.eflowRecFlags import jobproperties # set reco flags for eFlowRec algorithms
+jobproperties.eflowRecFlags.usePFEGammaPFOAssoc.set_Value_and_Lock(True)
+jobproperties.eflowRecFlags.useFlowElements.set_Value_and_Lock(True)
 
 if jobproperties.eflowRecFlags.usePFEGammaPFOAssoc:
-
+   
    from eflowRec.eflowRecConf import PFEGammaPFOAssoc
    PFEGammaPFOAssoc=PFEGammaPFOAssoc("PFEGammaPFOAssoc")
    topSequence += PFEGammaPFOAssoc
 
 #Add new FlowElement creators
-if jobproperties.eflowRecFlags.useFlowElements:
+if jobproperties.eflowRecFlags.useFlowElements: 
   from eflowRec.eflowRecConf import PFChargedFlowElementCreatorAlgorithm
   PFChargedFlowElementCreatorAlgorithm = PFChargedFlowElementCreatorAlgorithm("PFChargedFlowElementCreatorAlgorithm")
   topSequence += PFChargedFlowElementCreatorAlgorithm 
@@ -263,3 +266,7 @@ if jobproperties.eflowRecFlags.useFlowElements:
   from eflowRec.eflowRecConf import PFLCNeutralFlowElementCreatorAlgorithm
   PFLCNeutralFlowElementCreatorAlgorithm = PFLCNeutralFlowElementCreatorAlgorithm("PFLCNeutralFlowElementCreatorAlgorithm")
   topSequence += PFLCNeutralFlowElementCreatorAlgorithm 
+
+  from eflowRec.eflowRecConf import PFEGamFlowElementAssoc
+  PFEGamFlowElementAssoc=PFEGamFlowElementAssoc("PFEGamFlowElementAssoc")
+  topSequence +=PFEGamFlowElementAssoc
diff --git a/Reconstruction/eflowRec/src/PFEGamFlowElementAssoc.cxx b/Reconstruction/eflowRec/src/PFEGamFlowElementAssoc.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..d4f91632eb5f3e910fca2718e6633abf892e9050
--- /dev/null
+++ b/Reconstruction/eflowRec/src/PFEGamFlowElementAssoc.cxx
@@ -0,0 +1,258 @@
+/*  
+ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "StoreGate/WriteDecorHandle.h" 
+// Flow Element EDM
+#include "xAODPFlow/FlowElementContainer.h"
+#include "xAODPFlow/FlowElement.h"
+#include "xAODEgamma/ElectronContainer.h" 
+#include "xAODEgamma/PhotonContainer.h"
+#include "xAODEgamma/Electron.h" 
+#include "xAODEgamma/Photon.h"
+#include "xAODEgamma/ElectronxAODHelpers.h"
+#include "xAODEgamma/EgammaxAODHelpers.h" 
+
+
+#include "eflowRec/PFEGamFlowElementAssoc.h" 
+
+
+typedef ElementLink<xAOD::ElectronContainer> ElectronLink_t; 
+typedef ElementLink<xAOD::PhotonContainer> PhotonLink_t;
+typedef ElementLink<xAOD::FlowElementContainer> FlowElementLink_t; 
+
+PFEGamFlowElementAssoc::PFEGamFlowElementAssoc(
+const std::string& name,
+  ISvcLocator* pSvcLocator
+  ):
+  AthReentrantAlgorithm(name,pSvcLocator)
+{
+// Class initializer 
+declareProperty ("ElectronNeutralFEDecorKey", m_electronNeutralFEWriteDecorKey = "Electrons.neutralFELinks");   
+declareProperty ("ElectronChargedFEDecorKey", m_electronChargedFEWriteDecorKey = "Electrons.chargedFELinks");   
+
+declareProperty ("NeutralFEElectronDecorKey", m_neutralFEElectronWriteDecorKey = "JetETMissNeutralFlowElements.FE_ElectronLinks");   
+
+declareProperty ("ChargedFEElectronDecorKey", m_chargedFEElectronWriteDecorKey = "JetETMissChargedFlowElements.FE_ElectronLinks"); 
+
+declareProperty ("PhotonNeutralFEDecorKey", m_photonNeutralFEWriteDecorKey = "Photons.neutralFELinks");
+declareProperty ("PhotonChargedFEDecorKey", m_photonChargedFEWriteDecorKey = "Photons.chargedFELinks");
+declareProperty ("NeutralFEPhotonDecorKey", m_neutralFEPhotonWriteDecorKey = "JetETMissNeutralFlowElements.FE_PhotonLinks");
+declareProperty ("ChargedFEPhotonDecorKey", m_chargedFEPhotonWriteDecorKey = "JetETMissChargedFlowElements.FE_PhotonLinks");
+}
+
+// Class destructor 
+PFEGamFlowElementAssoc::~PFEGamFlowElementAssoc(){}
+
+StatusCode PFEGamFlowElementAssoc::initialize()
+{
+
+  ATH_MSG_DEBUG("Initializing "<<name() << "...");
+ ATH_CHECK(m_electronNeutralFEWriteDecorKey.initialize());   
+ ATH_CHECK(m_electronChargedFEWriteDecorKey.initialize());   
+ ATH_CHECK(m_neutralFEElectronWriteDecorKey.initialize());   
+ ATH_CHECK(m_chargedFEElectronWriteDecorKey.initialize());  
+
+ ATH_CHECK(m_photonNeutralFEWriteDecorKey.initialize());
+ ATH_CHECK(m_photonChargedFEWriteDecorKey.initialize());
+ ATH_CHECK(m_neutralFEPhotonWriteDecorKey.initialize());
+ ATH_CHECK(m_chargedFEPhotonWriteDecorKey.initialize());
+
+ //Init ReadHandleKeys
+ ATH_CHECK(m_photonReadHandleKey.initialize());
+ ATH_CHECK(m_electronReadHandleKey.initialize());
+ ATH_CHECK(m_chargedFEReadHandleKey.initialize());
+ ATH_CHECK(m_neutralFEReadHandleKey.initialize());
+
+ ATH_MSG_DEBUG("Initialization completed successfully");   
+
+return StatusCode::SUCCESS;
+}
+
+StatusCode PFEGamFlowElementAssoc::finalize(){
+return StatusCode::SUCCESS;
+}
+/**
+   This algorithm does the following:
+   1) Read the Input containers for Flow Elements, Electrons and Photons
+   2) Match the Clusters in the flow elements to the relevant E/Photon clusters (Neutral) or match tracks to relevant Electron/Photon tracks (Charged)
+   3) Link them
+   4) output the Electron/Photon containers with the linkers to the Flow element containers 
+**/
+StatusCode PFEGamFlowElementAssoc::execute(const EventContext &ctx) const
+{
+  // write decoration handles for the electron, photon and FE containers -- these are the OUTPUT handles
+  //Electron Write Handle
+  SG::WriteDecorHandle<xAOD::ElectronContainer, std::vector<FlowElementLink_t> > electronNeutralFEWriteDecorHandle (m_electronNeutralFEWriteDecorKey,ctx);   
+  SG::WriteDecorHandle<xAOD::ElectronContainer, std::vector<FlowElementLink_t> > electronChargedFEWriteDecorHandle (m_electronChargedFEWriteDecorKey,ctx);   
+  SG::WriteDecorHandle<xAOD::FlowElementContainer, std::vector<ElectronLink_t> > neutralFEElectronWriteDecorHandle (m_neutralFEElectronWriteDecorKey,ctx);   
+  SG::WriteDecorHandle<xAOD::FlowElementContainer, std::vector<ElectronLink_t> > chargedFEElectronWriteDecorHandle (m_chargedFEElectronWriteDecorKey,ctx); 
+
+  //Photon Write Handle
+  SG::WriteDecorHandle<xAOD::PhotonContainer, std::vector<FlowElementLink_t> > photonNeutralFEWriteDecorHandle (m_photonNeutralFEWriteDecorKey,ctx);
+  SG::WriteDecorHandle<xAOD::PhotonContainer, std::vector<FlowElementLink_t> > photonChargedFEWriteDecorHandle (m_photonChargedFEWriteDecorKey,ctx);
+  SG::WriteDecorHandle<xAOD::FlowElementContainer, std::vector<PhotonLink_t> > neutralFEPhotonWriteDecorHandle (m_neutralFEPhotonWriteDecorKey,ctx);
+  SG::WriteDecorHandle<xAOD::FlowElementContainer, std::vector<PhotonLink_t> > chargedFEPhotonWriteDecorHandle (m_chargedFEPhotonWriteDecorKey,ctx);  
+  
+  
+  // This is the READ handles (so the input containers for electron, photon, FE)
+  
+  SG::ReadHandle<xAOD::ElectronContainer>electronReadHandle (m_electronReadHandleKey,ctx);
+  SG::ReadHandle<xAOD::PhotonContainer> photonReadHandle (m_photonReadHandleKey,ctx);
+  
+  // Charged and Neutral PFlow "Flow elements"
+  SG::ReadHandle<xAOD::FlowElementContainer> neutralFEReadHandle (m_neutralFEReadHandleKey,ctx);   
+  SG::ReadHandle<xAOD::FlowElementContainer> chargedFEReadHandle (m_chargedFEReadHandleKey,ctx);   
+  
+  // now initialise some Flow element link containers
+  std::vector<std::vector<FlowElementLink_t>> electronNeutralFEVec(electronReadHandle->size());
+  std::vector<std::vector<FlowElementLink_t>> electronChargedFEVec(electronReadHandle->size());
+  
+  std::vector<std::vector<FlowElementLink_t>> photonNeutralFEVec(photonReadHandle->size());
+  std::vector<std::vector<FlowElementLink_t>> photonChargedFEVec(photonReadHandle->size());
+  //////////////////////////////////////////////////////////////////////////
+  ////                      DO MATCHING/LINKING
+  //////////////////////////////////////////////////////////////////////////
+  
+
+  ///////////////////////////
+  // Loop over neutral flow elements (FEs)
+  ///////////////////////////
+  for (const xAOD::FlowElement* FE: *neutralFEElectronWriteDecorHandle){
+    //Obtain the index of the FE calo-cluster
+    size_t FEClusterIndex=FE->otherObjects().at(0)->index();
+
+    // init the linkers
+    std::vector<ElectronLink_t> FEElectronLinks;
+    std::vector<PhotonLink_t> FEPhotonLinks;
+    
+    //Loop over electrons:
+    for (const xAOD::Electron* electron: *electronNeutralFEWriteDecorHandle){
+      // get the calo clusters from the electron
+
+      const std::vector<const xAOD::CaloCluster*> electronTopoClusters = xAOD::EgammaHelpers::getAssociatedTopoClusters(electron->caloCluster());
+	
+      
+      for(const xAOD::CaloCluster* cluster : electronTopoClusters){
+	// obtain the index of the electron seed topocluster
+	size_t electronClusterIndex=cluster->index();	
+	//match the indices: Cluster match between Flow Element (FE) and electron
+	if(electronClusterIndex==FEClusterIndex){
+	  FEElectronLinks.push_back( ElectronLink_t(*electronReadHandle,electron->index()) );
+	  //Add Flow Element (FE) link to a vector
+	  //index() is the unique index of the Flow Element in the container
+	  electronNeutralFEVec.at(electron->index()).push_back(FlowElementLink_t(*neutralFEReadHandle, FE->index()) );
+	}// end of matching block
+
+      } // end loop over cluster
+      
+    } // end Electron loop
+
+    // now loop over photons
+    for (const xAOD::Photon* photon: *photonNeutralFEWriteDecorHandle){
+      // retrieve clusters from the photon container
+      const std::vector<const xAOD::CaloCluster*> photonTopoClusters = xAOD::EgammaHelpers::getAssociatedTopoClusters(photon->caloCluster());
+      //loop over clusters, and do the matching
+      for (const xAOD::CaloCluster* cluster: photonTopoClusters){
+	//retrieve index of the cluster
+	size_t photonClusterIndex=cluster->index();
+	//do the matching
+	if(photonClusterIndex==FEClusterIndex){
+	  // Add flow element (FE) links to photon
+	  FEPhotonLinks.push_back( PhotonLink_t(*photonReadHandle,photon->index()) );
+	  //Add Flow Element (FE) link to a vector
+	  //index() is the unique index of the Flow Element in the container
+	  photonNeutralFEVec.at(photon->index()).push_back(FlowElementLink_t(*neutralFEReadHandle, FE->index()) );	  
+	}// end of matching block
+      } // end of neutral loop
+      
+
+    }// end of photon loop
+    
+    //Add vector of electron element links as decoration to FlowElement container
+    neutralFEElectronWriteDecorHandle (*FE)=FEElectronLinks;
+    neutralFEPhotonWriteDecorHandle (*FE)=FEPhotonLinks;
+
+  } // end neutral FE loop
+
+  ////////////////////////////////////////////////////////
+  //             Loop over charged Flow Elements (FEs)
+  ////////////////////////////////////////////////////////
+  for (const xAOD::FlowElement* FE: *chargedFEElectronWriteDecorHandle){
+    // retrieve the track from the Flow element
+    size_t FETrackIndex=FE->chargedObjects().at(0)->index();
+    // Initialise a vector of element links to electrons/Photons
+    std::vector<ElectronLink_t> FEElectronLinks;
+    std::vector<PhotonLink_t> FEPhotonLinks;
+
+    //loop over electrons
+    for (const xAOD::Electron* electron: *electronChargedFEWriteDecorHandle){
+      //obtain the clusters
+       const std::vector<const xAOD::TrackParticle*> electronTrackParticles = xAOD::EgammaHelpers::getTrackParticlesVec(electron, true, true); // useBremAssoc = true (get original non-GSF track), allParticles = true (include all track particles)
+       // loop over tracks
+       for (const xAOD::TrackParticle* electronTrack: electronTrackParticles){
+	 size_t electronTrackIndex = electronTrack->index();
+
+	 //link to FE if track indices match
+	 if(electronTrackIndex==FETrackIndex){
+	   // Add electron element link to a vector 
+	   // index() is the unique index of the electron in the electron container 
+	   FEElectronLinks.push_back( ElectronLink_t(*electronReadHandle, electron->index()) );
+	   // Add FE element link to a vector 
+	   // index() is the unique index of the cFE in the cFE container 
+	   electronChargedFEVec.at(electron->index()).push_back( FlowElementLink_t(*chargedFEReadHandle, FE->index()) );  
+
+	 }//end of matching block
+	 
+       }//end of loop on clusters
+    } // end of loop on electrons
+    
+    for(const xAOD::Photon* photon: *photonChargedFEWriteDecorHandle){
+      //obtain indices of the converted photon's original tracks
+      const std::set<const xAOD::TrackParticle*> photonTrackParticles = xAOD::EgammaHelpers::getTrackParticles(photon, true);
+      // loop over the tracks
+      for (const xAOD::TrackParticle* photonTrack: photonTrackParticles){
+	size_t photonTrackIndex=photonTrack->index();
+	
+	// Link the photon to the Flow Element (FE) if the track indices match
+	if (photonTrackIndex==FETrackIndex){
+	            // Add photon element link to a vector
+          // index() is the unique index of the photon in the photon container
+          FEPhotonLinks.push_back( PhotonLink_t(*photonReadHandle, photon->index()) );
+          // Add FE element link to a vector
+          // index() is the unique index of the cFE in the cFE container
+          photonChargedFEVec.at(photon->index()).push_back( FlowElementLink_t(*chargedFEReadHandle, FE->index()) );
+	}// end of matching block
+
+      }// end of loop on tracks
+      
+    }//end of loop on photons
+
+
+    // Add vector of electron element links as decoration to FE container     
+    chargedFEElectronWriteDecorHandle (*FE) = FEElectronLinks;  
+    // Add vector of photon element links as decoration to FE container
+    chargedFEPhotonWriteDecorHandle (*FE) = FEPhotonLinks;
+
+  } // end of charged FE loop
+  
+
+
+  ////////////////////////////////////////////////////
+  //   WRITE OUTPUT: ADD HANDLES TO EL/PHOT CONTAINERS
+  ////////////////////////////////////////////////////
+  // Add the vectors of the Flow Element (FE) Links as decorations to the electron container
+  for (const xAOD::Electron* electron : *electronNeutralFEWriteDecorHandle){
+    electronNeutralFEWriteDecorHandle (*electron) = electronNeutralFEVec.at(electron->index());
+    electronChargedFEWriteDecorHandle (*electron) = electronChargedFEVec.at(electron->index());
+  } //end of photon loop
+  // Add the vectors of the Flow Element (FE) Links as decorations to the photon container
+  for (const xAOD::Photon* photon: *photonNeutralFEWriteDecorHandle){
+    photonNeutralFEWriteDecorHandle (*photon) = photonNeutralFEVec.at(photon->index());
+    photonChargedFEWriteDecorHandle (*photon) = photonChargedFEVec.at(photon->index());
+  } // end of loop on photons
+
+  ATH_MSG_DEBUG("Execute completed successfully");
+
+  return StatusCode::SUCCESS;
+}
diff --git a/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx b/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx
index 3667e06ebd952faaeb247cbb3c36ba60d78f67af..f0ad355de1ce65f121457a6512f8facc179252d7 100644
--- a/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx
+++ b/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx
@@ -20,6 +20,7 @@
 #include "eflowRec/PFOChargedCreatorAlgorithm.h"
 #include "eflowRec/PFONeutralCreatorAlgorithm.h"
 #include "eflowRec/PFEGammaPFOAssoc.h"
+#include "eflowRec/PFEGamFlowElementAssoc.h"
 
 DECLARE_COMPONENT( eflowOverlapRemoval )
 DECLARE_COMPONENT( PFLeptonSelector )
@@ -43,3 +44,4 @@ DECLARE_COMPONENT( PFTrackClusterMatchingTool )
 DECLARE_COMPONENT( eflowCellEOverPTool_mc12_JetETMiss)
 DECLARE_COMPONENT(  eflowCellEOverPTool_mc12_HLLHC)
 DECLARE_COMPONENT( eflowCellEOverPTool_mc12_LC)
+DECLARE_COMPONENT( PFEGamFlowElementAssoc )
diff --git a/Reconstruction/egamma/egammaAlgs/src/EMBremCollectionBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/EMBremCollectionBuilder.cxx
index 969e7ee50f97c250df82079f369467d3057394bb..fedb6bc04bac98e87824543b9e7d805598c396f1 100644
--- a/Reconstruction/egamma/egammaAlgs/src/EMBremCollectionBuilder.cxx
+++ b/Reconstruction/egamma/egammaAlgs/src/EMBremCollectionBuilder.cxx
@@ -43,7 +43,7 @@ StatusCode EMBremCollectionBuilder::initialize() {
   ATH_CHECK(m_OutputTrkPartContainerKey.initialize());
   ATH_CHECK(m_OutputTrackContainerKey.initialize());
   ATH_CHECK(m_TruthParticlesLinkKey.initialize(m_doTruth));
-  
+
   /* retrieve the track refitter tool*/
   ATH_CHECK(m_trkRefitTool.retrieve());
   /* Get the particle creation tool */
@@ -52,12 +52,12 @@ StatusCode EMBremCollectionBuilder::initialize() {
   ATH_CHECK(m_slimTool.retrieve());
   /* Get the track summary tool */
   ATH_CHECK(m_summaryTool.retrieve());
-  
+
   return StatusCode::SUCCESS;
-}  
+}
+
+StatusCode EMBremCollectionBuilder::EMBremCollectionBuilder::finalize(){
 
-StatusCode EMBremCollectionBuilder::EMBremCollectionBuilder::finalize(){ 
-  
   ATH_MSG_INFO ("Not refitted due to Silicon Requirements " << m_FailedSiliconRequirFit);
   ATH_MSG_INFO ("Failed Fit Tracks " << m_FailedFitTracks);
   ATH_MSG_INFO ("RefittedTracks " << m_RefittedTracks);
@@ -99,62 +99,62 @@ EMBremCollectionBuilder::execute_r(const EventContext& ctx) const
   SG::WriteHandle<TrackCollection> finalTracks(m_OutputTrackContainerKey, ctx);
   ATH_CHECK(finalTracks.record(std::make_unique<TrackCollection>()));
   TrackCollection* cPtrTracks = finalTracks.ptr();
-  /* 
+  /*
    * Split TRT-alone from silicon ones
    * For the TRT we can get all the info already
    */
   std::vector<const xAOD::TrackParticle*> siliconTrkTracks;
-  siliconTrkTracks.reserve(16); 
+  siliconTrkTracks.reserve(16);
   std::vector<TrackWithIndex> trtAloneTrkTracks;
-  trtAloneTrkTracks.reserve(16); 
+  trtAloneTrkTracks.reserve(16);
   for(const xAOD::TrackParticle* track : *selectedTracks){
     const Trk::Track* trktrack{nullptr};
-    if (  track->trackLink().isValid() ){ 
+    if (  track->trackLink().isValid() ){
       trktrack =track->track();
     }
     else{
       ATH_MSG_ERROR("TrackParticle has not Track --  are you running on AOD?");
       return StatusCode::FAILURE;
     }
-    int nSiliconHits_trk =0; 
-    uint8_t dummy(0); 
+    int nSiliconHits_trk =0;
+    uint8_t dummy(0);
     if( track->summaryValue(dummy,xAOD::numberOfSCTHits) ){
       nSiliconHits_trk += dummy;
     }
     if(track->summaryValue(dummy,xAOD::numberOfPixelHits) ){
       nSiliconHits_trk += dummy;
     }
-    ATH_MSG_DEBUG("Number of Silicon hits "<<nSiliconHits_trk);    
+    ATH_MSG_DEBUG("Number of Silicon hits "<<nSiliconHits_trk);
 
     if(nSiliconHits_trk >= m_MinNoSiHits){
-      siliconTrkTracks.push_back(track); 
+      siliconTrkTracks.push_back(track);
     }else{
       //copy Trk::Track and keep also the index of the original
       trtAloneTrkTracks.emplace_back(
         std::make_unique<Trk::Track>(*trktrack),track->index());
     }
   }
-  /* 
+  /*
    * Refitted  and possible failed fit info
    */
-  std::vector<TrackWithIndex> refitted; 
-  refitted.reserve(siliconTrkTracks.size());    
-  std::vector<TrackWithIndex> failedfit; 
+  std::vector<TrackWithIndex> refitted;
+  refitted.reserve(siliconTrkTracks.size());
+  std::vector<TrackWithIndex> failedfit;
   /*
    * Do the refit and get all the info
    */
-  ATH_CHECK(refitTracks(ctx,siliconTrkTracks,refitted,failedfit)); 
+  ATH_CHECK(refitTracks(ctx,siliconTrkTracks,refitted,failedfit));
   siliconTrkTracks.clear();
   /*
    * Fill the final collections
    */
   ATH_CHECK(createCollections(refitted,failedfit,trtAloneTrkTracks,
                     cPtrTracks,cPtrTrkPart,trackTES.ptr()));
-   /* 
+   /*
    * update counters
    * */
   m_RefittedTracks.fetch_add(refitted.size(), std::memory_order_relaxed);
-  m_FailedFitTracks.fetch_add(failedfit.size(), std::memory_order_relaxed); 
+  m_FailedFitTracks.fetch_add(failedfit.size(), std::memory_order_relaxed);
   m_FailedSiliconRequirFit.fetch_add(trtAloneTrkTracks.size(),std::memory_order_relaxed);
   return StatusCode::SUCCESS;
 }
@@ -169,7 +169,7 @@ EMBremCollectionBuilder::refitTracks(
   for (const xAOD::TrackParticle* in:input){
     const Trk::Track* track =in->track();
     IegammaTrkRefitterTool::Cache cache{};
-    StatusCode status = m_trkRefitTool->refitTrack(ctx,                                                   
+    StatusCode status = m_trkRefitTool->refitTrack(ctx,
                                                    track,
                                                    cache);
     if (status == StatusCode::SUCCESS){
@@ -177,7 +177,7 @@ EMBremCollectionBuilder::refitTracks(
       //this is new track
       refitted.emplace_back(
         std::move(cache.refittedTrack),in->index()
-        ); 
+        );
     }
     else{
       ATH_MSG_DEBUG("FIT FAILED ");
@@ -185,7 +185,7 @@ EMBremCollectionBuilder::refitTracks(
       failedfit.emplace_back(
         std::make_unique<Trk::Track>(*track),in->index()
         );
-    }    
+    }
   }
   return StatusCode::SUCCESS;
 }
@@ -210,11 +210,11 @@ EMBremCollectionBuilder::createCollections(
   for (auto& Info : refitted){
     ATH_CHECK(createNew(Info,finalTracks,finalTrkPartContainer,AllTracks));
   }
-                                                               
+
   for (auto& Info  :  failedfit){
     ATH_CHECK(createNew(Info,finalTracks,finalTrkPartContainer,AllTracks));
   }
-                                                                
+
   for (auto& Info : trtAlone){
     ATH_CHECK(createNew(Info,finalTracks,finalTrkPartContainer,AllTracks));
   }
@@ -299,7 +299,7 @@ EMBremCollectionBuilder::createNew(
   m_slimTool->slimTrack(*(Info.track));
   finalTracks->push_back(std::move(Info.track));
   ElementLink<TrackCollection> trackLink(*finalTracks,finalTracks->size()-1);
-  aParticle->setTrackLink( trackLink );     
+  aParticle->setTrackLink( trackLink );
   return StatusCode::SUCCESS;
 }
 
@@ -310,19 +310,19 @@ EMBremCollectionBuilder::updateGSFTrack(
 {
 
   //update the summary of the non-const track without hole search
-  m_summaryTool->updateRefittedTrack(*(Info.track));
+  m_summaryTool->updateTrackSummary(*(Info.track));
   //Get the summary so as to add info to it
   Trk::TrackSummary* summary = Info.track->trackSummary();
 
   size_t origIndex = Info.origIndex;
   const xAOD::TrackParticle* original = AllTracks->at(origIndex);
-  
+
   uint8_t dummy(0);
   if (m_doPix) {
     //copy over dead sensors
     uint8_t deadPixel= original->summaryValue(dummy,xAOD::numberOfPixelDeadSensors)?dummy:0;
     summary->update(Trk::numberOfPixelDeadSensors,deadPixel);
-    
+
     int nPixHitsRefitted = summary->get(Trk::numberOfPixelHits);
     int nPixOutliersRefitted = summary->get(Trk::numberOfPixelOutliers);
     int nPixHitsOriginal = original->summaryValue(dummy,xAOD::numberOfPixelHits) ? dummy:-1;
@@ -336,10 +336,10 @@ EMBremCollectionBuilder::updateGSFTrack(
   }
   if (m_doSCT) {
     uint8_t deadSCT= original->summaryValue(dummy,xAOD::numberOfSCTDeadSensors)?dummy:0;
-    summary->update(Trk::numberOfSCTDeadSensors,deadSCT); 
+    summary->update(Trk::numberOfSCTDeadSensors,deadSCT);
 
     uint8_t SCTDoubleHoles = original->summaryValue(dummy,xAOD::numberOfSCTDoubleHoles )?dummy:0;
-    summary->update(Trk::numberOfSCTDoubleHoles , SCTDoubleHoles); 
+    summary->update(Trk::numberOfSCTDoubleHoles , SCTDoubleHoles);
 
     int nSCTHitsRefitted = summary->get(Trk::numberOfSCTHits);
     int nSCTOutliersRefitted = summary->get(Trk::numberOfSCTOutliers);
diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.cxx
index d38f58395d3635177a5692db0e59d6fb627621f1..91446362a14bc827aa66c94b10467f006278cdcf 100644
--- a/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.cxx
+++ b/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.cxx
@@ -106,7 +106,7 @@ etaphi_range(const CaloDetDescrManager& dd_man,
 // Constructor.
 egammaSuperClusterBuilder::egammaSuperClusterBuilder(const std::string& name,
                                                      ISvcLocator* pSvcLocator)
-  : AthAlgorithm(name, pSvcLocator)
+  : AthReentrantAlgorithm(name, pSvcLocator)
 {
 
   m_searchWindowPhiBarrel = m_searchWindowPhiCellsBarrel * s_cellPhiSize * 0.5;
diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.h b/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.h
index 87de0d6277ca7391252240d7673698524e3f0542..f925bbd605fd6017a2213de211df63c6e0d09294 100644
--- a/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.h
+++ b/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.h
@@ -6,7 +6,7 @@
 #define EGAMMAALGS_EGAMMASUPERCLUSTERBUILDER_H
 
 // INCLUDE HEADER FILES:
-#include "AthenaBaseComps/AthAlgorithm.h"
+#include "AthenaBaseComps/AthReentrantAlgorithm.h"
 #include "GaudiKernel/EventContext.h"
 #include "GaudiKernel/SystemOfUnits.h"
 #include "GaudiKernel/ToolHandle.h"
@@ -29,7 +29,7 @@ class CaloDetDescrManager;
  *  The inheritance should be private. This class should never be instantiated
  *  by itself, and hence has no interface class
  **/
-class egammaSuperClusterBuilder : public AthAlgorithm
+class egammaSuperClusterBuilder : public AthReentrantAlgorithm
 {
 
 protected:
diff --git a/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.cxx
index 2297cf933cc7d71a1d3d36f717c0047000e5d13d..2da7b8a630ad8a747013800c1653f12adf59c85b 100644
--- a/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.cxx
+++ b/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.cxx
@@ -55,7 +55,7 @@ electronSuperClusterBuilder::finalize()
 }
 
 StatusCode
-electronSuperClusterBuilder::execute_r(const EventContext& ctx) const
+electronSuperClusterBuilder::execute(const EventContext& ctx) const
 {
 
   SG::ReadHandle<EgammaRecContainer> egammaRecs(m_inputEgammaRecContainerKey, ctx);
diff --git a/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.h b/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.h
index cc4b46c976179ec0fb55e92eabd730dd9cab0a79..6458fd3d190617f25cec565e5a4e6ab281fc83eb 100644
--- a/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.h
+++ b/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.h
@@ -29,13 +29,7 @@ public:
   // Tool standard routines.
   virtual StatusCode initialize() override final;
   virtual StatusCode finalize() override final;
-  virtual StatusCode execute() override final
-  {
-    return execute_r(Algorithm::getContext());
-  }
-  // This will become the normal execute when
-  // inheriting from AthReentrantAlgorithm
-  StatusCode execute_r(const EventContext& ctx) const;
+  StatusCode execute(const EventContext& ctx) const override final;
 
 private:
   bool matchSameTrack(const xAOD::TrackParticle& seedTrack,
diff --git a/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.cxx
index ae573e4b9019100c733812e45e775ea37a7657bd..0342ef800e5a6e3a7f2030ca9aa995c01b0976f9 100644
--- a/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.cxx
+++ b/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.cxx
@@ -58,7 +58,7 @@ photonSuperClusterBuilder::finalize()
 }
 
 StatusCode
-photonSuperClusterBuilder::execute_r(const EventContext& ctx) const
+photonSuperClusterBuilder::execute(const EventContext& ctx) const
 {
 
   // Retrieve input egammaRec container.
diff --git a/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.h b/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.h
index b5408a0c199e5375640ba1b2e39b13fba9fc506d..038869eeb6e785598ab3392e50bc89cb76d2d7e9 100644
--- a/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.h
+++ b/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.h
@@ -28,13 +28,7 @@ public:
   // Tool standard routines.
   virtual StatusCode initialize() override final;
   virtual StatusCode finalize() override final;
-  virtual StatusCode execute() override final
-  {
-    return execute_r(Algorithm::getContext());
-  }
-  // This will become the normal execute when
-  // inheriting from AthReentrantAlgorithm
-  StatusCode execute_r(const EventContext& ctx) const;
+  virtual StatusCode execute(const EventContext& ctx) const override final;
 
 private:
   /** Return extra clusters that can be added to make supercluster */
diff --git a/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.h b/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.h
index cd7e7798891f7101f34f7e83536967281929667d..8ff922000e332bb0ba7dd7b63c8360a1ef927984 100644
--- a/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.h
+++ b/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.h
@@ -69,7 +69,7 @@ private:
     "The selector result names"
   };
 
-  ToolHandleArray<CP::ISelectionTool> m_genericIsEMselectors{
+  ToolHandleArray<IAsgSelectionTool> m_genericIsEMselectors{
     this,
     "genericIsEMselectors",
     {},
diff --git a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py
index 02c74c1cf1fa7e0d0278a94798004a36f72874eb..91d668a8f2bad33c38ff9eeb895bfe67999ee3f9 100644
--- a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py
+++ b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py
@@ -388,7 +388,6 @@ def getPi0ClusterCreator():
     
     from tauRecTools.tauRecToolsConf import TauPi0ClusterCreator
     TauPi0ClusterCreator = TauPi0ClusterCreator(name = _name,
-                                                Key_Pi0ClusterContainer="TauPi0SubtractedClusters",
                                                 TauVertexCorrection = getTauVertexCorrection(),
                                                 IncShowerSubtr = tauFlags.useShowerSubClusters()
                                                 )
@@ -923,6 +922,58 @@ def getTauIDVarCalculator():
     cached_instances[_name] = myTauIDVarCalculator
     return myTauIDVarCalculator
 
+def getTauEleRNNEvaluator(_n,
+        NetworkFile1P="", NetworkFile3P="",
+        OutputVarname="RNNEleScore", MaxTracks=10,
+        MaxClusters=6, MaxClusterDR=1.0, InputLayerScalar="scalar",
+        InputLayerTracks="tracks", InputLayerClusters="clusters",
+        OutputLayer="rnneveto_output", OutputNode="sig_prob"):
+
+    _name = sPrefix + _n 
+    from tauRecTools.tauRecToolsConf import TauJetRNNEvaluator
+    tool = TauJetRNNEvaluator(name=_name,
+                              NetworkFile1P=NetworkFile1P,
+                              NetworkFile3P=NetworkFile3P,
+                              OutputVarname=OutputVarname,
+                              MaxTracks=MaxTracks,
+                              MaxClusters=MaxClusters,
+                              MaxClusterDR=MaxClusterDR,
+                              InputLayerScalar=InputLayerScalar,
+                              InputLayerTracks=InputLayerTracks,
+                              InputLayerClusters=InputLayerClusters,
+                              OutputLayer=OutputLayer,
+                              OutputNode=OutputNode,
+                              TauVertexCorrection = getTauVertexCorrection(),
+                              IncShowerSubtr = tauFlags.useShowerSubClusters())
+
+    cached_instances[_name] = tool
+    return tool
+
+def getTauWPDecoratorEleRNN():
+    import PyUtils.RootUtils as ru
+    ROOT = ru.import_root()
+    import cppyy
+    cppyy.load_library('libxAODTau_cDict')
+
+    _name = sPrefix + 'TauWPDecoratorEleRNN'
+    from tauRecTools.tauRecToolsConf import TauWPDecorator
+    myTauWPDecorator = TauWPDecorator( name=_name,
+                                       flatteningFile1Prong="rnneveto_mc16d_flat_1p.root",
+                                       flatteningFile3Prong="rnneveto_mc16d_flat_3p.root",
+                                       CutEnumVals =
+                                       [ ROOT.xAOD.TauJetParameters.IsTauFlag.EleRNNLoose,
+                                         ROOT.xAOD.TauJetParameters.IsTauFlag.EleRNNMedium,
+                                         ROOT.xAOD.TauJetParameters.IsTauFlag.EleRNNTight ],
+                                       SigEff1P = [0.95, 0.90, 0.85],
+                                       SigEff3P = [0.98, 0.95, 0.90],
+                                       UseEleBDT = True ,
+                                       ScoreName = "RNNEleScore",
+                                       NewScoreName = "RNNEleScoreSigTrans",
+                                       DefineWPs = True,
+                                       )
+    cached_instances[_name] = myTauWPDecorator
+    return myTauWPDecorator
+              
 def getTauDecayModeNNClassifier():
     _name = sPrefix + 'TauDecayModeNNClassifier'
 
diff --git a/Reconstruction/tauRec/python/TauRecRunner.py b/Reconstruction/tauRec/python/TauRecRunner.py
index 176ebb9561f08f9116a24970feca815a80d452b7..42613a673f93231b430ff386d9576abe8a37ece2 100644
--- a/Reconstruction/tauRec/python/TauRecRunner.py
+++ b/Reconstruction/tauRec/python/TauRecRunner.py
@@ -122,6 +122,11 @@ class TauRecRunner ( TauRecRunConfigured ) :
                                                        weightsFile="EleBDT1PEnd23.root", minNTracks=1, minAbsTrackEta=2.0, 
                                                        maxAbsTrackEta=3.0, outputVarName="BDTEleScore"))
             tools.append(taualgs.getTauWPDecoratorEleBDT())
+            tools.append(taualgs.getTauEleRNNEvaluator("TauEleRNN",
+                                                         NetworkFile1P="rnneveto_mc16d_config_1p.json",
+                                                         NetworkFile3P="rnneveto_mc16d_config_3p.json",
+                                                         OutputVarname="RNNEleScore", MaxTracks=10, MaxClusters=6))
+            tools.append(taualgs.getTauWPDecoratorEleRNN())
             tools.append(taualgs.getTauDecayModeNNClassifier())
             tools.append(taualgs.getTauEleOLRDecorator())              
             
diff --git a/Reconstruction/tauRec/src/TauProcessorAlg.cxx b/Reconstruction/tauRec/src/TauProcessorAlg.cxx
index 220c4e9e7ae2d49a443630679a9cd0b6094c92e0..3a8ce013473ac1b99d02342588fd800da346d8e9 100644
--- a/Reconstruction/tauRec/src/TauProcessorAlg.cxx
+++ b/Reconstruction/tauRec/src/TauProcessorAlg.cxx
@@ -7,7 +7,6 @@
 #include "xAODJet/Jet.h"
 #include "xAODJet/JetContainer.h"
 
-
 #include "xAODTau/TauJetContainer.h"
 #include "xAODTau/TauJetAuxContainer.h"
 #include "xAODTau/TauDefs.h"
@@ -27,8 +26,8 @@ using Gaudi::Units::GeV;
 // Constructor
 //-----------------------------------------------------------------------------
 TauProcessorAlg::TauProcessorAlg(const std::string &name,
-    ISvcLocator * pSvcLocator) :
-AthAlgorithm(name, pSvcLocator) {
+				 ISvcLocator * pSvcLocator) :
+  AthReentrantAlgorithm(name, pSvcLocator) {
 }
 
 //-----------------------------------------------------------------------------
@@ -43,67 +42,36 @@ TauProcessorAlg::~TauProcessorAlg() {
 StatusCode TauProcessorAlg::initialize() {
   ATH_CHECK( detStore()->retrieve(m_cellID) );
     
-    ATH_CHECK( m_jetInputContainer.initialize() );
-    ATH_CHECK( m_tauOutputContainer.initialize() );
-    ATH_CHECK( m_tauTrackOutputContainer.initialize() );
-    ATH_CHECK( m_tauShotClusOutputContainer.initialize() );
-    ATH_CHECK( m_tauShotPFOOutputContainer.initialize() );
-    ATH_CHECK( m_tauPi0CellOutputContainer.initialize() );
-
-    ATH_CHECK( m_cellMakerTool.retrieve() );
-
-    //-------------------------------------------------------------------------
-    // No tools allocated!
-    //-------------------------------------------------------------------------
-    if (m_tools.size() == 0) {
-        ATH_MSG_ERROR("no tools given!");
-        return StatusCode::FAILURE;
-    }
-
-    //-------------------------------------------------------------------------
-    // Allocate tools
-    //-------------------------------------------------------------------------
-    ATH_CHECK( m_tools.retrieve() );
-    
-    ATH_MSG_INFO("List of tools in execution sequence:");
-    ATH_MSG_INFO("------------------------------------");
-
-    unsigned int tool_count = 0;
-
-    for (ToolHandle<ITauToolBase>& tool : m_tools) {
-      ++tool_count;
-      ATH_MSG_INFO(tool->type() << " - " << tool->name());
-    }
-    ATH_MSG_INFO(" ");
-    ATH_MSG_INFO("------------------------------------");
-
-    if (tool_count == 0) {
-        ATH_MSG_ERROR("could not allocate any tool!");
-        return StatusCode::FAILURE;
-    }
-
-    return StatusCode::SUCCESS;
-}
-
-//-----------------------------------------------------------------------------
-// Finalizer
-//-----------------------------------------------------------------------------
-StatusCode TauProcessorAlg::finalize() {
+  ATH_CHECK( m_jetInputContainer.initialize() );
+  ATH_CHECK( m_tauOutputContainer.initialize() );
+  ATH_CHECK( m_tauTrackOutputContainer.initialize() );
+  ATH_CHECK( m_tauShotClusOutputContainer.initialize() );
+  ATH_CHECK( m_tauShotPFOOutputContainer.initialize() );
+  ATH_CHECK( m_tauPi0CellOutputContainer.initialize() );
+
+  ATH_CHECK( m_cellMakerTool.retrieve() );
+
+  //-------------------------------------------------------------------------
+  // No tools allocated!
+  //-------------------------------------------------------------------------
+  if (m_tools.size() == 0) {
+    ATH_MSG_ERROR("no tools given!");
+    return StatusCode::FAILURE;
+  }
 
-  StatusCode sc;
+  //-------------------------------------------------------------------------
+  // Allocate tools
+  //-------------------------------------------------------------------------    
+  ATH_MSG_INFO("List of tools in execution sequence:");
+  ATH_MSG_INFO("------------------------------------");
 
-  //-----------------------------------------------------------------
-  // Loop stops when Failure indicated by one of the tools
-  //-----------------------------------------------------------------
-  for (ToolHandle<ITauToolBase>& tool : m_tools) {
-    ATH_MSG_VERBOSE("Invoking tool " << tool->name());
-    sc = tool->finalize();
-    if (sc.isFailure()) break;
+  for (const ToolHandle<ITauToolBase>& tool : m_tools) {
+    ATH_CHECK( tool.retrieve() );
+    ATH_MSG_INFO(tool->type() << " - " << tool->name());
   }
 
-  if (sc.isSuccess()) {
-    ATH_MSG_VERBOSE("All the invoded tools are finilized successfully.");
-  } 
+  ATH_MSG_INFO(" ");
+  ATH_MSG_INFO("------------------------------------");
 
   return StatusCode::SUCCESS;
 }
@@ -111,8 +79,7 @@ StatusCode TauProcessorAlg::finalize() {
 //-----------------------------------------------------------------------------
 // Execution
 //-----------------------------------------------------------------------------
-StatusCode TauProcessorAlg::execute() {
-  const EventContext& ctx = Gaudi::Hive::currentContext();
+StatusCode TauProcessorAlg::execute(const EventContext& ctx) const {
 
   /// record output containers
   SG::WriteHandle<xAOD::TauJetContainer> tauHandle( m_tauOutputContainer, ctx );
@@ -167,60 +134,60 @@ StatusCode TauProcessorAlg::execute() {
       continue;
     }
 
-      //-----------------------------------------------------------------                                                                 
-      // Seed passed cuts --> create tau candidate
-      //-----------------------------------------------------------------                                                                           
-      xAOD::TauJet* pTau = new xAOD::TauJet();
-      pContainer->push_back( pTau );
-      pTau->setJet(pSeedContainer, pSeed);
+    //-----------------------------------------------------------------                                                                 
+    // Seed passed cuts --> create tau candidate
+    //-----------------------------------------------------------------                                                                           
+    xAOD::TauJet* pTau = new xAOD::TauJet();
+    pContainer->push_back( pTau );
+    pTau->setJet(pSeedContainer, pSeed);
       
-      //-----------------------------------------------------------------
-      // Loop stops when Failure indicated by one of the tools
-      //-----------------------------------------------------------------
-      StatusCode sc;
-      for (ToolHandle<ITauToolBase>& tool : m_tools) {
-	ATH_MSG_DEBUG("ProcessorAlg Invoking tool " << tool->name());
-
-	if (tool->type() == "TauVertexFinder" ) {
-	  sc = tool->executeVertexFinder(*pTau);
-	}
-	else if ( tool->type() == "TauTrackFinder") {
-	  sc = tool->executeTrackFinder(*pTau, *pTauTrackCont);
-	}
-	else if ( tool->type() == "tauRecTools::TauTrackClassifier" || tool->type() == "tauRecTools::TauTrackRNNClassifier" ) {
-	  sc = tool->executeTrackClassifier(*pTau, *pTauTrackCont);
-	}
-	else if ( tool->type() == "TauShotFinder"){
-	  sc = tool->executeShotFinder(*pTau, *tauShotClusContainer, *tauShotPFOContainer);
-	}
-	else if ( tool->type() == "TauPi0CreateROI"){
-	  sc = tool->executePi0CreateROI(*pTau, *Pi0CellContainer, addedCellsMap);
-	}
-	else {
-	  sc = tool->execute(*pTau);
-	}
-	if (sc.isFailure())  break;
+    //-----------------------------------------------------------------
+    // Loop stops when Failure indicated by one of the tools
+    //-----------------------------------------------------------------
+    StatusCode sc;
+    for (const ToolHandle<ITauToolBase>& tool : m_tools) {
+      ATH_MSG_DEBUG("ProcessorAlg Invoking tool " << tool->name());
+
+      if (tool->type() == "TauVertexFinder" ) {
+	sc = tool->executeVertexFinder(*pTau);
+      }
+      else if ( tool->type() == "TauTrackFinder") {
+	sc = tool->executeTrackFinder(*pTau, *pTauTrackCont);
+      }
+      else if ( tool->type() == "tauRecTools::TauTrackClassifier" || tool->type() == "tauRecTools::TauTrackRNNClassifier" ) {
+	sc = tool->executeTrackClassifier(*pTau, *pTauTrackCont);
+      }
+      else if ( tool->type() == "TauShotFinder"){
+	sc = tool->executeShotFinder(*pTau, *tauShotClusContainer, *tauShotPFOContainer);
+      }
+      else if ( tool->type() == "TauPi0CreateROI"){
+	sc = tool->executePi0CreateROI(*pTau, *Pi0CellContainer, addedCellsMap);
       }
-
-      if (sc.isSuccess()) {
-	ATH_MSG_VERBOSE("The tau candidate has been registered");
-      } 
       else {
-	//remove orphaned tracks before tau is deleted via pop_back
-	xAOD::TauJet* bad_tau = pContainer->back();
-	ATH_MSG_DEBUG("Deleting " << bad_tau->nAllTracks() << "Tracks associated with tau: ");
-	pTauTrackCont->erase(pTauTrackCont->end()-bad_tau->nAllTracks(), pTauTrackCont->end());
-
-	pContainer->pop_back();
-      } 
-    }// loop through seeds
-
-    // Check this is needed for the cell container?
-    // symlink as INavigable4MomentumCollection (as in CaloRec/CaloCellMaker)
-    ATH_CHECK(evtStore()->symLink(Pi0CellContainer, static_cast<INavigable4MomentumCollection*> (0)));
+	sc = tool->execute(*pTau);
+      }
+      if (sc.isFailure())  break;
+    }
+
+    if (sc.isSuccess()) {
+      ATH_MSG_VERBOSE("The tau candidate has been registered");
+    } 
+    else {
+      //remove orphaned tracks before tau is deleted via pop_back
+      xAOD::TauJet* bad_tau = pContainer->back();
+      ATH_MSG_DEBUG("Deleting " << bad_tau->nAllTracks() << "Tracks associated with tau: ");
+      pTauTrackCont->erase(pTauTrackCont->end()-bad_tau->nAllTracks(), pTauTrackCont->end());
+
+      pContainer->pop_back();
+    } 
+  }// loop through seeds
+
+  // Check this is needed for the cell container?
+  // symlink as INavigable4MomentumCollection (as in CaloRec/CaloCellMaker)
+  ATH_CHECK(evtStore()->symLink(Pi0CellContainer, static_cast<INavigable4MomentumCollection*> (0)));
   
-    // sort the cell container by hash
-    ATH_CHECK( m_cellMakerTool->process(static_cast<CaloCellContainer*> (Pi0CellContainer), ctx) );
+  // sort the cell container by hash
+  ATH_CHECK( m_cellMakerTool->process(static_cast<CaloCellContainer*> (Pi0CellContainer), ctx) );
 
   ATH_MSG_VERBOSE("The tau candidate container has been modified");
   
diff --git a/Reconstruction/tauRec/tauRec/TauProcessorAlg.h b/Reconstruction/tauRec/tauRec/TauProcessorAlg.h
index 87be74c9064e0ccdf56b3b0eb724597fe3e20954..205ba5fe1da0db62e1d67e36d517eaf414411486 100644
--- a/Reconstruction/tauRec/tauRec/TauProcessorAlg.h
+++ b/Reconstruction/tauRec/tauRec/TauProcessorAlg.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 TAUREC_TAUPROCESSORALG_H
@@ -10,7 +10,9 @@
 #include "StoreGate/ReadCondHandleKey.h"
 #include "StoreGate/ReadHandle.h"
 #include "StoreGate/WriteHandle.h"
-#include "AthenaBaseComps/AthAlgorithm.h"
+
+#include "AthenaBaseComps/AthReentrantAlgorithm.h"
+
 #include "xAODTau/TauJetContainer.h"
 #include "xAODPFlow/PFOContainer.h"
 #include "xAODPFlow/PFOAuxContainer.h"
@@ -29,44 +31,43 @@
 
 class CaloCell_ID;
 
-class TauProcessorAlg: public AthAlgorithm
+class TauProcessorAlg: public AthReentrantAlgorithm
 {
-    public:
-        //-----------------------------------------------------------------
-        // Contructor and destructor
-        //-----------------------------------------------------------------
-        TauProcessorAlg( const std::string &name, ISvcLocator *pSvcLocator );
-        ~TauProcessorAlg();
+ public:
+  //-----------------------------------------------------------------
+  // Contructor and destructor
+  //-----------------------------------------------------------------
+  TauProcessorAlg( const std::string &name, ISvcLocator *pSvcLocator );
+  ~TauProcessorAlg();
 
-        //-----------------------------------------------------------------
-        // Gaudi algorithm hooks
-        //-----------------------------------------------------------------
-        virtual StatusCode initialize();
-        virtual StatusCode execute();
-        virtual StatusCode finalize();
+  //-----------------------------------------------------------------
+  // Gaudi algorithm hooks
+  //-----------------------------------------------------------------
+  virtual StatusCode initialize();
+  virtual StatusCode execute(const EventContext& ctx) const;
 
-    private:
+ private:
        
-    Gaudi::Property<double> m_maxEta {this, "MaxEta", 2.5, "maximum eta for jet seed"};
-    Gaudi::Property<double> m_minPt {this, "MinPt", 10 * Gaudi::Units::GeV, "minimum pT for jet seed"};
+  Gaudi::Property<double> m_maxEta {this, "MaxEta", 2.5, "maximum eta for jet seed"};
+  Gaudi::Property<double> m_minPt {this, "MinPt", 10 * Gaudi::Units::GeV, "minimum pT for jet seed"};
 
-    ToolHandleArray<ITauToolBase>  m_tools {this, "Tools", {}, "Tools processing taus"};
-	ToolHandle<ICaloCellMakerTool> m_cellMakerTool {this, "CellMakerTool", "", "Tool to sort the CaloCellContainer"};
+  const ToolHandleArray<ITauToolBase> m_tools {this, "Tools", {}, "Tools processing taus"};
+  const ToolHandle<ICaloCellMakerTool> m_cellMakerTool {this, "CellMakerTool", "", "Tool to sort the CaloCellContainer"};
 
-	SG::ReadHandleKey<xAOD::JetContainer> m_jetInputContainer{this,"Key_jetInputContainer","AntiKt4LCTopoJets","input jet key"};
+  SG::ReadHandleKey<xAOD::JetContainer> m_jetInputContainer{this,"Key_jetInputContainer","AntiKt4LCTopoJets","input jet key"};
 	
-    SG::WriteHandleKey<xAOD::TauJetContainer> m_tauOutputContainer{this,"Key_tauOutputContainer","tmp_TauJets","output tau data key"};
-	SG::WriteHandleKey<xAOD::TauTrackContainer> m_tauTrackOutputContainer{this,"Key_tauTrackOutputContainer","TauTracks","output tau tracks data key"};
-	SG::WriteHandleKey<xAOD::CaloClusterContainer> m_tauShotClusOutputContainer{this,"Key_tauShotClusOutputContainer", "TauShotClusters", "tau shot clusters out key"};
-	SG::WriteHandleKey<xAOD::PFOContainer> m_tauShotPFOOutputContainer{this,"Key_tauShotPFOOutputContainer", "TauShotParticleFlowObjects", "tau pfo out key"};
-	SG::WriteHandleKey<CaloCellContainer> m_tauPi0CellOutputContainer{this,"Key_tauPi0CellOutputContainer","TauCommonPi0Cells","output calo cell key"};
+  SG::WriteHandleKey<xAOD::TauJetContainer> m_tauOutputContainer{this,"Key_tauOutputContainer","tmp_TauJets","output tau data key"};
+  SG::WriteHandleKey<xAOD::TauTrackContainer> m_tauTrackOutputContainer{this,"Key_tauTrackOutputContainer","TauTracks","output tau tracks data key"};
+  SG::WriteHandleKey<xAOD::CaloClusterContainer> m_tauShotClusOutputContainer{this,"Key_tauShotClusOutputContainer", "TauShotClusters", "tau shot clusters out key"};
+  SG::WriteHandleKey<xAOD::PFOContainer> m_tauShotPFOOutputContainer{this,"Key_tauShotPFOOutputContainer", "TauShotParticleFlowObjects", "tau pfo out key"};
+  SG::WriteHandleKey<CaloCellContainer> m_tauPi0CellOutputContainer{this,"Key_tauPi0CellOutputContainer","TauCommonPi0Cells","output calo cell key"};
     
-    const CaloCell_ID* m_cellID;
+  const CaloCell_ID* m_cellID;
     
-    // These are needed to read ESD and AOD in AthenaMT for P->T conversion of ID tracks.
-    SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_pixelDetEleCollKey{this, "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"};
-    SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_SCTDetEleCollKey{this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"};
-    SG::ReadCondHandleKey<InDetDD::TRT_DetElementContainer> m_trtDetEleContKey{this, "TRTDetEleContKey", "TRT_DetElementContainer", "Key of TRT_DetElementContainer"}; 
+  // These are needed to read ESD and AOD in AthenaMT for P->T conversion of ID tracks.
+  SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_pixelDetEleCollKey{this, "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"};
+  SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_SCTDetEleCollKey{this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"};
+  SG::ReadCondHandleKey<InDetDD::TRT_DetElementContainer> m_trtDetEleContKey{this, "TRTDetEleContKey", "TRT_DetElementContainer", "Key of TRT_DetElementContainer"}; 
 
 };
 
diff --git a/Reconstruction/tauRecTools/Root/CaloClusterVariables.cxx b/Reconstruction/tauRecTools/Root/CaloClusterVariables.cxx
index adb2157ab41d890cc2a5eb79c889ae8fd3bd4144..166f13a549db40f77f9f7aefc32250807c6212b1 100644
--- a/Reconstruction/tauRecTools/Root/CaloClusterVariables.cxx
+++ b/Reconstruction/tauRecTools/Root/CaloClusterVariables.cxx
@@ -44,7 +44,7 @@ bool CaloClusterVariables::update(const xAOD::TauJet& pTau, const ToolHandle<ITa
 
     std::vector<TLorentzVector> clusterP4Vector;
     for (const xAOD::CaloCluster* cluster : clusterList) {
-      TLorentzVector clusterP4 = tauVertexCorrection->getVertexCorrectedP4(cluster, tauVertex, jetVertex);
+      TLorentzVector clusterP4 = tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex);
       clusterP4Vector.push_back(clusterP4);
     }
 
diff --git a/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx b/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx
index 07f56f54b07732ea0925ccdcf26b7cc4b2be7b89..292e8e2fc3a90fce14eb49699f4a05a1ccbcd9ae 100644
--- a/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx
+++ b/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx
@@ -98,7 +98,7 @@ StatusCode MvaTESVariableDecorator::execute(xAOD::TauJet& xTau) const {
 
   // Loop through clusters and jet constituents
   for (const xAOD::CaloCluster* cluster : clusterList){
-    TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(cluster, tauVertex, jetVertex);
+    TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex);
   
     if (clusterP4.DeltaR(tauAxis) > 0.2) continue;
 
diff --git a/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx b/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx
index 614cfe0d6232e5af291f86321a045e255999a45b..6df31f25c0a60e67ceec2290f361eaebfee63204 100644
--- a/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx
+++ b/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx
@@ -102,7 +102,7 @@ StatusCode TauIDVarCalculator::execute(xAOD::TauJet& tau) const
   float eHad1AtEMScaleFixed = 0.;
 
   for (const xAOD::CaloCluster* cluster  : clusterList) {
-    TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(cluster, tauVertex, jetVertex);
+    TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex);
     
     if( tauAxis.DeltaR(clusterP4) > 0.2 ) continue;
     
diff --git a/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx b/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx
index 82ac97fe9ca8d85ada5d3214988e7653b392ee12..e5ca38e7aa873a7dd34fe7a615117422dfb62c13 100644
--- a/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx
+++ b/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx
@@ -200,7 +200,7 @@ StatusCode TauJetRNNEvaluator::get_clusters(
     auto cItr = clusters.begin();
     while( cItr != clusters.end() ){
       const xAOD::CaloCluster* cluster = (*cItr);
-      TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(cluster, tauVertex, jetVertex);
+      TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex);
 
       if (tauAxis.DeltaR(clusterP4) > m_max_cluster_dr) {
         clusters.erase(cItr);
diff --git a/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx b/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx
index 685066fad69e374a385c6c52c0988402de649853..317104d80a8167035e75727cdaefc3b20fafdd50 100644
--- a/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx
+++ b/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx
@@ -3,6 +3,7 @@
 */
 
 #include "tauRecTools/TauJetRNNUtils.h"
+#include "tauRecTools/HelperFunctions.h"
 
 #define GeV 1000
 
@@ -115,6 +116,18 @@ std::unique_ptr<VarCalc> get_default_calculator() {
     calc->insert("pt", Variables::pt);
     calc->insert("ptDetectorAxis", Variables::ptDetectorAxis);
     calc->insert("ptIntermediateAxis", Variables::ptIntermediateAxis);
+    //---added for the eVeto
+    calc->insert("ptJetSeed_log",              Variables::ptJetSeed_log  );
+    calc->insert("absleadTrackEta",            Variables::absleadTrackEta  );
+    calc->insert("leadTrackDeltaEta",          Variables::leadTrackDeltaEta);
+    calc->insert("leadTrackDeltaPhi",          Variables::leadTrackDeltaPhi);
+    calc->insert("EMFracFixed",                Variables::EMFracFixed      );
+    calc->insert("etHotShotWinOverPtLeadTrk",  Variables::etHotShotWinOverPtLeadTrk);
+    calc->insert("hadLeakFracFixed",           Variables::hadLeakFracFixed);
+    calc->insert("PSFrac",                     Variables::PSFrac);
+    calc->insert("ClustersMeanCenterLambda",   Variables::ClustersMeanCenterLambda  );
+    calc->insert("ClustersMeanFirstEngDens",   Variables::ClustersMeanFirstEngDens  );
+    calc->insert("ClustersMeanPresamplerFrac", Variables::ClustersMeanPresamplerFrac);
 
     // Track variable calculator functions
     calc->insert("pt_log", Variables::Track::pt_log);
@@ -129,6 +142,7 @@ std::unique_ptr<VarCalc> get_default_calculator() {
     calc->insert("nIBLHitsAndExp", Variables::Track::nIBLHitsAndExp);
     calc->insert("nPixelHitsPlusDeadSensors", Variables::Track::nPixelHitsPlusDeadSensors);
     calc->insert("nSCTHitsPlusDeadSensors", Variables::Track::nSCTHitsPlusDeadSensors);
+    calc->insert("eProbabilityHT", Variables::Track::eProbabilityHT);
 
     // Cluster variable calculator functions
     calc->insert("et_log", Variables::Cluster::et_log);
@@ -138,7 +152,10 @@ std::unique_ptr<VarCalc> get_default_calculator() {
     calc->insert("SECOND_R", Variables::Cluster::SECOND_R);
     calc->insert("SECOND_LAMBDA", Variables::Cluster::SECOND_LAMBDA);
     calc->insert("CENTER_LAMBDA", Variables::Cluster::CENTER_LAMBDA);
-
+    //---added for the eVeto
+    calc->insert("SECOND_LAMBDAOverClustersMeanSecondLambda", Variables::Cluster::SECOND_LAMBDAOverClustersMeanSecondLambda);
+    calc->insert("CENTER_LAMBDAOverClustersMeanCenterLambda", Variables::Cluster::CENTER_LAMBDAOverClustersMeanCenterLambda);
+    calc->insert("FirstEngDensOverClustersMeanFirstEngDens" , Variables::Cluster::FirstEngDensOverClustersMeanFirstEngDens);
     return calc;
 }
 
@@ -157,7 +174,7 @@ bool etOverPtLeadTrk(const xAOD::TauJet &tau, double &out) {
     float etOverPtLeadTrk;
     const auto success = tau.detail(TauDetail::etOverPtLeadTrk,
                                     etOverPtLeadTrk);
-    out = TMath::Log10(std::max(etOverPtLeadTrk, 0.1f));
+    out = std::log10(std::max(etOverPtLeadTrk, 0.1f));
     return success;
 }
 
@@ -186,7 +203,7 @@ bool SumPtTrkFrac(const xAOD::TauJet &tau, double &out) {
 bool EMPOverTrkSysP(const xAOD::TauJet &tau, double &out) {
     float EMPOverTrkSysP;
     const auto success = tau.detail(TauDetail::EMPOverTrkSysP, EMPOverTrkSysP);
-    out = TMath::Log10(std::max(EMPOverTrkSysP, 1e-3f));
+    out = std::log10(std::max(EMPOverTrkSysP, 1e-3f));
     return success;
 }
 
@@ -201,7 +218,7 @@ bool ptRatioEflowApprox(const xAOD::TauJet &tau, double &out) {
 bool mEflowApprox(const xAOD::TauJet &tau, double &out) {
     float mEflowApprox;
     const auto success = tau.detail(TauDetail::mEflowApprox, mEflowApprox);
-    out = TMath::Log10(std::max(mEflowApprox, 140.0f));
+    out = std::log10(std::max(mEflowApprox, 140.0f));
     return success;
 }
 
@@ -216,56 +233,140 @@ bool trFlightPathSig(const xAOD::TauJet &tau, double &out) {
     float trFlightPathSig;
     const auto success = tau.detail(TauDetail::trFlightPathSig,
                                     trFlightPathSig);
-    out = TMath::Log10(std::max(trFlightPathSig, 0.01f));
+    out = std::log10(std::max(trFlightPathSig, 0.01f));
     return success;
 }
 
 bool massTrkSys(const xAOD::TauJet &tau, double &out) {
     float massTrkSys;
     const auto success = tau.detail(TauDetail::massTrkSys, massTrkSys);
-    out = TMath::Log10(std::max(massTrkSys, 140.0f));
+    out = std::log10(std::max(massTrkSys, 140.0f));
     return success;
 }
 
 bool pt(const xAOD::TauJet &tau, double &out) {
-    out = TMath::Log10(std::min(tau.pt() / GeV, 100.0));
+    out = std::log10(std::min(tau.pt() / GeV, 100.0));
     return true;
 }
 
 bool ptDetectorAxis(const xAOD::TauJet &tau, double &out) {
-    out = TMath::Log10(std::min(tau.ptDetectorAxis() / GeV, 100.0));
+    out = std::log10(std::min(tau.ptDetectorAxis() / GeV, 100.0));
     return true;
 }
 
 bool ptIntermediateAxis(const xAOD::TauJet &tau, double &out) {
-    out = TMath::Log10(std::min(tau.ptIntermediateAxis() /GeV, 100.0));
+    out = std::log10(std::min(tau.ptIntermediateAxis() /GeV, 100.0));
     return true;
 }
 
+bool ptJetSeed_log(const xAOD::TauJet &tau, double &out) {
+  out = std::log10(std::max(tau.ptJetSeed(), 1e-3));
+  return true;
+}
+
+bool absleadTrackEta(const xAOD::TauJet &tau, double &out){
+  out = std::max(0.f, tau.auxdata<float>("ABS_ETA_LEAD_TRACK"));
+  return true;
+}
+
+bool leadTrackDeltaEta(const xAOD::TauJet &tau, double &out){
+  out = std::max(0.f, tau.auxdata<float>("TAU_ABSDELTAETA"));
+  return true;
+}
+
+bool leadTrackDeltaPhi(const xAOD::TauJet &tau, double &out){
+  out = std::max(0.f, tau.auxdata<float>("TAU_ABSDELTAPHI"));
+  return true;
+}
+
+bool EMFracFixed(const xAOD::TauJet &tau, double &out){
+  float emFracFized = tau.auxdata<float>("EMFracFixed");
+  out = std::max(emFracFized, 0.0f);
+  return true;
+}
+
+bool etHotShotWinOverPtLeadTrk(const xAOD::TauJet &tau, double &out){
+  float etHotShotWinOverPtLeadTrk = tau.auxdata<float>("etHotShotWinOverPtLeadTrk");
+  out = std::max(etHotShotWinOverPtLeadTrk, 1e-6f);
+  out = std::log10(out);
+  return true;
+}
+
+bool hadLeakFracFixed(const xAOD::TauJet &tau, double &out){
+  float hadLeakFracFixed = tau.auxdata<float>("hadLeakFracFixed");
+  out = std::max(0.f, hadLeakFracFixed);
+  return true;
+}
+
+bool PSFrac(const xAOD::TauJet &tau, double &out){
+  float PSFrac;
+  const auto success = tau.detail(TauDetail::PSSFraction, PSFrac);
+  out = std::max(0.f,PSFrac);
+  
+  return success;
+}
+
+bool ClustersMeanCenterLambda(const xAOD::TauJet &tau, double &out){
+  float ClustersMeanCenterLambda;
+  const auto success = tau.detail(TauDetail::ClustersMeanCenterLambda, ClustersMeanCenterLambda);
+  out = std::max(0.f, ClustersMeanCenterLambda);
+
+  return success;
+}
+
+bool ClustersMeanEMProbability(const xAOD::TauJet &tau, double &out){
+  float ClustersMeanEMProbability;
+  const auto success = tau.detail(TauDetail::ClustersMeanEMProbability, ClustersMeanEMProbability);
+  out = std::max(0.f, ClustersMeanEMProbability);
+  return success;
+}
+
+bool ClustersMeanFirstEngDens(const xAOD::TauJet &tau, double &out){
+  float ClustersMeanFirstEngDens;
+  const auto success = tau.detail(TauDetail::ClustersMeanFirstEngDens, ClustersMeanFirstEngDens);
+  out =  std::max(-10.f, ClustersMeanFirstEngDens);
+  return success;
+}
+
+bool ClustersMeanPresamplerFrac(const xAOD::TauJet &tau, double &out){
+  float ClustersMeanPresamplerFrac;
+  const auto success = tau.detail(TauDetail::ClustersMeanPresamplerFrac, ClustersMeanPresamplerFrac);
+  out = std::max(0.f, ClustersMeanPresamplerFrac);
+
+  return success;
+}
+
+bool ClustersMeanSecondLambda(const xAOD::TauJet &tau, double &out){
+  float ClustersMeanSecondLambda;
+  const auto success = tau.detail(TauDetail::ClustersMeanSecondLambda, ClustersMeanSecondLambda);
+  out = std::max(0.f, ClustersMeanSecondLambda);
+
+  return success;
+}
 
 namespace Track {
 
 bool pt_log(const xAOD::TauJet& /*tau*/, const xAOD::TauTrack &track,
             double &out) {
-    out = TMath::Log10(track.pt());
+    out = std::log10(track.pt());
     return true;
 }
 
 bool pt_jetseed_log(const xAOD::TauJet &tau, const xAOD::TauTrack& /*track*/,
                     double &out) {
-    out = TMath::Log10(tau.ptJetSeed());
+    out = std::log10(tau.ptJetSeed());
     return true;
 }
 
 bool d0_abs_log(const xAOD::TauJet& /*tau*/, const xAOD::TauTrack &track,
                 double &out) {
-    out = TMath::Log10(TMath::Abs(track.track()->d0()) + 1e-6);
+    out = std::log10(TMath::Abs(track.track()->d0()) + 1e-6);
     return true;
 }
 
 bool z0sinThetaTJVA_abs_log(const xAOD::TauJet& tau, const xAOD::TauTrack &track,
                             double &out) {
-    out = TMath::Log10(TMath::Abs(track.z0sinThetaTJVA(tau)) + 1e-6);
+    out = std::log10(TMath::Abs(track.z0sinThetaTJVA(tau)) + 1e-6);
     return true;
 }
 
@@ -334,6 +435,16 @@ bool nSCTHitsPlusDeadSensors(const xAOD::TauJet& /*tau*/, const xAOD::TauTrack &
     return success1 && success2;
 }
 
+bool eProbabilityHT(const xAOD::TauJet& /*tau*/, const xAOD::TauTrack &track,
+		    double &out) {
+
+    float tracksEProbabilityHT;
+    const auto success =  track.track()->summaryValue( tracksEProbabilityHT, 
+						       xAOD::eProbabilityHT);
+    out = tracksEProbabilityHT;
+    return success;
+}
+
 } // namespace Track
 
 
@@ -342,13 +453,13 @@ using MomentType = xAOD::CaloCluster::MomentType;
 
 bool et_log(const xAOD::TauJet& /*tau*/, const xAOD::CaloCluster &cluster,
             double &out) {
-    out = TMath::Log10(cluster.et());
+    out = std::log10(cluster.et());
     return true;
 }
 
 bool pt_jetseed_log(const xAOD::TauJet &tau, const xAOD::CaloCluster& /*cluster*/,
                     double &out) {
-    out = TMath::Log10(tau.ptJetSeed());
+    out = std::log10(tau.ptJetSeed());
     return true;
 }
 
@@ -367,24 +478,97 @@ bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster,
 bool SECOND_R(const xAOD::TauJet& /*tau*/, const xAOD::CaloCluster &cluster,
               double &out) {
     const auto success = cluster.retrieveMoment(MomentType::SECOND_R, out);
-    out = TMath::Log10(out + 0.1);
+    out = std::log10(out + 0.1);
     return success;
 }
 
 bool SECOND_LAMBDA(const xAOD::TauJet& /*tau*/, const xAOD::CaloCluster &cluster,
                    double &out) {
     const auto success = cluster.retrieveMoment(MomentType::SECOND_LAMBDA, out);
-    out = TMath::Log10(out + 0.1);
+    out = std::log10(out + 0.1);
     return success;
 }
 
 bool CENTER_LAMBDA(const xAOD::TauJet& /*tau*/, const xAOD::CaloCluster &cluster,
                    double &out) {
     const auto success = cluster.retrieveMoment(MomentType::CENTER_LAMBDA, out);
-    out = TMath::Log10(out + 1e-6);
+    out = std::log10(out + 1e-6);
     return success;
 }
 
+bool SECOND_LAMBDAOverClustersMeanSecondLambda   (const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out){
+  float ClustersMeanSecondLambda = tau.auxdata<float>("ClustersMeanSecondLambda");
+
+  double secondLambda(0);
+  const auto success = cluster.retrieveMoment(MomentType::SECOND_LAMBDA, secondLambda);
+
+  out = secondLambda/ClustersMeanSecondLambda;
+
+  return success;
+}
+
+bool CENTER_LAMBDAOverClustersMeanCenterLambda   (const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out){
+  float ClustersMeanCenterLambda = tau.auxdata<float>("ClustersMeanCenterLambda");
+
+  double centerLambda(0);
+  const auto success = cluster.retrieveMoment(MomentType::CENTER_LAMBDA, centerLambda);
+  if (ClustersMeanCenterLambda == 0.){
+    out = 250.;
+  }else {
+    out = centerLambda/ClustersMeanCenterLambda;
+  }
+
+  out = std::min(out, 250.);
+
+  return success;
+}
+
+
+bool FirstEngDensOverClustersMeanFirstEngDens    (const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out){
+  if (!tau.jetLink().isValid()){
+    return false;
+  }
+  const xAOD::Jet *jetSeed = tau.jet();
+   
+  std::vector<const xAOD::CaloCluster *> clusters;
+  bool            incShowerSubtracted(true);
+  auto check_tauClusters = tauRecTools::GetJetClusterList(jetSeed, clusters, incShowerSubtracted);
+
+  std::size_t nClustersTotal = clusters.size();
+
+  // Number of tracks to save
+  std::size_t nClustersSave = nClustersTotal;
+  std::size_t n_clusterMax(6);
+  if (n_clusterMax > 0) {
+    nClustersSave = std::min((n_clusterMax),nClustersTotal);
+  }
+  // Sort clusters in descending et order
+  auto et_cmp = [](const xAOD::CaloCluster *lhs,
+		     const xAOD::CaloCluster *rhs) {
+    return lhs->et() > rhs->et();
+  };
+  std::sort(clusters.begin(), clusters.end(), et_cmp);
+  
+  float Etot(0.);
+  using MomentType = xAOD::CaloCluster::MomentType;
+  const xAOD::CaloCluster *cls(0);
+  for (std::size_t i = 0; i < nClustersSave; ++i) {
+    cls = clusters[i];
+
+    TLorentzVector cluster_P4 = cls->p4(xAOD::CaloCluster::State::CALIBRATED);
+    Etot += cls->calE();
+  }
+	
+  // the ClustersMeanFirstEngDens is the log10 of the energy weighted average of the First_ENG_DENS 
+  // divided by ETot to make it dimension-less, 
+  // so we need to evaluate the differance of log10(cluster_firstEngDens) and the ClustersMeanFirstEngDens
+  float min_FirstEng = 1e-10;
+  float cluster_FirstEngDens       = std::max(cluster.getMomentValue(MomentType::FIRST_ENG_DENS), (double)min_FirstEng);
+  out = std::log10(cluster_FirstEngDens/std::max(Etot, min_FirstEng)) - tau.auxdata<float>("ClustersMeanFirstEngDens");
+  
+  return true;
+}
+
 } // namespace Cluster
 } // namespace Variables
 } // namespace TauJetRNNUtils
diff --git a/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx b/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx
index 5fdc7a4936764e607faf0a4fbba5c6a07342e26c..dd0f79b48d9e9eeaa3658c6bc8166160a048b222 100644
--- a/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx
+++ b/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx
@@ -103,7 +103,7 @@ StatusCode TauSubstructureVariables::execute(xAOD::TauJet& pTau) const {
   for (auto cluster : vClusters){
     totalEnergy += cluster->e();
 		
-    TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(cluster, tauVertex, jetVertex);
+    TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex);
     dr = tauAxis.DeltaR(clusterP4);    
     
     if (0.2 <= dr && dr < 0.4) {
diff --git a/Reconstruction/tauRecTools/Root/TauTrackClassifier.cxx b/Reconstruction/tauRecTools/Root/TauTrackClassifier.cxx
index 7fd0488d019a32ceb116a4fe1f5b86fde865f384..d669aabd04fa6695c9deea0a0e6180e28b20efa4 100644
--- a/Reconstruction/tauRecTools/Root/TauTrackClassifier.cxx
+++ b/Reconstruction/tauRecTools/Root/TauTrackClassifier.cxx
@@ -112,12 +112,6 @@ TrackMVABDT::~TrackMVABDT()
 {
 }
 
-//______________________________________________________________________________
-StatusCode TrackMVABDT::finalize()
-{
-  return StatusCode::SUCCESS;
-}
-
 //______________________________________________________________________________
 StatusCode TrackMVABDT::initialize()
 {
diff --git a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx
index 7db492683bd059e9f25b3c423af2bc4dbf735f61..59a1e7c708da24654dfcd20eb4ed5fc39daac51d 100644
--- a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx
+++ b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx
@@ -81,8 +81,8 @@ StatusCode TauPi0ClusterCreator::executePi0ClusterCreator(xAOD::TauJet& pTau, xA
     
     TLorentzVector tauAxis = m_tauVertexCorrection->getTauAxis(pTau);
 
-    for (auto cluster: pPi0ClusterContainer){
-        TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(cluster, tauVertex, jetVertex);
+    for (const xAOD::CaloCluster* cluster: pPi0ClusterContainer){
+        TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex);
         
         // selection
         if (clusterP4.Pt() < m_clusterEtCut)   continue;
@@ -272,7 +272,7 @@ std::map<unsigned, xAOD::CaloCluster*> TauPi0ClusterCreator::getClusterToShotMap
 
         for (; clusterItr != clusterItrEnd; ++clusterItr){
             xAOD::CaloCluster* cluster = (xAOD::CaloCluster*) (*clusterItr);
-            TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(cluster, tauVertex, jetVertex);
+            TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex);
             
             weightInCluster=-1.;
             if (clusterP4.Et() < m_clusterEtCut) continue; // Not interested in clusters that fail the Et cut
@@ -443,14 +443,14 @@ bool TauPi0ClusterCreator::setHadronicClusterPFOs(xAOD::TauJet& pTau, xAOD::PFOC
     StatusCode sc = tauRecTools::GetJetClusterList(jetSeed, clusterList, m_incShowerSubtr);
     if (!sc) return false;
 
-    for (auto cluster : clusterList){
+    for (const xAOD::CaloCluster* cluster : clusterList){
         // Procedure: 
         // - Calculate cluster energy in Hcal. This is to treat -ve energy cells correctly
         // - Then set 4momentum via setP4(E/cosh(eta), eta, phi, m). This forces the PFO to have the correct energy and mass
         // - Ignore clusters outside 0.2 cone and those with overall negative energy or negative energy in Hcal
 
         // Don't create PFOs for clusters with overall (Ecal+Hcal) negative energy (noise)
-        TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(cluster, tauVertex, jetVertex);
+        TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex);
         
         if(clusterP4.E()<=0.) continue;
 
diff --git a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h
index 9395ffac366235f2591efde6698d5a1323ba0eec..49c3bc0da56b00c774cecf64d84f491a75a69563 100644
--- a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h
+++ b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h
@@ -69,8 +69,6 @@ private:
     Gaudi::Property<double> m_clusterEtCut {this, "ClusterEtCut", 0.5 * Gaudi::Units::GeV, "Et threshould for pi0 candidate clusters"};
     Gaudi::Property<bool> m_incShowerSubtr {this, "IncShowerSubtr", true, "use shower subtracted clusters in calo calculations"};
 
-    SG::ReadHandleKey<xAOD::CaloClusterContainer> m_pi0ClusterInputContainer{this,"Key_Pi0ClusterContainer", "TauPi0SubtractedClusters", "input pi0 cluster"};
-
     ToolHandle<ITauVertexCorrection> m_tauVertexCorrection { this, 
       "TauVertexCorrection", "TauVertexCorrection", "Tool to perform the vertex correction"};
 };
diff --git a/Reconstruction/tauRecTools/tauRecTools/MvaTESEvaluator.h b/Reconstruction/tauRecTools/tauRecTools/MvaTESEvaluator.h
index 9278fce1243eb80a241db5742d52beb12a4429c8..c1f438416a1b9cbc473c5ae931d041c33a96849d 100644
--- a/Reconstruction/tauRecTools/tauRecTools/MvaTESEvaluator.h
+++ b/Reconstruction/tauRecTools/tauRecTools/MvaTESEvaluator.h
@@ -23,7 +23,6 @@ class MvaTESEvaluator
     
   virtual StatusCode initialize() override;
   virtual StatusCode execute(xAOD::TauJet& xTau) const override;
-  virtual StatusCode finalize() override { return StatusCode::SUCCESS; }
   
  private:
   // MVA input variables (provide all variables in float)
diff --git a/Reconstruction/tauRecTools/tauRecTools/TauJetRNNUtils.h b/Reconstruction/tauRecTools/tauRecTools/TauJetRNNUtils.h
index 74ef77af82fbd92c5aacaa3ec3831cabb980d6ed..1b5b3665864c0a24705c8aa448a3030d6100acc7 100644
--- a/Reconstruction/tauRecTools/tauRecTools/TauJetRNNUtils.h
+++ b/Reconstruction/tauRecTools/tauRecTools/TauJetRNNUtils.h
@@ -105,6 +105,22 @@ bool ptDetectorAxis(const xAOD::TauJet &tau, double &out);
 
 bool ptIntermediateAxis(const xAOD::TauJet &tau, double &out);
 
+//functions to calculate input variables needed for the eVeto RNN
+bool ptJetSeed_log             (const xAOD::TauJet &tau, double &out);
+bool absleadTrackEta           (const xAOD::TauJet &tau, double &out);
+bool leadTrackDeltaEta         (const xAOD::TauJet &tau, double &out);
+bool leadTrackDeltaPhi         (const xAOD::TauJet &tau, double &out);
+bool EMFracFixed               (const xAOD::TauJet &tau, double &out);
+bool etHotShotWinOverPtLeadTrk (const xAOD::TauJet &tau, double &out);
+bool hadLeakFracFixed          (const xAOD::TauJet &tau, double &out);
+bool PSFrac                    (const xAOD::TauJet &tau, double &out);
+bool ClustersMeanCenterLambda  (const xAOD::TauJet &tau, double &out);
+bool ClustersMeanEMProbability (const xAOD::TauJet &tau, double &out);
+bool ClustersMeanFirstEngDens  (const xAOD::TauJet &tau, double &out);
+bool ClustersMeanPresamplerFrac(const xAOD::TauJet &tau, double &out);
+bool ClustersMeanSecondLambda  (const xAOD::TauJet &tau, double &out);
+bool EMPOverTrkSysP            (const xAOD::TauJet &tau, double &out);
+
 
 namespace Track {
 
@@ -148,6 +164,9 @@ bool nPixelHitsPlusDeadSensors (
 bool nSCTHitsPlusDeadSensors (
     const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out);
 
+bool eProbabilityHT(
+    const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out);
+
 } // namespace Track
 
 
@@ -177,6 +196,10 @@ bool SECOND_LAMBDA(
 bool CENTER_LAMBDA(
     const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out);
 
+bool SECOND_LAMBDAOverClustersMeanSecondLambda   (const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out);
+bool CENTER_LAMBDAOverClustersMeanCenterLambda   (const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out);
+bool FirstEngDensOverClustersMeanFirstEngDens    (const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out);
+
 } // namespace Cluster
 } // namespace Variables
 } // namespace TauJetRNNUtils
diff --git a/Reconstruction/tauRecTools/tauRecTools/TauTrackClassifier.h b/Reconstruction/tauRecTools/tauRecTools/TauTrackClassifier.h
index d578ba763a3aee57c6eca6fcaa777eb8cc5eb31f..6fbb507d49422f49955ae55e5596a66aaaa71569 100644
--- a/Reconstruction/tauRecTools/tauRecTools/TauTrackClassifier.h
+++ b/Reconstruction/tauRecTools/tauRecTools/TauTrackClassifier.h
@@ -68,7 +68,6 @@ class TrackMVABDT
   // for possible MVA inputs. Only Variables defined in the root weights file
   // are passed to the MVA object
   StatusCode initialize() override;
-  StatusCode finalize() override;
   
   // executes MVA object to get the BDT score, makes the decision and resets
   // classification flags
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/src/PunchThroughTool.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/src/PunchThroughTool.cxx
index 36bf78563c3fc063f1e2bab8a483715e84524d33..f75ac5915aa3da3b0317b3c887c7df7cdd69c1d2 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/src/PunchThroughTool.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/src/PunchThroughTool.cxx
@@ -263,8 +263,8 @@ StatusCode ISF::PunchThroughTool::initialize()
 
   // get the calo-MS border coordinates. Look at calo and MS geometry definitions, if same R and Z -> boundary surface
 
-  RZPairVector* rzMS = &(m_envDefSvc->getMuonRZValues());
-  RZPairVector* rzCalo = &(m_envDefSvc->getCaloRZValues());
+  const RZPairVector* rzMS = &(m_envDefSvc->getMuonRZBoundary());
+  const RZPairVector* rzCalo = &(m_envDefSvc->getCaloRZBoundary());
 
   bool found1, found2;
   found1=false; found2=false;
diff --git a/Simulation/Overlay/OverlayConfiguration/test/OverlayMetadataConfig_test.py b/Simulation/Overlay/OverlayConfiguration/test/OverlayMetadataConfig_test.py
index 8e3740ede83999b3cc29c8fcd816a8394418ebe8..c71c2ef052e0e615514b91c672879be9cb96f5df 100755
--- a/Simulation/Overlay/OverlayConfiguration/test/OverlayMetadataConfig_test.py
+++ b/Simulation/Overlay/OverlayConfiguration/test/OverlayMetadataConfig_test.py
@@ -25,7 +25,8 @@ args = parser.parse_args()
 defaultTestFlags(ConfigFlags, args)
 overlayMetadataCheck(ConfigFlags)
 postprocessAndLockFlags(ConfigFlags, args)
-
+ConfigFlags.initAll()
+ConfigFlags.dump()
 # Construct our accumulator to run
 acc = MainServicesCfg(ConfigFlags)
 acc.merge(PoolReadCfg(ConfigFlags))
diff --git a/Tools/PyJobTransforms/python/trfArgs.py b/Tools/PyJobTransforms/python/trfArgs.py
index 854fd04b7382791eab85131bc15ddb1aa0a76f09..b4c94be325b781520b830dd2b5a68506c39e653c 100644
--- a/Tools/PyJobTransforms/python/trfArgs.py
+++ b/Tools/PyJobTransforms/python/trfArgs.py
@@ -16,7 +16,8 @@ from PyJobTransforms.trfLogger import stdLogLevels
 
 ## Add standard transform arguments to an argparse ArgumentParser
 def addStandardTrfArgs(parser):
-    parser.add_argument('--CA', action='store_true', help='Use ComponentAccumulator base configuration')
+    parser.add_argument('--CA', type=argFactory(trfArgClasses.argSubstepBool, runarg=False), nargs='?',
+                        help='Use ComponentAccumulator base configuration')
     parser.add_argument('--verbose', '--debug', action='store_true', help='Set transform loglevel to DEBUG')
     parser.add_argument('--loglevel', choices=list(stdLogLevels), help='Set transform logging level')
     parser.add_argument('--argJSON', '--argjson', metavar='FILE', help='File containing JSON serialised argument dictionary')
diff --git a/Tools/PyJobTransforms/python/trfExe.py b/Tools/PyJobTransforms/python/trfExe.py
index 05a017c984d9c86e14e3b400097def28d66653aa..8c961cee0bf7f0232112c79c05e92e5eb8da345a 100755
--- a/Tools/PyJobTransforms/python/trfExe.py
+++ b/Tools/PyJobTransforms/python/trfExe.py
@@ -1205,6 +1205,22 @@ class athenaExecutor(scriptExecutor):
         self._valStop = os.times()
         msg.debug('valStop time is {0}'.format(self._valStop))
 
+    ## @brief Check if running with CA
+    def _isCAEnabled(self):
+        # CA not present, not running with CA
+        if 'CA' not in self.conf.argdict:
+            return False
+
+        # CA present but None, all substeps running with CA
+        if self.conf.argdict['CA'] is None:
+            return True
+
+        # CA enabled for a substep, running with CA
+        if self.conf.argdict['CA'].returnMyValue(name=self.name, substep=self.substep) is True:
+            return True
+
+        return False
+
     ## @brief Prepare the correct command line to be used to invoke athena
     def _prepAthenaCommandLine(self):
         ## Start building up the command line
@@ -1307,7 +1323,7 @@ class athenaExecutor(scriptExecutor):
                 self._cmd.append('--nprocs=%s' % str(self._athenaMP))
 
         #Switch to ComponentAccumulator based config if requested
-        if 'CA' in self.conf.argdict:
+        if self._isCAEnabled():
             self._cmd.append("--CA")
 
         # Add topoptions
diff --git a/Tools/PyJobTransforms/python/trfJobOptions.py b/Tools/PyJobTransforms/python/trfJobOptions.py
index 624f3dffb610374d1a8dca14e5bd1fa2ecb39cfa..e5f437839e648afcd2f5556b20fa7ffa1343f460 100644
--- a/Tools/PyJobTransforms/python/trfJobOptions.py
+++ b/Tools/PyJobTransforms/python/trfJobOptions.py
@@ -58,12 +58,12 @@ class JobOptionsTemplate(object):
         msg.info('Writing runArgs to file \"%s\"', self._runArgsFile)
 
         ## Check consistency btw --CA flag and provided skeletons:
-        if 'CA' in self._exe.conf.argdict:
+        if self._exe._isCAEnabled():
             if self._exe._skeletonCA is None:
                 errMsg = "Got the --CA option but this transform doesn't supply a ComponentAccumulator-based skeleton file"
                 msg.error(errMsg)
                 raise  trfExceptions.TransformExecutionException(trfExit.nameToCode('TRF_EXEC_RUNARGS_ERROR'),errMsg)
-        else: # 'CA' not in self._exe.conf.argdict
+        else: # not self._exe._isCAEnabled():
             if self._exe._skeleton is None:
                 errMsg = "No --CA option given, but this transform doesn't supply old-style skeleton file"
                 msg.error(errMsg)
@@ -203,7 +203,7 @@ class JobOptionsTemplate(object):
                             raise trfExceptions.TransformExecutionException(trfExit.nameToCode("TRF_EXEC_RUNARGS_ERROR"), "Failed to find file: {0} required by athenaMP option: --athenaMPUseEventOrders true".format(self._exe._athenaMPEventOrdersFile))
                     if 'athenaMPEventsBeforeFork' in self._exe.conf.argdict:
                         print('AthenaMPJobProps.AthenaMPFlags.EventsBeforeFork={0}'.format(self._exe.conf.argdict['athenaMPEventsBeforeFork'].value), file=runargsFile)
-                if 'CA' in self._exe.conf.argdict:
+                if self._exe._isCAEnabled():
                     print(os.linesep, '# Threading flags', file=runargsFile)
                     #Pass the number of threads
                     threads = self._exe._athenaMT
@@ -251,7 +251,7 @@ class JobOptionsTemplate(object):
         self.writeRunArgs(input = input, output = output)
         # Make sure runArgs and skeleton are valid
         self.ensureJobOptions()
-        if 'CA' in self._exe.conf.argdict:
+        if self._exe._isCAEnabled():
             #ComponentAccumulator based config, use only runargs file
             return [ self._runArgsFile ]
         else:
diff --git a/Tools/PyJobTransforms/scripts/HelloWorld_tf.py b/Tools/PyJobTransforms/scripts/HelloWorld_tf.py
index caa2a6afff4b2c79c6b9fd18909a836f1d23ba83..24a55b0b2a045f2e75c232845921b20ad16f192c 100755
--- a/Tools/PyJobTransforms/scripts/HelloWorld_tf.py
+++ b/Tools/PyJobTransforms/scripts/HelloWorld_tf.py
@@ -33,6 +33,7 @@ def main():
 ## Get the base transform with all arguments added
 def getTransform():
     trf = transform(executor = athenaExecutor(name = 'athena', 
+                                              substep='HelloWorld',
                                               skeletonFile=None,
                                               skeletonCA="PyJobTransforms.HelloWorldSkeleton"))
     addAthenaArguments(trf.parser)
diff --git a/Tools/PyJobTransforms/test/test_HelloWorldTrf.sh b/Tools/PyJobTransforms/test/test_HelloWorldTrf.sh
index f5f19a3993001ca00d64d842dd9b831f10c13a41..989703b84fb3081e8da2dd58237c54d63bd5d0c4 100755
--- a/Tools/PyJobTransforms/test/test_HelloWorldTrf.sh
+++ b/Tools/PyJobTransforms/test/test_HelloWorldTrf.sh
@@ -19,3 +19,13 @@ ATHENA_CORE_NUMBER=2 HelloWorld_tf.py --maxEvents=5 --CA --multithreaded
 
 grep 'runArgs.threads = 2' runargs.athena.py
 grep 'runArgs.concurrentEvents = 2' runargs.athena.py
+
+# CA arg test 1
+HelloWorld_tf.py --maxEvents=5 --CA HelloWorld:True
+
+# CA arg test 2
+set +e
+
+if HelloWorld_tf.py --maxEvents=5; then
+  exit 1
+fi
diff --git a/Tools/PyUtils/bin/checkxAOD.py b/Tools/PyUtils/bin/checkxAOD.py
index c694d0a0bcd59f35ab836410a45c3de32c8f8af3..39a718b689185dfb9f3c62ddfc1a9a0991dfd05d 100755
--- a/Tools/PyUtils/bin/checkxAOD.py
+++ b/Tools/PyUtils/bin/checkxAOD.py
@@ -36,7 +36,6 @@ if __name__ == "__main__":
        help = "Output CSV file name, to use with spreadsheets" )
     ( options, args ) = parser.parse_args()
 
-    # Set up categorization matching strings:
     # Set up categorization matching strings:
     categoryStrings = {
         "MetaData" : ["^DataHeader", "(.*)_mems$", "(.*)_timings$", "^Token$", "^RawInfoSummaryForTag$", "^index_ref$"],
@@ -49,10 +48,11 @@ if __name__ == "__main__":
         "Muon"     : ["^Muon", "^TileMuObj", "^MS", "^SlowMuons", "^Staus", "(.*)MuonTrackParticles$", "MUCTPI_RDO", "^RPC", "^TGC", "^MDT", "^CSC", ".*MuonMeasurements$", "^ExtrapolatedMuonTracks", "^CombinedMuonTracks", "^NCB_MuonSegments"],
         "BTag"     : ["^BTag"],
         "InDet"    : ["^InDet", "^PrimaryVertices", "^ComTime_TRT", "^Pixel", "^TRT", "^SCT", "^BCM", "^CTP", "^Tracks", "^ResolvedForwardTracks", "^SplitClusterAmbiguityMap"],
-        "Jet"      : ["^CamKt", "^AntiKt", "^Jet","^LCOriginTopoClusters","^EMOriginTopoClusters"],
+        "Jet"      : ["^CamKt", "^AntiKt", "^Jet(?!.*ParticleFlowObjects$)","^LCOriginTopoClusters","^EMOriginTopoClusters"],
         "CaloTopo" : ["CaloCalTopoCluster"],
         "Calo"     : ["^LAr", "^AllCalo", "^AODCellContainer", "^MBTSContainer", "^CaloCompactCellContainer", "^E4prContainer", "^TileCellVec", "^TileDigits"],
-        "Truth"    : ["^Truth", "Truth$", "TruthMap$", "TruthCollection$", "^PRD_MultiTruth", "TracksTruth$", ".*TrackTruth$", "TrackTruthCollection"]
+        "Truth"    : ["^Truth", "Truth$", "TruthMap$", "TruthCollection$", "^PRD_MultiTruth", "TracksTruth$", ".*TrackTruth$", "TrackTruthCollection"],
+        "AFP"      : ["^AFP"]
         }
     
     fileNames = []
diff --git a/Tools/PyUtils/python/Helpers.py b/Tools/PyUtils/python/Helpers.py
index 3bb6d39c358ef9452a7a2df7b5b62e53944c6b4a..372334917715f101956307186284cba19ed1bce9 100644
--- a/Tools/PyUtils/python/Helpers.py
+++ b/Tools/PyUtils/python/Helpers.py
@@ -4,52 +4,53 @@
 # @date:   March 2007
 #
 #
-from __future__ import with_statement, print_function
-
-__author__  = "Sebastien Binet <binet@cern.ch>"
 
 import sys
 import os
-import six
 
 from AthenaCommon.Logging import log
 
-# import xml before ROOT to prevent crashes (LCG_96): ATEAM-597
-# should be OK to remove from LCG_97 on
-import xml.etree.cElementTree  # noqa: F401
-
-def ROOT6Setup():
+def ROOT6Setup(batch=False):
    log.info('executing ROOT6Setup')
-   if six.PY3:
-      import builtins as builtin_mod
-   else:
-      import __builtin__ as builtin_mod
+   import builtins as builtin_mod
    oldimporthook = builtin_mod.__import__
    autoload_var_name = 'ROOT6_NamespaceAutoloadHook'
-   
-   def root6_importhook(name, globals={}, locals={}, fromlist=[], level=-1):
-       if six.PY3 and level < 0: level = 0
+   batch_mode = bool(batch)
+
+   def root6_importhook(name, globals={}, locals={}, fromlist=[], level=0):
+       nonlocal batch_mode
+       isroot = False
+       bm = batch_mode
+       if name=='ROOT' or (name[0:4]=='ROOT' and name!='ROOT.pythonization'):
+          isroot = True
+          batch_mode = None  # only set it on first ROOT import
+
        m = oldimporthook(name, globals, locals, fromlist, level)
-       if m and (m.__name__== 'ROOT' or name[0:4]=='ROOT') \
-             and (name!='ROOT' or fromlist is not None): # prevent triggering on just 'import ROOT'; see ATEAM-597
-          log.debug('Python import module=%s  fromlist=%s', name, str(fromlist))
+
+       if m and isroot:
+          log.debug('Python import module=%s, fromlist=%s', name, fromlist)
+          if bm is not None:
+             log.debug('Setting ROOT batch mode to %s', bm)
+             m.gROOT.SetBatch(bm)
+
           if fromlist:
-             #MN: in this case 'm' is the final nested module already, don't walk the full 'name'
+             # in this case 'm' is the final nested module already, don't walk the full 'name'
              vars = [ '.'.join(['', fl, autoload_var_name]) for fl in fromlist]
           else:
              vars = [ '.'.join([name, autoload_var_name]) ]
+
           for v in vars:
              try:
                 mm = m
-                #MN: walk the module chain and try to touch 'autoload_var_name' to trigger ROOT autoloading of namespaces
+                # walk the module chain and try to touch 'autoload_var_name' to trigger ROOT autoloading of namespaces
                 for comp in v.split('.')[1:]:
                    mm = getattr(mm, comp)
              except Exception:
                 pass
+
        return m
-   
+
    builtin_mod.__import__ = root6_importhook
-      
 
 
 import re
@@ -116,8 +117,7 @@ class ShutUp(object):
     def __filterRootMessages(self, fd):
         fd.seek(0)
         for l in fd.readlines():
-            if six.PY3:
-               l = l.decode()
+            l = l.decode()
             printOut = True
             for filter in self.filters:
                 if re.match(filter, l):
diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilder.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilder.cxx
index dc1188ec97cc62f007a71250d6aa8da84bf59655..1681a09595f823a3ab80bef7fbe723307dcf390e 100644
--- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilder.cxx
+++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilder.cxx
@@ -111,25 +111,22 @@ const Trk::TrackingGeometry* Trk::GenericGeometryBuilder::trackingGeometry(const
     // vacuum
     Trk::Material vacuum;
     
-    RZPairVector envelopeDefs;  
-    // build the inner detector if configured
-    if (m_geometrySignature == Trk::ID){
-        // get the dimensions from the envelope service 
-        envelopeDefs = m_enclosingEnvelopeSvc->getInDetRZValues();
-        ATH_MSG_VERBOSE("       -> retrieved Inner Detector envelope definitions at size " << envelopeDefs.size());
-    } else if ( m_geometrySignature == Trk::Calo  ){
-        // get the dimensions from the envelope service 
-        envelopeDefs = m_enclosingEnvelopeSvc->getCaloRZValues();
-        ATH_MSG_VERBOSE("       -> retrieved Calorimeter envelope definitions at size " << envelopeDefs.size());
-    } else if ( m_geometrySignature == Trk::MS ) {
-        // get the dimensions from the envelope service 
-        envelopeDefs = m_enclosingEnvelopeSvc->getMuonRZValues();
-        ATH_MSG_VERBOSE("       -> retrieved Muon System envelope definitions at size " << envelopeDefs.size());
-    } else {
-        ATH_MSG_WARNING("No geometry signature found, return 0.");
-        return 0;
+    const std::map<int,AtlasDetDescr::AtlasRegion> trk2DetDesc{
+      {Trk::ID,AtlasDetDescr::fAtlasID},
+      {Trk::Calo,AtlasDetDescr::fAtlasCalo},
+      {Trk::MS,AtlasDetDescr::fAtlasMS}
+    };
+
+    const auto addId=trk2DetDesc.find(m_geometrySignature);
+    if (addId==trk2DetDesc.end()) {
+      ATH_MSG_WARNING("No geometry signature found, return 0.");
+      //dummy infinite range
+      EventIDRange range;
+      return nullptr;
     }
 
+    const RZPairVector& envelopeDefs=m_enclosingEnvelopeSvc->getRZBoundary(addId->second);
+
     // ------------------------------- overall dimensions ----------------------------------------------
     // get the maximum extend in R
     for ( auto& rzIter : envelopeDefs){
diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilderCond.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilderCond.cxx
index f65cdef1ce26412622aa5a9a53f2284ab16266c7..6ffd400006ea46d1f1b02e0ff7a15c206408ca3c 100644
--- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilderCond.cxx
+++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilderCond.cxx
@@ -111,27 +111,22 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Trk::GenericGeometryBuilde
     // vacuum
     Trk::Material vacuum;
     
-    RZPairVector envelopeDefs;  
-    // build the inner detector if configured
-    if (m_geometrySignature == Trk::ID){
-        // get the dimensions from the envelope service 
-        envelopeDefs = m_enclosingEnvelopeSvc->getInDetRZValues();
-        ATH_MSG_VERBOSE("       -> retrieved Inner Detector envelope definitions at size " << envelopeDefs.size());
-    } else if ( m_geometrySignature == Trk::Calo  ){
-        // get the dimensions from the envelope service 
-        envelopeDefs = m_enclosingEnvelopeSvc->getCaloRZValues();
-        ATH_MSG_VERBOSE("       -> retrieved Calorimeter envelope definitions at size " << envelopeDefs.size());
-    } else if ( m_geometrySignature == Trk::MS ) {
-        // get the dimensions from the envelope service 
-        envelopeDefs = m_enclosingEnvelopeSvc->getMuonRZValues();
-        ATH_MSG_VERBOSE("       -> retrieved Muon System envelope definitions at size " << envelopeDefs.size());
-    } else {
-        ATH_MSG_WARNING("No geometry signature found, return 0.");
-        //dummy infinite range
-        EventIDRange range;
-        return std::make_pair(range,tGeometry);
+    const std::map<int,AtlasDetDescr::AtlasRegion> trk2DetDesc{
+      {Trk::ID,AtlasDetDescr::fAtlasID},
+      {Trk::Calo,AtlasDetDescr::fAtlasCalo},
+      {Trk::MS,AtlasDetDescr::fAtlasMS}
+    };
+
+    const auto addId=trk2DetDesc.find(m_geometrySignature);
+    if (addId==trk2DetDesc.end()) {
+      ATH_MSG_WARNING("No geometry signature found, return 0.");
+      //dummy infinite range
+      EventIDRange range;
+      return std::make_pair(range,tGeometry);
     }
 
+    const RZPairVector& envelopeDefs=m_enclosingEnvelopeSvc->getRZBoundary(addId->second);
+
     // ------------------------------- overall dimensions ----------------------------------------------
     // get the maximum extend in R
     for ( auto& rzIter : envelopeDefs){
diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/CMakeLists.txt b/Tracking/TrkFitter/TrkGaussianSumFilter/CMakeLists.txt
index ddbed75050f15477daff17c495cd4040f6bde11b..8d8288fd72e6aa61493d53d922bc5ab629840e07 100644
--- a/Tracking/TrkFitter/TrkGaussianSumFilter/CMakeLists.txt
+++ b/Tracking/TrkFitter/TrkGaussianSumFilter/CMakeLists.txt
@@ -25,14 +25,19 @@ atlas_install_runtime( Data/*.par )
 #Executables for tests
 atlas_add_executable( GSF_testFindMinimumIndex
 	test/testFindMinimumIndex.cxx src/KLGaussianMixtureReduction.cxx
-        LINK_LIBRARIES CxxUtils )
+  LINK_LIBRARIES CxxUtils )
 
 atlas_add_executable( GSF_testAlignedDynArray
 	test/testAlignedDynArray.cxx)
 
 atlas_add_executable( GSF_testMergeComponents
 	test/testMergeComponents.cxx src/KLGaussianMixtureReduction.cxx
-        LINK_LIBRARIES CxxUtils )
+  LINK_LIBRARIES CxxUtils )
+
+atlas_add_executable( GSF_testFindMode
+	test/testFindMode.cxx src/MultiComponentStateModeCalculator.cxx
+  LINK_LIBRARIES CxxUtils TrkMultiComponentStateOnSurface)
+
 
 #Tests
 atlas_add_test(ut_GSF_testFindMinimumIndex
@@ -44,3 +49,6 @@ atlas_add_test(ut_GSF_testAlignedDynArray
 atlas_add_test(ut_GSF_testMergeComponents
 	SCRIPT GSF_testMergeComponents)
 
+atlas_add_test(ut_GSF_testFindMode
+	SCRIPT GSF_testFindMode)
+
diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h
index 5e29de448805524cdd7c1e21f87ea312216269fa..4d1492a70378b11d97c4ddfd5532fda0062709a8 100644
--- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h
+++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h
@@ -114,14 +114,15 @@ private:
   const MultiComponentStateOnSurface* makePerigee(
     const EventContext& ctx,
     Trk::IMultiStateExtrapolator::Cache&,
-    const SmoothedTrajectory*,
+    const SmoothedTrajectory&,
     const ParticleHypothesis particleHypothesis = nonInteracting) const;
 
   //* Calculate the fit quality */
-  const Trk::FitQuality* buildFitQuality(const Trk::SmoothedTrajectory&) const;
+  std::unique_ptr<Trk::FitQuality> buildFitQuality(
+    const Trk::SmoothedTrajectory&) const;
 
   /** Gsf smoothe trajectory*/
-  SmoothedTrajectory* fit(
+  std::unique_ptr<SmoothedTrajectory> fit(
     const EventContext& ctx,
     Trk::IMultiStateExtrapolator::Cache&,
     const ForwardTrajectory&,
@@ -137,7 +138,7 @@ private:
     const EventContext& ctx,
     const Trk::TrackStateOnSurface* currentState,
     const Trk::CaloCluster_OnTrack* ccot,
-    Trk::SmoothedTrajectory* smoothedTrajectory) const;
+    Trk::SmoothedTrajectory& smoothedTrajectory) const;
 
   /** Forward GSF fit using PrepRawData */
   std::unique_ptr<ForwardTrajectory> fitPRD(
diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialMixtureConvolution.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialMixtureConvolution.h
index 815240b3e929d9da392143ac5c1b2bef64c2e633..7eb271c1cf365e9199eb10899620fa25bb2daf72 100644
--- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialMixtureConvolution.h
+++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialMixtureConvolution.h
@@ -47,10 +47,8 @@ public:
   virtual ~GsfMaterialMixtureConvolution();
 
   //!< AlgTool initialise method
-  virtual StatusCode initialize() override;
+  virtual StatusCode initialize() override final;
 
-  //!< AlgTool finalize method
-  virtual StatusCode finalize() override;
 
   //!< Convolution with full material properties
   virtual MultiComponentState update(
diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateModeCalculator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateModeCalculator.h
index 1f1096cd9e250a0a9eae01774ce3c96147322f11..d330191b8c12f66eff9f142a5aed3a2f7abd4182 100644
--- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateModeCalculator.h
+++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateModeCalculator.h
@@ -21,9 +21,9 @@
 namespace Trk {
 namespace MultiComponentStateModeCalculator {
 
+// Simple representation of 1D component
 struct Component
 {
-  // Default ctors/dtor/assignment operators
   Component() = default;
   ~Component() = default;
   Component(const Component&) = default;
@@ -41,36 +41,14 @@ struct Component
   double sigma = 0;
 };
 
-/** @brief  Method to calculate mode*/
+/** @brief  Method to calculate mode with MultiComponentState
+ * state as input */
 std::array<double, 10>
 calculateMode(const MultiComponentState&);
 
-/**
- * method to extract the weight, mean and sigma values from the
-  multi-component state*/
-void
-fillMixture(const MultiComponentState&,
-            std::array<std::vector<Component>, 5>& mixture);
-
-/**
- * method to find the mode using the Newton-Raphson method based on a
- *   starting guess
- */
-double
-findMode(double, int, const std::array<std::vector<Component>, 5>& mixture);
-
-double
-findModeGlobal(double,
-               int,
-               const std::array<std::vector<Component>, 5>& mixture);
-
-double
-findRoot(double& result,
-         double xlo,
-         double xhi,
-         double value,
-         double i,
-         const std::array<std::vector<Component>, 5>& mixture);
+/** @brief  Method to calculate mode*/
+std::array<double, 10>
+calculateMode(const std::array<std::vector<Component>, 5>& mixture);
 
 } // namespace MultiComponentStateModeCalculator
 
diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/share/ut_GSF_testFindMode.ref b/Tracking/TrkFitter/TrkGaussianSumFilter/share/ut_GSF_testFindMode.ref
new file mode 100644
index 0000000000000000000000000000000000000000..7834719fda33d13509d62f605f803b9b18be2b9f
--- /dev/null
+++ b/Tracking/TrkFitter/TrkGaussianSumFilter/share/ut_GSF_testFindMode.ref
@@ -0,0 +1,10 @@
+-27.9078
+38.4943
+-1.0267
+2.94981
+-7.99292e-05
+0.0539087
+0.758757
+0.000448727
+0.0011341
+1.23707e-05
diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/share/ut_GSF_testMergeComponents b/Tracking/TrkFitter/TrkGaussianSumFilter/share/ut_GSF_testMergeComponents.ref
similarity index 100%
rename from Tracking/TrkFitter/TrkGaussianSumFilter/share/ut_GSF_testMergeComponents
rename to Tracking/TrkFitter/TrkGaussianSumFilter/share/ut_GSF_testMergeComponents.ref
diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx
index 63b782bfba7780e0052daea5ed6102705ef94c82..afef29f20f45ef69d7c37a7b60ecd1811255d6af 100644
--- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx
+++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx
@@ -10,10 +10,10 @@
  */
 
 #include "TrkGaussianSumFilter/GaussianSumFitter.h"
-#include "TrkGaussianSumFilter/IMultiStateExtrapolator.h"
-#include "TrkGaussianSumFilter/MultiComponentStateCombiner.h"
 #include "TrkEventUtils/MeasurementBaseComparisonFunction.h"
 #include "TrkEventUtils/PrepRawDataComparisonFunction.h"
+#include "TrkGaussianSumFilter/IMultiStateExtrapolator.h"
+#include "TrkGaussianSumFilter/MultiComponentStateCombiner.h"
 #include "TrkParameters/TrackParameters.h"
 
 #include "TrkCaloCluster_OnTrack/CaloCluster_OnTrack.h"
@@ -69,10 +69,8 @@ Trk::GaussianSumFitter::initialize()
   StatusCode sc;
   // Request the GSF extrapolator
   ATH_CHECK(m_extrapolator.retrieve());
-
   // Request the RIO_OnTrack creator
   // No need to return if RioOnTrack creator tool, only if PrepRawData is used
-  // in fit
   if (m_rioOnTrackCreator.retrieve().isFailure()) {
     if (!m_refitOnMeasurementBase) {
       ATH_MSG_FATAL("Attempting to use PrepRawData with no RIO_OnTrack creator "
@@ -83,7 +81,16 @@ Trk::GaussianSumFitter::initialize()
       "Request to retrieve the RIO_OnTrack Creator"
       << "failed but track is fit at the MeasurementBase level... Continuing!");
   }
-
+  if (m_overideMaterialEffectsSwitch) {
+    ATH_MSG_INFO("Material effects in forwards fitter have been overiden by "
+                 "jobOptions... New "
+                 "Trk::ParticleHypothesis: "
+                 << m_overideMaterialEffects);
+  }
+  if( m_maximumNumberOfComponents > 16){
+      ATH_MSG_FATAL("Requested MaximumNumberOfComponents > 16");
+      return StatusCode::FAILURE;
+  }
   // Initialise the closest track parameters search algorithm
   Amg::Vector3D referencePosition(m_sortingReferencePoint[0],
                                   m_sortingReferencePoint[1],
@@ -91,19 +98,11 @@ Trk::GaussianSumFitter::initialize()
 
   m_trkParametersComparisonFunction =
     std::make_unique<Trk::TrkParametersComparisonFunction>(referencePosition);
-
   Trk::ParticleSwitcher particleSwitcher;
   m_overideParticleHypothesis =
     particleSwitcher.particle[m_overideMaterialEffects];
-  if (m_overideMaterialEffectsSwitch) {
-    ATH_MSG_INFO("Material effects in forwards fitter have been overiden by "
-                 "jobOptions... New "
-                 "Trk::ParticleHypothesis: "
-                 << m_overideMaterialEffects);
-  }
-
   m_inputPreparator = std::make_unique<TrackFitInputPreparator>();
-  ATH_MSG_INFO("Initialisation of " << name() << " was successful");
+
   return StatusCode::SUCCESS;
 }
 
@@ -286,52 +285,42 @@ Trk::GaussianSumFitter::fit(
   Trk::IMultiStateExtrapolator::Cache extrapolatorCache;
 
   // Perform GSF forwards fit
-  ForwardTrajectory* forwardTrajectory = fitPRD(ctx,
-                                                extrapolatorCache,
-                                                sortedPrepRawDataSet,
-                                                estimatedParametersNearOrigin,
-                                                particleHypothesis)
-                                           .release();
-
-  if (!forwardTrajectory) {
+  std::unique_ptr<ForwardTrajectory> forwardTrajectory =
+    fitPRD(ctx,
+           extrapolatorCache,
+           sortedPrepRawDataSet,
+           estimatedParametersNearOrigin,
+           particleHypothesis);
+
+  if (!forwardTrajectory || forwardTrajectory->empty()) {
     ATH_MSG_DEBUG("Forward GSF fit failed... Exiting!");
     ++m_ForwardFailure;
     return nullptr;
   }
 
-  if (forwardTrajectory->empty()) {
-    ATH_MSG_DEBUG("No states in forward trajectory... Exiting!");
-    ++m_ForwardFailure;
-    delete forwardTrajectory;
-    return nullptr;
-  }
-
   // Perform GSF smoother operation
-  SmoothedTrajectory* smoothedTrajectory =
+  std::unique_ptr<SmoothedTrajectory> smoothedTrajectory =
     fit(ctx, extrapolatorCache, *forwardTrajectory, particleHypothesis);
 
   // Protect against failed smoother fit
   if (!smoothedTrajectory) {
     ATH_MSG_DEBUG("Smoother GSF fit failed... Exiting!");
     ++m_SmootherFailure;
-    delete forwardTrajectory;
     return nullptr;
   }
 
   // Outlier m_logic and track finalisation
-  const FitQuality* fitQuality = buildFitQuality(*smoothedTrajectory);
+  std::unique_ptr<FitQuality> fitQuality = buildFitQuality(*smoothedTrajectory);
   if (!fitQuality) {
     ATH_MSG_DEBUG("Chi squared could not be calculated... Bailing");
     ++m_fitQualityFailure;
-    delete forwardTrajectory;
-    delete smoothedTrajectory;
     return nullptr;
   }
 
   if (m_makePerigee) {
     const Trk::MultiComponentStateOnSurface* perigeeMultiStateOnSurface =
       makePerigee(
-        ctx, extrapolatorCache, smoothedTrajectory, particleHypothesis);
+        ctx, extrapolatorCache, *smoothedTrajectory, particleHypothesis);
     ATH_MSG_DEBUG(
       "perigeeMultiStateOnSurface  :" << perigeeMultiStateOnSurface);
     if (perigeeMultiStateOnSurface) {
@@ -339,15 +328,10 @@ Trk::GaussianSumFitter::fit(
     } else {
       ATH_MSG_DEBUG("Perigee asked to be created but failed.....Exiting");
       ++m_PerigeeFailure;
-      delete smoothedTrajectory;
-      delete forwardTrajectory;
-      delete fitQuality;
       return nullptr;
     }
   }
 
-  // Delete forward trajectory. New memory was assigned in ForwardGsfFitter.
-  delete forwardTrajectory;
   // Reverse the order of the TSOS's to make be order flow from inside to out
   std::reverse(smoothedTrajectory->begin(), smoothedTrajectory->end());
 
@@ -358,14 +342,13 @@ Trk::GaussianSumFitter::fit(
     for (const Trk::TrackStateOnSurface* tsos : *smoothedTrajectory) {
       slimmedSmoothedTrajectory->push_back(new Trk::TrackStateOnSurface(*tsos));
     }
-    delete smoothedTrajectory;
     // Create new track
     Trk::TrackInfo info(Trk::TrackInfo::GaussianSumFilter, particleHypothesis);
     info.setTrackProperties(TrackInfo::BremFit);
     info.setTrackProperties(TrackInfo::BremFitSuccessful);
     ++m_fitSuccess;
     return std::make_unique<Track>(
-      info, slimmedSmoothedTrajectory.release(), fitQuality);
+      info, slimmedSmoothedTrajectory.release(), fitQuality.release());
   }
 
   // Create new track
@@ -373,7 +356,8 @@ Trk::GaussianSumFitter::fit(
   info.setTrackProperties(TrackInfo::BremFit);
   info.setTrackProperties(TrackInfo::BremFitSuccessful);
   ++m_fitSuccess;
-  return std::make_unique<Track>(info, smoothedTrajectory, fitQuality);
+  return std::make_unique<Track>(
+    info, smoothedTrajectory.release(), fitQuality.release());
 }
 
 /*
@@ -444,13 +428,12 @@ Trk::GaussianSumFitter::fit(
   Trk::IMultiStateExtrapolator::Cache extrapolatorCache;
 
   // Perform GSF forwards fit - new memory allocated in forwards fitter
-  ForwardTrajectory* forwardTrajectory =
+  std::unique_ptr<ForwardTrajectory> forwardTrajectory =
     fitMeasurements(ctx,
                     extrapolatorCache,
                     sortedMeasurementSet,
                     estimatedParametersNearOrigin,
-                    particleHypothesis)
-      .release();
+                    particleHypothesis);
 
   if (!forwardTrajectory) {
     ATH_MSG_DEBUG("Forward GSF fit failed... Exiting!");
@@ -460,39 +443,35 @@ Trk::GaussianSumFitter::fit(
 
   if (forwardTrajectory->empty()) {
     ATH_MSG_DEBUG("No states in forward trajectory... Exiting!");
-    delete forwardTrajectory;
     ++m_ForwardFailure;
     return nullptr;
   }
 
   // Perform GSF smoother operation
 
-  SmoothedTrajectory* smoothedTrajectory =
+  std::unique_ptr<SmoothedTrajectory> smoothedTrajectory =
     fit(ctx, extrapolatorCache, *forwardTrajectory, particleHypothesis, ccot);
 
   // Protect against failed smoother fit
   if (!smoothedTrajectory) {
     ATH_MSG_DEBUG("Smoother GSF fit failed... Exiting!");
     ++m_SmootherFailure;
-    delete forwardTrajectory;
     return nullptr;
   }
 
   // Outlier m_logic and track finalisation
-  const FitQuality* fitQuality = buildFitQuality(*smoothedTrajectory);
+  std::unique_ptr<FitQuality> fitQuality = buildFitQuality(*smoothedTrajectory);
 
   if (!fitQuality) {
     ATH_MSG_DEBUG("Chi squared could not be calculated... Bailing");
     ++m_fitQualityFailure;
-    delete forwardTrajectory;
-    delete smoothedTrajectory;
     return nullptr;
   }
 
   if (m_makePerigee) {
     const Trk::MultiComponentStateOnSurface* perigeeMultiStateOnSurface =
       makePerigee(
-        ctx, extrapolatorCache, smoothedTrajectory, particleHypothesis);
+        ctx, extrapolatorCache, *smoothedTrajectory, particleHypothesis);
     ATH_MSG_DEBUG(
       "perigeeMultiStateOnSurface  :" << perigeeMultiStateOnSurface);
 
@@ -501,16 +480,10 @@ Trk::GaussianSumFitter::fit(
     } else {
       ATH_MSG_DEBUG("Perigee asked to be created but failed.....Exiting");
       ++m_PerigeeFailure;
-      delete fitQuality;
-      delete forwardTrajectory;
-      delete smoothedTrajectory;
       return nullptr;
     }
   }
 
-  // Delete forward trajectory. New memory was assigned in ForwardGsfFitter.
-  delete forwardTrajectory;
-
   // Reverse the order of the TSOS's to make be order flow from inside to out
   std::reverse(smoothedTrajectory->begin(), smoothedTrajectory->end());
 
@@ -521,14 +494,13 @@ Trk::GaussianSumFitter::fit(
     for (const Trk::TrackStateOnSurface* tsos : *smoothedTrajectory) {
       slimmedSmoothedTrajectory->push_back(new Trk::TrackStateOnSurface(*tsos));
     }
-    delete smoothedTrajectory;
     // Create new track
     Trk::TrackInfo info(Trk::TrackInfo::GaussianSumFilter, particleHypothesis);
     info.setTrackProperties(TrackInfo::BremFit);
     info.setTrackProperties(TrackInfo::BremFitSuccessful);
     ++m_fitSuccess;
     return std::make_unique<Track>(
-      info, slimmedSmoothedTrajectory.release(), fitQuality);
+      info, slimmedSmoothedTrajectory.release(), fitQuality.release());
   }
 
   // Create new track
@@ -536,7 +508,8 @@ Trk::GaussianSumFitter::fit(
   info.setTrackProperties(TrackInfo::BremFit);
   info.setTrackProperties(TrackInfo::BremFitSuccessful);
   ++m_fitSuccess;
-  return std::make_unique<Track>(info, smoothedTrajectory, fitQuality);
+  return std::make_unique<Track>(
+    info, smoothedTrajectory.release(), fitQuality.release());
 }
 
 std::unique_ptr<Trk::Track>
@@ -696,14 +669,14 @@ const Trk::MultiComponentStateOnSurface*
 Trk::GaussianSumFitter::makePerigee(
   const EventContext& ctx,
   Trk::IMultiStateExtrapolator::Cache& extrapolatorCache,
-  const Trk::SmoothedTrajectory* smoothedTrajectory,
+  const Trk::SmoothedTrajectory& smoothedTrajectory,
   const Trk::ParticleHypothesis particleHypothesis) const
 {
 
   // Propagate track to perigee
   const Trk::PerigeeSurface perigeeSurface;
   const Trk::TrackStateOnSurface* stateOnSurfaceNearestOrigin =
-    smoothedTrajectory->back();
+    smoothedTrajectory.back();
   const Trk::MultiComponentStateOnSurface*
     multiComponentStateOnSurfaceNearestOrigin = nullptr;
 
@@ -782,27 +755,23 @@ Trk::GaussianSumFitter::makePerigee(
   return perigeeMultiStateOnSurface;
 }
 
-const Trk::FitQuality*
+std::unique_ptr<Trk::FitQuality>
 Trk::GaussianSumFitter::buildFitQuality(
   const Trk::SmoothedTrajectory& smoothedTrajectory) const
 {
 
   double chiSquared = 0.;
   int numberDoF = -5;
-
   // Loop over all TrackStateOnSurface objects in trajectory
   SmoothedTrajectory::const_iterator stateOnSurface =
     smoothedTrajectory.begin();
-
   for (; stateOnSurface != smoothedTrajectory.end(); ++stateOnSurface) {
-
     if (!(*stateOnSurface)->type(TrackStateOnSurface::Measurement)) {
       continue;
     }
     if ((*stateOnSurface)->fitQualityOnSurface() == nullptr) {
       continue;
     }
-
     chiSquared += (*stateOnSurface)->fitQualityOnSurface()->chiSquared();
     numberDoF += (*stateOnSurface)->fitQualityOnSurface()->numberDoF();
   }
@@ -811,9 +780,7 @@ Trk::GaussianSumFitter::buildFitQuality(
     return nullptr;
   }
 
-  const FitQuality* fitQuality = new FitQuality(chiSquared, numberDoF);
-
-  return fitQuality;
+  return std::make_unique<FitQuality>(chiSquared, numberDoF);
 }
 
 /*
@@ -1083,7 +1050,7 @@ Trk::GaussianSumFitter::stepForwardFit(
   return true;
 }
 
-Trk::SmoothedTrajectory*
+std::unique_ptr<Trk::SmoothedTrajectory>
 Trk::GaussianSumFitter::fit(
   const EventContext& ctx,
   Trk::IMultiStateExtrapolator::Cache& extrapolatorCache,
@@ -1384,14 +1351,14 @@ Trk::GaussianSumFitter::fit(
       if (ccot && trackStateOnSurface == secondLastTrackStateOnSurface) {
 
         Trk::MultiComponentState ccotState =
-          addCCOT(ctx, updatedStateOnSurface, ccot, smoothedTrajectory.get());
+          addCCOT(ctx, updatedStateOnSurface, ccot, *smoothedTrajectory);
         if (!ccotState.empty()) {
           updatedState = std::move(ccotState);
         }
       }
     }
   } // End for loop over all components
-  return smoothedTrajectory.release();
+  return smoothedTrajectory;
 }
 
 Trk::MultiComponentState
@@ -1497,7 +1464,7 @@ Trk::GaussianSumFitter::addCCOT(
   const EventContext& ctx,
   const Trk::TrackStateOnSurface* currentState,
   const Trk::CaloCluster_OnTrack* ccot,
-  Trk::SmoothedTrajectory* smoothedTrajectory) const
+  Trk::SmoothedTrajectory& smoothedTrajectory) const
 {
 
   const Trk::MultiComponentStateOnSurface* currentMultiStateOS = nullptr;
@@ -1594,8 +1561,8 @@ Trk::GaussianSumFitter::addCCOT(
       combinedState.release(),
       MultiComponentStateHelpers::clone(extrapolatedState).release(),
       combinedFitQuality.release());
-  smoothedTrajectory->push_back(updatedMCSOS);
-  smoothedTrajectory->push_back(finalSOS);
+  smoothedTrajectory.push_back(updatedMCSOS);
+  smoothedTrajectory.push_back(finalSOS);
 
   return extrapolatedState;
 }
diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfBetheHeitlerEffects.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfBetheHeitlerEffects.cxx
index 9b95a0ab243fdfa9e4f0a9cae0b8ff11a2287988..3c6063f1c849aa314188a699efce428357dcf5ff 100644
--- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfBetheHeitlerEffects.cxx
+++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfBetheHeitlerEffects.cxx
@@ -238,8 +238,8 @@ Trk::GsfBetheHeitlerEffects::readParameters()
   fin >> orderPolynomial;
   fin >> m_transformationCode;
   //
-  if (not inRange(m_numberOfComponents, 0, 100)) {
-    ATH_MSG_ERROR("numberOfComponents Parameter out of range 0-100: "
+  if (not inRange(m_numberOfComponents, 0, 8)) {
+    ATH_MSG_ERROR("numberOfComponents Parameter out of range 0-8: "
                   << m_numberOfComponents);
     return false;
   }
@@ -288,8 +288,8 @@ Trk::GsfBetheHeitlerEffects::readParameters()
     fin >> orderPolynomial;
     fin >> m_transformationCodeHighX0;
     //
-    if (not inRange(m_numberOfComponentsHighX0, 0, 100)) {
-      ATH_MSG_ERROR("numberOfComponents Parameter out of range 0-100: "
+    if (not inRange(m_numberOfComponentsHighX0, 0, 8)) {
+      ATH_MSG_ERROR("numberOfComponents Parameter out of range 0-8: "
                     << m_numberOfComponentsHighX0);
       return false;
     }
diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolution.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolution.cxx
index 480069ee1be259ca09d55abc12736151f2f9a13d..b7b99c9aafa1c171deee23a8b927cfcaee1a470e 100644
--- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolution.cxx
+++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolution.cxx
@@ -39,15 +39,11 @@ Trk::GsfMaterialMixtureConvolution::~GsfMaterialMixtureConvolution() = default;
 StatusCode
 Trk::GsfMaterialMixtureConvolution::initialize()
 {
-
+  if( m_maximumNumberOfComponents > 16){
+      ATH_MSG_FATAL("Requested MaximumNumberOfComponents > 16");
+      return StatusCode::FAILURE;
+  }
   ATH_CHECK(m_materialEffects.retrieve());
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode
-Trk::GsfMaterialMixtureConvolution::finalize()
-{
   return StatusCode::SUCCESS;
 }
 
diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateModeCalculator.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateModeCalculator.cxx
index 8a64b86d297fd2f54ed8026117a1c45f3855933b..0a9d1e11a2b43301597f0274e532ca08880c55dd 100644
--- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateModeCalculator.cxx
+++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateModeCalculator.cxx
@@ -13,7 +13,6 @@
 #include "TrkGaussianSumFilter/MultiComponentStateModeCalculator.h"
 #include "CxxUtils/phihelper.h"
 #include "TrkMultiComponentStateOnSurface/MultiComponentState.h"
-#include "TrkParameters/TrackParameters.h"
 #include <cmath>
 
 namespace {
@@ -63,7 +62,6 @@ d1pdf(double x, int i, const std::array<std::vector<Component>, 5>& mixture)
   }
   return result;
 }
-
 /** @brief method to determine the second order derivative of the pdf at a given
  * value*/
 double
@@ -93,94 +91,10 @@ width(int i, const std::array<std::vector<Component>, 5>& mixture)
   return pdf;
 }
 
-} // end of anonymous namespace
-
-std::array<double, 10>
-Trk::MultiComponentStateModeCalculator::calculateMode(
-  const Trk::MultiComponentState& multiComponentState)
-{
-  std::array<double, 10> modes{};
-  // Check to see if the multi-component state is measured
-  if (!MultiComponentStateHelpers::isMeasured(multiComponentState)) {
-    return modes;
-  }
-
-  std::array<std::vector<Component>, 5> mixture;
-
-  fillMixture(multiComponentState, mixture);
-
-  /* loop over the 5 direction , d0,z0,phi,theta,qOverP*/
-
-  for (int i = 0; i < 5; i++) {
-
-    double largerPdfComponent = 0.0;
-    double largerMeanComponent = 0.0;
-    /*
-     * Loop over the mixture in the ith direction and find the  component
-     * whose mean give the larger value for the Gaussian Mixture pdf.
-     * This should be a good enough starting point for the mode
-     * finding in this direction
-     */
-    for (const Component& component : mixture[i]) {
-      double pdfValue = pdf(component.mean, i, mixture);
-      if (pdfValue > largerPdfComponent) {
-        largerPdfComponent = pdfValue;
-        largerMeanComponent = component.mean;
-      }
-    }
-    modes[i] = findMode(largerMeanComponent, i, mixture);
-    // Calculate the FWHM and return this back so that it can be used to correct
-    // the covariance matrix
-    if (largerMeanComponent != modes[i]) {
-      // mode calculation was successful now calulate FWHM
-      double currentWidth = width(i, mixture);
-      modes[i + 5] = -1; // Failure is flagged with a value less than 0;
-
-      double pdfVal = pdf(modes[i], i, mixture);
-      double highX(0);
-      double lowX(0);
-
-      double upperbound = modes[i] + 1.5 * currentWidth;
-      while (true) {
-        if (pdf(upperbound, i, mixture) > pdfVal * 0.5) {
-          upperbound += currentWidth;
-        } else {
-          break;
-        }
-      }
-
-      bool highXFound =
-        findRoot(highX, modes[i], upperbound, pdfVal * 0.5, i, mixture);
-
-      double lowerbound = modes[i] - 1.5 * currentWidth;
-      while (true) {
-        if (pdf(lowerbound, i, mixture) > pdfVal * 0.5) {
-          lowerbound -= currentWidth;
-        } else {
-          break;
-        }
-      }
-      bool lowXFound =
-        findRoot(lowX, lowerbound, modes[i], pdfVal * 0.5, i, mixture);
-      if (highXFound && lowXFound) {
-        double FWHM = highX - lowX;
-        modes[i + 5] = FWHM / 2.35482; // 2 * sqrt( 2* log(2))
-      }
-      // Ensure that phi is between -pi and pi
-      if (i == 2) {
-        modes[i] = CxxUtils::wrapToPi(modes[i]);
-      }
-    }
-  }
-  return modes;
-}
-
 void
-Trk::MultiComponentStateModeCalculator::fillMixture(
-  const Trk::MultiComponentState& multiComponentState,
-  std::array<std::vector<Component>, 5>& mixture)
+fillMixture(const Trk::MultiComponentState& multiComponentState,
+            std::array<std::vector<Component>, 5>& mixture)
 {
-
   constexpr Trk::ParamDefs parameter[5] = {
     Trk::d0, Trk::z0, Trk::phi, Trk::theta, Trk::qOverP
   };
@@ -209,9 +123,8 @@ Trk::MultiComponentStateModeCalculator::fillMixture(
       // FIXME ATLASRECTS-598 this std::abs() should not be necessary... for
       // some reason cov(qOverP,qOverP) can be negative
       double sigma = sqrt(std::abs((*measuredCov)(parameter[i], parameter[i])));
-
-      // Ensure that we don't have any problems with the cyclical nature of phi
-      // Use first state as reference point
+      // Ensure that we don't have any problems with the cyclical nature of
+      // phi Use first state as reference point
       if (i == 2) { // phi
         double deltaPhi =
           multiComponentState.begin()->first->parameters()[2] - mean;
@@ -223,14 +136,14 @@ Trk::MultiComponentStateModeCalculator::fillMixture(
       }
       mixture[i].emplace_back(weight, mean, sigma);
     }
+
   }
 }
 
 double
-Trk::MultiComponentStateModeCalculator::findMode(
-  double xStart,
-  int i,
-  const std::array<std::vector<Component>, 5>& mixture)
+findMode(double xStart,
+         int i,
+         const std::array<std::vector<Component>, 5>& mixture)
 {
 
   int iteration(0);
@@ -271,49 +184,17 @@ Trk::MultiComponentStateModeCalculator::findMode(
 }
 
 double
-Trk::MultiComponentStateModeCalculator::findModeGlobal(
-  double mean,
-  int i,
-  const std::array<std::vector<Component>, 5>& mixture)
+findRoot(double& result,
+         double xlo,
+         double xhi,
+         double value,
+         double i,
+         const std::array<std::vector<Component>, 5>& mixture)
 {
-
-  double start(-1);
-  double end(1);
-  if (mean > 0.0) {
-    start = mean / 2;
-    end = 3 * mean / 2;
-  } else if (mean < 0.0) {
-    start = 3 * mean / 2;
-    end = mean / 2;
-  }
-
-  double mode(0);
-  double maximum(-1);
-  double iterate(std::abs(mean / 1000));
-
-  for (double counter(start); counter < end; counter += iterate) {
-    double value(pdf(counter, i, mixture));
-    if (value > maximum) {
-      maximum = value;
-      mode = counter;
-    }
-  }
-  return mode;
-}
-
-double
-Trk::MultiComponentStateModeCalculator::findRoot(
-  double& result,
-  double xlo,
-  double xhi,
-  double value,
-  double i,
-  const std::array<std::vector<Component>, 5>& mixture)
-{
-  // Do the root finding using the Brent-Decker method. Returns a boolean status
-  // and loads 'result' with our best guess at the root if true. Prints a
-  // warning if the initial interval does not bracket a single root or if the
-  // root is not found after a fixed number of iterations.
+  // Do the root finding using the Brent-Decker method. Returns a boolean
+  // status and loads 'result' with our best guess at the root if true. Prints
+  // a warning if the initial interval does not bracket a single root or if
+  // the root is not found after a fixed number of iterations.
 
   double a(xlo);
   double b(xhi);
@@ -416,3 +297,91 @@ Trk::MultiComponentStateModeCalculator::findRoot(
 
   return false;
 }
+
+} // end of anonymous namespace
+
+std::array<double, 10>
+Trk::MultiComponentStateModeCalculator::calculateMode(
+  const Trk::MultiComponentState& multiComponentState)
+{
+  // Check to see if the multi-component state is measured
+  if (!MultiComponentStateHelpers::isMeasured(multiComponentState)) {
+    return {};
+  }
+
+  std::array<std::vector<Component>, 5> mixture;
+
+  fillMixture(multiComponentState, mixture);
+  return calculateMode(mixture);
+}
+
+std::array<double, 10>
+Trk::MultiComponentStateModeCalculator::calculateMode(
+  const std::array<std::vector<Component>, 5>& mixture)
+{
+  std::array<double, 10> modes{};
+  /* loop over the 5 direction , d0,z0,phi,theta,qOverP*/
+
+  for (int i = 0; i < 5; i++) {
+
+    double largerPdfComponent = 0.0;
+    double largerMeanComponent = 0.0;
+    /*
+     * Loop over the mixture in the ith direction and find the  component
+     * whose mean give the larger value for the Gaussian Mixture pdf.
+     * This should be a good enough starting point for the mode
+     * finding in this direction
+     */
+    for (const Component& component : mixture[i]) {
+      double pdfValue = pdf(component.mean, i, mixture);
+      if (pdfValue > largerPdfComponent) {
+        largerPdfComponent = pdfValue;
+        largerMeanComponent = component.mean;
+      }
+    }
+    modes[i] = findMode(largerMeanComponent, i, mixture);
+    // Calculate the FWHM and return this back so that it can be used to correct
+    // the covariance matrix
+    if (largerMeanComponent != modes[i]) {
+      // mode calculation was successful now calulate FWHM
+      double currentWidth = width(i, mixture);
+      modes[i + 5] = -1; // Failure is flagged with a value less than 0;
+
+      double pdfVal = pdf(modes[i], i, mixture);
+      double highX(0);
+      double lowX(0);
+
+      double upperbound = modes[i] + 1.5 * currentWidth;
+      while (true) {
+        if (pdf(upperbound, i, mixture) > pdfVal * 0.5) {
+          upperbound += currentWidth;
+        } else {
+          break;
+        }
+      }
+
+      bool highXFound =
+        findRoot(highX, modes[i], upperbound, pdfVal * 0.5, i, mixture);
+
+      double lowerbound = modes[i] - 1.5 * currentWidth;
+      while (true) {
+        if (pdf(lowerbound, i, mixture) > pdfVal * 0.5) {
+          lowerbound -= currentWidth;
+        } else {
+          break;
+        }
+      }
+      bool lowXFound =
+        findRoot(lowX, lowerbound, modes[i], pdfVal * 0.5, i, mixture);
+      if (highXFound && lowXFound) {
+        double FWHM = highX - lowX;
+        modes[i + 5] = FWHM / 2.35482; // 2 * sqrt( 2* log(2))
+      }
+      // Ensure that phi is between -pi and pi
+      if (i == 2) {
+        modes[i] = CxxUtils::wrapToPi(modes[i]);
+      }
+    }
+  }
+  return modes;
+}
diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/test/testFindMode.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/test/testFindMode.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..c43854aef3dd01afd4933bb9f69770beb394b1dd
--- /dev/null
+++ b/Tracking/TrkFitter/TrkGaussianSumFilter/test/testFindMode.cxx
@@ -0,0 +1,76 @@
+
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+#include "TrkGaussianSumFilter/MultiComponentStateModeCalculator.h"
+#include <iostream>
+
+int
+main()
+{
+
+  using namespace Trk::MultiComponentStateModeCalculator;
+
+  std::vector<Component> vec0 = {
+    { 0.973657, -27.9079, 0.0538001 },    { 0.024202, -27.9023, 0.0580491 },
+    { 0.00146762, -27.9063, 0.0594736 },  { 0.000452399, -27.8908, 0.0591268 },
+    { 0.000152378, -27.8987, 0.0604233 }, { 5.65349e-05, -27.9603, 0.0517557 },
+    { 5.81047e-06, -27.9495, 0.0553466 }, { 5.21863e-06, -27.9006, 0.0603241 },
+    { 6.61547e-07, -27.9117, 0.0626188 }, { 1.19371e-07, -27.8984, 0.060867 },
+    { 1.11035e-07, -27.9323, 0.0585395 }
+  };
+
+  std::vector<Component> vec1 = {
+    { 0.973657, 38.4958, 0.757618 },    { 0.024202, 38.4292, 0.801337 },
+    { 0.00146762, 38.4686, 0.814726 },  { 0.000452399, 38.285, 0.811128 },
+    { 0.000152378, 38.382, 0.826285 },  { 5.65349e-05, 39.137, 0.728419 },
+    { 5.81047e-06, 39.0091, 0.763217 }, { 5.21863e-06, 38.3888, 0.824838 },
+    { 6.61547e-07, 38.5323, 0.858115 }, { 1.19371e-07, 38.2937, 0.834079 },
+    { 1.11035e-07, 38.7643, 0.802247 }
+  };
+
+  std::vector<Component> vec2 = { { 0.973657, -1.0267, 0.000445822 },
+                                  { 0.024202, -1.02727, 0.000738283 },
+                                  { 0.00146762, -1.03185, 0.000786109 },
+                                  { 0.000452399, -1.02815, 0.000729393 },
+                                  { 0.000152378, -1.03015, 0.00159626 },
+                                  { 5.65349e-05, -1.03469, 0.000698825 },
+                                  { 5.81047e-06, -1.04587, 0.00150398 },
+                                  { 5.21863e-06, -1.03862, 0.00246934 },
+                                  { 6.61547e-07, -1.05081, 0.00301325 },
+                                  { 1.19371e-07, -1.08593, 0.0072159 },
+                                  { 1.11035e-07, -1.07377, 0.0038744 } };
+
+  std::vector<Component> vec3 = {
+    { 0.973657, 2.94981, 0.00113228 },    { 0.024202, 2.94985, 0.00120513 },
+    { 0.00146762, 2.94994, 0.00120203 },  { 0.000452399, 2.95008, 0.00122586 },
+    { 0.000152378, 2.94981, 0.00140487 }, { 5.65349e-05, 2.94921, 0.00108731 },
+    { 5.81047e-06, 2.94948, 0.00113324 }, { 5.21863e-06, 2.95005, 0.00141219 },
+    { 6.61547e-07, 2.9482, 0.00391511 },  { 1.19371e-07, 2.94952, 0.00241575 },
+    { 1.11035e-07, 2.94963, 0.0014292 }
+  };
+
+  std::vector<Component> vec4 = { { 0.973657, -7.99235e-05, 1.2352e-05 },
+                                  { 0.024202, -0.000165865, 6.85227e-05 },
+                                  { 0.00146762, -0.000731881, 4.43473e-05 },
+                                  { 0.000452399, -0.000297975, 2.98129e-05 },
+                                  { 0.000152378, -0.000534431, 0.00017548 },
+                                  { 5.65349e-05, -0.000996226, 5.45339e-05 },
+                                  { 5.81047e-06, -0.00246959, 0.00014759 },
+                                  { 5.21863e-06, -0.0015881, 0.000274361 },
+                                  { 6.61547e-07, -0.00321585, 0.000282572 },
+                                  { 1.19371e-07, -0.00750016, 0.000670315 },
+                                  { 1.11035e-07, -0.0059806, 0.000365448 } };
+
+  std::array<std::vector<Component>, 5> mixture = {
+    vec0, vec1, vec2, vec3, vec4
+  };
+
+  std::array<double, 10> result =
+    Trk::MultiComponentStateModeCalculator::calculateMode(mixture);
+  for (double i : result) {
+    std::cout << i << '\n';
+  }
+
+  return 0;
+}
diff --git a/Tracking/TrkTools/TrkMaterialProvider/TrkMaterialProvider/TrkMaterialProviderTool.h b/Tracking/TrkTools/TrkMaterialProvider/TrkMaterialProvider/TrkMaterialProviderTool.h
index 636a4cc0938fdab44c4ae1aa3e208a5bc3fa0f11..bd2f19258197decc8d355e05d418812aaa0f25e4 100644
--- a/Tracking/TrkTools/TrkMaterialProvider/TrkMaterialProvider/TrkMaterialProviderTool.h
+++ b/Tracking/TrkTools/TrkMaterialProvider/TrkMaterialProvider/TrkMaterialProviderTool.h
@@ -118,8 +118,8 @@ namespace Trk{
 
     /** update the TSOS vector for the Muon Spectrometer applying X0 and Eloss scaling*/
     void updateVectorMS(DataVector<const Trk::TrackStateOnSurface>* inputTSOS,
-                                                  DataVector<const Trk::TrackStateOnSurface>::iterator firstMS,
-                                                  double X0ScaleMS, double ElossScaleMS) const;
+                        const DataVector<const Trk::TrackStateOnSurface>::iterator& firstMS,
+                        double X0ScaleMS, double ElossScaleMS) const;
 
     //* Helper to indentify detector volume**/
     unsigned int getVolumeByGeo(const Trk::TrackStateOnSurface* m) const;
diff --git a/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx b/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx
index c6632eebbbc6f65381d1717fea0a03b05ee7bf88..87ac7c1ed8331b205d73ab0bb0011dc5dfbd3beb 100644
--- a/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx
+++ b/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx
@@ -1142,8 +1142,8 @@ void Trk::TrkMaterialProviderTool::updateVector(DataVector<const Trk::TrackState
   // delete the view container
   delete caloTSOS;
 }
-void Trk::TrkMaterialProviderTool::updateVectorMS(DataVector<const Trk::TrackStateOnSurface>* inputTSOS, 
-						  DataVector<const Trk::TrackStateOnSurface>::iterator firstMS, 
+void Trk::TrkMaterialProviderTool::updateVectorMS(DataVector<const Trk::TrackStateOnSurface>* inputTSOS,
+						  const DataVector<const Trk::TrackStateOnSurface>::iterator& firstMS, 
                                                   double X0ScaleMS, double ElossScaleMS) const
 {
 
diff --git a/Tracking/TrkTools/TrkToolInterfaces/CMakeLists.txt b/Tracking/TrkTools/TrkToolInterfaces/CMakeLists.txt
index 7bec323927963b5ffd0707117915a91e24e2cd6f..c72223fa9523879f333b01a47219c4f0ae44914a 100644
--- a/Tracking/TrkTools/TrkToolInterfaces/CMakeLists.txt
+++ b/Tracking/TrkTools/TrkToolInterfaces/CMakeLists.txt
@@ -5,28 +5,8 @@
 # Declare the package name:
 atlas_subdir( TrkToolInterfaces )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthContainers
-                          Control/AthLinks
-                          Event/EventPrimitives
-                          Event/xAOD/xAODTracking
-                          Event/xAOD/xAODTruth
-                          GaudiKernel
-                          Tracking/TrkDetDescr/TrkSurfaces
-                          Tracking/TrkEvent/TrkCompetingRIOsOnTrack
-                          Tracking/TrkEvent/TrkEventPrimitives
-                          Tracking/TrkEvent/TrkEventUtils
-                          Tracking/TrkEvent/TrkMaterialOnTrack
-                          Tracking/TrkEvent/TrkParameters
-                          Tracking/TrkEvent/TrkParticleBase
-                          Tracking/TrkEvent/TrkSegment
-                          Tracking/TrkEvent/TrkTrack
-                          Tracking/TrkEvent/TrkTrackSummary
-                          Tracking/TrkEvent/TrkEventUtils )
-
 # Component(s) in the package:
 atlas_add_library( TrkToolInterfaces
                    PUBLIC_HEADERS TrkToolInterfaces
-                   LINK_LIBRARIES AthContainers AthLinks EventPrimitives xAODTracking xAODTruth GaudiKernel TrkSurfaces TrkCompetingRIOsOnTrack TrkEventPrimitives TrkEventUtils TrkMaterialOnTrack TrkParameters TrkParticleBase TrkSegment TrkTrack TrkTrackSummary TrkEventUtils )
+                   LINK_LIBRARIES AthContainers AthLinks EventPrimitives xAODTracking xAODTruth GaudiKernel TrkSurfaces TrkCompetingRIOsOnTrack TrkEventPrimitives TrkEventUtils TrkMaterialOnTrack TrkParameters TrkParticleBase TrkSegment TrkTrack TrkTrackSummary TrkEventUtils CxxUtils )
 
diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ATLAS_CHECK_THREAD_SAFETY b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..ebc8e8153e0f1ab9c9d30e1276fe51ff8e9964b3
--- /dev/null
+++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+Tracking/TrkTools/TrkToolInterfaces
diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IAmbiTrackSelectionTool.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IAmbiTrackSelectionTool.h
index 9f6274ddef650ab99934b9361b3e53f30fdccdf0..9bedd6c2317b65b5bc6af6add0e227814b25e0b8 100755
--- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IAmbiTrackSelectionTool.h
+++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IAmbiTrackSelectionTool.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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -10,6 +10,7 @@
 
 #include "GaudiKernel/IAlgTool.h"
 #include "TrkEventPrimitives/TrackScore.h"
+#include "CxxUtils/checker_macros.h"
 #include <vector>
 
 namespace Trk 
@@ -18,8 +19,6 @@ namespace Trk
   class PrepRawData;
   class PRDtoTrackMap;
   
-  static const InterfaceID IID_IAmbiTrackSelectionTool("InDet::IAmbiTrackSelectionTool", 1, 0);
-
   /** @class Trk::IAmbiTrackSelectionTool
       @brief Interface for building new tracks using information about shared and already associated hits.
 
@@ -28,7 +27,7 @@ namespace Trk
 
   class IAmbiTrackSelectionTool : virtual public IAlgTool {
   public:
-    static const InterfaceID& interfaceID( ) ;
+    DeclareInterfaceID( IAmbiTrackSelectionTool, 1, 0 );
 
     /** Performs cleaning of a track from already used hits.
         @param track the input track to be checked and cleaned.
@@ -40,16 +39,14 @@ namespace Trk
         replacing the input track. The second element of the returned tuple is true if the input track does not
         reuire cleaning, fulfils the quality criteria and should be kept.
     */
-    virtual std::tuple<Trk::Track*,bool> getCleanedOutTrack(const Trk::Track *track,
-                                                            const Trk::TrackScore score,
-                                                            Trk::PRDtoTrackMap &prd_to_track_map) const =0;
+    // Implementation in InDetDenseEnvAmbiTrackSelectionTool
+    // is not thread-safe.
+    virtual std::tuple<Trk::Track*,bool> getCleanedOutTrack ATLAS_NOT_THREAD_SAFE
+      (const Trk::Track *track,
+       const Trk::TrackScore score,
+       Trk::PRDtoTrackMap &prd_to_track_map) const =0;
   };
 
-  inline const InterfaceID& Trk::IAmbiTrackSelectionTool::interfaceID()
-    { 
-      return IID_IAmbiTrackSelectionTool; 
-    }
-
 } // end of namespace
 
 #endif 
diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IExtendedTrackSummaryTool.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IExtendedTrackSummaryTool.h
index a079f8ac11c6925df26521d42501b56858b46954..da1c39a339ddbd99184aaab8bbcc8a3eca6c0f58 100644
--- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IExtendedTrackSummaryTool.h
+++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IExtendedTrackSummaryTool.h
@@ -47,14 +47,21 @@ public:
     Track& track,
     const Trk::PRDtoTrackMap* prd_to_track_map,
     bool suppress_hole_search = false) const = 0;
-
-  /** create a summary object from passed Track.*/
+  
+   /* Start from a copy of the existing input track summary if there,
+    * otherwise start from a new one. Fill it and return it.
+    * Does not modify the const track.
+    */
   virtual std::unique_ptr<Trk::TrackSummary> summary(
     const Track& track,
     const Trk::PRDtoTrackMap* prd_to_track_map) const = 0;
 
-  /** create a summary object of passed track without doing the tedious hole
-   * search. */
+
+  /* Start from a copy of the existing input track summary if there,
+   * otherwise start from a new one. Fill it and return it.
+   * but without doing the hole search.
+   * Does not modify the const track.
+   */
   virtual std::unique_ptr<Trk::TrackSummary> summaryNoHoleSearch(
     const Track& track,
     const Trk::PRDtoTrackMap* prd_to_track_map) const = 0;
diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryTool.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryTool.h
index 75616e5fb9b6be2120b410b8077e9acf4c7f6f41..7417ae0e0a3e0323a1c837533edba1ec437ca219 100755
--- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryTool.h
+++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryTool.h
@@ -27,26 +27,35 @@ class ITrackSummaryTool : virtual public IAlgTool
 public:
   static const InterfaceID& interfaceID();
 
-  /** Create a  new summary object from a passed Track or clone
-   * the existing.
+  /* Start from a copy of the existing input track summary if there,
+   * otherwise start from a new one. Fill it and return it.
+   * Does not modify the const track.
    */
   virtual std::unique_ptr<Trk::TrackSummary> summary(
     const Track& track) const = 0;
-
-  /** create a summary object from a passed track, without doing the tedious
-   hole search, or clone the existing.*/
+  
+  /* Start from a copy of the existing input track summary if there,
+   * otherwise start from a new one. Fill it and return it.
+   * but without doing the hole search.
+   * Does not modify the const track.
+   */
   virtual std::unique_ptr<Trk::TrackSummary> summaryNoHoleSearch(
     const Track& track) const = 0;
 
-  /** Method which can be used to update the track and add a summary to it.
-      This can be used to add a summary to a track and then retrieve it from it
-     without the need to clone. */
+  /** Same behavious as
+   * IExtendedTrackSummaryTool:computeAndReplaceTrackSummary
+   * but without the need to pass
+   * Trk::PRDtoTrackMap
+   * Does hole search
+   */
   virtual void updateTrack(Track& track) const = 0;
 
-  /** method which can be used to update a refitted track and add a summary to
-   * it, without doing shard hit/ or hole search. Adds a summary to a track and
-   * then retrieve it from it without the need to clone. */
-  virtual void updateRefittedTrack(Track& track) const = 0;
+  /** method which can be used to update the summary of a track
+   * it, without doing shared hit/ or hole search. 
+   * If a summary is present is modified in place
+   * otherwise a new one is created.
+   */
+  virtual void updateTrackSummary(Track& track) const = 0;
 
   /** method to update the shared hit content only, this is optimised for track
    * collection merging. */
diff --git a/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.h b/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.h
index bcdd9b114d7f8f45edcef621917cc363c9379cac..f0d51ac8888fb304c7294fea1abe5047e032abf4 100755
--- a/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.h
+++ b/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.h
@@ -72,26 +72,63 @@ public:
     const Trk::PRDtoTrackMap* prd_to_track_map,
     bool suppress_hole_search = false) const override;
 
-  /** create a summary object from passed Track or clone the existing*/
+  /** Same behavious as
+   * IExtendedTrackSummaryTool:computeAndReplaceTrackSummary
+   * but without the need to pass
+   * Trk::PRDtoTrackMap
+   * Does hole search
+   */
+  virtual void updateTrack(Track& track) const override
+  {
+   computeAndReplaceTrackSummary(track,nullptr,false /*DO NOT suppress hole search*/);
+  }
+  
+  /* Start from a copy of the existing input track summary if there,
+   * otherwise start from a new one. Fill it and return it.
+   * Does not modify the const track.
+   */
   virtual std::unique_ptr<Trk::TrackSummary> summary(
     const Track& track) const override;
 
-  /** create a summary object of passed track, without doing the tedious hole
-   * search, or clone the existing*/
+  /* Start from a copy of the existing input track summary if there,
+   * otherwise start from a new one. Fill it and return it.
+   * but without doing the hole search.
+   * Does not modify the const track.
+   */
   virtual std::unique_ptr<Trk::TrackSummary> summaryNoHoleSearch(
     const Track& track) const override;
 
-  /** create a summary object from passed Track,*/
+  /* Start from a copy of the existing input track summary if there,
+   * otherwise start from a new one. Fill it and return it.
+   * Does not modify the const track.
+   */
   virtual std::unique_ptr<Trk::TrackSummary> summary(
     const Track& track,
     const Trk::PRDtoTrackMap* prd_to_track_map) const override;
-
-  /** create a summary object of passed track without doing the tedious hole
-   * search. */
+  
+  /* Start from a copy of the existing input track summary if there,
+   * otherwise start from a new one. Fill it and return it.
+   * but without doing the hole search.
+   * Does not modify the const track.
+   */
   virtual std::unique_ptr<Trk::TrackSummary> summaryNoHoleSearch(
     const Track& track,
     const Trk::PRDtoTrackMap* prd_to_track_map) const override;
 
+  /** method which can be used to update the summary of a track
+   * it, without doing shared hit/ or hole search. 
+   * If a summary is present it is  modified in place.
+   * Otherwise a new one is created and filled.
+   */
+  virtual void updateTrackSummary(Track& track) const override
+  {
+    /*suppress hole search*/
+    UpdateSummary(track, nullptr, true);
+    /*Needed for expected B-Layer*/
+    m_idTool->updateExpectedHitInfo(track, *track.trackSummary());
+  }
+
+ 
   /** method to update the shared hit content only, this is optimised for track
    * collection merging. */
   virtual void updateSharedHitCount(
@@ -125,23 +162,6 @@ public:
     }
   }
 
-  /** use this method to update a track. this means a tracksummary is created
-  for this track but not returned. the summary can then be obtained from the
-  track. Because it is taken from the track the ownership stays with the track
-*/
-  virtual void updateTrack(Track& track) const override
-  {
-    updateTrack(track, nullptr);
-  }
-
-  /** method which can be used to update a refitted track and add a summary to
-   * it, without doing shard hit/ or hole search. Adds a summary to a track and
-   * then retrieve it from it without the need to clone. */
-  virtual void updateRefittedTrack(Track& track) const override
-  {
-    updateTrackNoHoleSearch(track, nullptr);
-  }
-
   /** Update the shared hit count of the given track summary.
    * @param summary the summary to be updated i.e. a copy of the track summary
    * of the given track.
@@ -207,6 +227,33 @@ public:
   }
 
 private:
+
+  /*
+   * Fill the summary info for a Track*/
+  void fillSummary(Trk::TrackSummary& ts,
+                   const Trk::Track& track,
+                   const Trk::PRDtoTrackMap *prd_to_track_map,
+                   bool doHolesInDet,
+                   bool doHolesMuon) const;
+
+  /*
+   * If a summary is there Update it with the required info.
+   * If not there create a new one with the required info.
+   */
+  void UpdateSummary(Track& track,
+                     const Trk::PRDtoTrackMap* prd_to_track_map,
+                     bool suppress_hole_search) const
+  {
+    if (!track.trackSummary()) {
+      track.setTrackSummary(std::make_unique<Trk::TrackSummary>());
+    }
+    fillSummary(*(track.trackSummary()),
+                track,
+                prd_to_track_map,
+                m_doHolesInDet && !suppress_hole_search,
+                m_doHolesMuon && !suppress_hole_search);
+  }
+
   void updateAdditionalInfo(const Track& track,
                             const Trk::PRDtoTrackMap* prd_to_track_map,
                             TrackSummary& summary,
@@ -219,10 +266,6 @@ private:
   void updateTrack(Track& track,
                    const Trk::PRDtoTrackMap* prd_to_track_map) const;
 
-  void updateTrackNoHoleSearch(
-    Track& track,
-    const Trk::PRDtoTrackMap* prd_to_track_map) const;
-
   std::unique_ptr<Trk::TrackSummary> createSummary(
     const Track& track,
     const Trk::PRDtoTrackMap* prd_to_track_map,
diff --git a/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx b/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx
index 4710bcd560475f608e43cab580e4dc0fd8f765c3..3b081fddc069fdf13312167a890a80ff53d15ab3 100755
--- a/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx
+++ b/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx
@@ -117,43 +117,53 @@ StatusCode
 }
 
 /*
- * First the methods to create a new or clone the existing
+ * Method that creates a new summary for the track.
+ * First calculates a summary according to job options.
+ * If one is present it uses it as starting point (cloning it).
+ * But adds relavant info.
+ * And then sets the Track Summary for the non-const
+ * track.
  */
-void Trk::TrackSummaryTool::computeAndReplaceTrackSummary(Trk::Track &track,
-                                                          const Trk::PRDtoTrackMap *prd_to_track_map,
-                                                          bool suppress_hole_search) const {
-  track.setTrackSummary(
-    createSummary(
-      track,
-      prd_to_track_map,
-      m_doHolesInDet & !suppress_hole_search,
-      m_doHolesMuon  & !suppress_hole_search
-    )
-  );
+void
+Trk::TrackSummaryTool::computeAndReplaceTrackSummary(
+  Trk::Track& track,
+  const Trk::PRDtoTrackMap* prd_to_track_map,
+  bool suppress_hole_search) const
+{
+  track.setTrackSummary(createSummary(track,
+                                      prd_to_track_map,
+                                      m_doHolesInDet & !suppress_hole_search,
+                                      m_doHolesMuon & !suppress_hole_search));
 }
 
-std::unique_ptr<Trk::TrackSummary> Trk::TrackSummaryTool::summary( const Track& track) const
+std::unique_ptr<Trk::TrackSummary>
+Trk::TrackSummaryTool::summary(const Track& track) const
 {
-  return createSummary(track, nullptr, m_doHolesInDet, m_doHolesMuon );
+  return createSummary(track, nullptr, m_doHolesInDet, m_doHolesMuon);
 }
 
-std::unique_ptr<Trk::TrackSummary> Trk::TrackSummaryTool::summary( const Track& track,
-                                                                   const Trk::PRDtoTrackMap *prd_to_track_map) const
+std::unique_ptr<Trk::TrackSummary>
+Trk::TrackSummaryTool::summary(const Track& track,
+                               const Trk::PRDtoTrackMap* prd_to_track_map) const
 {
-  return createSummary(track, prd_to_track_map, m_doHolesInDet, m_doHolesMuon );
+  return createSummary(track, prd_to_track_map, m_doHolesInDet, m_doHolesMuon);
 }
 
-std::unique_ptr<Trk::TrackSummary> Trk::TrackSummaryTool::summaryNoHoleSearch( const Track& track) const
+std::unique_ptr<Trk::TrackSummary>
+Trk::TrackSummaryTool::summaryNoHoleSearch(const Track& track) const
 {
-  return createSummary(track, nullptr, false, false );
+  return createSummary(track, nullptr, false, false);
 }
 
-std::unique_ptr<Trk::TrackSummary> Trk::TrackSummaryTool::summaryNoHoleSearch( const Track& track,
-                                                                               const Trk::PRDtoTrackMap *prd_to_track_map) const
+std::unique_ptr<Trk::TrackSummary>
+Trk::TrackSummaryTool::summaryNoHoleSearch(
+  const Track& track,
+  const Trk::PRDtoTrackMap* prd_to_track_map) const
 {
-  return createSummary(track, prd_to_track_map, false, false );
+  return createSummary(track, prd_to_track_map, false, false);
 }
 
+//Method to create a new summary
 std::unique_ptr<Trk::TrackSummary>
 Trk::TrackSummaryTool::createSummary( const Track& track,
                                       const Trk::PRDtoTrackMap *prd_to_track_map,
@@ -169,60 +179,72 @@ Trk::TrackSummaryTool::createSummary( const Track& track,
   } else {
     ts = std::make_unique<Trk::TrackSummary>();
   }
+  //fill the summary
+  fillSummary(*ts, track, prd_to_track_map, doHolesInDet, doHolesMuon);
+  return ts;
+}
 
-  std::vector<int> & information = ts->m_information;
-  information.resize(std::min(information.size(), static_cast<size_t>(numberOfTrackSummaryTypes)));
+// Method filling the summary with information
+void
+Trk::TrackSummaryTool::fillSummary(Trk::TrackSummary& ts,
+                                   const Trk::Track& track,
+                                   const Trk::PRDtoTrackMap *prd_to_track_map,
+                                   bool doHolesInDet,
+                                   bool doHolesMuon) const {
 
-  // Troels.Petersen@cern.ch:
-  unsigned int numberOfeProbabilityTypes = Trk::numberOfeProbabilityTypes+1;
-  std::vector<float> eProbability(numberOfeProbabilityTypes,0.5);
+std::vector<int>& information = ts.m_information;
+information.resize(std::min(information.size(),
+                            static_cast<size_t>(numberOfTrackSummaryTypes)));
+
+// Troels.Petersen@cern.ch:
+unsigned int numberOfeProbabilityTypes = Trk::numberOfeProbabilityTypes + 1;
+std::vector<float> eProbability(numberOfeProbabilityTypes, 0.5);
 
-  float dedx=-1;
-  int nhitsuseddedx=-1;
-  int noverflowhitsdedx=-1;
+  float dedx = -1;
+  int nhitsuseddedx = -1;
+  int noverflowhitsdedx = -1;
 
   // Now set values to 0 for the ones we evaluate
   if (!m_idTool.empty()) {
-    if (m_pixelExists)
-    {
-      information [numberOfContribPixelLayers]   = 0;
-      information [numberOfInnermostPixelLayerHits] = 0;
-      information [numberOfInnermostPixelLayerOutliers] = 0;
-      information [numberOfNextToInnermostPixelLayerHits] = 0;
-      information [numberOfNextToInnermostPixelLayerOutliers] = 0;
-      information [numberOfPixelHits]            = 0;
-      information [numberOfPixelOutliers]        = 0;
-      information [numberOfGangedPixels]         = 0;
-      information [numberOfGangedFlaggedFakes]   = 0;
-      information [numberOfPixelSpoiltHits]      = 0;
-      information [numberOfGangedFlaggedFakes]   = 0;
-      information [numberOfPixelSplitHits]       = 0;
-      information [numberOfInnermostLayerSplitHits] = 0;
-      information [numberOfNextToInnermostLayerSplitHits] = 0;
-      if (track.info().trackFitter() != TrackInfo::Unknown && !m_dedxtool.empty()) {
+    if (m_pixelExists) {
+      information[numberOfContribPixelLayers] = 0;
+      information[numberOfInnermostPixelLayerHits] = 0;
+      information[numberOfInnermostPixelLayerOutliers] = 0;
+      information[numberOfNextToInnermostPixelLayerHits] = 0;
+      information[numberOfNextToInnermostPixelLayerOutliers] = 0;
+      information[numberOfPixelHits] = 0;
+      information[numberOfPixelOutliers] = 0;
+      information[numberOfGangedPixels] = 0;
+      information[numberOfGangedFlaggedFakes] = 0;
+      information[numberOfPixelSpoiltHits] = 0;
+      information[numberOfGangedFlaggedFakes] = 0;
+      information[numberOfPixelSplitHits] = 0;
+      information[numberOfInnermostLayerSplitHits] = 0;
+      information[numberOfNextToInnermostLayerSplitHits] = 0;
+      if (track.info().trackFitter() != TrackInfo::Unknown &&
+          !m_dedxtool.empty()) {
         dedx = m_dedxtool->dEdx(track, nhitsuseddedx, noverflowhitsdedx);
       }
-      information [Trk::numberOfDBMHits]                  = 0;
+      information[Trk::numberOfDBMHits] = 0;
     }
-    information [numberOfSCTHits]                  = 0;
-    information [numberOfSCTSpoiltHits]            = 0;
-    information [numberOfSCTOutliers]              = 0;
-    information [numberOfTRTHits]                  = 0;
-    information [numberOfTRTXenonHits]             = 0;
-    information [numberOfTRTHighThresholdHits]     = 0;
-    information [numberOfTRTHighThresholdHitsTotal]= 0;
-    information [numberOfTRTOutliers]              = 0;
-    information [numberOfTRTHighThresholdOutliers] = 0;
-    information [numberOfTRTTubeHits]              = 0;
-    information [numberOfTRTSharedHits]            = 0;
+    information[numberOfSCTHits] = 0;
+    information[numberOfSCTSpoiltHits] = 0;
+    information[numberOfSCTOutliers] = 0;
+    information[numberOfTRTHits] = 0;
+    information[numberOfTRTXenonHits] = 0;
+    information[numberOfTRTHighThresholdHits] = 0;
+    information[numberOfTRTHighThresholdHitsTotal] = 0;
+    information[numberOfTRTOutliers] = 0;
+    information[numberOfTRTHighThresholdOutliers] = 0;
+    information[numberOfTRTTubeHits] = 0;
+    information[numberOfTRTSharedHits] = 0;
 
     // Troels.Petersen@cern.ch:
-    if ( !m_eProbabilityTool.empty() ) {
+    if (!m_eProbabilityTool.empty()) {
       eProbability = m_eProbabilityTool->electronProbability(track);
     }
   }
 
-
   if (m_doSharedHits) {
     information [numberOfSCTSharedHits]      = 0;
     if (m_pixelExists) {
@@ -305,43 +327,22 @@ Trk::TrackSummaryTool::createSummary( const Track& track,
     eProbability.push_back(0.0);
   }
 
-  ts->m_eProbability = eProbability;
-  ts->m_idHitPattern = hitPattern.to_ulong();
-  ts->m_dedx = dedx;
-  ts->m_nhitsdedx = nhitsuseddedx;
-  ts->m_nhitsoverflowdedx = noverflowhitsdedx;
+  ts.m_eProbability = eProbability;
+  ts.m_idHitPattern = hitPattern.to_ulong();
+  ts.m_dedx = dedx;
+  ts.m_nhitsdedx = nhitsuseddedx;
+  ts.m_nhitsoverflowdedx = noverflowhitsdedx;
 
   // add detailed summary for indet
   if( m_addInDetDetailedSummary && !m_idTool.empty() ){
-    m_idTool->addDetailedTrackSummary(track,*ts);
+    m_idTool->addDetailedTrackSummary(track,ts);
   }
   // add detailed summary for muons
   if( m_addMuonDetailedSummary && !m_muonTool.empty() ){
-    m_muonTool->addDetailedTrackSummary(track,*ts);
+    m_muonTool->addDetailedTrackSummary(track,ts);
   }
   // move this part to VERBOSE
-  ATH_MSG_VERBOSE ( *ts << endmsg << "Finished!");
-
-  return ts;
-}
-
-/*
- * The the update methods
- */
-
-void Trk::TrackSummaryTool::updateTrack(Track& track,const Trk::PRDtoTrackMap *prd_to_track_map) const
-{
-  // first check if track has summary already.
-  computeAndReplaceTrackSummary(track,prd_to_track_map,false /*DO NOT suppress hole search*/);
-}
-
-void
-Trk::TrackSummaryTool::updateTrackNoHoleSearch(Track& track,
-                                               const Trk::PRDtoTrackMap* prd_to_track_map) const
-{
-  // first check if track has summary already.
-  computeAndReplaceTrackSummary(track, prd_to_track_map, true /*suppress hole search*/);
-  m_idTool->updateExpectedHitInfo(track, *track.trackSummary()); /*Needed for expected B-Layer*/
+  ATH_MSG_VERBOSE ( ts << endmsg << "Finished!");
 }
 
 void Trk::TrackSummaryTool::updateSharedHitCount(const Track& track, const Trk::PRDtoTrackMap *prd_to_track_map,TrackSummary &summary) const
diff --git a/Tracking/TrkVertexFitter/TrkVertexBilloirTools/TrkVertexBilloirTools/FastVertexFitter.h b/Tracking/TrkVertexFitter/TrkVertexBilloirTools/TrkVertexBilloirTools/FastVertexFitter.h
index ba763e34b386ed511853fe778bd3a4f9d6f537e6..09eff0b9df5463ba1b129c3ce87248b9f244904b 100755
--- a/Tracking/TrkVertexFitter/TrkVertexBilloirTools/TrkVertexBilloirTools/FastVertexFitter.h
+++ b/Tracking/TrkVertexFitter/TrkVertexBilloirTools/TrkVertexBilloirTools/FastVertexFitter.h
@@ -33,8 +33,7 @@ EDM Migration to xAOD - from Trk::VxCandidate to xAOD::Vertex,
                         from Trk::Vertex      to Amg::Vector3D
 */
 
-class ATLAS_NOT_THREAD_SAFE FastVertexFitter //const_cast the extrapolator result
-  : public extends<AthAlgTool, IVertexFitter>
+class FastVertexFitter : public extends<AthAlgTool, IVertexFitter>
 {
 public:
   // The following 'using' can be removed when IVertexFitter::fit has been fully
diff --git a/Tracking/TrkVertexFitter/TrkVertexBilloirTools/src/FastVertexFitter.cxx b/Tracking/TrkVertexFitter/TrkVertexBilloirTools/src/FastVertexFitter.cxx
index a35a85d78b886b8c0ae461e9c8847e43d0cb49c6..3de822d35296e74fa4b975c05f810549f55c8472 100755
--- a/Tracking/TrkVertexFitter/TrkVertexBilloirTools/src/FastVertexFitter.cxx
+++ b/Tracking/TrkVertexFitter/TrkVertexBilloirTools/src/FastVertexFitter.cxx
@@ -318,14 +318,15 @@ namespace Trk
 					// you need to extrapolate the original perigee ((*BTIter).originalPerigee) really to the
 					// found vertex. The first propagation above is only to the starting point. But here we
 					// want to store it wrt. to the last fitted vertex
-					Trk::TrackParameters * extrapolatedPerigee = const_cast<Trk::TrackParameters*> ( m_extrapolator->extrapolate ( * ( *BTIter ).originalPerigee, perigeeSurface ) );
+					auto extrapolatedPerigee = std::unique_ptr<const Trk::TrackParameters> ( m_extrapolator->extrapolate ( * ( *BTIter ).originalPerigee, perigeeSurface ) );
 					if ( extrapolatedPerigee==nullptr )
 					{
-						extrapolatedPerigee = ( ( *BTIter ).originalPerigee )->clone();
+						extrapolatedPerigee = std::unique_ptr<const Trk::TrackParameters>(((*BTIter).originalPerigee)->clone());
 						ATH_MSG_DEBUG("Could not extrapolate these track parameters to final vertex position! Storing original position as final one ...");
 					}
-
-					Trk::VxTrackAtVertex* tmpVxTrkAtVtx = new Trk::VxTrackAtVertex ( ( *BTIter ).chi2, extrapolatedPerigee, ( *BTIter ).originalPerigee ) ;
+          //VxTrackAtVertex will own the clone of the extrapolatedPerigee
+					Trk::VxTrackAtVertex* tmpVxTrkAtVtx = new Trk::VxTrackAtVertex ( ( *BTIter ).chi2, extrapolatedPerigee->clone(), 
+                                                                           ( *BTIter ).originalPerigee ) ;
 					tracksAtVertex.push_back ( *tmpVxTrkAtVtx );
 					// TODO: here is where the vxTracksAtVertex pointers are deleted
 					delete tmpVxTrkAtVtx; // TODO: is this ok?
diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/ATLAS_CHECK_THREAD_SAFETY b/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..415ac0cee8d0757f5a6d481ee3230b36c496556a
--- /dev/null
+++ b/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+Tracking/TrkVertexFitter/TrkVertexFitterInterfaces
diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/ImpactPoint3dEstimator_test.ref b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/ImpactPoint3dEstimator_test.ref
index 3c785584c0fa8756412a6edeea2d3ff0c3b74d75..1f10c9c8f9880470c83d7437c43ddd68c5498b39 100644
--- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/ImpactPoint3dEstimator_test.ref
+++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/ImpactPoint3dEstimator_test.ref
@@ -1,18 +1,29 @@
 TrkVertexFitterUtils/ImpactPoint3dEstimator_test
 
 
+Initializing Gaudi ApplicationMgr using job opts /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexFitterUtils/TrkVertexFitterUtils_tests.txt
+JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexFitterUtils/TrkVertexFitterUtils_tests.txt
+JobOptionsSvc        INFO # (1,1): ToolSvc.Trk::DetAnnealingMaker.SetOfTemperatures = [3, 2, 1]
+JobOptionsSvc        INFO Job options successfully read in from /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexFitterUtils/TrkVertexFitterUtils_tests.txt
+ApplicationMgr    SUCCESS 
+====================================================================================================================================
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v34r0)
+                                          running on lxplus750.cern.ch on Wed Sep 23 18:13:22 2020
+====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 EventLoopMgr      WARNING Unable to locate service "EventSelector" 
 EventLoopMgr      WARNING No events will be processed from external input.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr Ready
+ClassIDSvc           INFO  getRegistryEntries: read 1476 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 379 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 2769 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 652 CLIDRegistry entries for module ALL
 ServiceManager      FATAL No Service factory for AtlasTrackingGeometrySvc available.
 ToolSvc.Trk::Ex...  ERROR ServiceLocatorHelper::service: can not locate service AtlasTrackingGeometrySvc
 ToolSvc.Trk::Ex...WARNING Couldn't retrieve TrackingGeometrySvc = ServiceHandle('AtlasTrackingGeometrySvc'). 
 ToolSvc.Trk::Ex...WARNING  -> Trying to retrieve default 'AtlasTrackingGeometry' from DetectorStore.
-ToolSvc.Trk::Ex...   INFO Minimal momentum cut for material update : 50 MeV
-ToolSvc.AtlasEn...   INFO initialize()
 ToolSvc.AtlasMu...   INFO initialize() successful
+ClassIDSvc           INFO  getRegistryEntries: read 113 CLIDRegistry entries for module ALL
 ToolSvc.Trk::Ex...   INFO initialize() successful
-ToolSvc.Trk::Ex...   INFO initialize()
 test1
diff --git a/Tracking/TrkVertexFitter/TrkVertexFitters/TrkVertexFitters/DummyVertexSmoother.h b/Tracking/TrkVertexFitter/TrkVertexFitters/TrkVertexFitters/DummyVertexSmoother.h
index a48d3de9e74cf5fd741de83ea170ef20a6ef01df..4e4fc91aad7c4a8fc2d9f2a7f4c4c37d9915282e 100755
--- a/Tracking/TrkVertexFitter/TrkVertexFitters/TrkVertexFitters/DummyVertexSmoother.h
+++ b/Tracking/TrkVertexFitter/TrkVertexFitters/TrkVertexFitters/DummyVertexSmoother.h
@@ -40,7 +40,7 @@ namespace Trk
    */ 
 
   //Not THREAD_SAFE due to const_cast 
-  class ATLAS_NOT_THREAD_SAFE DummyVertexSmoother : public AthAlgTool, virtual public IVertexSmoother
+  class DummyVertexSmoother : public AthAlgTool, virtual public IVertexSmoother
   {
   public:
   
diff --git a/Tracking/TrkVertexFitter/TrkVertexFitters/src/DummyVertexSmoother.cxx b/Tracking/TrkVertexFitter/TrkVertexFitters/src/DummyVertexSmoother.cxx
index bad68a45f101d3626c6ddf1a8a4e67ace2c13ef6..03a19f720072a13553612999bf98802cc50dde75 100755
--- a/Tracking/TrkVertexFitter/TrkVertexFitters/src/DummyVertexSmoother.cxx
+++ b/Tracking/TrkVertexFitter/TrkVertexFitters/src/DummyVertexSmoother.cxx
@@ -75,14 +75,13 @@ namespace Trk
 
           if(initPar != nullptr)
           {
-            //This does not play well with const correctness
             //Either we should return non-const parameters from the extrapolator
             //as the owner here has to delete them
             //Or we need to clone  
-            const Trk::TrackParameters* extrapolatedPerigee(m_extrapolator->extrapolate(*initPar,perigeeSurface));
+            auto extrapolatedPerigee = std::unique_ptr<const Trk::TrackParameters>(m_extrapolator->extrapolate(*initPar,perigeeSurface));
             if(extrapolatedPerigee != nullptr)
             {
-              (*t_it).setPerigeeAtVertex(const_cast<Trk::TrackParameters*>(extrapolatedPerigee));
+              (*t_it).setPerigeeAtVertex(extrapolatedPerigee->clone());
             } else {
               msg(MSG::ERROR)  << " Extrapolation failed; VxTrackAtertex will not be updated" << endmsg;
             }//end of successfull extrapolation check
diff --git a/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx b/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx
index 0476c11ae892138103452f2d7c11182833430ec1..5aaf35b9b998eba0a519fc273cdac16878a1a8ab 100644
--- a/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx
+++ b/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx
@@ -1664,7 +1664,7 @@ const IRoiDescriptor* TrigMuSuperEF::getRoiDescriptor(const HLT::TriggerElement*
       }
       
       if (trigRoI) {
-	newTrigRoI = createSingleTrigRoiDescriptor( trigRoI->eta(), trigRoI->phi(), m_dEtaRoI, m_dPhiRoI, trigRoI->roiId() );
+	newTrigRoI = new TrigRoiDescriptor(unsigned(0), unsigned(trigRoI->roiId()), trigRoI->eta(), trigRoI->etaMinus(), trigRoI->etaPlus(), trigRoI->phi(), trigRoI->phiMinus(), trigRoI->phiPlus());
 	m_Roi_StillToBeAttached = newTrigRoI;
 	m_roi = newTrigRoI;
       } // if trigRoI
diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/CaloDef.py b/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/CaloDef.py
index 16bd617e6908858840ac38f31ba3978dd7480b89..6093811ed349e5ea95b4ed5cc83fbdbec0888d46 100644
--- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/CaloDef.py
+++ b/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/CaloDef.py
@@ -142,8 +142,7 @@ def HLTRoITopoRecoSequence(RoIs):
     import AthenaCommon.CfgMgr as CfgMgr
     HLTRoITopoRecoSequenceVDV = CfgMgr.AthViews__ViewDataVerifier("HLTRoITopoRecoSequenceVDV")
     HLTRoITopoRecoSequenceVDV.DataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+PrecisionCaloRoIs' ),
-                                             ( 'CaloBCIDAverage' , 'StoreGateSvc+CaloBCIDAverage' ),
-                                             ( 'ILArHVScaleCorr' , 'ConditionStore+LArHVScaleCorrRecomputed' )]
+                                             ( 'CaloBCIDAverage' , 'StoreGateSvc+CaloBCIDAverage' )]
 
     cellMaker = HLTCellMaker(RoIs, algSuffix="RoI")
     topoClusterMaker = _algoHLTTopoCluster(inputEDM = cellMaker.CellsName, algSuffix="RoI")
diff --git a/Trigger/TrigAnalysis/TrigJiveXML/src/TrigSiSpacePointRetriever.cxx b/Trigger/TrigAnalysis/TrigJiveXML/src/TrigSiSpacePointRetriever.cxx
index c42287556dbb754343892b217be39daccc0df46e..53d943cc5f083e8ea67166ef6256a94c48998820 100755
--- a/Trigger/TrigAnalysis/TrigJiveXML/src/TrigSiSpacePointRetriever.cxx
+++ b/Trigger/TrigAnalysis/TrigJiveXML/src/TrigSiSpacePointRetriever.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 "TrigJiveXML/TrigSiSpacePointRetriever.h"
@@ -21,13 +21,13 @@ namespace JiveXML {
     AthAlgTool(type, name, parent),
     m_typeName("TrigS3D"),
     m_pixelHelper(nullptr),
-    m_sctHelper(nullptr)
+    m_sctHelper(nullptr),
+    m_pixelSpContainerName ("TrigPixelSpacePoints"),
+    m_SCT_SpContainerName  ("TrigSCT_SpacePoints")
   {
 
     declareInterface<IDataRetriever>(this);
 
-    m_pixelSpContainerName = "TrigPixelSpacePoints";
-    m_SCT_SpContainerName  = "TrigSCT_SpacePoints";
     declareProperty("PixelSpacePoints", m_pixelSpContainerName);
     declareProperty("SCTSpacePoints"  , m_SCT_SpContainerName);
   }
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcConfig.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcConfig.py
index aa9e51a3481cb7d87dc6e387c9669d5721885f73..59b620da65188398096f77ff782781665c077125 100755
--- a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcConfig.py
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcConfig.py
@@ -82,7 +82,7 @@ class DefaultHLTConfigSvc( TrigConf__HLTConfigSvc ):
         else:
             mlog.info("Will load algos from xml")
             allalgs = []
-            doc = ET.parse(self.XMLMenuFile)
+            doc = ET.parse( findFileInXMLPATH(self.XMLMenuFile) )
             algs = self.getAllAlgorithms(doc)
             l2TEs, efTEs = self.getTEsByLevel(doc)
 
@@ -111,7 +111,7 @@ class DefaultHLTConfigSvc( TrigConf__HLTConfigSvc ):
             mlog.info("Will load algos from xml")
             l2algs = []
             efalgs = []
-            doc = ET.parse(self.XMLMenuFile)
+            doc = ET.parse( findFileInXMLPATH(self.XMLMenuFile) )
             algs = self.getAllAlgorithms(doc)
             l2TEs, efTEs = self.getTEsByLevel(doc)
 
@@ -130,7 +130,7 @@ class DefaultHLTConfigSvc( TrigConf__HLTConfigSvc ):
         l2TEs = []
         efTEs = []
         #print "INFO parsing: " + self.XMLMenuFile
-        if not doc: doc = ET.parse(self.XMLMenuFile)
+        if not doc: doc = ET.parse( findFileInXMLPATH(self.XMLMenuFile) )
 
         #print "INFO got chains " + str(chainlist)
         for ch in doc.getiterator("CHAIN"):
@@ -173,7 +173,7 @@ class DefaultHLTConfigSvc( TrigConf__HLTConfigSvc ):
 
     def getAllSequenceInputs (self, doc = None):
         """ Produce dictionaries where key is outout TE name and values are tuples of TEs """
-        if not doc: doc = ET.parse(self.XMLMenuFile)
+        if not doc: doc = ET.parse( findFileInXMLPATH(self.XMLMenuFile) )
         inp = {}
         for seq in doc.getiterator("SEQUENCE"):
             #print "INFO Discovered algorithms in the sequence: " + seq.getAttribute("algorithm")
@@ -183,7 +183,7 @@ class DefaultHLTConfigSvc( TrigConf__HLTConfigSvc ):
     def getAllAlgorithms(self, doc = None):
         """ Produce dictionary where key is output TE name of the sequence and value is a list of algos in sequence"""
         #print "INFO parsing: " + self.XMLMenuFile
-        if not doc: doc = ET.parse(self.XMLMenuFile)
+        if not doc: doc = ET.parse( findFileInXMLPATH(self.XMLMenuFile) )
         #print "INFO getting sequences "
         algos = {}
         for seq in doc.getiterator("SEQUENCE"):
diff --git a/Trigger/TrigCost/TrigCostD3PD/CMakeLists.txt b/Trigger/TrigCost/TrigCostD3PD/CMakeLists.txt
deleted file mode 100644
index e31dc074cb246ada51748311bca97d8af4d4cf5a..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-################################################################################
-# Package: TrigCostD3PD
-################################################################################
-
-# Declare the package name:
-atlas_subdir( TrigCostD3PD )
-
-# External dependencies:
-find_package( ROOT COMPONENTS Cint Core Tree MathCore Hist RIO pthread )
-
-# Component(s) in the package:
-atlas_add_root_dictionary( TrigCostD3PD
-                           TrigCostD3PDDictSource
-                           ROOT_HEADERS TrigCostD3PD/*.h Root/LinkDef.h
-                           EXTERNAL_PACKAGES ROOT )
-
-atlas_add_library( TrigCostD3PD
-                   Root/*.cxx
-                   ${TrigCostD3PDDictSource}
-                   PUBLIC_HEADERS TrigCostD3PD
-                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${ROOT_LIBRARIES} )
-
diff --git a/Trigger/TrigCost/TrigCostD3PD/Root/LinkDef.h b/Trigger/TrigCost/TrigCostD3PD/Root/LinkDef.h
deleted file mode 100644
index d2295f82fbfc2296dd5a0d4212688e161e2ee1bb..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/Root/LinkDef.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: Helpers.py 530000 2012-12-11 15:45:53Z krasznaa $
-#ifdef __CINT__
-
-#include "../TrigCostD3PD/D3PDObjectBase.h"
-//#include "../TrigCostD3PD/D3PDPerfStats.h"
-//#include "../TrigCostD3PD/D3PDReadStats.h"
-#include "../TrigCostD3PD/NTUP_TRIGCOST.h"
-#include "../TrigCostD3PD/TrigCostD3PDObject.h"
-#include "../TrigCostD3PD/TrigDBKeysD3PDObject.h"
-#include "../TrigCostD3PD/UserD3PDObject.h"
-#include "../TrigCostD3PD/Utils.h"
-
-#pragma link off all globals;
-#pragma link off all classes;
-#pragma link off all functions;
-
-#pragma link C++ nestedclass;
-
-#pragma link C++ class std::map<std::string,int>+;
-#pragma link C++ class std::map<std::string,float>+;
-
-#pragma link C++ class D3PDReader::VarHandleBase+;
-#pragma link C++ class D3PDReader::VarProxyBase+;
-//#pragma link C++ class D3PDReader::VariableStats+;
-//#pragma link C++ class D3PDReader::D3PDReadStats+;
-//#pragma link C++ class map<TString,D3PDReader::VariableStats>+;
-//#pragma link C++ class pair<TString,D3PDReader::VariableStats>+;
-#pragma link C++ class map<TString,D3PDReader::VarHandleBase*>+;
-#pragma link C++ class pair<TString,D3PDReader::VarHandleBase*>+;
-#pragma link C++ class D3PDReader::UserD3PDObjectElement+;
-#pragma link C++ class D3PDReader::UserD3PDObject+;
-#pragma link C++ class D3PDReader::VarHandle<unsigned int>+;
-#pragma link C++ class D3PDReader::D3PDObjectBase+;
-//#pragma link C++ class D3PDReader::D3PDPerfStats+;
-#pragma link C++ class D3PDReader::VarHandle<float>+;
-#pragma link C++ class D3PDReader::NTUP_TRIGCOST+;
-#pragma link C++ class D3PDReader::VarHandle<vector<unsigned short>*>+;
-#pragma link C++ class D3PDReader::VarHandle<vector<unsigned char>*>+;
-#pragma link C++ class D3PDReader::VarHandle<unsigned short>+;
-#pragma link C++ class D3PDReader::VarHandle<vector<float>*>+;
-#pragma link C++ class D3PDReader::VarHandle<vector<vector<unsigned int> >*>+;
-#pragma link C++ class D3PDReader::VarHandle<vector<vector<unsigned char> >*>+;
-#pragma link C++ class D3PDReader::VarHandle<vector<unsigned int>*>+;
-#pragma link C++ class D3PDReader::VarHandle<vector<double>*>+;
-#pragma link C++ class D3PDReader::VarHandle<vector<vector<double> >*>+;
-#pragma link C++ class D3PDReader::VarHandle<vector<vector<unsigned short> >*>+;
-#pragma link C++ class D3PDReader::TrigCostD3PDObject+;
-#pragma link C++ class D3PDReader::TrigDBKeysD3PDObject+;
-#pragma link C++ class D3PDReader::VarHandle<vector<short>*>+;
-#pragma link C++ class D3PDReader::VarHandle<bool>+;
-// You can disable the remaining lines if you don't
-// plan to use the library in CINT or PyROOT.
-#pragma link C++ function D3PDReader::UserD3PDObject::DeclareVariable<bool>;
-#pragma link C++ function D3PDReader::UserD3PDObject::DeclareVariable<short>;
-#pragma link C++ function D3PDReader::UserD3PDObject::DeclareVariable<unsigned short>;
-#pragma link C++ function D3PDReader::UserD3PDObject::DeclareVariable<int>;
-#pragma link C++ function D3PDReader::UserD3PDObject::DeclareVariable<unsigned int>;
-#pragma link C++ function D3PDReader::UserD3PDObject::DeclareVariable<long long>;
-#pragma link C++ function D3PDReader::UserD3PDObject::DeclareVariable<unsigned long long>;
-#pragma link C++ function D3PDReader::UserD3PDObject::DeclareVariable<float>;
-#pragma link C++ function D3PDReader::UserD3PDObject::DeclareVariable<double>;
-#pragma link C++ function D3PDReader::UserD3PDObject::Variable<bool>;
-#pragma link C++ function D3PDReader::UserD3PDObject::Variable<short>;
-#pragma link C++ function D3PDReader::UserD3PDObject::Variable<unsigned short>;
-#pragma link C++ function D3PDReader::UserD3PDObject::Variable<int>;
-#pragma link C++ function D3PDReader::UserD3PDObject::Variable<unsigned int>;
-#pragma link C++ function D3PDReader::UserD3PDObject::Variable<long long>;
-#pragma link C++ function D3PDReader::UserD3PDObject::Variable<unsigned long long>;
-#pragma link C++ function D3PDReader::UserD3PDObject::Variable<float>;
-#pragma link C++ function D3PDReader::UserD3PDObject::Variable<double>;
-#pragma link C++ function D3PDReader::UserD3PDObjectElement::Variable<short>;
-#pragma link C++ function D3PDReader::UserD3PDObjectElement::Variable<unsigned short>;
-#pragma link C++ function D3PDReader::UserD3PDObjectElement::Variable<int>;
-#pragma link C++ function D3PDReader::UserD3PDObjectElement::Variable<unsigned int>;
-#pragma link C++ function D3PDReader::UserD3PDObjectElement::Variable<long long>;
-#pragma link C++ function D3PDReader::UserD3PDObjectElement::Variable<unsigned long long>;
-#pragma link C++ function D3PDReader::UserD3PDObjectElement::Variable<float>;
-#pragma link C++ function D3PDReader::UserD3PDObjectElement::Variable<double>;
-
-#endif // __CINT__
diff --git a/Trigger/TrigCost/TrigCostD3PD/Root/NTUP_TRIGCOST.cxx b/Trigger/TrigCost/TrigCostD3PD/Root/NTUP_TRIGCOST.cxx
deleted file mode 100644
index 01315336d4095273a4eb4b3a23463d4cfac9c082..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/Root/NTUP_TRIGCOST.cxx
+++ /dev/null
@@ -1,105 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// -------------------------------------------------------------
-//             Code produced by D3PDMakerReader
-//
-//  author: Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
-// -------------------------------------------------------------
-
-#include "../TrigCostD3PD/NTUP_TRIGCOST.h"
-//#include "../TrigCostD3PD/D3PDPerfStats.h"
-
-ClassImp( D3PDReader::NTUP_TRIGCOST )
-
-namespace D3PDReader {
-
-   NTUP_TRIGCOST::NTUP_TRIGCOST()
-      : D3PDObjectBase(),
-        TrigCostHLT( m_entry, "TrigCostHLT_" ),
-        trig_DB( m_entry, "trig_DB_" ),
-        m_entry( 0 ),
-        m_fromInput( kTRUE ) {
-
-   }
-
-   NTUP_TRIGCOST::NTUP_TRIGCOST( Bool_t )
-      : D3PDObjectBase(),
-        TrigCostHLT( "TrigCostHLT_" ),
-        trig_DB( "trig_DB_" ),
-        m_entry( 0 ),
-        m_fromInput( kFALSE ) {
-
-   }
-
-   const char* NTUP_TRIGCOST::GetPrefix() const {
-
-      Warning( "GetPrefix", "A prefix is not defined for this object" );
-      return "";
-   }
-
-   void NTUP_TRIGCOST::SetPrefix( const char* ) {
-
-      Warning( "SetPrefix", "A prefix is not defined for this object" );
-      return;
-   }
-
-   void NTUP_TRIGCOST::ReadFrom( ::TTree* tree ) {
-
-      if( ! m_fromInput ) {
-         Error( "ReadFrom", "Object can't read a D3PD. Use a different constructor!" );
-         return;
-      }
-
-      TrigCostHLT.ReadFrom( tree );
-      trig_DB.ReadFrom( tree );
-
-      return;
-   }
-
-   void NTUP_TRIGCOST::WriteTo( ::TTree* tree ) {
-
-      TrigCostHLT.WriteTo( tree );
-      trig_DB.WriteTo( tree );
-
-      return;
-   }
-
-   void NTUP_TRIGCOST::SetActive( ::Bool_t active, const ::TString& pattern ) {
-
-      TrigCostHLT.SetActive( active, pattern );
-      trig_DB.SetActive( active, pattern );
-
-      return;
-   }
-
-   void NTUP_TRIGCOST::ReadAllActive() {
-
-      TrigCostHLT.ReadAllActive();
-      trig_DB.ReadAllActive();
-
-      return;
-   }
-
-   // D3PDReadStats NTUP_TRIGCOST::GetStatistics() const {
-
-   //    // The result object:
-   //    D3PDReadStats result( D3PDPerfStats::Instance()->GetStats() );
-
-   //    // Collect the statistics from all constituents:
-   //    result += TrigCostHLT.GetStatistics();
-   //    result += trig_DB.GetStatistics();
-
-   //    return result;
-   // }
-
-   void NTUP_TRIGCOST::GetEntry( ::Long64_t entry ) {
-
-      m_entry = entry;
-      return;
-   }
-
-} // namespace D3PDReader
diff --git a/Trigger/TrigCost/TrigCostD3PD/Root/TrigCostD3PDObject.cxx b/Trigger/TrigCost/TrigCostD3PD/Root/TrigCostD3PDObject.cxx
deleted file mode 100644
index 70c5b52afb5565a78492ac87d186c338f07b4315..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/Root/TrigCostD3PDObject.cxx
+++ /dev/null
@@ -1,1450 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// -------------------------------------------------------------
-//             Code produced by D3PDMakerReader
-//
-//  author: Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
-// -------------------------------------------------------------
-
-#include <TPRegexp.h>
-#include <TList.h>
-#include <TDataMember.h>
-
-#include "../TrigCostD3PD/TrigCostD3PDObject.h"
-
-ClassImp( D3PDReader::TrigCostD3PDObject )
-
-namespace D3PDReader {
-
-   /**
-    * This constructor should be used when the object will be used to read
-    * variables from an existing ntuple. The object will also be able to
-    * output variables, but it will also need to read them from somewhere.
-    *
-    * @param master Reference to the variable holding the current event number
-    * @param prefix Prefix of the variables in the D3PD
-    */
-   TrigCostD3PDObject::TrigCostD3PDObject( const ::Long64_t& master, const char* prefix )
-      : UserD3PDObject( master, prefix ),
-        m_handles(),
-        m_fromInput( kTRUE ),
-        m_prefix( prefix ) {
-
-      SetVarHandles( &master );
-   }
-
-   /**
-    * This constructor can be used when the object will only have to output
-    * (and temporarily store) new information into an output ntuple. For
-    * instance when one wants to create a selected/modified list of information.
-    *
-    * @param prefix Prefix of the variables in the D3PD
-    */
-   TrigCostD3PDObject::TrigCostD3PDObject( const char* prefix )
-      : UserD3PDObject( prefix ),
-        m_handles(),
-        m_fromInput( kFALSE ),
-        m_prefix( prefix ) {
-
-      SetVarHandles( 0 );
-   }
-
-   /**
-    * @returns The branch name prefix used by the object
-    */
-   const char* TrigCostD3PDObject::GetPrefix() const {
-
-      return m_prefix;
-   }
-
-   /**
-    * @param prefix The prefix that should be used for the variables
-    */
-   void TrigCostD3PDObject::SetPrefix( const char* prefix ) {
-
-      // Call the base class's function:
-      UserD3PDObject::SetPrefix( prefix );
-
-      // Remember the prefix:
-      m_prefix = prefix;
-
-      // Set all the variable names:
-      std::map< TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         itr->second->SetName( ::TString( prefix ) + itr->first );
-      }
-
-      return;
-   }
-
-   /**
-    * This function should be called every time a new TFile is opened
-    * by your analysis code.
-    *
-    * @param tree Pointer to the TTree with the variables
-    */
-   void TrigCostD3PDObject::ReadFrom( TTree* tree ) {
-
-      // Check if the object will be able to read from the TTree:
-      if( ! m_fromInput ) {
-         Error( "ReadFrom", "The object was not created with the correct" );
-         Error( "ReadFrom", "constructor to read data from a D3PD!" );
-         return;
-      }
-
-      // Call the base class's function:
-      UserD3PDObject::ReadFrom( tree );
-
-      // Call ReadFrom(...) on all the variables:
-      std::map< TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         itr->second->ReadFrom( tree );
-      }
-
-      return;
-   }
-
-   /**
-    * This function can be called to connect the active variables of the object
-    * to an output TTree. It can be called multiple times, then the variables
-    * will be written to multiple TTrees.
-    *
-    * @param tree Pointer to the TTree where the variables should be written
-    */
-   void TrigCostD3PDObject::WriteTo( TTree* tree ) {
-
-      // Call the base class's function:
-      UserD3PDObject::WriteTo( tree );
-
-      // Call WriteTo(...) on all the variables:
-      std::map< TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         itr->second->WriteTo( tree );
-      }
-
-      return;
-   }
-
-   /**
-    * This is a convenience function for turning the branches active or
-    * inactive conveniently. If the parameter is set to <code>kTRUE</code>
-    * then the branches available from the input which match the given
-    * pattern are turned active.
-    * When it's set to <code>kFALSE</code> then all the variables matching
-    * the pattern are turned inactive.
-    *
-    * @param active Flag behaving as explained above
-    * @param pattern Regular expression specifying which branches to modify
-    */
-   void TrigCostD3PDObject::SetActive( ::Bool_t active, const ::TString& pattern ) {
-
-      // Call the base class's function:
-      UserD3PDObject::SetActive( active, pattern );
-
-      ::TPRegexp re( pattern );
-
-      std::map< TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         if( ! re.Match( m_prefix + itr->first ) ) continue;
-         if( active ) {
-            if( itr->second->IsAvailable() ) itr->second->SetActive( active );
-         } else {
-            itr->second->SetActive( active );
-         }
-      }
-
-      return;
-   }
-
-   /**
-    * This function can be used to read in all the branches from the input
-    * TTree which are set active for writing out. This can simplify writing
-    * event selector codes immensely. Remember to set the desired variable
-    * active before calling this function.
-    */
-   void TrigCostD3PDObject::ReadAllActive() {
-
-      // Check if it makes sense to call this function:
-      if( ! m_fromInput ) {
-         static ::Bool_t wPrinted = kFALSE;
-         if( ! wPrinted ) {
-            Warning( "ReadAllActive", "Function only meaningful when used on objects" );
-            Warning( "ReadAllActive", "which are used to read information from a D3PD" );
-            wPrinted = kTRUE;
-         }
-      }
-
-      // Call the base class's function:
-      UserD3PDObject::ReadAllActive();
-
-      // Read in the current entry for each active variable:
-      std::map< TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         if( ! itr->second->IsActive() ) continue;
-         itr->second->ReadCurrentEntry();
-      }
-
-      return;
-   }
-
-   /**
-    * This function can be used to get information about the access
-    * pattern/statistics of the job. It should be called at the end of
-    * an analysis job to get the information about the performance of the
-    * analysis.
-    *
-    * @returns An object describing the D3PD access statistics
-    */
-   // D3PDReadStats TrigCostD3PDObject::GetStatistics() const {
-
-   //    // The result object:
-   //    D3PDReadStats result = UserD3PDObject::GetStatistics();
-
-   //    // Add the statistics from each variable to the result:
-   //    std::map< ::TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-   //    std::map< ::TString, VarHandleBase* >::const_iterator end = m_handles.end();
-   //    for( ; itr != end; ++itr ) {
-   //       result.AddVariable( itr->second->GetStatistics() );
-   //    }
-
-   //    return result;
-   // }
-
-   /**
-    * This function can be used to copy the contents of the entire object
-    * for a given event. This can be useful for instance when the user
-    * wants to copy all information to an output file, and modify it a bit,
-    * and only then write it out.
-    *
-    * @param parent The object to copy the information from
-    * @returns This same object, for convenience reasons
-    */
-   TrigCostD3PDObject& TrigCostD3PDObject::Set( const TrigCostD3PDObject& parent ) {
-
-      // Check if this function can be used on the object:
-      if( m_fromInput ) {
-         Error( "Set", "Objects used for reading a D3PD can't be modified!" );
-         return *this;
-      }
-
-      // Call the base class's function:
-      UserD3PDObject::Set( parent );
-
-      if( parent.appId.IsAvailable() && appId.IsActive() ) {
-         appId() = parent.appId();
-      } else {
-         appId() = 0;
-      }
-      if( parent.ebWeight.IsAvailable() && ebWeight.IsActive() ) {
-         ebWeight() = parent.ebWeight();
-      } else {
-         ebWeight() = 0;
-      }
-      if( parent.ebWeightBG.IsAvailable() && ebWeightBG.IsActive() ) {
-         ebWeightBG() = parent.ebWeightBG();
-      } else {
-         ebWeightBG() = 0;
-      }
-      if( parent.ebUnbiased.IsAvailable() && ebUnbiased.IsActive() ) {
-         ebUnbiased() = parent.ebUnbiased();
-      } else {
-         ebUnbiased() = 0;
-      }
-      if( parent.ranScaleTools.IsAvailable() && ranScaleTools.IsActive() ) {
-         ranScaleTools() = parent.ranScaleTools();
-      } else {
-         ranScaleTools() = 0;
-      }
-      if( parent.bunchCrossingId.IsAvailable() && bunchCrossingId.IsActive() ) {
-         bunchCrossingId() = parent.bunchCrossingId();
-      } else {
-         bunchCrossingId() = 0;
-      }
-      if( parent.chain_counter.IsAvailable() && chain_counter.IsActive() ) {
-         *( chain_counter() ) = *( parent.chain_counter() );
-      } else {
-         chain_counter()->clear();
-      }
-      if( parent.chain_isExpressStream.IsAvailable() && chain_isExpressStream.IsActive() ) {
-         *( chain_isExpressStream() ) = *( parent.chain_isExpressStream() );
-      } else {
-         chain_isExpressStream()->clear();
-      }
-      if( parent.chain_isPassed.IsAvailable() && chain_isPassed.IsActive() ) {
-         *( chain_isPassed() ) = *( parent.chain_isPassed() );
-      } else {
-         chain_isPassed()->clear();
-      }
-      if( parent.chain_isPassedRaw.IsAvailable() && chain_isPassedRaw.IsActive() ) {
-         *( chain_isPassedRaw() ) = *( parent.chain_isPassedRaw() );
-      } else {
-         chain_isPassedRaw()->clear();
-      }
-      if( parent.chain_isPassthrough.IsAvailable() && chain_isPassthrough.IsActive() ) {
-         *( chain_isPassthrough() ) = *( parent.chain_isPassthrough() );
-      } else {
-         chain_isPassthrough()->clear();
-      }
-      if( parent.chain_isPrescaled.IsAvailable() && chain_isPrescaled.IsActive() ) {
-         *( chain_isPrescaled() ) = *( parent.chain_isPrescaled() );
-      } else {
-         chain_isPrescaled()->clear();
-      }
-      if( parent.chain_isResurrected.IsAvailable() && chain_isResurrected.IsActive() ) {
-         *( chain_isResurrected() ) = *( parent.chain_isResurrected() );
-      } else {
-         chain_isResurrected()->clear();
-      }
-      if( parent.chain_level.IsAvailable() && chain_level.IsActive() ) {
-         *( chain_level() ) = *( parent.chain_level() );
-      } else {
-         chain_level()->clear();
-      }
-      if( parent.chain_n.IsAvailable() && chain_n.IsActive() ) {
-         chain_n() = parent.chain_n();
-      } else {
-         chain_n() = 0;
-      }
-      if( parent.chain_timer.IsAvailable() && chain_timer.IsActive() ) {
-         *( chain_timer() ) = *( parent.chain_timer() );
-      } else {
-         chain_timer()->clear();
-      }
-      if( parent.chain_wasL1AfterPrescale.IsAvailable() && chain_wasL1AfterPrescale.IsActive() ) {
-         *( chain_wasL1AfterPrescale() ) = *( parent.chain_wasL1AfterPrescale() );
-      } else {
-         chain_wasL1AfterPrescale()->clear();
-      }
-      if( parent.chain_wasL1AfterVeto.IsAvailable() && chain_wasL1AfterVeto.IsActive() ) {
-         *( chain_wasL1AfterVeto() ) = *( parent.chain_wasL1AfterVeto() );
-      } else {
-         chain_wasL1AfterVeto()->clear();
-      }
-      if( parent.chain_wasL1BeforePrescale.IsAvailable() && chain_wasL1BeforePrescale.IsActive() ) {
-         *( chain_wasL1BeforePrescale() ) = *( parent.chain_wasL1BeforePrescale() );
-      } else {
-         chain_wasL1BeforePrescale()->clear();
-      }
-      if( parent.costEvent.IsAvailable() && costEvent.IsActive() ) {
-         costEvent() = parent.costEvent();
-      } else {
-         costEvent() = 0;
-      }
-      if( parent.costRunNsec.IsAvailable() && costRunNsec.IsActive() ) {
-         costRunNsec() = parent.costRunNsec();
-      } else {
-         costRunNsec() = 0;
-      }
-      if( parent.costRunSec.IsAvailable() && costRunSec.IsActive() ) {
-         costRunSec() = parent.costRunSec();
-      } else {
-         costRunSec() = 0;
-      }
-      if( parent.eventNumber.IsAvailable() && eventNumber.IsActive() ) {
-         eventNumber() = parent.eventNumber();
-      } else {
-         eventNumber() = 0;
-      }
-      if( parent.l1_ctpId.IsAvailable() && l1_ctpId.IsActive() ) {
-         *( l1_ctpId() ) = *( parent.l1_ctpId() );
-      } else {
-         l1_ctpId()->clear();
-      }
-      if( parent.l1_isPrescaled.IsAvailable() && l1_isPrescaled.IsActive() ) {
-         *( l1_isPrescaled() ) = *( parent.l1_isPrescaled() );
-      } else {
-         l1_isPrescaled()->clear();
-      }
-      if( parent.l1_isVetoed.IsAvailable() && l1_isVetoed.IsActive() ) {
-         *( l1_isVetoed() ) = *( parent.l1_isVetoed() );
-      } else {
-         l1_isVetoed()->clear();
-      }
-      if( parent.l1_n.IsAvailable() && l1_n.IsActive() ) {
-         l1_n() = parent.l1_n();
-      } else {
-         l1_n() = 0;
-      }
-      if( parent.l1_passed.IsAvailable() && l1_passed.IsActive() ) {
-         *( l1_passed() ) = *( parent.l1_passed() );
-      } else {
-         l1_passed()->clear();
-      }
-      if( parent.l1_passedAfterPrescale.IsAvailable() && l1_passedAfterPrescale.IsActive() ) {
-         *( l1_passedAfterPrescale() ) = *( parent.l1_passedAfterPrescale() );
-      } else {
-         l1_passedAfterPrescale()->clear();
-      }
-      if( parent.l1_passedAfterVeto.IsAvailable() && l1_passedAfterVeto.IsActive() ) {
-         *( l1_passedAfterVeto() ) = *( parent.l1_passedAfterVeto() );
-      } else {
-         l1_passedAfterVeto()->clear();
-      }
-      if( parent.l1_passedBeforePrescale.IsAvailable() && l1_passedBeforePrescale.IsActive() ) {
-         *( l1_passedBeforePrescale() ) = *( parent.l1_passedBeforePrescale() );
-      } else {
-         l1_passedBeforePrescale()->clear();
-      }
-      if( parent.lumi.IsAvailable() && lumi.IsActive() ) {
-         lumi() = parent.lumi();
-      } else {
-         lumi() = 0;
-      }
-      if( parent.lumiLength.IsAvailable() && lumiLength.IsActive() ) {
-         lumiLength() = parent.lumiLength();
-      } else {
-         lumiLength() = 0;
-      }
-      if( parent.nanoSeconds.IsAvailable() && nanoSeconds.IsActive() ) {
-         nanoSeconds() = parent.nanoSeconds();
-      } else {
-         nanoSeconds() = 0;
-      }
-      if( parent.rob_data_id.IsAvailable() && rob_data_id.IsActive() ) {
-         *( rob_data_id() ) = *( parent.rob_data_id() );
-      } else {
-         rob_data_id()->clear();
-      }
-      if( parent.rob_data_isCached.IsAvailable() && rob_data_isCached.IsActive() ) {
-         *( rob_data_isCached() ) = *( parent.rob_data_isCached() );
-      } else {
-         rob_data_isCached()->clear();
-      }
-      if( parent.rob_data_isDisabled.IsAvailable() && rob_data_isDisabled.IsActive() ) {
-         *( rob_data_isDisabled() ) = *( parent.rob_data_isDisabled() );
-      } else {
-         rob_data_isDisabled()->clear();
-      }
-      if( parent.rob_data_isIgnored.IsAvailable() && rob_data_isIgnored.IsActive() ) {
-         *( rob_data_isIgnored() ) = *( parent.rob_data_isIgnored() );
-      } else {
-         rob_data_isIgnored()->clear();
-      }
-      if( parent.rob_data_isRetrieved.IsAvailable() && rob_data_isRetrieved.IsActive() ) {
-         *( rob_data_isRetrieved() ) = *( parent.rob_data_isRetrieved() );
-      } else {
-         rob_data_isRetrieved()->clear();
-      }
-      if( parent.rob_data_isStatusOk.IsAvailable() && rob_data_isStatusOk.IsActive() ) {
-         *( rob_data_isStatusOk() ) = *( parent.rob_data_isStatusOk() );
-      } else {
-         rob_data_isStatusOk()->clear();
-      }
-      if( parent.rob_data_isStatusPrefetched.IsAvailable() && rob_data_isStatusPrefetched.IsActive() ) {
-         *( rob_data_isStatusPrefetched() ) = *( parent.rob_data_isStatusPrefetched() );
-      } else {
-         rob_data_isStatusPrefetched()->clear();
-      }
-      if( parent.rob_data_isUnclassified.IsAvailable() && rob_data_isUnclassified.IsActive() ) {
-         *( rob_data_isUnclassified() ) = *( parent.rob_data_isUnclassified() );
-      } else {
-         rob_data_isUnclassified()->clear();
-      }
-      if( parent.rob_data_n.IsAvailable() && rob_data_n.IsActive() ) {
-         *( rob_data_n() ) = *( parent.rob_data_n() );
-      } else {
-         rob_data_n()->clear();
-      }
-      if( parent.rob_data_size.IsAvailable() && rob_data_size.IsActive() ) {
-         *( rob_data_size() ) = *( parent.rob_data_size() );
-      } else {
-         rob_data_size()->clear();
-      }
-      if( parent.rob_n.IsAvailable() && rob_n.IsActive() ) {
-         rob_n() = parent.rob_n();
-      } else {
-         rob_n() = 0;
-      }
-      if( parent.rob_requestorId.IsAvailable() && rob_requestorId.IsActive() ) {
-         *( rob_requestorId() ) = *( parent.rob_requestorId() );
-      } else {
-         rob_requestorId()->clear();
-      }
-      if( parent.rob_sum_isCached.IsAvailable() && rob_sum_isCached.IsActive() ) {
-         *( rob_sum_isCached() ) = *( parent.rob_sum_isCached() );
-      } else {
-         rob_sum_isCached()->clear();
-      }
-      if( parent.rob_sum_isDisabled.IsAvailable() && rob_sum_isDisabled.IsActive() ) {
-         *( rob_sum_isDisabled() ) = *( parent.rob_sum_isDisabled() );
-      } else {
-         rob_sum_isDisabled()->clear();
-      }
-      if( parent.rob_sum_isIgnored.IsAvailable() && rob_sum_isIgnored.IsActive() ) {
-         *( rob_sum_isIgnored() ) = *( parent.rob_sum_isIgnored() );
-      } else {
-         rob_sum_isIgnored()->clear();
-      }
-      if( parent.rob_sum_isRetrieved.IsAvailable() && rob_sum_isRetrieved.IsActive() ) {
-         *( rob_sum_isRetrieved() ) = *( parent.rob_sum_isRetrieved() );
-      } else {
-         rob_sum_isRetrieved()->clear();
-      }
-      if( parent.rob_sum_isUnclassified.IsAvailable() && rob_sum_isUnclassified.IsActive() ) {
-         *( rob_sum_isUnclassified() ) = *( parent.rob_sum_isUnclassified() );
-      } else {
-         rob_sum_isUnclassified()->clear();
-      }
-      if( parent.rob_sum_n.IsAvailable() && rob_sum_n.IsActive() ) {
-         *( rob_sum_n() ) = *( parent.rob_sum_n() );
-      } else {
-         rob_sum_n()->clear();
-      }
-      if( parent.rob_sum_nRob.IsAvailable() && rob_sum_nRob.IsActive() ) {
-         *( rob_sum_nRob() ) = *( parent.rob_sum_nRob() );
-      } else {
-         rob_sum_nRob()->clear();
-      }
-      if( parent.rob_sum_size.IsAvailable() && rob_sum_size.IsActive() ) {
-         *( rob_sum_size() ) = *( parent.rob_sum_size() );
-      } else {
-         rob_sum_size()->clear();
-      }
-      if( parent.rob_sum_subDet.IsAvailable() && rob_sum_subDet.IsActive() ) {
-         *( rob_sum_subDet() ) = *( parent.rob_sum_subDet() );
-      } else {
-         rob_sum_subDet()->clear();
-      }
-      if( parent.rob_timeStartMicroSec.IsAvailable() && rob_timeStartMicroSec.IsActive() ) {
-         *( rob_timeStartMicroSec() ) = *( parent.rob_timeStartMicroSec() );
-      } else {
-         rob_timeStartMicroSec()->clear();
-      }
-      if( parent.rob_timeStartSec.IsAvailable() && rob_timeStartSec.IsActive() ) {
-         *( rob_timeStartSec() ) = *( parent.rob_timeStartSec() );
-      } else {
-         rob_timeStartSec()->clear();
-      }
-      if( parent.rob_timeStopMicroSec.IsAvailable() && rob_timeStopMicroSec.IsActive() ) {
-         *( rob_timeStopMicroSec() ) = *( parent.rob_timeStopMicroSec() );
-      } else {
-         rob_timeStopMicroSec()->clear();
-      }
-      if( parent.rob_timeStopSec.IsAvailable() && rob_timeStopSec.IsActive() ) {
-         *( rob_timeStopSec() ) = *( parent.rob_timeStopSec() );
-      } else {
-         rob_timeStopSec()->clear();
-      }
-      if( parent.rob_timer.IsAvailable() && rob_timer.IsActive() ) {
-         *( rob_timer() ) = *( parent.rob_timer() );
-      } else {
-         rob_timer()->clear();
-      }
-      if( parent.roi_area.IsAvailable() && roi_area.IsActive() ) {
-         *( roi_area() ) = *( parent.roi_area() );
-      } else {
-         roi_area()->clear();
-      }
-      if( parent.roi_eta.IsAvailable() && roi_eta.IsActive() ) {
-         *( roi_eta() ) = *( parent.roi_eta() );
-      } else {
-         roi_eta()->clear();
-      }
-      if( parent.roi_id.IsAvailable() && roi_id.IsActive() ) {
-         *( roi_id() ) = *( parent.roi_id() );
-      } else {
-         roi_id()->clear();
-      }
-      if( parent.roi_isTypeEmTau.IsAvailable() && roi_isTypeEmTau.IsActive() ) {
-         *( roi_isTypeEmTau() ) = *( parent.roi_isTypeEmTau() );
-      } else {
-         roi_isTypeEmTau()->clear();
-      }
-      if( parent.roi_isTypeEnergy.IsAvailable() && roi_isTypeEnergy.IsActive() ) {
-         *( roi_isTypeEnergy() ) = *( parent.roi_isTypeEnergy() );
-      } else {
-         roi_isTypeEnergy()->clear();
-      }
-      if( parent.roi_isTypeJet.IsAvailable() && roi_isTypeJet.IsActive() ) {
-         *( roi_isTypeJet() ) = *( parent.roi_isTypeJet() );
-      } else {
-         roi_isTypeJet()->clear();
-      }
-      if( parent.roi_isTypeJetEt.IsAvailable() && roi_isTypeJetEt.IsActive() ) {
-         *( roi_isTypeJetEt() ) = *( parent.roi_isTypeJetEt() );
-      } else {
-         roi_isTypeJetEt()->clear();
-      }
-      if( parent.roi_isTau.IsAvailable() && roi_isTau.IsActive() ) {
-         *( roi_isTau() ) = *( parent.roi_isTau() );
-      } else {
-         roi_isTau()->clear();
-      }
-      if( parent.roi_isTypeMuon.IsAvailable() && roi_isTypeMuon.IsActive() ) {
-         *( roi_isTypeMuon() ) = *( parent.roi_isTypeMuon() );
-      }
-       else {
-         roi_isTypeMuon()->clear();
-      }
-      if( parent.roi_isTypeNone.IsAvailable() && roi_isTypeNone.IsActive() ) {
-         *( roi_isTypeNone() ) = *( parent.roi_isTypeNone() );
-      } else {
-         roi_isTypeNone()->clear();
-      }
-      if( parent.roi_n.IsAvailable() && roi_n.IsActive() ) {
-         roi_n() = parent.roi_n();
-      } else {
-         roi_n() = 0;
-      }
-      if( parent.roi_nL1Thresholds.IsAvailable() && roi_nL1Thresholds.IsActive() ) {
-         *( roi_nL1Thresholds() ) = *( parent.roi_nL1Thresholds() );
-      } else {
-         roi_nL1Thresholds()->clear();
-      }
-      if( parent.roi_phi.IsAvailable() && roi_phi.IsActive() ) {
-         *( roi_phi() ) = *( parent.roi_phi() );
-      } else {
-         roi_phi()->clear();
-      }
-      if( parent.roi_et.IsAvailable() && roi_et.IsActive() ) {
-         *( roi_et() ) = *( parent.roi_et() );
-      } else {
-         roi_et()->clear();
-      }       
-      if( parent.roi_etLarge.IsAvailable() && roi_etLarge.IsActive() ) {
-         *( roi_etLarge() ) = *( parent.roi_etLarge() );
-      } else {
-         roi_etLarge()->clear();
-      }       
-      if( parent.roi_muCharge.IsAvailable() && roi_muCharge.IsActive() ) {
-         *( roi_muCharge() ) = *( parent.roi_muCharge() );
-      } else {
-         roi_muCharge()->clear();
-      }       
-      if( parent.roi_isoBits.IsAvailable() && roi_isoBits.IsActive() ) {
-         *( roi_isoBits() ) = *( parent.roi_isoBits() );
-      } else {
-         roi_isoBits()->clear();
-      }       
-      if( parent.roi_vectorEX.IsAvailable() && roi_vectorEX.IsActive() ) {
-         *( roi_vectorEX() ) = *( parent.roi_vectorEX() );
-      } else {
-         roi_vectorEX()->clear();
-      }       
-      if( parent.roi_vectorEY.IsAvailable() && roi_vectorEY.IsActive() ) {
-         *( roi_vectorEY() ) = *( parent.roi_vectorEY() );
-      } else {
-         roi_vectorEY()->clear();
-      }       
-      if( parent.roi_overflowEX.IsAvailable() && roi_overflowEX.IsActive() ) {
-         *( roi_overflowEX() ) = *( parent.roi_overflowEX() );
-      } else {
-         roi_overflowEX()->clear();
-      }       
-      if( parent.roi_overflowEY.IsAvailable() && roi_overflowEY.IsActive() ) {
-         *( roi_overflowEY() ) = *( parent.roi_overflowEY() );
-      } else {
-         roi_overflowEY()->clear();
-      }       
-      if( parent.roi_overflowET.IsAvailable() && roi_overflowET.IsActive() ) {
-         *( roi_overflowET() ) = *( parent.roi_overflowET() );
-      } else {
-         roi_overflowET()->clear();
-      }
-      if( parent.runNumber.IsAvailable() && runNumber.IsActive() ) {
-         runNumber() = parent.runNumber();
-      } else {
-         runNumber() = 0;
-      }
-      if( parent.seconds.IsAvailable() && seconds.IsActive() ) {
-         seconds() = parent.seconds();
-      } else {
-         seconds() = 0;
-      }
-      if( parent.seq_algTotalTime.IsAvailable() && seq_algTotalTime.IsActive() ) {
-         *( seq_algTotalTime() ) = *( parent.seq_algTotalTime() );
-      } else {
-         seq_algTotalTime()->clear();
-      }
-      if( parent.seq_alg_isCached.IsAvailable() && seq_alg_isCached.IsActive() ) {
-         *( seq_alg_isCached() ) = *( parent.seq_alg_isCached() );
-      } else {
-         seq_alg_isCached()->clear();
-      }
-      if( parent.seq_alg_isCalled.IsAvailable() && seq_alg_isCalled.IsActive() ) {
-         *( seq_alg_isCalled() ) = *( parent.seq_alg_isCalled() );
-      } else {
-         seq_alg_isCalled()->clear();
-      }
-      if( parent.seq_alg_n.IsAvailable() && seq_alg_n.IsActive() ) {
-         *( seq_alg_n() ) = *( parent.seq_alg_n() );
-      } else {
-         seq_alg_n()->clear();
-      }
-      if( parent.seq_alg_position.IsAvailable() && seq_alg_position.IsActive() ) {
-         *( seq_alg_position() ) = *( parent.seq_alg_position() );
-      } else {
-         seq_alg_position()->clear();
-      }
-      if( parent.seq_alg_roi_index.IsAvailable() && seq_alg_roi_index.IsActive() ) {
-         *( seq_alg_roi_index() ) = *( parent.seq_alg_roi_index() );
-      } else {
-         seq_alg_roi_index()->clear();
-      }
-      if( parent.seq_alg_roi_n.IsAvailable() && seq_alg_roi_n.IsActive() ) {
-         *( seq_alg_roi_n() ) = *( parent.seq_alg_roi_n() );
-      } else {
-         seq_alg_roi_n()->clear();
-      }
-      if( parent.seq_alg_timeStartMicroSec.IsAvailable() && seq_alg_timeStartMicroSec.IsActive() ) {
-         *( seq_alg_timeStartMicroSec() ) = *( parent.seq_alg_timeStartMicroSec() );
-      } else {
-         seq_alg_timeStartMicroSec()->clear();
-      }
-      if( parent.seq_alg_timeStartSec.IsAvailable() && seq_alg_timeStartSec.IsActive() ) {
-         *( seq_alg_timeStartSec() ) = *( parent.seq_alg_timeStartSec() );
-      } else {
-         seq_alg_timeStartSec()->clear();
-      }
-      if( parent.seq_alg_timeStopMicroSec.IsAvailable() && seq_alg_timeStopMicroSec.IsActive() ) {
-         *( seq_alg_timeStopMicroSec() ) = *( parent.seq_alg_timeStopMicroSec() );
-      } else {
-         seq_alg_timeStopMicroSec()->clear();
-      }
-      if( parent.seq_alg_timeStopSec.IsAvailable() && seq_alg_timeStopSec.IsActive() ) {
-         *( seq_alg_timeStopSec() ) = *( parent.seq_alg_timeStopSec() );
-      } else {
-         seq_alg_timeStopSec()->clear();
-      }
-      if( parent.seq_alg_timer.IsAvailable() && seq_alg_timer.IsActive() ) {
-         *( seq_alg_timer() ) = *( parent.seq_alg_timer() );
-      } else {
-         seq_alg_timer()->clear();
-      }
-      if( parent.seq_channelCounter.IsAvailable() && seq_channelCounter.IsActive() ) {
-         *( seq_channelCounter() ) = *( parent.seq_channelCounter() );
-      } else {
-         seq_channelCounter()->clear();
-      }
-      if( parent.seq_index.IsAvailable() && seq_index.IsActive() ) {
-         *( seq_index() ) = *( parent.seq_index() );
-      } else {
-         seq_index()->clear();
-      }
-      if( parent.seq_isAlreadyExecuted.IsAvailable() && seq_isAlreadyExecuted.IsActive() ) {
-         *( seq_isAlreadyExecuted() ) = *( parent.seq_isAlreadyExecuted() );
-      } else {
-         seq_isAlreadyExecuted()->clear();
-      }
-      if( parent.seq_isExecuted.IsAvailable() && seq_isExecuted.IsActive() ) {
-         *( seq_isExecuted() ) = *( parent.seq_isExecuted() );
-      } else {
-         seq_isExecuted()->clear();
-      }
-      if( parent.seq_isInitial.IsAvailable() && seq_isInitial.IsActive() ) {
-         *( seq_isInitial() ) = *( parent.seq_isInitial() );
-      } else {
-         seq_isInitial()->clear();
-      }
-      if( parent.seq_isPrevious.IsAvailable() && seq_isPrevious.IsActive() ) {
-         *( seq_isPrevious() ) = *( parent.seq_isPrevious() );
-      } else {
-         seq_isPrevious()->clear();
-      }
-      if( parent.seq_level.IsAvailable() && seq_level.IsActive() ) {
-         *( seq_level() ) = *( parent.seq_level() );
-      } else {
-         seq_level()->clear();
-      }
-      if( parent.seq_n.IsAvailable() && seq_n.IsActive() ) {
-         seq_n() = parent.seq_n();
-      } else {
-         seq_n() = 0;
-      }
-      if( parent.seq_roi.IsAvailable() && seq_roi.IsActive() ) {
-         *( seq_roi() ) = *( parent.seq_roi() );
-      } else {
-         seq_roi()->clear();
-      }
-      if( parent.seq_timer.IsAvailable() && seq_timer.IsActive() ) {
-         *( seq_timer() ) = *( parent.seq_timer() );
-      } else {
-         seq_timer()->clear();
-      }
-      if( parent.te_childIndex.IsAvailable() && te_childIndex.IsActive() ) {
-         *( te_childIndex() ) = *( parent.te_childIndex() );
-      } else {
-         te_childIndex()->clear();
-      }
-      if( parent.te_clid.IsAvailable() && te_clid.IsActive() ) {
-         *( te_clid() ) = *( parent.te_clid() );
-      } else {
-         te_clid()->clear();
-      }
-      if( parent.te_id.IsAvailable() && te_id.IsActive() ) {
-         *( te_id() ) = *( parent.te_id() );
-      } else {
-         te_id()->clear();
-      }
-      if( parent.te_index.IsAvailable() && te_index.IsActive() ) {
-         *( te_index() ) = *( parent.te_index() );
-      } else {
-         te_index()->clear();
-      }
-      if( parent.te_isActiveState.IsAvailable() && te_isActiveState.IsActive() ) {
-         *( te_isActiveState() ) = *( parent.te_isActiveState() );
-      } else {
-         te_isActiveState()->clear();
-      }
-      if( parent.te_isErrorState.IsAvailable() && te_isErrorState.IsActive() ) {
-         *( te_isErrorState() ) = *( parent.te_isErrorState() );
-      } else {
-         te_isErrorState()->clear();
-      }
-      if( parent.te_isInitialTe.IsAvailable() && te_isInitialTe.IsActive() ) {
-         *( te_isInitialTe() ) = *( parent.te_isInitialTe() );
-      } else {
-         te_isInitialTe()->clear();
-      }
-      if( parent.te_isL1ThresholdTe.IsAvailable() && te_isL1ThresholdTe.IsActive() ) {
-         *( te_isL1ThresholdTe() ) = *( parent.te_isL1ThresholdTe() );
-      } else {
-         te_isL1ThresholdTe()->clear();
-      }
-      if( parent.te_isOutputEFNode.IsAvailable() && te_isOutputEFNode.IsActive() ) {
-         *( te_isOutputEFNode() ) = *( parent.te_isOutputEFNode() );
-      } else {
-         te_isOutputEFNode()->clear();
-      }
-      if( parent.te_isOutputL2Node.IsAvailable() && te_isOutputL2Node.IsActive() ) {
-         *( te_isOutputL2Node() ) = *( parent.te_isOutputL2Node() );
-      } else {
-         te_isOutputL2Node()->clear();
-      }
-      if( parent.te_isRegularTe.IsAvailable() && te_isRegularTe.IsActive() ) {
-         *( te_isRegularTe() ) = *( parent.te_isRegularTe() );
-      } else {
-         te_isRegularTe()->clear();
-      }
-      if( parent.te_isRoITe.IsAvailable() && te_isRoITe.IsActive() ) {
-         *( te_isRoITe() ) = *( parent.te_isRoITe() );
-      } else {
-         te_isRoITe()->clear();
-      }
-      if( parent.te_isTerminalNode.IsAvailable() && te_isTerminalNode.IsActive() ) {
-         *( te_isTerminalNode() ) = *( parent.te_isTerminalNode() );
-      } else {
-         te_isTerminalNode()->clear();
-      }
-      if( parent.te_isTopologicalTe.IsAvailable() && te_isTopologicalTe.IsActive() ) {
-         *( te_isTopologicalTe() ) = *( parent.te_isTopologicalTe() );
-      } else {
-         te_isTopologicalTe()->clear();
-      }
-      if( parent.te_n.IsAvailable() && te_n.IsActive() ) {
-         te_n() = parent.te_n();
-      } else {
-         te_n() = 0;
-      }
-      if( parent.te_parentIndex.IsAvailable() && te_parentIndex.IsActive() ) {
-         *( te_parentIndex() ) = *( parent.te_parentIndex() );
-      } else {
-         te_parentIndex()->clear();
-      }
-      if( parent.te_roiId.IsAvailable() && te_roiId.IsActive() ) {
-         *( te_roiId() ) = *( parent.te_roiId() );
-      } else {
-         te_roiId()->clear();
-      }
-      if( parent.timer.IsAvailable() && timer.IsActive() ) {
-         timer() = parent.timer();
-      } else {
-         timer() = 0;
-      }
-      if( parent.timerChainProcess.IsAvailable() && timerChainProcess.IsActive() ) {
-         timerChainProcess() = parent.timerChainProcess();
-      } else {
-         timerChainProcess() = 0;
-      }
-      if( parent.timerEndSteer.IsAvailable() && timerEndSteer.IsActive() ) {
-         timerEndSteer() = parent.timerEndSteer();
-      } else {
-         timerEndSteer() = 0;
-      }
-      if( parent.timerMon.IsAvailable() && timerMon.IsActive() ) {
-         timerMon() = parent.timerMon();
-      } else {
-         timerMon() = 0;
-      }
-      if( parent.timerResultBuilder.IsAvailable() && timerResultBuilder.IsActive() ) {
-         timerResultBuilder() = parent.timerResultBuilder();
-      } else {
-         timerResultBuilder() = 0;
-      }
-      if( parent.timerTrigCost.IsAvailable() && timerTrigCost.IsActive() ) {
-         timerTrigCost() = parent.timerTrigCost();
-      } else {
-         timerTrigCost() = 0;
-      }
-
-      return *this;
-   }
-
-   /**
-    * This function is used internally to access VarHandle members
-    * by name. This is necessary to push some setup from compile time
-    * to run time. It may sound weird, but it makes a lot of sense for large
-    * classes.
-    *
-    * @param name The name of the C++ variable (not of the branch)
-    * @returns A pointer to the VarHandle object
-    */
-   VarHandleBase* TrigCostD3PDObject::GetVarHandle( const char* name ) {
-
-      if( ! ::strcmp( name, "appId" ) ) {
-         return &appId;
-      }
-      else if( ! ::strcmp( name, "ebWeight" ) ) {
-         return &ebWeight;
-      }
-      else if( ! ::strcmp( name, "ebWeightBG" ) ) {
-         return &ebWeightBG;
-      }
-      else if( ! ::strcmp( name, "ebUnbiased" ) ) {
-         return &ebUnbiased;
-      }
-      else if( ! ::strcmp( name, "ranScaleTools" ) ) {
-         return &ranScaleTools;
-      }
-      else if( ! ::strcmp( name, "bunchCrossingId" ) ) {
-         return &bunchCrossingId;
-      }
-      else if( ! ::strcmp( name, "chain_counter" ) ) {
-         return &chain_counter;
-      }
-      else if( ! ::strcmp( name, "chain_isExpressStream" ) ) {
-         return &chain_isExpressStream;
-      }
-      else if( ! ::strcmp( name, "chain_isPassed" ) ) {
-         return &chain_isPassed;
-      }
-      else if( ! ::strcmp( name, "chain_isPassedRaw" ) ) {
-         return &chain_isPassedRaw;
-      }
-      else if( ! ::strcmp( name, "chain_isPassthrough" ) ) {
-         return &chain_isPassthrough;
-      }
-      else if( ! ::strcmp( name, "chain_isPrescaled" ) ) {
-         return &chain_isPrescaled;
-      }
-      else if( ! ::strcmp( name, "chain_isResurrected" ) ) {
-         return &chain_isResurrected;
-      }
-      else if( ! ::strcmp( name, "chain_level" ) ) {
-         return &chain_level;
-      }
-      else if( ! ::strcmp( name, "chain_n" ) ) {
-         return &chain_n;
-      }
-      else if( ! ::strcmp( name, "chain_timer" ) ) {
-         return &chain_timer;
-      }
-      else if( ! ::strcmp( name, "chain_wasL1AfterPrescale" ) ) {
-         return &chain_wasL1AfterPrescale;
-      }
-      else if( ! ::strcmp( name, "chain_wasL1AfterVeto" ) ) {
-         return &chain_wasL1AfterVeto;
-      }
-      else if( ! ::strcmp( name, "chain_wasL1BeforePrescale" ) ) {
-         return &chain_wasL1BeforePrescale;
-      }
-      else if( ! ::strcmp( name, "costEvent" ) ) {
-         return &costEvent;
-      }
-      else if( ! ::strcmp( name, "costRunNsec" ) ) {
-         return &costRunNsec;
-      }
-      else if( ! ::strcmp( name, "costRunSec" ) ) {
-         return &costRunSec;
-      }
-      else if( ! ::strcmp( name, "eventNumber" ) ) {
-         return &eventNumber;
-      }
-      else if( ! ::strcmp( name, "l1_ctpId" ) ) {
-         return &l1_ctpId;
-      }
-      else if( ! ::strcmp( name, "l1_isPrescaled" ) ) {
-         return &l1_isPrescaled;
-      }
-      else if( ! ::strcmp( name, "l1_isVetoed" ) ) {
-         return &l1_isVetoed;
-      }
-      else if( ! ::strcmp( name, "l1_n" ) ) {
-         return &l1_n;
-      }
-      else if( ! ::strcmp( name, "l1_passed" ) ) {
-         return &l1_passed;
-      }
-      else if( ! ::strcmp( name, "l1_passedAfterPrescale" ) ) {
-         return &l1_passedAfterPrescale;
-      }
-      else if( ! ::strcmp( name, "l1_passedAfterVeto" ) ) {
-         return &l1_passedAfterVeto;
-      }
-      else if( ! ::strcmp( name, "l1_passedBeforePrescale" ) ) {
-         return &l1_passedBeforePrescale;
-      }
-      else if( ! ::strcmp( name, "lumi" ) ) {
-         return &lumi;
-      }
-      else if( ! ::strcmp( name, "lumiLength" ) ) {
-         return &lumiLength;
-      }
-      else if( ! ::strcmp( name, "nanoSeconds" ) ) {
-         return &nanoSeconds;
-      }
-      else if( ! ::strcmp( name, "rob_data_id" ) ) {
-         return &rob_data_id;
-      }
-      else if( ! ::strcmp( name, "rob_data_isCached" ) ) {
-         return &rob_data_isCached;
-      }
-      else if( ! ::strcmp( name, "rob_data_isDisabled" ) ) {
-         return &rob_data_isDisabled;
-      }
-      else if( ! ::strcmp( name, "rob_data_isIgnored" ) ) {
-         return &rob_data_isIgnored;
-      }
-      else if( ! ::strcmp( name, "rob_data_isRetrieved" ) ) {
-         return &rob_data_isRetrieved;
-      }
-      else if( ! ::strcmp( name, "rob_data_isStatusOk" ) ) {
-         return &rob_data_isStatusOk;
-      }
-      else if( ! ::strcmp( name, "rob_data_isStatusPrefetched" ) ) {
-         return &rob_data_isStatusPrefetched;
-      }
-      else if( ! ::strcmp( name, "rob_data_isUnclassified" ) ) {
-         return &rob_data_isUnclassified;
-      }
-      else if( ! ::strcmp( name, "rob_data_n" ) ) {
-         return &rob_data_n;
-      }
-      else if( ! ::strcmp( name, "rob_data_size" ) ) {
-         return &rob_data_size;
-      }
-      else if( ! ::strcmp( name, "rob_n" ) ) {
-         return &rob_n;
-      }
-      else if( ! ::strcmp( name, "rob_requestorId" ) ) {
-         return &rob_requestorId;
-      }
-      else if( ! ::strcmp( name, "rob_sum_isCached" ) ) {
-         return &rob_sum_isCached;
-      }
-      else if( ! ::strcmp( name, "rob_sum_isDisabled" ) ) {
-         return &rob_sum_isDisabled;
-      }
-      else if( ! ::strcmp( name, "rob_sum_isIgnored" ) ) {
-         return &rob_sum_isIgnored;
-      }
-      else if( ! ::strcmp( name, "rob_sum_isRetrieved" ) ) {
-         return &rob_sum_isRetrieved;
-      }
-      else if( ! ::strcmp( name, "rob_sum_isUnclassified" ) ) {
-         return &rob_sum_isUnclassified;
-      }
-      else if( ! ::strcmp( name, "rob_sum_n" ) ) {
-         return &rob_sum_n;
-      }
-      else if( ! ::strcmp( name, "rob_sum_nRob" ) ) {
-         return &rob_sum_nRob;
-      }
-      else if( ! ::strcmp( name, "rob_sum_size" ) ) {
-         return &rob_sum_size;
-      }
-      else if( ! ::strcmp( name, "rob_sum_subDet" ) ) {
-         return &rob_sum_subDet;
-      }
-      else if( ! ::strcmp( name, "rob_timeStartMicroSec" ) ) {
-         return &rob_timeStartMicroSec;
-      }
-      else if( ! ::strcmp( name, "rob_timeStartSec" ) ) {
-         return &rob_timeStartSec;
-      }
-      else if( ! ::strcmp( name, "rob_timeStopMicroSec" ) ) {
-         return &rob_timeStopMicroSec;
-      }
-      else if( ! ::strcmp( name, "rob_timeStopSec" ) ) {
-         return &rob_timeStopSec;
-      }
-      else if( ! ::strcmp( name, "rob_timer" ) ) {
-         return &rob_timer;
-      }
-      else if( ! ::strcmp( name, "roi_area" ) ) {
-         return &roi_area;
-      }
-      else if( ! ::strcmp( name, "roi_eta" ) ) {
-         return &roi_eta;
-      }
-      else if( ! ::strcmp( name, "roi_id" ) ) {
-         return &roi_id;
-      }
-      else if( ! ::strcmp( name, "roi_isTypeEmTau" ) ) {
-         return &roi_isTypeEmTau;
-      }
-      else if( ! ::strcmp( name, "roi_isTau" ) ) {
-         return &roi_isTau;
-      }
-      else if( ! ::strcmp( name, "roi_isTypeEnergy" ) ) {
-         return &roi_isTypeEnergy;
-      }
-      else if( ! ::strcmp( name, "roi_isTypeJet" ) ) {
-         return &roi_isTypeJet;
-      }
-      else if( ! ::strcmp( name, "roi_isTypeJetEt" ) ) {
-         return &roi_isTypeJetEt;
-      }
-      else if( ! ::strcmp( name, "roi_isTypeMuon" ) ) {
-         return &roi_isTypeMuon;
-      }
-      else if( ! ::strcmp( name, "roi_isTypeNone" ) ) {
-         return &roi_isTypeNone;
-      }
-      else if( ! ::strcmp( name, "roi_n" ) ) {
-         return &roi_n;
-      }
-      else if( ! ::strcmp( name, "roi_nL1Thresholds" ) ) {
-         return &roi_nL1Thresholds;
-      }
-       else if( ! ::strcmp( name, "roi_phi" ) ) {
-         return &roi_phi;
-      }
-      else if( ! ::strcmp( name, "roi_et" ) ) {
-         return &roi_et;
-      }
-      else if( ! ::strcmp( name, "roi_etLarge" ) ) {
-         return &roi_etLarge;
-      }
-      else if( ! ::strcmp( name, "roi_muCharge" ) ) {
-         return &roi_muCharge;
-      }
-      else if( ! ::strcmp( name, "roi_isoBits" ) ) {
-         return &roi_isoBits;
-      }
-      else if( ! ::strcmp( name, "roi_vectorEX" ) ) {
-         return &roi_vectorEX;
-      }
-      else if( ! ::strcmp( name, "roi_vectorEY" ) ) {
-         return &roi_vectorEY;
-      }
-      else if( ! ::strcmp( name, "roi_overflowEX" ) ) {
-         return &roi_overflowEX;
-      }
-      else if( ! ::strcmp( name, "roi_overflowEY" ) ) {
-         return &roi_overflowEY;
-      }
-      else if( ! ::strcmp( name, "roi_overflowET" ) ) {
-         return &roi_overflowET;
-      }
-      else if( ! ::strcmp( name, "runNumber" ) ) {
-         return &runNumber;
-      }
-      else if( ! ::strcmp( name, "seconds" ) ) {
-         return &seconds;
-      }
-      else if( ! ::strcmp( name, "seq_algTotalTime" ) ) {
-         return &seq_algTotalTime;
-      }
-      else if( ! ::strcmp( name, "seq_alg_isCached" ) ) {
-         return &seq_alg_isCached;
-      }
-      else if( ! ::strcmp( name, "seq_alg_isCalled" ) ) {
-         return &seq_alg_isCalled;
-      }
-      else if( ! ::strcmp( name, "seq_alg_n" ) ) {
-         return &seq_alg_n;
-      }
-      else if( ! ::strcmp( name, "seq_alg_position" ) ) {
-         return &seq_alg_position;
-      }
-      else if( ! ::strcmp( name, "seq_alg_roi_index" ) ) {
-         return &seq_alg_roi_index;
-      }
-      else if( ! ::strcmp( name, "seq_alg_roi_n" ) ) {
-         return &seq_alg_roi_n;
-      }
-      else if( ! ::strcmp( name, "seq_alg_timeStartMicroSec" ) ) {
-         return &seq_alg_timeStartMicroSec;
-      }
-      else if( ! ::strcmp( name, "seq_alg_timeStartSec" ) ) {
-         return &seq_alg_timeStartSec;
-      }
-      else if( ! ::strcmp( name, "seq_alg_timeStopMicroSec" ) ) {
-         return &seq_alg_timeStopMicroSec;
-      }
-      else if( ! ::strcmp( name, "seq_alg_timeStopSec" ) ) {
-         return &seq_alg_timeStopSec;
-      }
-      else if( ! ::strcmp( name, "seq_alg_timer" ) ) {
-         return &seq_alg_timer;
-      }
-      else if( ! ::strcmp( name, "seq_channelCounter" ) ) {
-         return &seq_channelCounter;
-      }
-      else if( ! ::strcmp( name, "seq_index" ) ) {
-         return &seq_index;
-      }
-      else if( ! ::strcmp( name, "seq_isAlreadyExecuted" ) ) {
-         return &seq_isAlreadyExecuted;
-      }
-      else if( ! ::strcmp( name, "seq_isExecuted" ) ) {
-         return &seq_isExecuted;
-      }
-      else if( ! ::strcmp( name, "seq_isInitial" ) ) {
-         return &seq_isInitial;
-      }
-      else if( ! ::strcmp( name, "seq_isPrevious" ) ) {
-         return &seq_isPrevious;
-      }
-      else if( ! ::strcmp( name, "seq_level" ) ) {
-         return &seq_level;
-      }
-      else if( ! ::strcmp( name, "seq_n" ) ) {
-         return &seq_n;
-      }
-      else if( ! ::strcmp( name, "seq_roi" ) ) {
-         return &seq_roi;
-      }
-      else if( ! ::strcmp( name, "seq_timer" ) ) {
-         return &seq_timer;
-      }
-      else if( ! ::strcmp( name, "te_childIndex" ) ) {
-         return &te_childIndex;
-      }
-      else if( ! ::strcmp( name, "te_clid" ) ) {
-         return &te_clid;
-      }
-      else if( ! ::strcmp( name, "te_id" ) ) {
-         return &te_id;
-      }
-      else if( ! ::strcmp( name, "te_index" ) ) {
-         return &te_index;
-      }
-      else if( ! ::strcmp( name, "te_isActiveState" ) ) {
-         return &te_isActiveState;
-      }
-      else if( ! ::strcmp( name, "te_isErrorState" ) ) {
-         return &te_isErrorState;
-      }
-      else if( ! ::strcmp( name, "te_isInitialTe" ) ) {
-         return &te_isInitialTe;
-      }
-      else if( ! ::strcmp( name, "te_isL1ThresholdTe" ) ) {
-         return &te_isL1ThresholdTe;
-      }
-      else if( ! ::strcmp( name, "te_isOutputEFNode" ) ) {
-         return &te_isOutputEFNode;
-      }
-      else if( ! ::strcmp( name, "te_isOutputL2Node" ) ) {
-         return &te_isOutputL2Node;
-      }
-      else if( ! ::strcmp( name, "te_isRegularTe" ) ) {
-         return &te_isRegularTe;
-      }
-      else if( ! ::strcmp( name, "te_isRoITe" ) ) {
-         return &te_isRoITe;
-      }
-      else if( ! ::strcmp( name, "te_isTerminalNode" ) ) {
-         return &te_isTerminalNode;
-      }
-      else if( ! ::strcmp( name, "te_isTopologicalTe" ) ) {
-         return &te_isTopologicalTe;
-      }
-      else if( ! ::strcmp( name, "te_n" ) ) {
-         return &te_n;
-      }
-      else if( ! ::strcmp( name, "te_parentIndex" ) ) {
-         return &te_parentIndex;
-      }
-      else if( ! ::strcmp( name, "te_roiId" ) ) {
-         return &te_roiId;
-      }
-      else if( ! ::strcmp( name, "timer" ) ) {
-         return &timer;
-      }
-      else if( ! ::strcmp( name, "timerChainProcess" ) ) {
-         return &timerChainProcess;
-      }
-      else if( ! ::strcmp( name, "timerEndSteer" ) ) {
-         return &timerEndSteer;
-      }
-      else if( ! ::strcmp( name, "timerMon" ) ) {
-         return &timerMon;
-      }
-      else if( ! ::strcmp( name, "timerResultBuilder" ) ) {
-         return &timerResultBuilder;
-      }
-      else if( ! ::strcmp( name, "timerTrigCost" ) ) {
-         return &timerTrigCost;
-      }
-
-      Error( "GetVarHandle", "Variable \"%s\" unknown", name );
-      return 0;
-   }
-
-   /**
-    * This function is used internally to set up all the VarHandle members
-    * of the class. It speeds up compilation *a lot* to do this at run-time
-    * like this, instead of putting a lot of lines of code operating on
-    * the std::map member.
-    *
-    * @param master Pointer to the master index, or a null pointer
-    */
-   void TrigCostD3PDObject::SetVarHandles( const ::Long64_t* master ) {
-
-      // Create a list of variable-branch name pairs:
-      static const Int_t NVARNAMES = 129;
-      static const char* VARNAMES[ NVARNAMES ][ 2 ] = {
-         { "appId", "appId" },
-         { "ebWeight", "ebWeight" },
-         { "ebWeightBG", "ebWeightBG" },
-         { "ebUnbiased", "ebUnbiased" },         
-         { "ranScaleTools", "ranScaleTools" },         
-         { "bunchCrossingId", "bunchCrossingId" },
-         { "chain_counter", "chain_counter" },
-         { "chain_isExpressStream", "chain_isExpressStream" },
-         { "chain_isPassed", "chain_isPassed" },
-         { "chain_isPassedRaw", "chain_isPassedRaw" },
-         { "chain_isPassthrough", "chain_isPassthrough" },
-         { "chain_isPrescaled", "chain_isPrescaled" },
-         { "chain_isResurrected", "chain_isResurrected" },
-         { "chain_level", "chain_level" },
-         { "chain_n", "chain_n" },
-         { "chain_timer", "chain_timer" },
-         { "chain_wasL1AfterPrescale", "chain_wasL1AfterPrescale" },
-         { "chain_wasL1AfterVeto", "chain_wasL1AfterVeto" },
-         { "chain_wasL1BeforePrescale", "chain_wasL1BeforePrescale" },
-         { "costEvent", "costEvent" },
-         { "costRunNsec", "costRunNsec" },
-         { "costRunSec", "costRunSec" },
-         { "eventNumber", "eventNumber" },
-         { "l1_ctpId", "l1_ctpId" },
-         { "l1_isPrescaled", "l1_isPrescaled" },
-         { "l1_isVetoed", "l1_isVetoed" },
-         { "l1_n", "l1_n" },
-         { "l1_passed", "l1_passed" },
-         { "l1_passedAfterPrescale", "l1_passedAfterPrescale" },
-         { "l1_passedAfterVeto", "l1_passedAfterVeto" },
-         { "l1_passedBeforePrescale", "l1_passedBeforePrescale" },
-         { "lumi", "lumi" },
-         { "lumiLength", "lumiLength" },
-         { "nanoSeconds", "nanoSeconds" },
-         { "rob_data_id", "rob_data_id" },
-         { "rob_data_isCached", "rob_data_isCached" },
-         { "rob_data_isDisabled", "rob_data_isDisabled" },
-         { "rob_data_isIgnored", "rob_data_isIgnored" },
-         { "rob_data_isRetrieved", "rob_data_isRetrieved" },
-         { "rob_data_isStatusOk", "rob_data_isStatusOk" },
-         { "rob_data_isStatusPrefetched", "rob_data_isStatusPrefetched" },
-         { "rob_data_isUnclassified", "rob_data_isUnclassified" },
-         { "rob_data_n", "rob_data_n" },
-         { "rob_data_size", "rob_data_size" },
-         { "rob_n", "rob_n" },
-         { "rob_requestorId", "rob_requestorId" },
-         { "rob_sum_isCached", "rob_sum_isCached" },
-         { "rob_sum_isDisabled", "rob_sum_isDisabled" },
-         { "rob_sum_isIgnored", "rob_sum_isIgnored" },
-         { "rob_sum_isRetrieved", "rob_sum_isRetrieved" },
-         { "rob_sum_isUnclassified", "rob_sum_isUnclassified" },
-         { "rob_sum_n", "rob_sum_n" },
-         { "rob_sum_nRob", "rob_sum_nRob" },
-         { "rob_sum_size", "rob_sum_size" },
-         { "rob_sum_subDet", "rob_sum_subDet" },
-         { "rob_timeStartMicroSec", "rob_timeStartMicroSec" },
-         { "rob_timeStartSec", "rob_timeStartSec" },
-         { "rob_timeStopMicroSec", "rob_timeStopMicroSec" },
-         { "rob_timeStopSec", "rob_timeStopSec" },
-         { "rob_timer", "rob_timer" },
-         { "roi_area", "roi_area" },
-         { "roi_eta", "roi_eta" },
-         { "roi_id", "roi_id" },
-         { "roi_isTypeEmTau", "roi_isTypeEmTau" },
-         { "roi_isTau", "roi_isTau" },         
-         { "roi_isTypeEnergy", "roi_isTypeEnergy" },
-         { "roi_isTypeJet", "roi_isTypeJet" },
-         { "roi_isTypeJetEt", "roi_isTypeJetEt" },
-         { "roi_isTypeMuon", "roi_isTypeMuon" },
-         { "roi_isTypeNone", "roi_isTypeNone" },
-         { "roi_n", "roi_n" },
-         { "roi_nL1Thresholds", "roi_nL1Thresholds" },
-         { "roi_phi", "roi_phi" },
-         { "roi_et", "roi_et" },
-         { "roi_etLarge", "roi_etLarge" },
-         { "roi_muCharge", "roi_muCharge" },
-         { "roi_isoBits", "roi_isoBits" },
-         { "roi_vectorEX", "roi_vectorEX" },
-         { "roi_vectorEY", "roi_vectorEY" },
-         { "roi_overflowEX", "roi_overflowEX" },
-         { "roi_overflowEY", "roi_overflowEY" },
-         { "roi_overflowET", "roi_overflowET" },
-         { "runNumber", "runNumber" },
-         { "seconds", "seconds" },
-         { "seq_algTotalTime", "seq_algTotalTime" },
-         { "seq_alg_isCached", "seq_alg_isCached" },
-         { "seq_alg_isCalled", "seq_alg_isCalled" },
-         { "seq_alg_n", "seq_alg_n" },
-         { "seq_alg_position", "seq_alg_position" },
-         { "seq_alg_roi_index", "seq_alg_roi_index" },
-         { "seq_alg_roi_n", "seq_alg_roi_n" },
-         { "seq_alg_timeStartMicroSec", "seq_alg_timeStartMicroSec" },
-         { "seq_alg_timeStartSec", "seq_alg_timeStartSec" },
-         { "seq_alg_timeStopMicroSec", "seq_alg_timeStopMicroSec" },
-         { "seq_alg_timeStopSec", "seq_alg_timeStopSec" },
-         { "seq_alg_timer", "seq_alg_timer" },
-         { "seq_channelCounter", "seq_channelCounter" },
-         { "seq_index", "seq_index" },
-         { "seq_isAlreadyExecuted", "seq_isAlreadyExecuted" },
-         { "seq_isExecuted", "seq_isExecuted" },
-         { "seq_isInitial", "seq_isInitial" },
-         { "seq_isPrevious", "seq_isPrevious" },
-         { "seq_level", "seq_level" },
-         { "seq_n", "seq_n" },
-         { "seq_roi", "seq_roi" },
-         { "seq_timer", "seq_timer" },
-         { "te_childIndex", "te_childIndex" },
-         { "te_clid", "te_clid" },
-         { "te_id", "te_id" },
-         { "te_index", "te_index" },
-         { "te_isActiveState", "te_isActiveState" },
-         { "te_isErrorState", "te_isErrorState" },
-         { "te_isInitialTe", "te_isInitialTe" },
-         { "te_isL1ThresholdTe", "te_isL1ThresholdTe" },
-         { "te_isOutputEFNode", "te_isOutputEFNode" },
-         { "te_isOutputL2Node", "te_isOutputL2Node" },
-         { "te_isRegularTe", "te_isRegularTe" },
-         { "te_isRoITe", "te_isRoITe" },
-         { "te_isTerminalNode", "te_isTerminalNode" },
-         { "te_isTopologicalTe", "te_isTopologicalTe" },
-         { "te_n", "te_n" },
-         { "te_parentIndex", "te_parentIndex" },
-         { "te_roiId", "te_roiId" },
-         { "timer", "timer" },
-         { "timerChainProcess", "timerChainProcess" },
-         { "timerEndSteer", "timerEndSteer" },
-         { "timerMon", "timerMon" },
-         { "timerResultBuilder", "timerResultBuilder" },
-         { "timerTrigCost", "timerTrigCost" }
-      };
-
-      // Set up the m_handles map using this list:
-      for( Int_t i = 0; i < NVARNAMES; ++i ) {
-         VarHandleBase* vh = GetVarHandle( VARNAMES[ i ][ 0 ] );
-         vh->SetName( m_prefix + VARNAMES[ i ][ 1 ] );
-         vh->SetMaster( master );
-         m_handles[ VARNAMES[ i ][ 0 ] ] = vh;
-      }
-
-      return;
-   }
-
-} // namespace D3PDReader
diff --git a/Trigger/TrigCost/TrigCostD3PD/Root/TrigDBKeysD3PDObject.cxx b/Trigger/TrigCost/TrigCostD3PD/Root/TrigDBKeysD3PDObject.cxx
deleted file mode 100644
index ca0d18230b9acf4e40d683b8cdd7ac06869bf518..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/Root/TrigDBKeysD3PDObject.cxx
+++ /dev/null
@@ -1,315 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// -------------------------------------------------------------
-//             Code produced by D3PDMakerReader
-//
-//  author: Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
-// -------------------------------------------------------------
-
-#include <TPRegexp.h>
-#include <TList.h>
-#include <TDataMember.h>
-
-#include "../TrigCostD3PD/TrigDBKeysD3PDObject.h"
-
-ClassImp( D3PDReader::TrigDBKeysD3PDObject )
-
-namespace D3PDReader {
-
-   /**
-    * This constructor should be used when the object will be used to read
-    * variables from an existing ntuple. The object will also be able to
-    * output variables, but it will also need to read them from somewhere.
-    *
-    * @param master Reference to the variable holding the current event number
-    * @param prefix Prefix of the variables in the D3PD
-    */
-   TrigDBKeysD3PDObject::TrigDBKeysD3PDObject( const ::Long64_t& master, const char* prefix )
-      : UserD3PDObject( master, prefix ),
-        m_handles(),
-        m_fromInput( kTRUE ),
-        m_prefix( prefix ) {
-
-      SetVarHandles( &master );
-   }
-
-   /**
-    * This constructor can be used when the object will only have to output
-    * (and temporarily store) new information into an output ntuple. For
-    * instance when one wants to create a selected/modified list of information.
-    *
-    * @param prefix Prefix of the variables in the D3PD
-    */
-   TrigDBKeysD3PDObject::TrigDBKeysD3PDObject( const char* prefix )
-      : UserD3PDObject( prefix ),
-        m_handles(),
-        m_fromInput( kFALSE ),
-        m_prefix( prefix ) {
-
-      SetVarHandles( 0 );
-   }
-
-   /**
-    * @returns The branch name prefix used by the object
-    */
-   const char* TrigDBKeysD3PDObject::GetPrefix() const {
-
-      return m_prefix;
-   }
-
-   /**
-    * @param prefix The prefix that should be used for the variables
-    */
-   void TrigDBKeysD3PDObject::SetPrefix( const char* prefix ) {
-
-      // Call the base class's function:
-      UserD3PDObject::SetPrefix( prefix );
-
-      // Remember the prefix:
-      m_prefix = prefix;
-
-      // Set all the variable names:
-      std::map< TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         itr->second->SetName( ::TString( prefix ) + itr->first );
-      }
-
-      return;
-   }
-
-   /**
-    * This function should be called every time a new TFile is opened
-    * by your analysis code.
-    *
-    * @param tree Pointer to the TTree with the variables
-    */
-   void TrigDBKeysD3PDObject::ReadFrom( TTree* tree ) {
-
-      // Check if the object will be able to read from the TTree:
-      if( ! m_fromInput ) {
-         Error( "ReadFrom", "The object was not created with the correct" );
-         Error( "ReadFrom", "constructor to read data from a D3PD!" );
-         return;
-      }
-
-      // Call the base class's function:
-      UserD3PDObject::ReadFrom( tree );
-
-      // Call ReadFrom(...) on all the variables:
-      std::map< TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         itr->second->ReadFrom( tree );
-      }
-
-      return;
-   }
-
-   /**
-    * This function can be called to connect the active variables of the object
-    * to an output TTree. It can be called multiple times, then the variables
-    * will be written to multiple TTrees.
-    *
-    * @param tree Pointer to the TTree where the variables should be written
-    */
-   void TrigDBKeysD3PDObject::WriteTo( TTree* tree ) {
-
-      // Call the base class's function:
-      UserD3PDObject::WriteTo( tree );
-
-      // Call WriteTo(...) on all the variables:
-      std::map< TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         itr->second->WriteTo( tree );
-      }
-
-      return;
-   }
-
-   /**
-    * This is a convenience function for turning the branches active or
-    * inactive conveniently. If the parameter is set to <code>kTRUE</code>
-    * then the branches available from the input which match the given
-    * pattern are turned active.
-    * When it's set to <code>kFALSE</code> then all the variables matching
-    * the pattern are turned inactive.
-    *
-    * @param active Flag behaving as explained above
-    * @param pattern Regular expression specifying which branches to modify
-    */
-   void TrigDBKeysD3PDObject::SetActive( ::Bool_t active, const ::TString& pattern ) {
-
-      // Call the base class's function:
-      UserD3PDObject::SetActive( active, pattern );
-
-      ::TPRegexp re( pattern );
-
-      std::map< TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         if( ! re.Match( m_prefix + itr->first ) ) continue;
-         if( active ) {
-            if( itr->second->IsAvailable() ) itr->second->SetActive( active );
-         } else {
-            itr->second->SetActive( active );
-         }
-      }
-
-      return;
-   }
-
-   /**
-    * This function can be used to read in all the branches from the input
-    * TTree which are set active for writing out. This can simplify writing
-    * event selector codes immensely. Remember to set the desired variable
-    * active before calling this function.
-    */
-   void TrigDBKeysD3PDObject::ReadAllActive() {
-
-      // Check if it makes sense to call this function:
-      if( ! m_fromInput ) {
-         static ::Bool_t wPrinted = kFALSE;
-         if( ! wPrinted ) {
-            Warning( "ReadAllActive", "Function only meaningful when used on objects" );
-            Warning( "ReadAllActive", "which are used to read information from a D3PD" );
-            wPrinted = kTRUE;
-         }
-      }
-
-      // Call the base class's function:
-      UserD3PDObject::ReadAllActive();
-
-      // Read in the current entry for each active variable:
-      std::map< TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         if( ! itr->second->IsActive() ) continue;
-         itr->second->ReadCurrentEntry();
-      }
-
-      return;
-   }
-
-   /**
-    * This function can be used to get information about the access
-    * pattern/statistics of the job. It should be called at the end of
-    * an analysis job to get the information about the performance of the
-    * analysis.
-    *
-    * @returns An object describing the D3PD access statistics
-    */
-   // D3PDReadStats TrigDBKeysD3PDObject::GetStatistics() const {
-
-   //    // The result object:
-   //    D3PDReadStats result = UserD3PDObject::GetStatistics();
-
-   //    // Add the statistics from each variable to the result:
-   //    std::map< ::TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-   //    std::map< ::TString, VarHandleBase* >::const_iterator end = m_handles.end();
-   //    for( ; itr != end; ++itr ) {
-   //       result.AddVariable( itr->second->GetStatistics() );
-   //    }
-
-   //    return result;
-   // }
-
-   /**
-    * This function can be used to copy the contents of the entire object
-    * for a given event. This can be useful for instance when the user
-    * wants to copy all information to an output file, and modify it a bit,
-    * and only then write it out.
-    *
-    * @param parent The object to copy the information from
-    * @returns This same object, for convenience reasons
-    */
-   TrigDBKeysD3PDObject& TrigDBKeysD3PDObject::Set( const TrigDBKeysD3PDObject& parent ) {
-
-      // Check if this function can be used on the object:
-      if( m_fromInput ) {
-         Error( "Set", "Objects used for reading a D3PD can't be modified!" );
-         return *this;
-      }
-
-      // Call the base class's function:
-      UserD3PDObject::Set( parent );
-
-      if( parent.HLTPSK.IsAvailable() && HLTPSK.IsActive() ) {
-         HLTPSK() = parent.HLTPSK();
-      } else {
-         HLTPSK() = 0;
-      }
-      if( parent.L1PSK.IsAvailable() && L1PSK.IsActive() ) {
-         L1PSK() = parent.L1PSK();
-      } else {
-         L1PSK() = 0;
-      }
-      if( parent.SMK.IsAvailable() && SMK.IsActive() ) {
-         SMK() = parent.SMK();
-      } else {
-         SMK() = 0;
-      }
-
-      return *this;
-   }
-
-   /**
-    * This function is used internally to access VarHandle members
-    * by name. This is necessary to push some setup from compile time
-    * to run time. It may sound weird, but it makes a lot of sense for large
-    * classes.
-    *
-    * @param name The name of the C++ variable (not of the branch)
-    * @returns A pointer to the VarHandle object
-    */
-   VarHandleBase* TrigDBKeysD3PDObject::GetVarHandle( const char* name ) {
-
-      if( ! ::strcmp( name, "HLTPSK" ) ) {
-         return &HLTPSK;
-      }
-      else if( ! ::strcmp( name, "L1PSK" ) ) {
-         return &L1PSK;
-      }
-      else if( ! ::strcmp( name, "SMK" ) ) {
-         return &SMK;
-      }
-
-      Error( "GetVarHandle", "Variable \"%s\" unknown", name );
-      return 0;
-   }
-
-   /**
-    * This function is used internally to set up all the VarHandle members
-    * of the class. It speeds up compilation *a lot* to do this at run-time
-    * like this, instead of putting a lot of lines of code operating on
-    * the std::map member.
-    *
-    * @param master Pointer to the master index, or a null pointer
-    */
-   void TrigDBKeysD3PDObject::SetVarHandles( const ::Long64_t* master ) {
-
-      // Create a list of variable-branch name pairs:
-      static const Int_t NVARNAMES = 3;
-      static const char* VARNAMES[ NVARNAMES ][ 2 ] = {
-         { "HLTPSK", "HLTPSK" },
-         { "L1PSK", "L1PSK" },
-         { "SMK", "SMK" }
-      };
-
-      // Set up the m_handles map using this list:
-      for( Int_t i = 0; i < NVARNAMES; ++i ) {
-         VarHandleBase* vh = GetVarHandle( VARNAMES[ i ][ 0 ] );
-         vh->SetName( m_prefix + VARNAMES[ i ][ 1 ] );
-         vh->SetMaster( master );
-         m_handles[ VARNAMES[ i ][ 0 ] ] = vh;
-      }
-
-      return;
-   }
-
-} // namespace D3PDReader
diff --git a/Trigger/TrigCost/TrigCostD3PD/Root/UserD3PDObject.cxx b/Trigger/TrigCost/TrigCostD3PD/Root/UserD3PDObject.cxx
deleted file mode 100644
index 287a328621fad8e618bfdc3cf41d7760d5250b98..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/Root/UserD3PDObject.cxx
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: CodeGenerator_v2_constants.h 539451 2013-03-01 08:33:45Z krasznaa $
-
-// ROOT include(s):
-#include <TPRegexp.h>
-
-// Local include(s):
-#include "../TrigCostD3PD/UserD3PDObject.h"
-
-namespace D3PDReader {
-
-   UserD3PDObjectElement::UserD3PDObjectElement( size_t index,
-                                                 const UserD3PDObject& parent )
-      : ::TNamed(), m_parent( &parent ), m_index( index ), m_proxies() {
-
-   }
-
-   UserD3PDObjectElement::
-   UserD3PDObjectElement( const UserD3PDObjectElement& parent )
-      : TNamed( parent ), m_parent( parent.m_parent ), m_index( parent.m_index ),
-        m_proxies() {
-
-   }
-
-   UserD3PDObjectElement::~UserD3PDObjectElement() {
-
-      // Delete the allocated objects:
-      std::map< ::TString, VarProxyBase* >::iterator itr = m_proxies.begin();
-      std::map< ::TString, VarProxyBase* >::iterator end = m_proxies.end();
-      for( ; itr != end; ++itr ) {
-         delete itr->second;
-      }
-   }
-
-   size_t UserD3PDObjectElement::GetIndex() const {
-
-      return m_index;
-   }
-
-   UserD3PDObject::UserD3PDObject( const ::Long64_t& master,
-                                   const char* prefix )
-      : D3PDObjectBase(), m_master( &master ), m_prefix( prefix ), m_proxies(),
-        m_handles(), m_extraHandles(), m_fromInput( kTRUE ),
-        m_inTree( 0 ) {
-
-   }
-
-   UserD3PDObject::UserD3PDObject( const char* prefix )
-      : D3PDObjectBase(), m_master( 0 ), m_prefix( prefix ), m_proxies(),
-        m_handles(), m_extraHandles(), m_fromInput( kFALSE ),
-        m_inTree( 0 ) {
-
-   }
-
-   UserD3PDObject::~UserD3PDObject() {
-
-      // Delete the allocated objects:
-      std::map< ::TString, VarHandleBase* >::iterator itr = m_handles.begin();
-      std::map< ::TString, VarHandleBase* >::iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         delete itr->second;
-      }
-      // Although the code almost certainly crashes when such dummy objects
-      // are created, there's still some chance that they need to be cleaned:
-      std::vector< VarHandleBase* >::iterator eitr = m_extraHandles.begin();
-      std::vector< VarHandleBase* >::iterator eend = m_extraHandles.end();
-      for( ; eitr != eend; ++eitr ) {
-         delete *eitr;
-      }
-   }
-
-   /**
-    * @returns The branch name prefix used by the object
-    */
-   const char* UserD3PDObject::GetPrefix() const {
-
-      return m_prefix;
-   }
-
-   /**
-    * @param prefix The prefix that should be used for the variables
-    */
-   void UserD3PDObject::SetPrefix( const char* prefix ) {
-
-      m_prefix = prefix;
-
-      // Set all the variable names:
-      std::map< TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         itr->second->SetName( ::TString( prefix ) + itr->first );
-      }
-
-      return;
-   }
-
-   /**
-    * This function should be called every time a new TFile is opened
-    * by your analysis code.
-    *
-    * @param tree Pointer to the TTree with the variables
-    */
-   void UserD3PDObject::ReadFrom( TTree* tree ) {
-
-      // Check if the object will be able to read from the TTree:
-      if( ! m_fromInput ) {
-         Error( "ReadFrom",
-                "The object was not created with the correct" );
-         Error( "ReadFrom",
-                "constructor to read data from a D3PD!" );
-         return;
-      }
-
-      // Call ReadFrom(...) on all the variables:
-      std::map< TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         // Ignore the variables that are created only now:
-         if( ! itr->second->GetMaster() ) continue;
-         itr->second->ReadFrom( tree );
-      }
-
-      // Remember the pointer:
-      m_inTree = tree;
-
-      return;
-   }
-
-   /**
-    * This function can be called to connect the active variables of the object
-    * to an output TTree. It can be called multiple times, then the variables
-    * will be written to multiple TTrees.
-    *
-    * @param tree Pointer to the TTree where the variables should be written
-    */
-   void UserD3PDObject::WriteTo( TTree* tree ) {
-
-      // Call WriteTo(...) on all the variables:
-      std::map< TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         itr->second->WriteTo( tree );
-      }
-
-      return;
-   }
-
-   /**
-    * This is a convenience function for turning the branches active or
-    * inactive conveniently. If the parameter is set to <code>kTRUE</code>
-    * then the branches available from the input which match the given
-    * pattern are turned active.
-    * When it's set to <code>kFALSE</code> then all the variables matching
-    * the pattern are turned inactive.
-    *
-    * @param active Flag behaving as explained above
-    * @param pattern Regular expression specifying which branches to modify
-    */
-   void UserD3PDObject::SetActive( ::Bool_t active, const ::TString& pattern ) {
-
-      ::TPRegexp re( pattern );
-
-      std::map< TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         if( ! re.Match( m_prefix + itr->first ) ) continue;
-         if( active ) {
-            if( itr->second->IsAvailable() ) itr->second->SetActive( active );
-         } else {
-            itr->second->SetActive( active );
-         }
-      }
-
-      return;
-   }
-
-   /**
-    * This function can be used to read in all the branches from the input
-    * TTree which are set active for writing out. This can simplify writing
-    * event selector codes immensely. Remember to set the desired variable
-    * active before calling this function.
-    */
-   void UserD3PDObject::ReadAllActive() {
-
-      // Check if it makes sense to call this function:
-      if( ! m_fromInput ) {
-         static ::Bool_t wPrinted = kFALSE;
-         if( ! wPrinted ) {
-            Warning( "ReadAllActive",
-                     "Function only meaningful when used on objects" );
-            Warning( "ReadAllActive",
-                     "which are used to read information from a D3PD" );
-            wPrinted = kTRUE;
-         }
-      }
-
-      // Read in the current entry for each active variable:
-      std::map< TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         if( ! itr->second->IsActive() ) continue;
-         itr->second->ReadCurrentEntry();
-      }
-
-      return;
-   }
-
-   /**
-    * This function can be used to get information about the access
-    * pattern/statistics of the job. It should be called at the end of
-    * an analysis job to get the information about the performance of the
-    * analysis.
-    *
-    * @returns An object describing the D3PD access statistics
-    */
-   // D3PDReadStats UserD3PDObject::GetStatistics() const {
-
-   //    // The result object:
-   //    D3PDReadStats result;
-
-   //    // Add the statistics from each variable to the result:
-   //    std::map< ::TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-   //    std::map< ::TString, VarHandleBase* >::const_iterator end = m_handles.end();
-   //    for( ; itr != end; ++itr ) {
-   //       result.AddVariable( itr->second->GetStatistics() );
-   //    }
-
-   //    return result;
-   // }
-
-   /**
-    * User variables can't be copied like this at the moment.
-    */
-   UserD3PDObject& UserD3PDObject::Set( const UserD3PDObject& parent ) {
-
-      if( parent.m_handles.size() ) {
-         Error( "Set",
-                "User variables can not be copied usig this function!" );
-      }
-      return *this;
-   }
-
-   /**
-    * This function makes it easier to clear out the object completely.
-    * It cleares all the vector variables, and sets the element number
-    * variable to 0. Very useful when performing object selection.
-    * The option argument is not used at the moment for anything.
-    * It's only there because the <code>Clear</code> function defined in
-    * TObject has this parameter as well.
-    *
-    * @param option Ignored at the moment
-    */
-   void UserD3PDObject::Clear( Option_t* ) {
-
-      // Clear each variable:
-      std::map< ::TString, VarHandleBase* >::const_iterator itr = m_handles.begin();
-      std::map< ::TString, VarHandleBase* >::const_iterator end = m_handles.end();
-      for( ; itr != end; ++itr ) {
-         itr->second->Clear();
-      }
-
-      return;
-   }
-
-   /**
-    * User variables can't be copied like this at the moment.
-    */
-   UserD3PDObject& UserD3PDObject::Add( const UserD3PDObjectElement& el ) {
-
-      if( el.m_proxies.size() ) {
-         Error( "Add",
-                "User variables can not be copied usig this function!" );
-      }
-      return *this;
-   }
-
-   /**
-    * This operator can be used to get access to one element in the
-    * collection. This element can then be passed around between parts
-    * of the analysis code easily.
-    *
-    * This version is useful when modifying the variable contents through
-    * the proxy objects.
-    *
-    * @param index Index of the element inside the collection
-    */
-   UserD3PDObjectElement& UserD3PDObject::operator[]( size_t index ) {
-
-      while( m_proxies.size() <= index ) {
-         m_proxies.push_back( new UserD3PDObjectElement( m_proxies.size(), *this ) );
-      }
-      return *m_proxies[ index ];
-   }
-
-   /**
-    * This operator can be used to get access to one element in the
-    * collection. This element can then be passed around between parts
-    * of the analysis code easily.
-    *
-    * This version is useful when only reading the variables.
-    *
-    * @param index Index of the element inside the collection
-    */
-   const UserD3PDObjectElement& UserD3PDObject::operator[]( size_t index ) const {
-
-      while( m_proxies.size() <= index ) {
-         m_proxies.push_back( new UserD3PDObjectElement( m_proxies.size(), *this ) );
-      }
-      return *m_proxies[ index ];
-   }
-
-   /**
-    * A convenience operator for adding an 'element' to this collection.
-    *
-    * @see Add
-    * @param el The 'element' that should be added to the collection
-    */
-   UserD3PDObject& UserD3PDObject::operator+=( const UserD3PDObjectElement& el ) {
-
-      return this->Add( el );
-   }
-
-} // namespace D3PDReader
diff --git a/Trigger/TrigCost/TrigCostD3PD/Root/Utils.cxx b/Trigger/TrigCost/TrigCostD3PD/Root/Utils.cxx
deleted file mode 100644
index 96cbdc13748155c195fd84b16089e9d2916b52b7..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/Root/Utils.cxx
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: CodeGenerator_v2_constants.h 539451 2013-03-01 08:33:45Z krasznaa $
-
-// STL include(s):
-#include <cmath>
-
-// Local include(s):
-#include "../TrigCostD3PD/Utils.h"
-
-namespace {
-
-   /**
-    *  @short Simple structure describing an elapsed amount of time
-    *
-    *         In order to print some elapsed times in a nice way, the
-    *         private functions of this source file use this structure.
-    *
-    *         The amount of times measured by the code should be
-    *         representable by this structure. (We shouldn't care about
-    *         sub-milisecond times, or longer running periods than a
-    *         few days...)
-    *
-    * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
-    *
-    * $Revision: 539451 $
-    * $Date: 2013-03-01 09:33:45 +0100 (Fri, 01 Mar 2013) $
-    */
-   struct TimeStruct {
-      ::Int_t miliseconds; ///< Elapsed milisecods
-      ::Int_t seconds; ///< Elapsed seconds
-      ::Int_t minutes; ///< Elapsed minutes
-      ::Int_t hours; ///< Elapsed hours
-      ::Int_t days; ///< Elapsed days
-   }; // struct TimeStruct
-
-   /// Function creating a time structure
-   /**
-    * This function is used to break down a simple elapsed time expressed in
-    * seconds into an easy-to-print structure. Shame that I couldn't find something
-    * in standard C/C++ to do it...
-    *
-    * @param secs The elapsed time expressed in seconds
-    * @returns A structure describing the elapsed time
-    */
-   TimeStruct TimeToStruct( ::Double_t secs ) {
-
-      // Create the structure, fill its miliseconds variable,
-      // and reset all the rest:
-      TimeStruct result;
-      result.miliseconds =
-         static_cast< ::Int_t >( std::fmod( secs, 1.0 ) * 1000.0 );
-      result.seconds = 0; result.minutes = 0; result.hours = 0;
-      result.days = 0;
-
-      // If the elapsed time was less than a second, finish here:
-      secs -= ( result.miliseconds / 1000.0 );
-      if( std::abs( secs ) < 0.5 ) return result;
-
-      // Calculate the number of seconds passed, and finish if the
-      // amount of time passed was less than a minute:
-      result.seconds =
-         static_cast< ::Int_t >( std::fmod( secs, 60.0 ) );
-      secs -= result.seconds;
-      if( std::abs( secs ) < 0.5 ) return result;
-
-      // Calculate the number of minutes passed, and finish if the
-      // amount of time passed was less than an hour:
-      result.minutes =
-         static_cast< ::Int_t >( std::fmod( secs, 3600.0 ) / 60.0 );
-      secs -= result.minutes * 60.0;
-      if( std::abs( secs ) < 0.5 ) return result;
-
-      // Calculate the number of hours passed, and finish if the
-      // amount of time passed was less than a day:
-      result.hours =
-         static_cast< ::Int_t >( std::fmod( secs, 86400.0 ) / 3600.0 );
-      secs -= result.hours * 3600.0;
-      if( std::abs( secs ) < 0.5 ) return result;
-
-      // Calculate the number of days passed. The function should
-      // not expect to have to express a larger order of magnitude...
-      result.days = static_cast< ::Int_t >( secs / 86400.0 );
-
-      return result;
-   }
-
-} // private namespace
-
-namespace D3PDReader {
-
-   /**
-    * Since I wasn't able to find a nice function printing elapsed times
-    * in a human-readable format, I ended up writing one. This function
-    * is used in printing the statistics about an analysis.
-    *
-    * @param secs An amount of time passed, expressed in seconds
-    * @returns A formatted, human-readable version of the amount of time passed
-    */
-   ::TString TimeToString( ::Double_t secs ) {
-
-      const TimeStruct ts = TimeToStruct( secs );
-      ::TString result;
-      if( ts.days ) {
-         result += ::TString::Format( "%id ", ts.days );
-      }
-      if( ts.hours ) {
-         result += ::TString::Format( "%ih ", ts.hours );
-      }
-      if( ts.minutes ) {
-         result += ::TString::Format( "%im ", ts.minutes );
-      }
-      if( ts.seconds ) {
-         result += ::TString::Format( "%is ", ts.seconds );
-      }
-      result += ::TString::Format( "%ims", ts.miliseconds );
-
-      return result;
-   }
-
-   /**
-    * This function is used to produce nicely readable printouts for
-    * amounts of data.
-    *
-    * @param bytes The amount of data expressed in bytes
-    * @returns A human-readable printout of the data size
-    */
-   ::TString SizeToString( ::Long64_t bytes ) {
-
-      if( std::abs( bytes ) > 1e12 ) {
-         return ::TString::Format( "%g TB", bytes * 1e-12 );
-      } else if( std::abs( bytes ) > 1e9 ) {
-         return ::TString::Format( "%g GB", bytes * 1e-9 );
-      } else if( std::abs( bytes ) > 1e6 ) {
-         return ::TString::Format( "%g MB", bytes * 1e-6 );
-      } else if( std::abs( bytes ) > 1e3 ) {
-         return ::TString::Format( "%g kB", bytes * 1e-3 );
-      } else {
-         return ::TString::Format( "%lli bytes", bytes );
-      }
-   }
-
-   /**
-    * @param bytespersec The speed expressed in bytes / seconds
-    * @returns A human-readable printout of the data processing speed
-    */
-   ::TString SpeedToString( ::Double_t bytespersec ) {
-
-      if( ::fabs( bytespersec ) > 1e12 ) {
-         return ::TString::Format( "%g TB/s", bytespersec * 1e-12 );
-      } else if( ::fabs( bytespersec ) > 1e9 ) {
-         return ::TString::Format( "%g GB/s", bytespersec * 1e-9 );
-      } else if( ::fabs( bytespersec ) > 1e6 ) {
-         return ::TString::Format( "%g MB/s", bytespersec * 1e-6 );
-      } else if( ::fabs( bytespersec ) > 1e3 ) {
-         return ::TString::Format( "%g kB/s", bytespersec * 1e-3 );
-      } else {
-         return ::TString::Format( "%g B/s", bytespersec );
-      }
-   }
-
-} // namespace D3PDReader
diff --git a/Trigger/TrigCost/TrigCostD3PD/Root/VarHandle.cxx b/Trigger/TrigCost/TrigCostD3PD/Root/VarHandle.cxx
deleted file mode 100644
index 0173a2460b7f875d64dc1dfcbfc830af45fe57e6..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/Root/VarHandle.cxx
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: CodeGenerator_v2_constants.h 539451 2013-03-01 08:33:45Z krasznaa $
-
-// ROOT include(s):
-#include <TError.h>
-
-// Local include(s):
-#include "../TrigCostD3PD/VarHandle.h"
-//#include "../TrigCostD3PD/D3PDPerfStats.h"
-
-namespace D3PDReader {
-
-   VarHandleBase::VarHandleBase( const char* name,
-                                 const ::Long64_t* master )
-      : m_master( master ), m_fromInput( kFALSE ),
-        m_inTree( 0 ), m_inBranch( 0 ), m_available( UNKNOWN ), m_name( name ),
-        m_active( kFALSE ), m_type( "" ),
-        m_entriesRead(), m_branchSize(), m_zippedSize() {
-
-#ifdef COLLECT_D3PD_READING_STATISTICS
-      //D3PDPerfStats::Instance();
-#endif // COLLECT_D3PD_READING_STATISTICS
-   }
-
-   const char* VarHandleBase::GetName() const {
-
-      return m_name;
-   }
-
-   void VarHandleBase::SetName( const char* name ) {
-
-      m_name = name;
-      return;
-   }
-
-   const char* VarHandleBase::GetType() const {
-
-      return m_type;
-   }
-
-   void VarHandleBase::SetType( const char* type ) {
-
-      m_type = type;
-      return;
-   }
-
-   const ::Long64_t* VarHandleBase::GetMaster() const {
-
-      return m_master;
-   }
-
-   void VarHandleBase::SetMaster( const ::Long64_t* master ) {
-
-      m_master = master;
-      return;
-   }
-
-   ::Bool_t VarHandleBase::IsActive() const {
-
-      return m_active;
-   }
-
-   void VarHandleBase::SetActive( ::Bool_t active ) {
-
-      m_active = active;
-      return;
-   }
-
-   ::Bool_t VarHandleBase::IsAvailable() const {
-
-      if( ! m_fromInput ) return kTRUE;
-      switch( m_available ) {
-
-      case AVAILABLE:
-         return kTRUE;
-         break;
-      case UNAVAILABLE:
-         return kFALSE;
-         break;
-      case UNKNOWN:
-         {
-            if( ! m_inTree ) return kTRUE;
-            ::Bool_t temp = kFALSE;
-            m_available = ( temp = m_inTree->GetBranch( GetName() ) ) ? AVAILABLE :
-                         UNAVAILABLE;
-            return temp;
-         }
-         break;
-      default:
-         // This should really never be reached...
-         break;
-      }
-
-      // It's just here to make the compiler happy:
-      return kFALSE;
-   }
-
-   // VariableStats VarHandleBase::GetStatistics() const {
-
-   //    // Calculate the statistics:
-   //    ::Long64_t readEntries = 0;
-   //    ::Long64_t unzippedBytes = 0;
-   //    ::Long64_t zippedBytes = 0;
-   //    for( size_t i = 0; i < m_entriesRead.size(); ++i ) { 
-   //       readEntries += m_entriesRead[ i ];
-   //       unzippedBytes += static_cast< ::Long64_t >( m_branchSize[ i ] *
-   //                                                   m_entriesRead[ i ] );
-   //       zippedBytes += static_cast< ::Long64_t >( m_zippedSize[ i ] *
-   //                                                 m_entriesRead[ i ] );
-   //    }
-
-   //    // Now return the "smart" object:
-   //    return VariableStats( GetName(), GetType(),
-   //                          m_entriesRead.size(), readEntries,
-   //                          unzippedBytes, zippedBytes );
-   // }
-
-   ::Bool_t VarHandleBase::ConnectVariable( void* var, ::TClass* realClass,
-                                            EDataType dtype, Bool_t isptr ) const {
-
-      if( ! m_inTree ) {
-         ::Error( "D3PDReader::VarHandleBase::ConnectVariable",
-                  "Object not connected yet!" );
-         return kFALSE;
-      }
-      if( ! m_inTree->GetBranch( GetName() ) ) {
-         ::Error( "D3PDReader::VarHandleBase::ConnectVariable",
-                  "The following variable doesn't exist: %s",
-                  GetName() );
-         return kFALSE;
-      }
-#ifdef ACTIVATE_BRANCHES
-      // Only call this function when the user asks for it. It's quite expensive...
-      m_inTree->SetBranchStatus( ::TString( GetName() ) + "*", 1 );
-#endif // ACTIVATE_BRANCHES
-      if( m_inTree->SetBranchAddress( GetName(), var, &m_inBranch,
-                                     realClass, dtype, isptr ) ) {
-         ::Error( "D3PDReader::VarHandleBase::ConnectVariable",
-                  "Couldn't connect variable to branch: %s", GetName() );
-         return kFALSE;
-      }
-
-#ifdef COLLECT_D3PD_READING_STATISTICS
-      //UpdateStat( m_inBranch );
-#endif // COLLECT_D3PD_READING_STATISTICS
-
-      return kTRUE;
-   }
-
-   void VarHandleBase::UpdateBranch() const {
-      //Cov warning
-      if (!m_inBranch) return;
-
-      if( *m_master != m_inBranch->GetReadEntry() ) {
-         m_inBranch->GetEntry( *m_master );
-#ifdef COLLECT_D3PD_READING_STATISTICS
-        // ++( m_entriesRead.back() );
-#endif // COLLECT_D3PD_READING_STATISTICS
-      }
-
-      return;
-   }
-
-   // void VarHandleBase::UpdateStat( ::TBranch* br ) const {
-
-   //    m_entriesRead.push_back( 0 );
-   //    m_branchSize.push_back( ( ::Float_t ) br->GetTotalSize( "*" ) /
-   //                           ( ::Float_t ) br->GetEntries() );
-   //    m_zippedSize.push_back( ( ::Float_t ) br->GetZipBytes( "*" ) /
-   //                           ( ::Float_t ) br->GetEntries() );
-
-   //    D3PDPerfStats::Instance()->NewTreeAccessed( m_inTree );
-
-   //    return;
-   // }
-
-   const char* VarHandleBase::RootType( const char* typeid_type ) const {
-
-      if( strlen( typeid_type ) != 1 ) {
-         ::Error( "D3PDReader::VarHandleBase::RootType",
-                  "Received complex object description" );
-         return "";
-      }
-
-      switch( typeid_type[ 0 ] ) {
-
-      case 'c':
-         return "B";
-         break;
-      case 'h':
-         return "b";
-         break;
-      case 's':
-         return "S";
-         break;
-      case 't':
-         return "s";
-         break;
-      case 'i':
-         return "I";
-         break;
-      case 'j':
-         return "i";
-         break;
-      case 'f':
-         return "F";
-         break;
-      case 'd':
-         return "D";
-         break;
-      case 'x':
-         return "L";
-         break;
-      case 'y':
-         return "l";
-         break;
-      case 'b':
-         return "O";
-         break;
-
-      }
-
-      ::Error( "D3PDReader::VarHandleBase::RootType",
-               "Unknown primitive type encountered: %s",
-               typeid_type );
-      return "";
-   }
-
-   const char* VarHandleBase::RootCppType( const char* typeid_type ) const {
-
-      if( strlen( typeid_type ) != 1 ) {
-         ::Error( "D3PDReader::VarHandleBase::RootCppType",
-                  "Received complex object description" );
-         return "";
-      }
-
-      switch( typeid_type[ 0 ] ) {
-
-      case 'c':
-         return "Char_t";
-         break;
-      case 'h':
-         return "UChar_t";
-         break;
-      case 's':
-         return "Short_t";
-         break;
-      case 't':
-         return "UShort_t";
-         break;
-      case 'i':
-         return "Int_t";
-         break;
-      case 'j':
-         return "UInt_t";
-         break;
-      case 'f':
-         return "Float_t";
-         break;
-      case 'd':
-         return "Double_t";
-         break;
-      case 'x':
-         return "Long64_t";
-         break;
-      case 'y':
-         return "ULong64_t";
-         break;
-      case 'b':
-         return "Bool_t";
-         break;
-
-      }
-
-      ::Error( "D3PDReader::VarHandleBase::RootCppType",
-               "Unknown primitive type encountered: %s",
-               typeid_type );
-      return "";
-   }
-
-} // namespace D3PDReader
diff --git a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/D3PDObjectBase.h b/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/D3PDObjectBase.h
deleted file mode 100644
index 21d81c091b2321dc64dfe1a0a565ed53a3dca441..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/D3PDObjectBase.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: CodeGenerator_v2_constants.h 539451 2013-03-01 08:33:45Z krasznaa $
-#ifndef D3PDREADER_D3PDOBJECTBASE_H
-#define D3PDREADER_D3PDOBJECTBASE_H
-
-// ROOT include(s):
-#include <TNamed.h>
-#include <TString.h>
-
-// Local include(s):
-//#include "D3PDReadStats.h"
-
-// Forward declaration(s):
-class TTree;
-
-namespace D3PDReader {
-
-   /**
-    *  @short Common base class for all main D3PDReader classes
-    *
-    *         To make the classes a bit easier to handle in "smart" code
-    *         they inherit from a common base that defines all of their
-    *         common features.
-    *
-    * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
-    *
-    * $Revision: 539451 $
-    * $Date: 2013-03-01 09:33:45 +0100 (Fri, 01 Mar 2013) $
-    */
-   class D3PDObjectBase : public ::TNamed {
-
-   public:
-      /// Default constructor
-      D3PDObjectBase() : ::TNamed() {}
-
-      /// Get the currently configured prefix value
-      virtual const char* GetPrefix() const = 0;
-      /// Set the prefix for the variables
-      virtual void SetPrefix( const char* prefix ) = 0;
-
-      /// Connect the object to an input TTree
-      virtual void ReadFrom( ::TTree* tree ) = 0;
-      /// Connect the object to an output TTree
-      virtual void WriteTo( ::TTree* tree ) = 0;
-
-      /// Turn (selected) branches either on or off
-      virtual void SetActive( ::Bool_t active = kTRUE,
-                              const ::TString& pattern = ".*" ) = 0;
-
-      /// Read in all the variables that we need to write out as well
-      virtual void ReadAllActive() = 0;
-
-      /// Get the D3PD reading statistics
-      //virtual D3PDReadStats GetStatistics() const = 0;
-
-      ClassDef( D3PDObjectBase, 0 )
-
-   }; // class D3PDObjectBase
-
-} // namespace D3PDReader
-
-#endif // D3PDREADER_D3PDOBJECTBASE_H
diff --git a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/NTUP_TRIGCOST.h b/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/NTUP_TRIGCOST.h
deleted file mode 100644
index a759ee9a5caa762fd91baa1b12aa3fb50238a6e3..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/NTUP_TRIGCOST.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// -------------------------------------------------------------
-//             Code produced by D3PDMakerReader
-//
-//  author: Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
-// -------------------------------------------------------------
-#ifndef D3PDREADER_NTUP_TRIGCOST_H
-#define D3PDREADER_NTUP_TRIGCOST_H
-
-// Local include(s):
-#include "D3PDObjectBase.h"
-#include "TrigCostD3PDObject.h"
-#include "TrigDBKeysD3PDObject.h"
-
-namespace D3PDReader {
-
-   /**
-    * Code generated by CodeGenerator_v2 on:
-    *  host = lxplus0164.cern.ch
-    *  OS   = Linux / 2.6.32-431.11.2.el6.x86_64
-    *  user = tamartin
-    *  time = Fri Jun 27 16:52:19 2014
-    */
-   class NTUP_TRIGCOST : public D3PDObjectBase {
-
-   public:
-      /// Default constructor, to be used when reading a D3PD
-      NTUP_TRIGCOST();
-      /// Constructor for only writing data
-      NTUP_TRIGCOST( Bool_t onlyForWriting );
-
-      /// Get the currently configured prefix value
-      virtual const char* GetPrefix() const;
-      /// Set the prefix for the variables
-      virtual void SetPrefix( const char* prefix );
-
-      /// Connect the object to an input TTree
-      virtual void ReadFrom( ::TTree* tree );
-      /// Connect the object to an output TTree
-      virtual void WriteTo( ::TTree* tree );
-
-      /// Turn (selected) branches either on or off
-      virtual void SetActive( ::Bool_t active = kTRUE,
-                              const ::TString& pattern = ".*" );
-      /// Read in all the variables that we need to write out as well
-      virtual void ReadAllActive();
-
-      /// Get the D3PD reading statistics
-      //virtual D3PDReadStats GetStatistics() const;
-
-      /// Switch the reader object to a new event
-      void GetEntry( ::Long64_t entry );
-
-      //
-      // All the components of the D3PD:
-      //
-      TrigCostD3PDObject TrigCostHLT;
-      TrigDBKeysD3PDObject trig_DB;
-
-   private:
-      Long64_t m_entry; ///< Variable storing the current entry number
-      Bool_t m_fromInput; ///< Flag specifying if object is used for D3PD reading
-
-      ClassDef( NTUP_TRIGCOST, 0 )
-
-   }; // class NTUP_TRIGCOST
-
-} // namespace D3PDReader
-
-#endif // D3PDREADER_NTUP_TRIGCOST_H
diff --git a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/TrigCostD3PDObject.h b/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/TrigCostD3PDObject.h
deleted file mode 100644
index e4ce74f86c6d81e6031e6e07cb58801bb422a2ea..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/TrigCostD3PDObject.h
+++ /dev/null
@@ -1,234 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// -------------------------------------------------------------
-//             Code produced by D3PDMakerReader
-//
-//  author: Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
-// -------------------------------------------------------------
-#ifndef D3PDREADER_TrigCostD3PDObject_H
-#define D3PDREADER_TrigCostD3PDObject_H
-
-// STL include(s):
-#include <map>
-#include <vector>
-
-// ROOT include(s):
-#include <TObject.h>
-#include <TString.h>
-
-#include "D3PDObjectBase.h"
-//#include "D3PDReadStats.h"
-#include "VarHandle.h"
-#include "UserD3PDObject.h"
-
-class TTree;
-
-namespace D3PDReader {
-
-   /**
-    * Code generated by CodeGenerator_v2 on:
-    *  host = lxplus0164.cern.ch
-    *  OS   = Linux / 2.6.32-431.11.2.el6.x86_64
-    *  user = tamartin
-    *  time = Fri Jun 27 16:52:19 2014
-    */
-   class TrigCostD3PDObject : public UserD3PDObject {
-
-   public:
-      /// Constructor used when reading from a TTree
-      TrigCostD3PDObject( const ::Long64_t& master, const char* prefix = "TrigCostHLT_" );
-      /// Constructor when the object is only used for writing data out
-      TrigCostD3PDObject( const char* prefix = "TrigCostHLT_" );
-
-      /// Get the currently configured prefix value
-      virtual const char* GetPrefix() const;
-      /// Set the prefix for the variables
-      virtual void SetPrefix( const char* prefix );
-
-      /// Connect the object to an input TTree
-      virtual void ReadFrom( ::TTree* tree );
-      /// Connect the object to an output TTree
-      virtual void WriteTo( ::TTree* tree );
-
-      /// Turn (selected) branches either on or off
-      virtual void SetActive( ::Bool_t active = kTRUE,
-                              const ::TString& pattern = ".*" );
-      /// Read in all the variables that we need to write out as well
-      virtual void ReadAllActive();
-
-      /// Get the D3PD reading statistics
-      //virtual D3PDReadStats GetStatistics() const;
-
-      /// Set the contents of the object according to another object
-      TrigCostD3PDObject& Set( const TrigCostD3PDObject& parent );
-
-      /// Hash of AppId of the XPU node processing this event.
-      VarHandle< unsigned int > appId;
-      /// Enhanced bias weight of the event (only if specificaly calculated)
-      VarHandle< float > ebWeight;
-      VarHandle< unsigned int > ebWeightBG;
-      VarHandle< unsigned char > ebUnbiased;
-      /// If the event was a monitoring event
-      VarHandle< unsigned char > ranScaleTools;
-      /// BCID for this event
-      VarHandle< unsigned int > bunchCrossingId;
-      VarHandle< std::vector<unsigned short,std::allocator<unsigned short> >* > chain_counter;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > chain_isExpressStream;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > chain_isPassed;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > chain_isPassedRaw;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > chain_isPassthrough;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > chain_isPrescaled;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > chain_isResurrected;
-      VarHandle< std::vector<unsigned short,std::allocator<unsigned short> >* > chain_level;
-      VarHandle< unsigned short > chain_n;
-      VarHandle< std::vector<float,std::allocator<float> >* > chain_timer;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > chain_wasL1AfterPrescale;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > chain_wasL1AfterVeto;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > chain_wasL1BeforePrescale;
-      /// Sequential number of cost events processed
-      VarHandle< float > costEvent;
-      /// Nanosecond the data were saved by CostMon
-      VarHandle< unsigned int > costRunNsec;
-      /// Second the data were saved by CostMon
-      VarHandle< unsigned int > costRunSec;
-      /// Event number
-      VarHandle< unsigned int > eventNumber;
-      VarHandle< std::vector<unsigned short,std::allocator<unsigned short> >* > l1_ctpId;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > l1_isPrescaled;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > l1_isVetoed;
-      VarHandle< unsigned short > l1_n;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > l1_passed;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > l1_passedAfterPrescale;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > l1_passedAfterVeto;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > l1_passedBeforePrescale;
-      /// Lumi block number for this event
-      VarHandle< unsigned int > lumi;
-      VarHandle< float > lumiLength;
-      /// Start of the event nanoseconds
-      VarHandle< unsigned int > nanoSeconds;
-      VarHandle< std::vector<std::vector<unsigned int,std::allocator<unsigned int> >,std::allocator<std::vector<unsigned int,std::allocator<unsigned int> > > >* > rob_data_id;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > rob_data_isCached;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > rob_data_isDisabled;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > rob_data_isIgnored;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > rob_data_isRetrieved;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > rob_data_isStatusOk;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > rob_data_isStatusPrefetched;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > rob_data_isUnclassified;
-      VarHandle< std::vector<unsigned short,std::allocator<unsigned short> >* > rob_data_n;
-      VarHandle< std::vector<std::vector<unsigned int,std::allocator<unsigned int> >,std::allocator<std::vector<unsigned int,std::allocator<unsigned int> > > >* > rob_data_size;
-      VarHandle< unsigned short > rob_n;
-      VarHandle< std::vector<unsigned int,std::allocator<unsigned int> >* > rob_requestorId;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > rob_sum_isCached;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > rob_sum_isDisabled;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > rob_sum_isIgnored;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > rob_sum_isRetrieved;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > rob_sum_isUnclassified;
-      VarHandle< std::vector<unsigned short,std::allocator<unsigned short> >* > rob_sum_n;
-      VarHandle< std::vector<std::vector<unsigned int,std::allocator<unsigned int> >,std::allocator<std::vector<unsigned int,std::allocator<unsigned int> > > >* > rob_sum_nRob;
-      VarHandle< std::vector<std::vector<unsigned int,std::allocator<unsigned int> >,std::allocator<std::vector<unsigned int,std::allocator<unsigned int> > > >* > rob_sum_size;
-      VarHandle< std::vector<std::vector<unsigned int,std::allocator<unsigned int> >,std::allocator<std::vector<unsigned int,std::allocator<unsigned int> > > >* > rob_sum_subDet;
-      VarHandle< std::vector<unsigned int,std::allocator<unsigned int> >* > rob_timeStartMicroSec;
-      VarHandle< std::vector<unsigned int,std::allocator<unsigned int> >* > rob_timeStartSec;
-      VarHandle< std::vector<unsigned int,std::allocator<unsigned int> >* > rob_timeStopMicroSec;
-      VarHandle< std::vector<unsigned int,std::allocator<unsigned int> >* > rob_timeStopSec;
-      VarHandle< std::vector<double,std::allocator<double> >* > rob_timer;
-      VarHandle< std::vector<float,std::allocator<float> >* > roi_area;
-      VarHandle< std::vector<float,std::allocator<float> >* > roi_eta;
-      VarHandle< std::vector<unsigned int,std::allocator<unsigned int> >* > roi_id;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > roi_isTypeEmTau;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > roi_isTau; // new
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > roi_isTypeEnergy;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > roi_isTypeJet;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > roi_isTypeJetEt;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > roi_isTypeMuon;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > roi_isTypeNone;
-      VarHandle< unsigned short > roi_n;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > roi_nL1Thresholds;
-      VarHandle< std::vector<float,std::allocator<float> >* > roi_phi;
-      // New
-      VarHandle< std::vector<float,std::allocator<float> >* > roi_et;
-      VarHandle< std::vector<float,std::allocator<float> >* > roi_etLarge;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > roi_muCharge;
-      VarHandle< std::vector<unsigned int,std::allocator<unsigned int> >* > roi_isoBits;
-      VarHandle< std::vector<float,std::allocator<float> >* >  roi_vectorEX;
-      VarHandle< std::vector<float,std::allocator<float> >* > roi_vectorEY;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > roi_overflowEX;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > roi_overflowEY;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > roi_overflowET;
-      /// Run number for this event
-      VarHandle< unsigned int > runNumber;
-      /// Start of the event in seconds
-      VarHandle< unsigned int > seconds;
-      VarHandle< std::vector<double,std::allocator<double> >* > seq_algTotalTime;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > seq_alg_isCached;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > seq_alg_isCalled;
-      VarHandle< std::vector<unsigned short,std::allocator<unsigned short> >* > seq_alg_n;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > seq_alg_position;
-      VarHandle< std::vector<std::vector<unsigned int,std::allocator<unsigned int> >,std::allocator<std::vector<unsigned int,std::allocator<unsigned int> > > >* > seq_alg_roi_index;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > seq_alg_roi_n;
-      VarHandle< std::vector<std::vector<unsigned int,std::allocator<unsigned int> >,std::allocator<std::vector<unsigned int,std::allocator<unsigned int> > > >* > seq_alg_timeStartMicroSec;
-      VarHandle< std::vector<std::vector<unsigned int,std::allocator<unsigned int> >,std::allocator<std::vector<unsigned int,std::allocator<unsigned int> > > >* > seq_alg_timeStartSec;
-      VarHandle< std::vector<std::vector<unsigned int,std::allocator<unsigned int> >,std::allocator<std::vector<unsigned int,std::allocator<unsigned int> > > >* > seq_alg_timeStopMicroSec;
-      VarHandle< std::vector<std::vector<unsigned int,std::allocator<unsigned int> >,std::allocator<std::vector<unsigned int,std::allocator<unsigned int> > > >* > seq_alg_timeStopSec;
-      VarHandle< std::vector<std::vector<double,std::allocator<double> >,std::allocator<std::vector<double,std::allocator<double> > > >* > seq_alg_timer;
-      VarHandle< std::vector<unsigned short,std::allocator<unsigned short> >* > seq_channelCounter;
-      VarHandle< std::vector<unsigned short,std::allocator<unsigned short> >* > seq_index;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > seq_isAlreadyExecuted;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > seq_isExecuted;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > seq_isInitial;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > seq_isPrevious;
-      VarHandle< std::vector<unsigned short,std::allocator<unsigned short> >* > seq_level;
-      VarHandle< unsigned short > seq_n;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > seq_roi;
-      VarHandle< std::vector<float,std::allocator<float> >* > seq_timer;
-      VarHandle< std::vector<std::vector<unsigned short,std::allocator<unsigned short> >,std::allocator<std::vector<unsigned short,std::allocator<unsigned short> > > >* > te_childIndex;
-      VarHandle< std::vector<std::vector<unsigned int,std::allocator<unsigned int> >,std::allocator<std::vector<unsigned int,std::allocator<unsigned int> > > >* > te_clid;
-      VarHandle< std::vector<unsigned short,std::allocator<unsigned short> >* > te_id;
-      VarHandle< std::vector<unsigned short,std::allocator<unsigned short> >* > te_index;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > te_isActiveState;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > te_isErrorState;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > te_isInitialTe;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > te_isL1ThresholdTe;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > te_isOutputEFNode;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > te_isOutputL2Node;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > te_isRegularTe;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > te_isRoITe;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > te_isTerminalNode;
-      VarHandle< std::vector<unsigned char,std::allocator<unsigned char> >* > te_isTopologicalTe;
-      VarHandle< unsigned short > te_n;
-      VarHandle< std::vector<std::vector<unsigned short,std::allocator<unsigned short> >,std::allocator<std::vector<unsigned short,std::allocator<unsigned short> > > >* > te_parentIndex;
-      VarHandle< std::vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >* > te_roiId;
-      /// Nominal time for this event
-      VarHandle< float > timer;
-      /// Detailed: Time of chain execution
-      VarHandle< float > timerChainProcess;
-      /// Detailed: Time to end of steering
-      VarHandle< float > timerEndSteer;
-      /// Detailed: Total time of monitoring tool(s) execution
-      VarHandle< float > timerMon;
-      /// Detailed: Time of ResultBuilder tool execution
-      VarHandle< float > timerResultBuilder;
-      /// Detailed: Time to run the OPI trig cost tools
-      VarHandle< float > timerTrigCost;
-
-   private:
-      /// Function used internally to access the variables
-      VarHandleBase* GetVarHandle( const char* name );
-      /// Function setting up all the VarHandle members
-      void SetVarHandles( const ::Long64_t* master );
-
-      std::map< ::TString, VarHandleBase* > m_handles; ///< Book-keeper of the VarHandle members
-      const ::Bool_t m_fromInput; ///< Flag specifying if object is used for D3PD reading
-      ::TString m_prefix; ///< Prefix to the branch names
-
-      ClassDef( TrigCostD3PDObject, 0 )
-
-   }; // class TrigCostD3PDObject
-
-} // namespace D3PDReader
-
-#endif // D3PDREADER_TrigCostD3PDObject_H
diff --git a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/TrigDBKeysD3PDObject.h b/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/TrigDBKeysD3PDObject.h
deleted file mode 100644
index 59cba60fbf7c9872fd6d8d4c5c1b374ebdb38d03..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/TrigDBKeysD3PDObject.h
+++ /dev/null
@@ -1,91 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// -------------------------------------------------------------
-//             Code produced by D3PDMakerReader
-//
-//  author: Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
-// -------------------------------------------------------------
-#ifndef D3PDREADER_TrigDBKeysD3PDObject_H
-#define D3PDREADER_TrigDBKeysD3PDObject_H
-
-// STL include(s):
-#include <map>
-
-// ROOT include(s):
-#include <TObject.h>
-#include <TString.h>
-
-#include "D3PDObjectBase.h"
-//#include "D3PDReadStats.h"
-#include "VarHandle.h"
-#include "UserD3PDObject.h"
-
-class TTree;
-
-namespace D3PDReader {
-
-   /**
-    * Code generated by CodeGenerator_v2 on:
-    *  host = epp-ui01
-    *  OS   = Linux / 2.6.18-348.3.1.el5
-    *  user = phsmai
-    *  time = Tue Apr 16 11:36:42 2013
-    */
-   class TrigDBKeysD3PDObject : public UserD3PDObject {
-
-   public:
-      /// Constructor used when reading from a TTree
-      TrigDBKeysD3PDObject( const ::Long64_t& master, const char* prefix = "trig_DB_" );
-      /// Constructor when the object is only used for writing data out
-      TrigDBKeysD3PDObject( const char* prefix = "trig_DB_" );
-
-      /// Get the currently configured prefix value
-      virtual const char* GetPrefix() const;
-      /// Set the prefix for the variables
-      virtual void SetPrefix( const char* prefix );
-
-      /// Connect the object to an input TTree
-      virtual void ReadFrom( ::TTree* tree );
-      /// Connect the object to an output TTree
-      virtual void WriteTo( ::TTree* tree );
-
-      /// Turn (selected) branches either on or off
-      virtual void SetActive( ::Bool_t active = kTRUE,
-                              const ::TString& pattern = ".*" );
-      /// Read in all the variables that we need to write out as well
-      virtual void ReadAllActive();
-
-      /// Get the D3PD reading statistics
-      //virtual D3PDReadStats GetStatistics() const;
-
-      /// Set the contents of the object according to another object
-      TrigDBKeysD3PDObject& Set( const TrigDBKeysD3PDObject& parent );
-
-      /// HLT PreScale Key
-      VarHandle< unsigned int > HLTPSK;
-      /// LVL1 PreScale Key
-      VarHandle< unsigned int > L1PSK;
-      /// Super Master Key
-      VarHandle< unsigned int > SMK;
-
-   private:
-      /// Function used internally to access the variables
-      VarHandleBase* GetVarHandle( const char* name );
-      /// Function setting up all the VarHandle members
-      void SetVarHandles( const ::Long64_t* master );
-
-      std::map< ::TString, VarHandleBase* > m_handles; ///< Book-keeper of the VarHandle members
-      const ::Bool_t m_fromInput; ///< Flag specifying if object is used for D3PD reading
-      ::TString m_prefix; ///< Prefix to the branch names
-
-      ClassDef( TrigDBKeysD3PDObject, 0 )
-
-   }; // class TrigDBKeysD3PDObject
-
-} // namespace D3PDReader
-
-#endif // D3PDREADER_TrigDBKeysD3PDObject_H
diff --git a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/UserD3PDObject.h b/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/UserD3PDObject.h
deleted file mode 100644
index 8fbf2bbced91a0fe751ead60a2b632632048f2c7..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/UserD3PDObject.h
+++ /dev/null
@@ -1,186 +0,0 @@
-// Dear emacs, this is -*- c++ -*--
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: CodeGenerator_v2_constants.h 539451 2013-03-01 08:33:45Z krasznaa $
-#ifndef D3PDREADER_UserD3PDObject_H
-#define D3PDREADER_UserD3PDObject_H
-
-// STL include(s):
-#include <map>
-#include <vector>
-
-// ROOT include(s):
-#include <TNamed.h>
-#include <TString.h>
-
-// Local include(s):
-#include "D3PDObjectBase.h"
-//#include "D3PDReadStats.h"
-#include "VarHandle.h"
-#include "VarProxy.h"
-
-// Forward declaration(s):
-class TTree;
-
-namespace D3PDReader {
-
-   // Forward declaration(s):
-   class UserD3PDObject;
-
-   /**
-    *  @short Special class for handling user variables
-    *
-    *         This proxy class can be used to handle user-defined vector
-    *         variables in a fancy way. It is also used by all of the regular
-    *         proxy classes as base class, so they could handle user defined
-    *         variables as well. (For instance for adding a new property to
-    *         electrons in the analysis.)
-    *
-    *         The class doesn't inherit from TObject on purpose, in order to
-    *         avoid ending up with a diamond in the inheritance structure.
-    *         (Python *really* doesn't like that...)
-    *
-    * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
-    *
-    * $Revision: 539451 $
-    * $Date: 2013-03-01 09:33:45 +0100 (Fri, 01 Mar 2013) $
-    */
-   class UserD3PDObjectElement : public ::TNamed {
-
-      friend class UserD3PDObject;
-
-   protected:
-      /// Constructor only visible to children and UserD3PDObject
-      UserD3PDObjectElement( size_t index, const UserD3PDObject& parent );
-
-   public:
-      /// Copy constructor
-      UserD3PDObjectElement( const UserD3PDObjectElement& parent );
-      /// Destructor, cleaning up the created objects
-      virtual ~UserD3PDObjectElement();
-
-      /// Index of the object inside its container
-      virtual size_t GetIndex() const;
-
-      /// Access a variable
-      template< typename T >
-      VarProxy< T >& Variable( const TString& name );
-      /// Access a variable (constant version)
-      template< typename T >
-      const VarProxy< T >& Variable( const TString& name ) const;
-
-   private:
-      /// Reference to the parent of this object
-      const UserD3PDObject* m_parent;
-      /// The index of this object inside the parent container
-      size_t m_index;
-      /// Book-keeper of the VarProxy members
-      mutable std::map< ::TString, VarProxyBase* > m_proxies;
-
-      UserD3PDObjectElement& operator=( const UserD3PDObjectElement& parent );
-
-      ClassDef( UserD3PDObjectElement, 0 )
-
-   }; // class UserD3PDObjectElement
-
-   /**
-    *  @short Special class for handling user variables
-    *
-    *         This class is used to handle user defined variables. It can be
-    *         used on its own to read/write any sort of variable, but it also
-    *         acts as a base class for all the other D3PDObject classes, to
-    *         make it possible to decorate the information stored by them.
-    *
-    *         While the class fully implements the D3PDObjectBase interface,
-    *         it doesn't inherit from it, in order to avoid creating a diamond
-    *         in the inheritance structure. Python is not able to handle such
-    *         an inheritance structure correctly.
-    *
-    * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
-    *
-    * $Revision: 539451 $
-    * $Date: 2013-03-01 09:33:45 +0100 (Fri, 01 Mar 2013) $
-    */
-   class UserD3PDObject : public D3PDObjectBase {
-
-   public:
-      /// Constructor used when reading from a TTree
-      UserD3PDObject( const ::Long64_t& master, const char* prefix = "" );
-      /// Constructor when the object is only used for writing data out
-      UserD3PDObject( const char* prefix = "" );
-      /// Destructor, cleaning up the created objects
-      virtual ~UserD3PDObject();
-
-      /// Get the currently configured prefix value
-      virtual const char* GetPrefix() const;
-      /// Set the prefix for the variables
-      virtual void SetPrefix( const char* prefix );
-
-      /// Connect the object to an input TTree
-      virtual void ReadFrom( ::TTree* tree );
-      /// Connect the object to an output TTree
-      virtual void WriteTo( ::TTree* tree );
-
-      /// Turn (selected) branches either on or off
-      virtual void SetActive( ::Bool_t active = kTRUE,
-                              const ::TString& pattern = ".*" );
-      /// Read in all the variables that we need to write out as well
-      virtual void ReadAllActive();
-
-      /// Get the D3PD reading statistics
-      //virtual D3PDReadStats GetStatistics() const;
-
-      /// Set the contents of the object according to another object
-      UserD3PDObject& Set( const UserD3PDObject& parent );
-
-      /// Clear the container. Useful when writing new branches.
-      void Clear( Option_t* option = "" );
-      /// Add one element to an output collection
-      UserD3PDObject& Add( const UserD3PDObjectElement& el );
-
-      /// Access a proxy class describing one element of the container
-      UserD3PDObjectElement& operator[]( size_t index );
-      /// Access a proxy class describing one element of the container (constant version)
-      const UserD3PDObjectElement& operator[]( size_t index ) const;
-      /// Add one element to an output collection
-      UserD3PDObject& operator+=( const UserD3PDObjectElement& el );
-
-      /// Declare a new variable for writing
-      template< typename T >
-      void DeclareVariable( const TString& name );
-      /// Access a variable
-      template< typename T >
-      VarHandle< T >& Variable( const TString& name );
-      /// Access a variable (constant version)
-      template< typename T >
-      const VarHandle< T >& Variable( const TString& name ) const;
-
-   private:
-      const ::Long64_t* m_master; ///< Pointer to the master entry number
-      ::TString m_prefix; ///< Prefix to the branch names
-      ///< Internal list of proxy objects
-      mutable std::vector< UserD3PDObjectElement* > m_proxies;
-      /// Book-keeper of the VarHandle members
-      mutable std::map< ::TString, VarHandleBase* > m_handles;
-      /// Book-keeper of VarHandle objects needed for technical reasons
-      mutable std::vector< VarHandleBase* > m_extraHandles;
-      /// Flag specifying if object is used for D3PD reading
-      const ::Bool_t m_fromInput;
-      /// TTree that is being read currently
-      ::TTree* m_inTree;
-
-      ClassDef( UserD3PDObject, 0 )
-
-   }; // class UserD3PDObject
-
-} // namespace D3PDReader
-
-// Include the template implementation:
-#ifndef __CINT__
-#include "UserD3PDObject.icc"
-#endif // __CINT__
-
-#endif // D3PDREADER_UserD3PDObject_H
diff --git a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/UserD3PDObject.icc b/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/UserD3PDObject.icc
deleted file mode 100644
index f034ce35b1f6eefcbd482a9409198c2510554cc1..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/UserD3PDObject.icc
+++ /dev/null
@@ -1,249 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: CodeGenerator_v2_constants.h 539451 2013-03-01 08:33:45Z krasznaa $
-#ifndef D3PDREADER_UserD3PDObject_ICC
-#define D3PDREADER_UserD3PDObject_ICC
-
-namespace D3PDReader {
-
-   /**
-    * This function accesses a user-defined variable for modification.
-    * The template type needs to follow the type of the underlying
-    * TTree branch's type, without the outermost vector. So for instance
-    * to access a <code>std::vector<float></code> variable from here, you
-    * need to call the function with a <code>float</code> template argument.
-    *
-    * The function also takes care of extending the underlying vector variable
-    * to the needed size. This makes the decoration of existing objects in
-    * a container with new variables much easier.
-    *
-    * If you're decorating elements that you are reading from an input D3PD,
-    * you must have already called <code>DeclareVariable(...)</code> on the
-    * parent object before calling thig function.
-    *
-    * @param name The name of the user variable
-    * @returns The VarProxy object handling the requested variable
-    */
-   template< typename T >
-   VarProxy< T >& UserD3PDObjectElement::Variable( const TString& name ) {
-
-      // Try to find the variable:
-      std::map< ::TString, VarProxyBase* >::const_iterator itr =
-         m_proxies.find( name );
-      if( itr != m_proxies.end() ) {
-         // If it's already known, let's see if it's the right type:
-         VarProxy< T >* result =
-            dynamic_cast< VarProxy< T >* >( itr->second );
-         if( ! result ) {
-            // Create a dummy object. The code will crash soon
-            // anyway...
-            VarProxy< T >* dummy =
-               new VarProxy< T >( m_parent->Variable< std::vector< T >* >( name ),
-                                  m_index );
-            m_proxies[ name ] = dummy;
-            // Tell the user what happened:
-            Error( "Variable",
-                   "Variable with name '%s' requested with wrong type",
-                   name.Data() );
-            return *dummy;
-         }
-         // Check if the underlying vector is large enough:
-         const VarHandle< std::vector< T >* >& vh = 
-            m_parent->Variable< std::vector< T >* >( name );
-         if( vh.IsAvailable() && ( ! vh.GetMaster() ) &&
-             ( vh()->size() <= m_index ) ) {
-            UserD3PDObject* ncparent = const_cast< UserD3PDObject* >( m_parent );
-            ncparent->Variable< std::vector< T >* >( name )()->resize( m_index + 1 );
-         }
-         // Return the proxy:
-         return *result;
-      }
-
-      // Add the new proxy variable:
-      VarProxy< T >* result =
-         new VarProxy< T >( m_parent->Variable< std::vector< T >* >( name ),
-                            m_index );
-      m_proxies[ name ] = result;
-
-      // Check if the underlying vector is large enough:
-      const VarHandle< std::vector< T >* >& vh = 
-         m_parent->Variable< std::vector< T >* >( name );
-      if( vh.IsAvailable() && ( ! vh.GetMaster() ) &&
-          ( vh()->size() <= m_index ) ) {
-         UserD3PDObject* ncparent = const_cast< UserD3PDObject* >( m_parent );
-         ncparent->Variable< std::vector< T >* >( name )()->resize( m_index + 1 );
-      }
-
-      // Return the proxy:
-      return *result;
-   }
-
-   /**
-    * This function accesses a user-defined variable for reading.
-    * The template type needs to follow the type of the underlying
-    * TTree branch's type, without the outermost vector. So for instance
-    * to access a <code>std::vector<float></code> variable from here, you
-    * need to call the function with a <code>float</code> template argument.
-    *
-    * If you're decorating elements that you are reading from an input D3PD,
-    * you must have already called <code>DeclareVariable(...)</code> on the
-    * parent object before calling thig function.
-    *
-    * @param name The name of the user variable
-    * @returns The VarProxy object handling the requested variable
-    */
-   template< typename T >
-   const VarProxy< T >& UserD3PDObjectElement::Variable( const TString& name ) const {
-
-      // Try to find the variable:
-      std::map< ::TString, VarProxyBase* >::const_iterator itr =
-         m_proxies.find( name );
-      if( itr != m_proxies.end() ) {
-         // If it's already known, let's see if it's the right type:
-         VarProxy< T >* result =
-            dynamic_cast< VarProxy< T >* >( itr->second );
-         if( ! result ) {
-            // Create a dummy object. The code will crash soon
-            // anyway...
-            VarProxy< T >* dummy =
-               new VarProxy< T >( m_parent->Variable< std::vector< T >* >( name ),
-                                  m_index );
-            m_proxies[ name ] = dummy;
-            // Tell the user what happened:
-            Error( "Variable",
-                   "Variable with name '%s' requested with wrong type",
-                   name.Data() );
-            return *dummy;
-         }
-         // Return the proxy:
-         return *result;
-      }
-
-      // Add the new proxy variable:
-      VarProxy< T >* result =
-         new VarProxy< T >( m_parent->Variable< std::vector< T >* >( name ),
-                            m_index );
-      m_proxies[ name ] = result;
-
-      // Return the proxy:
-      return *result;
-   }
-
-   /**
-    * This function can be used to add a new variable to an output D3PD.
-    * When reading an input D3PD that the user wants to write out a part of,
-    * extended with some additional variables, this function should be used.
-    *
-    * @param name The name of the new variable to create
-    */
-   template< typename T >
-   void UserD3PDObject::DeclareVariable( const TString& name ) {
-
-      // Check if the variable with this name is already in place:
-      std::map< ::TString, VarHandleBase* >::const_iterator itr =
-         m_handles.find( name );
-      if( itr != m_handles.end() ) {
-         Warning( "DeclareVariable",
-                  "Variable with name '%s' already declared",
-                  ( m_prefix + name ).Data() );
-         return;
-      }
-
-      // Declare the new variable:
-      m_handles[ name ] = new VarHandle< T >( m_prefix + name, 0 );
-
-      return;
-   }
-
-   /**
-    * This function can be used to access a user-defined variable for
-    * modification. It should mostly be used when writing a D3PD with the
-    * additional user variable.
-    *
-    * @param name The name of the user-defined variable
-    * @returns The VarHandle object handling the user variable
-    */
-   template< typename T >
-   VarHandle< T >& UserD3PDObject::Variable( const TString& name ) {
-
-      // Try to find the variable:
-      std::map< ::TString, VarHandleBase* >::const_iterator itr =
-         m_handles.find( name );
-      if( itr != m_handles.end() ) {
-         // It's already known, so let's see if it's of the right type:
-         VarHandle< T >* result =
-            dynamic_cast< VarHandle< T >* >( itr->second );
-         if( ! result ) {
-            // Add a dummy object for technical reasons. The user code
-            // will anyway probably die after this.
-            VarHandle< T >* dummy = new VarHandle< T >();
-            m_extraHandles.push_back( dummy );
-            // Tell the user what happened:
-            Error( "Variable",
-                   "Variable with name '%s' is of type '%s', "
-                   "not of type '%s'",
-                   ( m_prefix + name ).Data(), itr->second->GetType(),
-                   dummy->GetType() );
-            // Return the dummy:
-            return *dummy;
-         }
-         // Return the object:
-         return *result;
-      }
-
-      // If it doesn't exist yet, let's add it:
-      VarHandle< T >* result = new VarHandle< T >( m_prefix + name, m_master );
-      if( m_inTree ) result->ReadFrom( m_inTree );
-      m_handles[ name ] = result;
-      return *result;
-   }
-
-   /**
-    * This function can be used to access a user-defined variable for
-    * reading. It can be used both when reading or writing a D3PD.
-    *
-    * @param name The name of the user-defined variable
-    * @returns The VarHandle object handling the user variable
-    */
-   template< typename T >
-   const VarHandle< T >& UserD3PDObject::Variable( const TString& name ) const {
-
-      // Try to find the variable:
-      std::map< ::TString, VarHandleBase* >::const_iterator itr =
-         m_handles.find( name );
-      if( itr != m_handles.end() ) {
-         // It's already known, so let's see if it's of the right type:
-         VarHandle< T >* result =
-            dynamic_cast< VarHandle< T >* >( itr->second );
-         if( ! result ) {
-            // Add a dummy object for technical reasons. The user code
-            // will anyway probably die after this.
-            VarHandle< T >* dummy = new VarHandle< T >();
-            m_extraHandles.push_back( dummy );
-            // Tell the user what happened:
-            Error( "Variable",
-                   "Variable with name '%s' is of type '%s', "
-                   "not of type '%s'",
-                   ( m_prefix + name ).Data(), itr->second->GetType(),
-                   dummy->GetType() );
-            // Return the dummy:
-            return *dummy;
-         }
-         // Return the object:
-         return *result;
-      }
-
-      // If it doesn't exist yet, let's add it:
-      VarHandle< T >* result = new VarHandle< T >( m_prefix + name, m_master );
-      if( m_inTree ) result->ReadFrom( m_inTree );
-      m_handles[ name ] = result;
-      return *result;
-   }
-
-} // namespace D3PDReader
-
-#endif // D3PDREADER_UserD3PDObject_ICC
diff --git a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/Utils.h b/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/Utils.h
deleted file mode 100644
index a30e4f4bc4d04cbab93e7d921ef53064ad6bd927..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/Utils.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: CodeGenerator_v2_constants.h 539451 2013-03-01 08:33:45Z krasznaa $
-#ifndef D3PDREADER_UTILS_H
-#define D3PDREADER_UTILS_H
-
-// ROOT include(s):
-#include <TString.h>
-
-namespace D3PDReader {
-
-   /// Function creating a human-readable elapsed time printout
-   ::TString TimeToString( ::Double_t secs );
-
-   /// Function for printing data sizes in human-readable format
-   ::TString SizeToString( ::Long64_t bytes );
-
-   /// Function for printing data processing speeds in a human-readable format
-   ::TString SpeedToString( ::Double_t bytespersec );
-
-} // namespace D3PDReader
-
-#endif // D3PDREADER_UTILS_H
diff --git a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/VarHandle.h b/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/VarHandle.h
deleted file mode 100644
index 243e09ce81e2297f7b38cd48dbab79ca9126a263..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/VarHandle.h
+++ /dev/null
@@ -1,225 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: CodeGenerator_v2_constants.h 539451 2013-03-01 08:33:45Z krasznaa $
-#ifndef D3PDREADER_VARHANDLE_H
-#define D3PDREADER_VARHANDLE_H
-
-// ROOT include(s):
-#include <TString.h>
-#include <TDataType.h>
-
-// Local include(s):
-//#include "D3PDReadStats.h"
-
-// Forward declaration(s):
-class TTree;
-class TBranch;
-
-namespace D3PDReader {
-
-   /**
-    *  @short Base class for the different kind of VarHandle specializations
-    *
-    *         This class is used to keep a list of all the VarHandle members of
-    *         a D3PDObject class. It makes some operations much easier.
-    *
-    * $Revision: 539451 $
-    * $Date: 2013-03-01 09:33:45 +0100 (Fri, 01 Mar 2013) $
-    */
-   class VarHandleBase {
-
-   protected:
-      /// Custom enumeration describing the availability of the branch
-      enum BranchAvailability {
-         UNKNOWN = 0, ///< The input TTree has not yet been checked
-         AVAILABLE = 1, ///< The input branch is available
-         UNAVAILABLE = 2 ///< The input branch is not available
-      };
-
-   public:
-      /// Constructor specifying all the needed parameters
-      VarHandleBase( const char* name = "",
-                     const ::Long64_t* master = 0 );
-      /// The destructor is actually only useful in the specialized class...
-      virtual ~VarHandleBase() {}
-
-      /// Get the name of the branch handled by this class
-      const char* GetName() const;
-      /// Set the name of the branch handled by this class
-      void SetName( const char* name );
-
-      /// Get the type name of the branch handled by this object
-      const char* GetType() const;
-      /// Set the type name of the branch handled by this object
-      void SetType( const char* type );
-
-      /// Get a pointer to the master entry variable
-      const ::Long64_t* GetMaster() const;
-      /// Set the pointer to the master entry variable
-      void SetMaster( const ::Long64_t* master );
-
-      /// Connect the object to an input tree
-      virtual void ReadFrom( ::TTree* tree ) = 0;
-      /// Connect the object to an output tree
-      virtual ::TBranch* WriteTo( ::TTree* tree ) = 0;
-
-      /// Check if this variable is "active" at the moment
-      ::Bool_t IsActive() const;
-      /// Set the "activity level" of the variable
-      void SetActive( ::Bool_t active = kTRUE );
-
-      /// Check if the variable is available in the input
-      virtual ::Bool_t IsAvailable() const;
-
-      /// Read in the current entry from the branch
-      virtual void ReadCurrentEntry() const = 0;
-
-      /// "Clear" the variable of its contents
-      virtual void Clear() = 0;
-
-      /// Get information about the read statistics
-      //virtual VariableStats GetStatistics() const;
-
-   protected:
-      /// Connect the variable to the branch
-      ::Bool_t ConnectVariable( void* var, ::TClass* realClass,
-                                EDataType dtype, Bool_t isptr ) const;
-      /// Update the variable to the current entry in the D3PD
-      void UpdateBranch() const;
-      /// Switch to a new tree in the statistics gathering
-      // void UpdateStat( ::TBranch* br ) const;
-      /// Translate the typeid() type name to something ROOT understands
-      const char* RootType( const char* typeid_type ) const;
-      /// Translate the typeid() type name to a huma-readable ROOT type name
-      const char* RootCppType( const char* typeid_type ) const;
-
-      const ::Long64_t* m_master; ///< Pointer to the current entry number
-      ::Bool_t m_fromInput; ///< Flag showing if the variable is read from an input TTree
-      ::TTree* m_inTree; ///< The input TTree
-      mutable ::TBranch* m_inBranch; /// The input branch belonging to this variable
-      mutable BranchAvailability m_available; ///< Availability of the branch
-
-   private:
-      ::TString m_name; ///< Name of the branch to handle
-      ::Bool_t m_active; ///< Flag telling if the variable can be written to the output
-
-      ::TString m_type; ///< Variable type
-      mutable std::vector< ::Long64_t > m_entriesRead; ///< Number of read entries for each tree
-      mutable std::vector< ::Float_t > m_branchSize; ///< Unzipped entry size for each tree
-      mutable std::vector< ::Float_t > m_zippedSize; ///< Zipped entry size for each tree
-
-   }; // class VarHandleBase
-
-   /**
-    *  @short Class responsible for reading primitive types from the D3PD
-    *
-    *         This class is used by all the D3PDReader classes to physically
-    *         handle the branches of the input TTree.
-    *
-    * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
-    *
-    * $Revision: 539451 $
-    * $Date: 2013-03-01 09:33:45 +0100 (Fri, 01 Mar 2013) $
-    */
-   template< typename Type >
-   class VarHandle : public VarHandleBase {
-
-   public:
-      /// Convenience typedef of the used variable
-      typedef Type& result_type;
-      /// Convenience typedef of the used variable (const version)
-      typedef const Type& const_result_type;
-
-      /// Constructor specifying all the needed parameters
-      VarHandle( const char* name = "",
-                 const ::Long64_t* master = 0 );
-      /// The destructor is actually only useful in the specialized class...
-      ~VarHandle();
-
-      /// Connect the object to an input tree
-      virtual void ReadFrom( ::TTree* tree );
-      /// Connect the object to an output tree
-      virtual ::TBranch* WriteTo( ::TTree* tree );
-
-      /// Operator used to access the branch itself
-      result_type operator()();
-      /// Operator used to access the branch itself (constant version)
-      const_result_type operator()() const;
-
-      /// Read in the current entry from the branch
-      virtual void ReadCurrentEntry() const;
-
-      /// "Clear" the variable of its contents
-      virtual void Clear();
-
-      /// Set the value of the variable. Used primarily from Python.
-      void Set( Type value );
-
-   private:
-      mutable Type m_variable; ///< The variable in memory
-
-   }; // class VarHandle
-
-   /**
-    *  @short Class responsible for reading STL objects from the D3PD
-    *
-    *         This specialization of the template class makes it possible to
-    *         handle branches describing primitive types and branches describing
-    *         STL collections a little differently.
-    *
-    * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
-    *
-    * $Revision: 539451 $
-    * $Date: 2013-03-01 09:33:45 +0100 (Fri, 01 Mar 2013) $
-    */
-   template< typename Type >
-   class VarHandle< Type* > : public VarHandleBase {
-
-   public:
-      /// Convenience typedef of the used variable
-      typedef Type* result_type;
-      /// Convenience typedef of the used variable (const version)
-      typedef const Type* const_result_type;
-
-      /// Constructor specifying all the needed parameters
-      VarHandle( const char* name = "",
-                 const ::Long64_t* master = 0 );
-      /// This destructor actually does something...
-      ~VarHandle();
-
-      /// Connect the object to an input tree
-      virtual void ReadFrom( ::TTree* tree );
-      /// Connect the object to an output tree
-      virtual ::TBranch* WriteTo( ::TTree* tree );
-
-      /// Operator used to access the branch itself
-      result_type operator()();
-      /// Operator used to access the branch itself (constant version)
-      const_result_type operator()() const;
-
-      /// Read in the current entry from the branch
-      virtual void ReadCurrentEntry() const;
-
-      /// "Clear" the variable of its contents
-      virtual void Clear();
-
-      /// Set the value of the variable. Used primarily from Python.
-      void Set( const_result_type value );
-
-   private:
-      mutable Type* m_variable; ///< The variable in memory
-
-   }; // class VarHandle
-
-} // namespace D3PDReader
-
-// Include the implementation:
-#ifndef __CINT__
-#include "VarHandle.icc"
-#endif // __CINT__
-
-#endif // D3PDREADER_VARHANDLE_H
diff --git a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/VarHandle.icc b/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/VarHandle.icc
deleted file mode 100644
index c5c45b58dde382f7d1f731f7ca2eda4cac3548cf..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/VarHandle.icc
+++ /dev/null
@@ -1,277 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: CodeGenerator_v2_constants.h 539451 2013-03-01 08:33:45Z krasznaa $
-#ifndef D3PDREADER_VARHANDLE_ICC
-#define D3PDREADER_VARHANDLE_ICC
-
-// System include(s):
-#include <string.h>
-#include <cxxabi.h>
-#include <cstdlib>
-
-// ROOT include(s):
-#include <TObject.h>
-#include <TClass.h>
-#include <TTree.h>
-#include <TBranch.h>
-#include <TError.h>
-
-namespace D3PDReader {
-
-   template< typename Type >
-   // cppcheck-suppress uninitMemberVar
-   VarHandle< Type >::VarHandle( const char* name,
-                                 const ::Long64_t* master )
-      : VarHandleBase( name, master ),
-        m_variable() {
-
-      SetType( RootCppType( typeid( Type ).name() ) );
-   }
-
-   template< typename Type >
-   VarHandle< Type >::~VarHandle() {
-
-   }
-
-   template< typename Type >
-   void VarHandle< Type >::ReadFrom( ::TTree* tree ) {
-
-      m_inTree = tree;
-      m_fromInput = kTRUE;
-      m_variable = 0;
-      m_inBranch = 0;
-      m_available = UNKNOWN;
-
-      return;
-   }
-
-   template< typename Type >
-   ::TBranch* VarHandle< Type >::WriteTo( ::TTree* tree ) {
-
-      if( ! IsActive() ) return 0;
-
-      ::TBranch* branch = tree->GetBranch( GetName() );
-      if( branch ) return branch;
-
-      branch = tree->Branch( GetName(), &m_variable,
-                             ::TString::Format( "%s/%s", GetName(),
-                                                RootType( typeid( Type ).name() ) ) );
-      if( ! branch ) {
-         ::Error( "D3PDReader::VarHandle::WriteTo",
-                  "Couldn't add variable %s to tree %s",
-                  GetName(), tree->GetName() );
-      } else {
-         for( ::Long64_t i = 0; i < tree->GetEntries(); ++i ) {
-            branch->Fill();
-         }
-      }
-
-      return branch;
-   }
-
-   template< typename Type >
-   typename VarHandle< Type >::result_type VarHandle< Type >::operator()() {
-
-      if( ! m_fromInput ) return m_variable;
-
-      if( ! m_inBranch ) {
-         if( ! ConnectVariable( &m_variable, TClass::GetClass( typeid( Type ) ),
-                                TDataType::GetType( typeid( Type ) ), kFALSE ) ||
-             !m_inBranch )
-         {
-            ::Error( ::TString( "D3PDReader::VarHandle::" ) + GetName() + "()",
-                     "Failed connecting to D3PD" );
-            return m_variable;
-         }
-      }
-      UpdateBranch();
-
-      return m_variable;
-   }
-
-   template< typename Type >
-   typename VarHandle< Type >::const_result_type VarHandle< Type >::operator()() const {
-
-      if( ! m_fromInput ) return m_variable;
-
-      if( ! m_inBranch ) {
-         if( ! ConnectVariable( &m_variable, TClass::GetClass( typeid( Type ) ),
-                                TDataType::GetType( typeid( Type ) ), kFALSE ) ) {
-            ::Error( ::TString( "D3PDReader::VarHandle::" ) + GetName() + "()",
-                     "Failed connecting to D3PD" );
-            return m_variable;
-         }
-      }
-      UpdateBranch();
-
-      return m_variable;
-   }
-
-   template< typename Type >
-   void VarHandle< Type >::ReadCurrentEntry() const {
-
-      if( IsAvailable() ) {
-         this->operator()();
-      } else {
-         m_variable = 0;
-      }
-      return;
-   }
-
-   template< typename Type >
-   void VarHandle< Type >::Clear() {
-
-      this->operator()() = 0;
-      return;
-   }
-
-   template< typename Type >
-   void VarHandle< Type >::Set( Type value ) {
-
-      m_variable = value;
-      return;
-   }
-
-   template< typename Type >
-   // cppcheck-suppress uninitMemberVar
-   VarHandle< Type* >::VarHandle( const char* name,
-                                  const ::Long64_t* master )
-      : VarHandleBase( name, master ),
-        m_variable( 0 ) {
-
-      int status;
-      char* type_name = abi::__cxa_demangle( typeid( Type ).name(), 0, 0, &status );
-      if( ! status ) {
-         SetType( type_name );
-         ::free( type_name );
-      }
-   }
-
-   template< typename Type >
-   VarHandle< Type* >::~VarHandle() {
-
-      if( m_variable ) delete m_variable;
-   }
-
-   template< typename Type >
-   void VarHandle< Type* >::ReadFrom( ::TTree* tree ) {
-
-      m_inTree = tree;
-      m_fromInput = kTRUE;
-      if( m_variable ) m_variable->clear();
-      m_inBranch = 0;
-      m_available = UNKNOWN;
-
-      return;
-   }
-
-   template< typename Type >
-   ::TBranch* VarHandle< Type* >::WriteTo( ::TTree* tree ) {
-
-      if( ! IsActive() ) return 0;
-
-      ::TBranch* branch = tree->GetBranch( GetName() );
-      if( branch ) return branch;
-
-      if( ! ::strcmp( GetType(), "" ) ) {
-         ::Error( "D3PDReader::VarHandle::WriteTo",
-                  "Couldn't demangle type name: %s",
-                  typeid( Type ).name() );
-         return 0;
-      }
-      if( ! m_variable ) {
-         m_variable = new Type();
-      }
-      branch = tree->Bronch( GetName(), GetType(), &m_variable );
-      if( ! branch ) {
-         ::Error( "D3PDReader::VarHandle::WriteTo",
-                  "Couldn't add variable %s to tree %s",
-                  GetName(), tree->GetName() );
-      } else {
-         for( ::Long64_t i = 0; i < tree->GetEntries(); ++i ) {
-            branch->Fill();
-         }
-      }
-
-      return branch;
-   }
-
-   template< typename Type >
-   typename VarHandle< Type* >::result_type
-   VarHandle< Type* >::operator()() {
-
-      if( ! m_fromInput ) {
-         if( ! m_variable ) m_variable = new Type();
-         return m_variable;
-      }
-
-      if( ! m_inBranch ) {
-         if( ! ConnectVariable( &m_variable, TClass::GetClass( typeid( Type ) ),
-                                TDataType::GetType( typeid( Type ) ), kTRUE ) ) {
-            ::Error( ::TString( "D3PDReader::VarHandle::" ) + GetName() + "()",
-                     "Failed connecting to D3PD" );
-            return m_variable;
-         }
-      }
-      UpdateBranch();
-
-      return m_variable;
-   }
-
-   template< typename Type >
-   typename VarHandle< Type* >::const_result_type
-   VarHandle< Type* >::operator()() const {
-
-      if( ! m_fromInput ) {
-         if( ! m_variable ) m_variable = new Type();
-         return m_variable;
-      }
-
-      if( ! m_inBranch ) {
-         if( ! ConnectVariable( &m_variable, TClass::GetClass( typeid( Type ) ),
-                                TDataType::GetType( typeid( Type ) ), kTRUE ) ||
-             !m_inBranch)
-         {
-            ::Error( ::TString( "D3PDReader::VarHandle::" ) + GetName() + "()",
-                     "Failed connecting to D3PD" );
-            return m_variable;
-         }
-      }
-      UpdateBranch();
-
-      return m_variable;
-   }
-
-   template< typename Type >
-   void VarHandle< Type* >::ReadCurrentEntry() const {
-
-      if( IsAvailable() ) {
-         this->operator()();
-      } else {
-         if( ! m_variable ) m_variable = new Type();
-         m_variable->clear();
-      }
-      return;
-   }
-
-   template< typename Type >
-   void VarHandle< Type* >::Clear() {
-
-      this->operator()()->clear();
-      return;
-   }
-
-   template< typename Type >
-   void VarHandle< Type* >::Set( const_result_type value ) {
-
-      *m_variable = *value;
-      return;
-   }
-
-} // namespace D3PDReader
-
-#endif // D3PDREADER_VARHANDLE_ICC
diff --git a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/VarProxy.h b/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/VarProxy.h
deleted file mode 100644
index bc6f71c51134a96063ddd0331df44e9c6f497d3e..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/VarProxy.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: CodeGenerator_v2_constants.h 539451 2013-03-01 08:33:45Z krasznaa $
-#ifndef D3PDREADER_VARPROXY_H
-#define D3PDREADER_VARPROXY_H
-
-// STL include(s):
-#include <vector>
-
-// Local include(s):
-#include "VarHandle.h"
-
-namespace D3PDReader {
-
-   /**
-    *  @short Base class for the VarProxy versions
-    *
-    *         This class is needed for technical reasons in order to handle
-    *         user defined variables in a nice way.
-    *
-    * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
-    *
-    * $Revision: 539451 $
-    * $Date: 2013-03-01 09:33:45 +0100 (Fri, 01 Mar 2013) $
-    */
-   class VarProxyBase {
-
-   public:
-      /// Destructor, to make vtable happy
-      virtual ~VarProxyBase() {}
-
-      /// Check if the variable is available in the input
-      virtual ::Bool_t IsAvailable() const = 0;
-
-   }; // class VarProxyBase
-
-   /**
-    *  @short Class acting as a proxy to one element of an std::vector
-    *
-    *         This class is used in the "Element" classes to represent one
-    *         object from a collection.
-    *
-    * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
-    *
-    * $Revision: 539451 $
-    * $Date: 2013-03-01 09:33:45 +0100 (Fri, 01 Mar 2013) $
-    */
-   template< typename Type >
-   class VarProxy : public VarProxyBase {
-
-   public:
-      /// Convenience typedef of the used variable
-      typedef Type& result_type;
-      /// Convenience typedef of the used variable (const version)
-      typedef const Type& const_result_type;
-
-      /// Constructor specifying the handle object this proxy uses
-      VarProxy( const VarHandle< std::vector< Type >* >& handle, size_t i );
-      /// Copy constructor
-      VarProxy( const VarProxy< Type >& parent );
-      /// Copy operator
-      VarProxy< Type >& operator=( const VarProxy< Type >& parent );
-
-      /// Check if the variable is available in the input
-      virtual ::Bool_t IsAvailable() const;
-
-      /// Operator returning the variable belonging to this object
-      result_type operator()();
-      /// Operator returning the variable belonging to this object (constant version)
-      const_result_type operator()() const;
-
-   private:
-      VarHandle< std::vector< Type >* >* m_handle; ///< Pointer to the handle object
-      size_t m_index; ///< Index inside the handle object's vector
-      Type m_dummy; ///< Object returned by default
-
-   }; // class VarProxy
-
-} // namespace D3PDReader
-
-// Include the implementation:
-#ifndef __CINT__
-#include "VarProxy.icc"
-#endif // __CINT__
-
-#endif // D3PDREADER_VARPROXY_H
diff --git a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/VarProxy.icc b/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/VarProxy.icc
deleted file mode 100644
index 7ab1c65f9dfb22f5c5936b4c4f51de15a6a0aeeb..0000000000000000000000000000000000000000
--- a/Trigger/TrigCost/TrigCostD3PD/TrigCostD3PD/VarProxy.icc
+++ /dev/null
@@ -1,72 +0,0 @@
-// Dear emacs, this is -*- c++ -*-
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: CodeGenerator_v2_constants.h 539451 2013-03-01 08:33:45Z krasznaa $
-#ifndef D3PDREADER_VARPROXY_ICC
-#define D3PDREADER_VARPROXY_ICC
-
-// ROOT include(s):
-#include <TError.h>
-
-namespace D3PDReader {
-
-   template< typename Type >
-   VarProxy< Type >::VarProxy( const VarHandle< std::vector< Type >* >& handle,
-                               size_t i )
-      : m_handle( const_cast< VarHandle< std::vector< Type >* >* >( &handle ) ),
-        m_index( i ), m_dummy() {
-
-   }
-
-   template< typename Type >
-   VarProxy< Type >::VarProxy( const VarProxy< Type >& parent )
-      : VarProxyBase(), m_handle( parent.m_handle ), m_index( parent.m_index ),
-        m_dummy() {
-
-   }
-
-   template< typename Type >
-   VarProxy< Type >& VarProxy< Type >::operator=( const VarProxy< Type >& parent ) {
-
-      m_handle = parent.m_handle;
-      m_index  = parent.m_index;
-
-      return *this;
-   }
-
-   template< typename Type >
-   ::Bool_t VarProxy< Type >::IsAvailable() const {
-
-      return m_handle->IsAvailable();
-   }
-
-   template< typename Type >
-   typename VarProxy< Type >::result_type VarProxy< Type >::operator()() {
-
-      if( m_handle->IsAvailable() ) {
-         return ( ( *( *m_handle )() ) )[ m_index ];
-      } else {
-         ::Warning( ::TString( "D3PDReader::VarProxy::" ) + m_handle->GetName() + "()",
-                    "Variable not available on input. Returning 0" );
-         return m_dummy;
-      }
-   }
-
-   template< typename Type >
-   typename VarProxy< Type >::const_result_type VarProxy< Type >::operator()() const {
-
-      if( m_handle->IsAvailable() ) {
-         return ( ( *( *m_handle )() ) )[ m_index ];
-      } else {
-         ::Warning( ::TString( "D3PDReader::VarProxy::" ) + m_handle->GetName() + "()",
-                    "Variable not available on input. Returning 0" );
-         return m_dummy;
-      }
-   }
-
-} // namespace D3PDReader
-
-#endif // D3PDREADER_VARPROXY_ICC
diff --git a/Trigger/TrigFake/CMakeLists.txt b/Trigger/TrigFake/CMakeLists.txt
deleted file mode 100644
index 0d79ad93b1fe04e877470904572858272dfd8201..0000000000000000000000000000000000000000
--- a/Trigger/TrigFake/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-
-# Declare the package name:
-atlas_subdir( TrigFake )
-
-# External dependencies:
-find_package( CLHEP )
-
-# Component(s) in the package:
-atlas_add_component( TrigFake
-                     src/*.cxx src/components/*.cxx
-                     INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib GeneratorObjects TrigConfHLTData TrigInDetEvent TrigSteeringEvent TrigSteeringLib TrigT1Interfaces TrigT1Result )
diff --git a/Trigger/TrigFake/src/FakeLvl1MultipleRoIsatFixedEtaPhi.cxx b/Trigger/TrigFake/src/FakeLvl1MultipleRoIsatFixedEtaPhi.cxx
deleted file mode 100644
index bda6b320806c441d0c870d85c711ee0388e27d7d..0000000000000000000000000000000000000000
--- a/Trigger/TrigFake/src/FakeLvl1MultipleRoIsatFixedEtaPhi.cxx
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/********************************************************************
-
-
-NAME:     FakeLvl1MultipleRoIsatFixedEtaPhi.cxx
-PACKAGE:
-
-AUTHORS: J. Boyd (copied from and then adapted FakeLvl1RoIatFixedEtaPhi
-
-CREATED:  Apr, 2007
-
-PURPOSE:  Fake Lvl1 RoI for seeding Lvl2
-
-Modified :
-
-
-********************************************************************/
-
-#include <stdlib.h>
-#include <vector>
-#include <utility>
-// INCLUDE GAUDI HEADER FILES:
-#include "GaudiKernel/MsgStream.h"
-#include "Gaudi/Property.h"
-#include "GaudiKernel/ISvcLocator.h"
-
-
-# include "CLHEP/Units/SystemOfUnits.h"
-
-#include "TrigSteeringEvent/TrigRoiDescriptor.h"
-#include "FakeLvl1MultipleRoIsatFixedEtaPhi.h"
-#include "FakeRoI.h"
-#include "Trajectory.h"
-
-#include "TrigInterfaces/AlgoConfig.h"
-#include "TrigSteering/SteeringChain.h"
-#include "TrigNavigation/Navigation.h"
-#include "TrigNavigation/TriggerElement.h"
-#include "TrigConfHLTData/HLTTriggerElement.h"
-
-#include "CLHEP/Vector/ThreeVector.h"
-
-#include "TrigT1Result/EMTauRoI.h"
-#include "TrigT1Result/JetEnergyResult.h"
-
-#include "TrigT1Interfaces/TrigT1Interfaces_ClassDEF.h"
-#include "TrigT1Interfaces/RecMuonRoI.h"
-#include "TrigT1Interfaces/RecMuonRoiSvc.h"
-
-
-
-
-////////////////////////////////////////////////////////////////
-//  CONSTRUCTOR:
-
-FakeLvl1MultipleRoIsatFixedEtaPhi::FakeLvl1MultipleRoIsatFixedEtaPhi(const std::string& name, const std::string& type,
-						   const IInterface* parent)
-  : HLT::LvlConverter(name, type, parent), 
-    m_roiId(0),
-    m_lvl1ID(1)
-{
-  declareProperty( "FakeEmRoiPhi", m_emRoiPhi);
-  declareProperty( "FakeEmRoiEta", m_emRoiEta);
-
-  declareProperty( "FakeTauRoiPhi", m_tauRoiPhi);
-  declareProperty( "FakeTauRoiEta", m_tauRoiEta);
-
-  declareProperty( "FakeMuonRoiPhi", m_muonRoiPhi);
-  declareProperty( "FakeMuonRoiEta", m_muonRoiEta);
-
-  declareProperty( "FakeJetRoiPhi", m_jetRoiPhi);
-  declareProperty( "FakeJetRoiEta", m_jetRoiEta);
-
-  declareProperty( "FakeEmRoiLabel",   m_emRoiLabel  );
-  declareProperty( "FakeMuonRoiLabel", m_muonRoiLabel);
-  declareProperty( "FakeJetRoiLabel",  m_jetRoiLabel );
-  declareProperty( "FakeTauRoiLabel",  m_tauRoiLabel );
-
-}
-
-// DESTRUCTOR:
-
-FakeLvl1MultipleRoIsatFixedEtaPhi::~FakeLvl1MultipleRoIsatFixedEtaPhi()
-{ }
-
-
-
-/////////////////////////////////////////////////////////////////
-// INITIALIZE METHOD:
-
-HLT::ErrorCode FakeLvl1MultipleRoIsatFixedEtaPhi::hltInitialize()
-{
-  // check that the vectors for emRoi are the same length
-  if (m_emRoiPhi.size() != m_emRoiEta.size() || m_emRoiPhi.size() != m_emRoiLabel.size()) {    msg() << MSG::FATAL << " problem configuring EMROI sizes of Phi, Eta, Label vectors different, phi " << m_muonRoiPhi.size()  << "  eta " << m_emRoiEta.size()  << "  label "<<m_emRoiLabel.size()  <<endmsg;
-  return HLT::BAD_JOB_SETUP;
-  }
-  if (m_emRoiPhi.size() == 0) msg() << MSG::INFO << " Not forming any fake EMROIs" << endmsg;
-
-  for (size_t em=0;em<m_emRoiPhi.size();em++){
-    if ( m_emRoiPhi.at(em) <= M_PI && m_emRoiPhi.at(em) >= -M_PI ) {
-      msg() << MSG::INFO << " Forming fake EMROI with name " << m_emRoiLabel.at(em)  <<" at phi =  " <<
-        m_emRoiPhi.at(em) << " eta = "  << m_emRoiEta.at(em) << endmsg;
-    } else {
-      msg() << MSG::INFO << " Not forming fake EMROI " <<m_emRoiLabel.at(em)  << " phi out of range"<< endmsg;
-    }
-  }
-
-  // check that the vectors for tauRoi are the same length
-  if (m_tauRoiPhi.size() != m_tauRoiEta.size() || m_tauRoiPhi.size() != m_tauRoiLabel.size()) {
-    msg() << MSG::FATAL << " problem configuring TAUROI sizes of Phi, Eta, Label vectors different, phi " << m_muonRoiPhi.size()  << "  eta " << m_tauRoiEta.size()  << "  label "<< m_tauRoiLabel.size()  <<endmsg;
-    return HLT::BAD_JOB_SETUP;
-  }
-  if (m_tauRoiPhi.size() == 0) msg() << MSG::INFO << " Not forming any fake TAUROIs" <<
-endmsg;
-  for (size_t tau=0;tau<m_tauRoiPhi.size();tau++){
-    if ( m_tauRoiPhi.at(tau) <= M_PI && m_tauRoiPhi.at(tau) >= -M_PI ) {
-      msg() << MSG::INFO << " Forming fake TAUROI with name " << m_tauRoiLabel.at(tau)
-<< " at phi =  " <<
-        m_tauRoiPhi.at(tau) << " eta = "  << m_tauRoiEta.at(tau) << endmsg;
-    } else {
-      msg() << MSG::INFO << " Not forming fake TAUROI " <<m_tauRoiLabel.at(tau)  << " phi out of range"<< endmsg;
-    }
-  }
-  // check that the vectors for muonRoi are the same length
-  if (m_muonRoiPhi.size() != m_muonRoiEta.size() || m_muonRoiPhi.size() != m_muonRoiLabel.size()) {
-    msg() << MSG::FATAL << " problem configuring MUONROI sizes of Phi, Eta, Label vectors different, phi " << m_muonRoiPhi.size()  << "  eta " << m_muonRoiEta.size()  << "  label "<< m_muonRoiLabel.size()  <<endmsg;
-    return HLT::BAD_JOB_SETUP;
-  }
-  if (m_muonRoiPhi.size() == 0) msg() << MSG::INFO << " Not forming any fake MUONROIs" << endmsg;
-
-  // print out the MUONROIs that will be created...
-  for (size_t mu=0;mu<m_muonRoiPhi.size();mu++){
-    if ( m_muonRoiPhi.at(mu) <= M_PI && m_muonRoiPhi.at(mu) >= -M_PI ) {
-      msg() << MSG::INFO << " Forming fake MUONROI " <<mu<< " with name " << m_muonRoiLabel.at(mu)  << "  at phi =  " <<
-        m_muonRoiPhi.at(mu) << " eta = "   << m_muonRoiEta.at(mu) << endmsg;
-    } else {
-      msg() << MSG::INFO << " Not forming fake MUONROI " <<mu << "phi out of range " <<endmsg;
-    }
-  }
-
-
-  // check that the vectors for jetRoi are the same length
-  if (m_jetRoiPhi.size() != m_jetRoiEta.size() || m_jetRoiPhi.size() != m_jetRoiLabel.size()) {
-    msg() << MSG::FATAL << " problem configuring JETROI sizes of Phi, Eta, Label vectors different, phi " << m_muonRoiPhi.size()  << "  eta " << m_jetRoiEta.size()  << "  label "<< m_jetRoiLabel.size()  <<endmsg;
-    return HLT::BAD_JOB_SETUP;
-  }
-  if (m_jetRoiPhi.size() == 0) msg() << MSG::INFO << " Not forming any fake JETROIs" <<
-endmsg;
-  for (size_t j=0;j<m_jetRoiPhi.size();j++){
-    if ( m_jetRoiPhi.at(j) <= M_PI && m_jetRoiPhi.at(j) >= -M_PI ) {
-      msg() << MSG::INFO << " Forming fake JETROI with name " << m_jetRoiLabel.at(j)  << "  at phi =  " <<
-        m_jetRoiPhi.at(j) << " eta = "  <<  m_jetRoiEta.at(j) << endmsg;
-    } else {
-      msg() << MSG::INFO << " Not forming fake JETROI " <<m_jetRoiLabel.at(j)  << " phi out of range "<< endmsg;
-    }
-  }
-
-
-  msg() << MSG::INFO << name() << ": Initialization completed successfully" << endmsg;
-
-  return HLT::OK;
-}
-
-
-/////////////////////////////////////////////////////////////////
-// EXECUTE METHOD:
-
-HLT::ErrorCode FakeLvl1MultipleRoIsatFixedEtaPhi::hltExecute( std::vector<HLT::SteeringChain*>& activeSteeringChains ) {
-
-
-
-
-
-  msg() << MSG::DEBUG << "Executing FakeLvl1MultipleRoIsatFixedEtaPhi" << endmsg;
-
-  // activate all configured chains:
-  msg() << MSG::DEBUG << "activating all configured chains." << endmsg;
-
-  for (std::vector<HLT::SteeringChain*>::const_iterator it = m_configuredChains->begin();
-       it != m_configuredChains->end(); ++it) {
-    // set to active:
-    (*it)->setActive();
-    // set pass through state:
-    (*it)->setPassThroughState();
-    activeSteeringChains.push_back( (*it) );
-  }
-
-  HLT::TriggerElement* initialTE = m_config->getNavigation()->getInitialNode();
-  msg() << MSG::DEBUG << "initial Navigation node created." << endmsg;
-
-  // set Lvl1 ID in AlgoConfig:
-  m_config->setLvl1Id(m_lvl1ID);
-
-
-  m_roiId=0;
-  const float zspread = 168.;
-
-  for (size_t em=0; em<m_emRoiPhi.size();em++){
-    if ( m_emRoiPhi.at(em) <= M_PI && m_emRoiPhi.at(em) >= -M_PI ) {
-      HLT::TriggerElement* roiTE = m_config->getNavigation()->addRoINode( initialTE );
-      TrigRoiDescriptor* roiDescriptor = new TrigRoiDescriptor(0, m_lvl1ID, m_roiId++,
-							       m_emRoiEta.at(em), m_emRoiEta.at(em)-0.1,m_emRoiEta.at(em)+0.1,
-							       m_emRoiPhi.at(em), m_emRoiPhi.at(em)-0.1, m_emRoiPhi.at(em)+0.1,
-							       0.,-zspread,zspread);
-      
-      std::string key;
-      m_config->getNavigation()->attachFeature( roiTE, roiDescriptor, HLT::Navigation::ObjectCreatedByNew, key, "initialRoI" );
-      
-      // build threshold TE
-      unsigned int teId;
-      TrigConf::HLTTriggerElement::getId(m_emRoiLabel.at(em).c_str(), teId);
-      m_config->getNavigation()->addNode(roiTE, teId);
-      
-      msg() << MSG::DEBUG << "created "<< m_emRoiLabel.at(em) << endmsg;
-    }
-  }
-  
-  for (size_t t=0; t<m_tauRoiPhi.size();t++){
-    if ( m_tauRoiPhi.at(t) <= M_PI && m_tauRoiPhi.at(t) >= -M_PI ) {
-      HLT::TriggerElement* roiTE = m_config->getNavigation()->addRoINode( initialTE );
-      TrigRoiDescriptor* roiDescriptor = new TrigRoiDescriptor(0, m_lvl1ID, m_roiId++,
-							       m_tauRoiEta.at(t), m_tauRoiEta.at(t)-0.4, m_tauRoiEta.at(t)+0.4,
-							       m_tauRoiPhi.at(t), m_tauRoiPhi.at(t)-0.4, m_tauRoiPhi.at(t)+0.4,
-							       0.,-zspread,zspread);
-      
-      std::string key;
-      m_config->getNavigation()->attachFeature( roiTE, roiDescriptor, HLT::Navigation::ObjectCreatedByNew, key, "initialRoI" );
-
-      // build threshold TE
-      unsigned int teId;
-      TrigConf::HLTTriggerElement::getId(m_tauRoiLabel.at(t).c_str(), teId);
-      m_config->getNavigation()->addNode(roiTE, teId);
-      msg() << MSG::DEBUG << "created" << m_tauRoiLabel.at(t) << endmsg;
-    }
-  }
-
-  for (size_t m=0; m<m_muonRoiPhi.size();m++){
-    if ( m_muonRoiPhi.at(m) <= M_PI && m_muonRoiPhi.at(m) >= -M_PI ) {
-    HLT::TriggerElement* roiTE = m_config->getNavigation()->addRoINode( initialTE );
-    TrigRoiDescriptor* roiDescriptor = new TrigRoiDescriptor(0, m_lvl1ID, m_roiId++,
-							     m_muonRoiEta.at(m),m_muonRoiEta.at(m)-0.1,m_muonRoiEta.at(m)+0.1,
-							     m_muonRoiPhi.at(m),m_muonRoiPhi.at(m)-0.1,m_muonRoiPhi.at(m)+0.1,
-							       0.,-zspread,zspread);
-
-    std::string key;
-    m_config->getNavigation()->attachFeature( roiTE, roiDescriptor, HLT::Navigation::ObjectCreatedByNew, key, "initialRoI" );
-
-    // build threshold TE
-    unsigned int teId;
-    TrigConf::HLTTriggerElement::getId(m_muonRoiLabel.at(m).c_str(), teId);
-    m_config->getNavigation()->addNode(roiTE, teId);
-    msg() << MSG::DEBUG << "created"<< m_muonRoiLabel.at(m) << endmsg;
-    }
-  }
-
-  for (size_t j=0; j<m_jetRoiPhi.size();j++){
-    if ( m_jetRoiPhi.at(j) <= M_PI && m_jetRoiPhi.at(j) >= -M_PI ) {
-      HLT::TriggerElement* roiTE = m_config->getNavigation()->addRoINode( initialTE );
-      TrigRoiDescriptor* roiDescriptor = new TrigRoiDescriptor(0, m_lvl1ID, m_roiId++,
-							       m_jetRoiEta.at(j),m_jetRoiEta.at(j)-0.4,m_jetRoiEta.at(j)+0.4,
-							       m_jetRoiPhi.at(j),m_jetRoiPhi.at(j)-0.4,m_jetRoiPhi.at(j)+0.4,
-							       0.,-zspread,zspread);
-
-
-      std::string key;
-      m_config->getNavigation()->attachFeature( roiTE, roiDescriptor, HLT::Navigation::ObjectCreatedByNew, key, "initialRoI" );
-      
-      // build threshold TE
-      unsigned int teId;
-      TrigConf::HLTTriggerElement::getId(m_jetRoiLabel.at(j).c_str(), teId);
-      m_config->getNavigation()->addNode(roiTE, teId);
-    msg() << MSG::DEBUG << "created " << m_jetRoiLabel.at(j) << endmsg;
-    }
-  }
-
-  m_lvl1ID++;
-  return HLT::OK;
-}
-
-/////////////////////////////////////////////////////////////////
-// FINALIZE METHOD:
-
-HLT::ErrorCode FakeLvl1MultipleRoIsatFixedEtaPhi::hltFinalize() 
-{ 
-  return HLT::OK; 
-}
diff --git a/Trigger/TrigFake/src/FakeLvl1MultipleRoIsatFixedEtaPhi.h b/Trigger/TrigFake/src/FakeLvl1MultipleRoIsatFixedEtaPhi.h
deleted file mode 100755
index 42b797f6226c847c93dd969a3848d4b9463d708c..0000000000000000000000000000000000000000
--- a/Trigger/TrigFake/src/FakeLvl1MultipleRoIsatFixedEtaPhi.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef FAKELVL1MULTIPLEROISATFIXEDETAPHI_H
-#define FAKELVL1MULTIPLEROISATFIXEDETAPHI_H
-
-#include <string>
-#include <vector>
-#include "TrigSteering/LvlConverter.h"
-
-#define DEFAULT_RoIBRDOLocation "/RoIB/RoIBRDOLocation"
-#define DEFAULT_CaloConfigLocation "/Run/CaloTrigConfig"
-
-class StoreGateSvc;
-class FakeRoI;
-class HepLorentzVector;
-class Hep3Vector;
-
-
-class FakeLvl1MultipleRoIsatFixedEtaPhi : public HLT::LvlConverter
-{
- public:
-
-  FakeLvl1MultipleRoIsatFixedEtaPhi(const std::string& name, const std::string& type,
-			   const IInterface* parent); //!< constructor
-  ~FakeLvl1MultipleRoIsatFixedEtaPhi();
-
-  HLT::ErrorCode hltInitialize();
-  HLT::ErrorCode hltExecute(std::vector<HLT::SteeringChain*>& activeSteeringChains);
-  HLT::ErrorCode hltFinalize();
-
- private:
-
-  unsigned int m_roiId;
-  std::vector<double> m_muonRoiPhi;
-  std::vector<double> m_muonRoiEta;
-  std::vector<std::string> m_muonRoiLabel;
-
-  std::vector<double> m_tauRoiPhi;
-  std::vector<double> m_tauRoiEta;
-  std::vector<std::string> m_tauRoiLabel;
-
-  std::vector<double> m_emRoiPhi;
-  std::vector<double> m_emRoiEta;
-  std::vector<std::string> m_emRoiLabel;
-
-  std::vector<double> m_jetRoiPhi;
-  std::vector<double> m_jetRoiEta;
-  std::vector<std::string> m_jetRoiLabel;
-
-  unsigned int m_lvl1ID; //!< Level 1 ID, in case Level 1 result is read from file
-
-
-};
-
-
-#endif
diff --git a/Trigger/TrigFake/src/FakeLvl1RoIatFixedEtaPhi.cxx b/Trigger/TrigFake/src/FakeLvl1RoIatFixedEtaPhi.cxx
deleted file mode 100644
index 164b12a3ea103697391a9545fd59af04bdff1d02..0000000000000000000000000000000000000000
--- a/Trigger/TrigFake/src/FakeLvl1RoIatFixedEtaPhi.cxx
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/********************************************************************
-
-NAME:     FakeLvl1RoIatFixedEtaPhi.cxx
-PACKAGE:
-
-AUTHORS: J. Baines        john.baines@rl.ac.uk based on TrigSteer/Lvl1Converstion by
-         G. Comune        gianluca.comune@cern.ch (http://cern.ch/gcomune)
-
-CREATED:  Nov, 2002
-
-PURPOSE:  Fake Lvl1 RoI for seeding Lvl2
-
-Modified :
-
-
-********************************************************************/
-
-#include <stdlib.h>
-#include <vector>
-#include <utility>
-// INCLUDE GAUDI HEADER FILES:
-
-# include "CLHEP/Units/SystemOfUnits.h"
-
-#include "TrigSteeringEvent/TrigRoiDescriptor.h"
-#include "FakeLvl1RoIatFixedEtaPhi.h"
-#include "FakeRoI.h"
-#include "Trajectory.h"
-
-#include "TrigInterfaces/AlgoConfig.h"
-#include "TrigSteering/SteeringChain.h"
-#include "TrigNavigation/Navigation.h"
-#include "TrigNavigation/TriggerElement.h"
-#include "TrigConfHLTData/HLTTriggerElement.h"
-
-#include "CLHEP/Vector/ThreeVector.h"
-
-#include "TrigT1Result/EMTauRoI.h"
-#include "TrigT1Result/JetEnergyResult.h"
-
-#include "TrigT1Interfaces/TrigT1Interfaces_ClassDEF.h"
-#include "TrigT1Interfaces/RecMuonRoI.h"
-#include "TrigT1Interfaces/RecMuonRoiSvc.h"
-
-
-
-
-////////////////////////////////////////////////////////////////
-//  CONSTRUCTOR:
-
-FakeLvl1RoIatFixedEtaPhi::FakeLvl1RoIatFixedEtaPhi(const std::string& name, const std::string& type,
-						   const IInterface* parent)
-  : HLT::LvlConverter(name, type, parent), 
-    m_roiId(0),
-    m_tauRoiPhi(99.),
-    m_tauRoiEta(0.),
-    m_emRoiPhi(99.),
-    m_emRoiEta(0.),
-    m_muonRoiPhi(99.),
-    m_muonRoiEta(0.),
-    m_jetRoiPhi(99.),
-    m_jetRoiEta(0.),
-    m_lvl1ID(1)
-{
-  declareProperty( "FakeEmRoiPhi", m_emRoiPhi=99.);
-  declareProperty( "FakeEmRoiEta", m_emRoiEta);
-
-  declareProperty( "FakeTauRoiPhi", m_tauRoiPhi=99.);
-  declareProperty( "FakeTauRoiEta", m_tauRoiEta);
-
-  declareProperty( "FakeMuonRoiPhi", m_muonRoiPhi=99.);
-  declareProperty( "FakeMuonRoiEta", m_muonRoiEta);
-
-  declareProperty( "FakeJetRoiPhi", m_jetRoiPhi=99.);
-  declareProperty( "FakeJetRoiEta", m_jetRoiEta);
-
-  declareProperty( "FakeEmRoiLabel",   m_emRoiLabel  ="EM01");
-  declareProperty( "FakeMuonRoiLabel", m_muonRoiLabel="MU06");
-  declareProperty( "FakeJetRoiLabel",  m_jetRoiLabel ="JT00");
-  declareProperty( "FakeTauRoiLabel",  m_tauRoiLabel ="TAU01");
-
-}
-
-// DESTRUCTOR:
-
-FakeLvl1RoIatFixedEtaPhi::~FakeLvl1RoIatFixedEtaPhi()
-{ }
-
-
-
-/////////////////////////////////////////////////////////////////
-// INITIALIZE METHOD:
-
-HLT::ErrorCode FakeLvl1RoIatFixedEtaPhi::hltInitialize()
-{
-  msg() << MSG::INFO << " FakeLvl1RoIatFixedEtaPhi creating the following RoI:  " << endmsg;
-  if ( m_emRoiPhi <= M_PI && m_emRoiPhi >= -M_PI ) {
-    msg() << MSG::INFO << " Forming fake EMROI with name " << m_emRoiLabel  << " at phi =  " <<
-      m_emRoiPhi << " eta = "  << m_emRoiEta << endmsg;
-
-  } else {
-    msg() << MSG::INFO << " Not forming fake EMROI" << endmsg;
-  }
-
-  if ( m_tauRoiPhi <= M_PI && m_tauRoiPhi >= -M_PI ) {
-    msg() << MSG::INFO << " Forming fake TAUROI with name " << m_tauRoiLabel  << " at phi =  " <<
-      m_tauRoiPhi << " eta = "  << m_tauRoiEta << endmsg;
-
-  } else {
-    msg() << MSG::INFO << " Not forming fake TAUROI" << endmsg;
-  }
-
-
-
-  if ( m_muonRoiPhi <= M_PI && m_muonRoiPhi >= -M_PI ) {
-    msg() << MSG::INFO << " Forming fake MUONROI with name " << m_muonRoiLabel  << "  at phi =  " <<
-      m_muonRoiPhi << " eta = "   << m_muonRoiEta << endmsg;
-
-  } else {
-    msg() << MSG::INFO << " Not forming fake MUONROI" << endmsg;
-  }
-
-
-  if ( m_jetRoiPhi <= M_PI && m_jetRoiPhi >= -M_PI ) {
-    msg() << MSG::INFO << " Forming fake JETROI with name " << m_jetRoiLabel  << "  at phi =  " <<
-      m_jetRoiPhi << " eta = "  <<  m_jetRoiEta << endmsg;
-
-  } else {
-    msg() << MSG::INFO << " Not forming fake JETROI" << endmsg;
-  }
-
-  msg() << MSG::INFO << name() << ": Initialization completed successfully" << endmsg;
-
-  return HLT::OK;
-}
-
-
-/////////////////////////////////////////////////////////////////
-// EXECUTE METHOD:
-
-HLT::ErrorCode FakeLvl1RoIatFixedEtaPhi::hltExecute( std::vector<HLT::SteeringChain*>& activeSteeringChains ) {
-
-
-
-
-
-  msg() << MSG::DEBUG << "Executing FakeLvl1RoIatFixedEtaPhi" << endmsg;
-
-  // activate all configured chains:
-  msg() << MSG::DEBUG << "activating all configured chains." << endmsg;
-
-  for (std::vector<HLT::SteeringChain*>::const_iterator it = m_configuredChains->begin();
-       it != m_configuredChains->end(); ++it) {
-    // set to active:
-    (*it)->setActive();
-    // set pass through state:
-    (*it)->setPassThroughState();
-    activeSteeringChains.push_back( (*it) );
-  }
-
-  HLT::TriggerElement* initialTE = m_config->getNavigation()->getInitialNode();
-  msg() << MSG::DEBUG << "initial Navigation node created." << endmsg;
-
-  // set Lvl1 ID in AlgoConfig:
-  m_config->setLvl1Id(m_lvl1ID);
-
-
-  m_roiId=0;
-  const float zspread = 168.;
-  if ( m_emRoiPhi <= M_PI && m_emRoiPhi >= -M_PI ) {
-    //    getStepSequencerPointer()->addTE(createSeed((key2keyStore*)0x00000000,m_emRoiEta, m_emRoiPhi, Frame::instance()->getId2Str(m_emRoiLabel), m_roiId++));
-
-    HLT::TriggerElement* roiTE = m_config->getNavigation()->addRoINode( initialTE );
-    TrigRoiDescriptor* roiDescriptor = new TrigRoiDescriptor(0, m_lvl1ID, m_roiId,
-							     m_emRoiEta, m_emRoiEta-0.1,m_emRoiEta+0.1,
-							     m_emRoiPhi,m_emRoiPhi-0.1,m_emRoiPhi+0.1,
-							     0., -zspread, zspread);
-
-
-    std::string key;
-    m_config->getNavigation()->attachFeature( roiTE, roiDescriptor, HLT::Navigation::ObjectCreatedByNew, key, "initialRoI" );
-
-    // build threshold TE
-    unsigned int teId;
-    TrigConf::HLTTriggerElement::getId(m_emRoiLabel.c_str(), teId);
-    m_config->getNavigation()->addNode(roiTE, teId);
-
-    msg() << MSG::DEBUG << "created "<< m_emRoiLabel << endmsg;
-  }
-
-  if ( m_tauRoiPhi <= M_PI && m_tauRoiPhi >= -M_PI ) {
-    //    getStepSequencerPointer()->addTE(createSeed((key2keyStore*)0x00000000,m_tauRoiEta, m_tauRoiPhi, Frame::instance()->getId2Str(m_tauRoiLabel), m_roiId++));
-
-    HLT::TriggerElement* roiTE = m_config->getNavigation()->addRoINode( initialTE );
-    TrigRoiDescriptor* roiDescriptor = new TrigRoiDescriptor(0, m_lvl1ID, m_roiId,
-							     m_tauRoiEta,m_tauRoiEta-0.4,m_tauRoiEta+0.4,
-							     m_tauRoiPhi,m_tauRoiPhi-0.4,m_tauRoiPhi+0.4,
-							     0., -zspread, zspread);
-
-
-    std::string key;
-    m_config->getNavigation()->attachFeature( roiTE, roiDescriptor, HLT::Navigation::ObjectCreatedByNew, key, "initialRoI" );
-
-
-    // build threshold TE
-    unsigned int teId;
-    TrigConf::HLTTriggerElement::getId(m_tauRoiLabel.c_str(), teId);
-    m_config->getNavigation()->addNode(roiTE, teId);
-    msg() << MSG::DEBUG << "created" << m_tauRoiLabel << endmsg;
-  }
-
-  if ( m_muonRoiPhi <= M_PI && m_muonRoiPhi >= -M_PI ) {
-    //    getStepSequencerPointer()->addTE(createSeed((key2keyStore*)0x00000000, m_muonRoiEta, m_muonRoiPhi, Frame::instance()->getId2Str(m_muonRoiLabel) ,m_roiId++));
-    HLT::TriggerElement* roiTE = m_config->getNavigation()->addRoINode( initialTE );
-    TrigRoiDescriptor* roiDescriptor = new TrigRoiDescriptor(0, m_lvl1ID, m_roiId,
-							     m_muonRoiEta,m_muonRoiEta-0.1,m_muonRoiEta+0.1,
-							     m_muonRoiPhi,m_muonRoiPhi-0.1,m_muonRoiPhi+0.1,
-							     0., -zspread, zspread);
-
-
-
-
-    std::string key;
-    m_config->getNavigation()->attachFeature( roiTE, roiDescriptor, HLT::Navigation::ObjectCreatedByNew, key, "initialRoI" );
-
-
-    // build threshold TE
-    unsigned int teId;
-    TrigConf::HLTTriggerElement::getId(m_muonRoiLabel.c_str(), teId);
-    m_config->getNavigation()->addNode(roiTE, teId);
-    msg() << MSG::DEBUG << "created"<< m_muonRoiLabel << endmsg;
-
-  }
-
-  if ( m_jetRoiPhi <= M_PI && m_jetRoiPhi >= -M_PI ) {
-    //    getStepSequencerPointer()->addTE(createSeed((key2keyStore*)0x00000000,m_jetRoiEta, m_jetRoiPhi, Frame::instance()->getId2Str(m_jetRoiLabel) ,m_roiId++));
-    HLT::TriggerElement* roiTE = m_config->getNavigation()->addRoINode( initialTE );
-    TrigRoiDescriptor* roiDescriptor = new TrigRoiDescriptor(0, m_lvl1ID, m_roiId,
-							     m_jetRoiEta,m_jetRoiEta-0.4,m_jetRoiEta+0.4,
-							     m_jetRoiPhi,m_jetRoiPhi-0.4,m_jetRoiPhi+0.4,   
-							     0., -zspread, zspread);
-
-    std::string key;
-    m_config->getNavigation()->attachFeature( roiTE, roiDescriptor, HLT::Navigation::ObjectCreatedByNew, key, "initialRoI" );
-
-
-    // build threshold TE
-    unsigned int teId;
-    TrigConf::HLTTriggerElement::getId(m_jetRoiLabel.c_str(), teId);
-    m_config->getNavigation()->addNode(roiTE, teId);
-    msg() << MSG::DEBUG << "created " << m_jetRoiLabel << endmsg;
-  }
-
-  m_lvl1ID++;
-  return HLT::OK;
-}
-
-/////////////////////////////////////////////////////////////////
-// FINALIZE METHOD:
-
-HLT::ErrorCode FakeLvl1RoIatFixedEtaPhi::hltFinalize() 
-{ 
-  return HLT::OK; 
-}
diff --git a/Trigger/TrigFake/src/FakeLvl1RoIatFixedEtaPhi.h b/Trigger/TrigFake/src/FakeLvl1RoIatFixedEtaPhi.h
deleted file mode 100755
index 6aa57d8a836566b7c7ff05f9719ffdc9d466499b..0000000000000000000000000000000000000000
--- a/Trigger/TrigFake/src/FakeLvl1RoIatFixedEtaPhi.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef FAKELVL1ROIATFIXEDETAPHI_H
-#define FAKELVL1ROIATFIXEDETAPHI_H
-
-#include <string>
-#include <vector>
-#include "TrigSteering/LvlConverter.h"
-
-#define DEFAULT_RoIBRDOLocation "/RoIB/RoIBRDOLocation"
-#define DEFAULT_CaloConfigLocation "/Run/CaloTrigConfig"
-
-class StoreGateSvc;
-class FakeRoI;
-class HepLorentzVector;
-class Hep3Vector;
-
-
-class FakeLvl1RoIatFixedEtaPhi : public HLT::LvlConverter
-{
- public:
-
-  FakeLvl1RoIatFixedEtaPhi(const std::string& name, const std::string& type,
-			   const IInterface* parent); //!< constructor
-  ~FakeLvl1RoIatFixedEtaPhi();
-
-  HLT::ErrorCode hltInitialize();
-  HLT::ErrorCode hltExecute(std::vector<HLT::SteeringChain*>& activeSteeringChains);
-  HLT::ErrorCode hltFinalize();
-
- private:
-
-  unsigned int m_roiId;
-
-  double m_tauRoiPhi;
-  double m_tauRoiEta;
-  double m_emRoiPhi;
-  double m_emRoiEta;
-  double m_muonRoiPhi;
-  double m_muonRoiEta;
-  double m_jetRoiPhi;
-  double m_jetRoiEta;
-
-  std::string m_emRoiLabel;
-  std::string m_muonRoiLabel;
-  std::string m_jetRoiLabel;
-  std::string m_tauRoiLabel;
-
-  unsigned int m_lvl1ID; //!< Level 1 ID, in case Level 1 result is read from file
-
-
-};
-
-
-#endif
diff --git a/Trigger/TrigFake/src/FakeLvl1RoIfromKine.cxx b/Trigger/TrigFake/src/FakeLvl1RoIfromKine.cxx
deleted file mode 100644
index ec18ce9258780bb9d623fc479348d9641efd4d29..0000000000000000000000000000000000000000
--- a/Trigger/TrigFake/src/FakeLvl1RoIfromKine.cxx
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-*/
-
-/*******************************************************************e
-
-NAME:     FakeLvl1RoIfromKine.cxx
-PACKAGE:
-
-AUTHORS: J. Baines        john.baines@rl.ac.uk based on TrigSteer/Lvl1Converstion by
-         G. Comune        gianluca.comune@cern.ch (http://cern.ch/gcomune)
-
-CREATED:  Nov, 2002
-
-PURPOSE:  Fake Lvl1 RoI for seeding Lvl2
-
-Modified :
-
-
-********************************************************************/
-
-#include <stdlib.h>
-#include <vector>
-#include <utility>
-// INCLUDE GAUDI HEADER FILES:
-#include "Gaudi/Property.h"
-#include "GaudiKernel/ISvcLocator.h"
-
-# include "CLHEP/Units/SystemOfUnits.h"
-
-#include "AtlasHepMC/GenEvent.h"
-#include "AtlasHepMC/GenParticle.h"
-#include "GeneratorObjects/McEventCollection.h"
-
-#include "TrigSteeringEvent/TrigRoiDescriptor.h"
-#include "FakeLvl1RoIfromKine.h"
-#include "FakeRoI.h"
-#include "Trajectory.h"
-
-
-#include "TrigInterfaces/AlgoConfig.h"
-#include "TrigSteering/SteeringChain.h"
-#include "TrigNavigation/Navigation.h"
-#include "TrigNavigation/TriggerElement.h"
-#include "TrigConfHLTData/HLTTriggerElement.h"
-
-#include "CLHEP/Vector/ThreeVector.h"
-
-#include "TrigT1Result/EMTauRoI.h"
-#include "TrigT1Result/JetEnergyResult.h"
-
-#include "TrigT1Interfaces/TrigT1Interfaces_ClassDEF.h"
-#include "TrigT1Interfaces/RecMuonRoI.h"
-#include "TrigT1Interfaces/RecMuonRoiSvc.h"
-
-
-
-using namespace TrigFake; // for Trajectory
-using namespace LVL1;
-
-
-////////////////////////////////////////////////////////////////
-//  CONSTRUCTOR:
-
-FakeLvl1RoIfromKine::FakeLvl1RoIfromKine(const std::string& name, const std::string& type,
-						   const IInterface* parent)
-  : HLT::LvlConverter(name, type, parent),
-    m_roiId(0),
-    m_mcEventCollectionName("")
-{
-
-  declareProperty("McEventCollectionName", m_mcEventCollectionName="GEN_EVENT");
-
-  declareProperty( "FakeEmTauRoiParticleIDs", m_emTauRoiParticles);
-  declareProperty( "FakeEmTauRoiPtMin", m_emTauRoiPtMin=20.*CLHEP::GeV);
-  declareProperty( "FakeEmTauRoiEtaMax", m_emTauRoiEtaMax=2.5);
-
-  declareProperty( "FakeMuonRoiParticleIDs",  m_muonRoiParticles);
-  declareProperty( "FakeMuonRoiPtMin",  m_muonRoiPtMin=20.*CLHEP::GeV);
-  declareProperty( "FakeMuonRoiEtaMax",  m_muonRoiEtaMax=2.5);
-
-  declareProperty( "FakeJetRoiParticleIDs",   m_jetRoiParticles);
-  declareProperty( "FakeJetRoiPtMin",   m_jetRoiPtMin=20.*CLHEP::GeV);
-  declareProperty( "FakeJetRoiEtaMax",   m_jetRoiEtaMax=2.5);
-
-  declareProperty( "FakeEmRoiLabel",   m_emRoiLabel  ="EM10");
-  declareProperty( "FakeMuonRoiLabel", m_muonRoiLabel="MU06");
-  declareProperty( "FakeJetRoiLabel",  m_jetRoiLabel ="JET20");
-  declareProperty( "FakeTauRoiLabel",  m_tauRoiLabel ="HA10");
-
-}
-
-// DESTRUCTOR:
-
-FakeLvl1RoIfromKine::~FakeLvl1RoIfromKine()
-{ }
-
-/////////////////////////////////////////////////////////////////
-// INITIALIZE METHOD:
-
-HLT::ErrorCode FakeLvl1RoIfromKine::hltInitialize()
-{
-  //  if ( m_particleDataTable.empty() ) {
-  //(*m_log) << MSG::WARNING << "FakeLvl1RoIfromKine failed to read particleDataTable" << endmsg;
-  //return StatusCode::FAILURE;
-  // }
-
-  if (! m_emTauRoiParticles.empty()) {
-    std::vector<int>::iterator emParticle=m_emTauRoiParticles.begin();
-    std::vector<int>::iterator lastEmParticle=m_emTauRoiParticles.end();
-    msg(MSG::INFO) << " Forming fake EMROI (" << m_emRoiLabel << ") from the following kine particle IDs : ";
-    for ( ; emParticle != lastEmParticle ; emParticle++ ) {
-      msg() << *emParticle << " " ;
-    }
-    msg() << endmsg;
-    ATH_MSG_INFO(" with ET > " << m_emTauRoiPtMin <<
-                 " and |eta| < " << m_emTauRoiEtaMax);
-  } else {
-    ATH_MSG_INFO(" Not forming fake EMROI (" << m_emRoiLabel << ")");
-  }
-
-  if ( ! m_muonRoiParticles.empty()) {
-    std::vector<int>::iterator muParticle=m_muonRoiParticles.begin();
-    std::vector<int>::iterator lastMuParticle=m_muonRoiParticles.end();
-    msg(MSG::INFO) << " Forming fake MUONROI (" << m_muonRoiLabel << ") from the following kine particle IDs : ";
-    for ( ; muParticle != lastMuParticle ; muParticle++ ) {
-      msg() << *muParticle << " " ;
-    }
-    msg() << endmsg;
-    ATH_MSG_INFO(" with pT > " << m_muonRoiPtMin <<
-                 " and |eta| < " << m_muonRoiEtaMax);
-  } else {
-    ATH_MSG_INFO(" Not forming fake MUONROI (" << m_muonRoiLabel << ")");
-  }
-
-
-  if ( ! m_jetRoiParticles.empty()) {
-    std::vector<int>::iterator muParticle=m_jetRoiParticles.begin();
-    std::vector<int>::iterator lastMuParticle=m_jetRoiParticles.end();
-    msg(MSG::INFO) << " Forming fake JETROI (" <<  m_jetRoiLabel << ") from the following kine particle IDs : ";
-    for ( ; muParticle != lastMuParticle ; muParticle++ ) {
-      msg() << *muParticle << " " ;
-    }
-    msg() << endmsg;
-    ATH_MSG_INFO(" with pT > " << m_jetRoiPtMin<<
-                 " and |eta| < " << m_jetRoiEtaMax);
-  } else {
-    ATH_MSG_INFO(" Not forming fake JETROI (" <<  m_jetRoiLabel << ")");
-  }
-
-  return HLT::OK;
-}
-
-/////////////////////////////////////////////////////////////////
-// FINALIZE METHOD:
-
-HLT::ErrorCode FakeLvl1RoIfromKine::hltFinalize()
-{
-  return HLT::OK;
-}
-
-/////////////////////////////////////////////////////////////////
-// EXECUTE METHOD:
-
-HLT::ErrorCode FakeLvl1RoIfromKine::hltExecute( std::vector<HLT::SteeringChain*>& activeSteeringChains )
-{
-  ATH_MSG_DEBUG("Executing FakeLvl1RoIfromKine");
-
-  // activate all configured chains:
-  ATH_MSG_DEBUG("activating all configured chains.");
-
-  for (std::vector<HLT::SteeringChain*>::const_iterator it = m_configuredChains->begin();
-       it != m_configuredChains->end(); ++it) {
-    // set to active:
-    (*it)->setActive();
-    // set pass through state:
-    (*it)->setPassThroughState();
-    activeSteeringChains.push_back( (*it) );
-  }
-
-
-  //  HLT::TriggerElement* initialTE = m_config->getNavigation()->getInitialNode();
-  //  (*m_log) << MSG::DEBUG << "initial Navigation node created." << endmsg;
-
-  m_roiId=0;
-  std::vector<FakeRoI> *roiList;
-  roiList = createRoIfromMC();
-
-
-  int nCreatedRoI=0;
-  std::vector< FakeRoI>::iterator firstroi =  roiList->begin();
-  std::vector< FakeRoI>::iterator lastRoi =   roiList->end();
-  for ( std::vector< FakeRoI>::iterator iroi = firstroi; iroi != lastRoi; iroi++) {
-
-    // skip duplicate roi
-    bool doneAlready = false;
-    std::vector< FakeRoI>::iterator jroi = firstroi;
-    for (; jroi != iroi; jroi++ ) {
-      if ( iroi->type() == jroi->type()){
-	double deta = fabs (jroi->eta() - iroi->eta());
-	double dphi = (jroi->phi() - iroi->phi());
-	double absdphi = fabs(dphi);
-	if (2.*M_PI-absdphi < absdphi) {
-	  if (dphi > 0) { dphi = dphi - 2.*M_PI;} else { dphi = 2*M_PI - absdphi;}
-	}
-        if ((fabs(deta) < 0.1) && (fabs (dphi) < 0.1)) doneAlready=true;
-      }
-    }
-    if (not doneAlready) {
-      if ( (this)->createRoI(*iroi).isSuccess()) nCreatedRoI++;
-    }
-  }
-
-  if ( nCreatedRoI == 0) {
-    ATH_MSG_DEBUG("FakeLvl1RoIfromKine did not create any RoI");
-} else {
-    ATH_MSG_DEBUG("FakeLvl1RoIfromKine created " << nCreatedRoI << " RoI");
-  }
-
-  delete roiList;
-
-  return HLT::OK;
-}
-
-StatusCode FakeLvl1RoIfromKine::createRoI(FakeRoI &fakeRoi) {
-
-
-
-  HLT::TriggerElement* roiTE = m_config->getNavigation()->addRoINode( m_config->getNavigation()->getInitialNode() );
-  const float zspread = 168.;
-  
-  TrigRoiDescriptor* roiDescriptor = new TrigRoiDescriptor(0, 0, m_roiId,
-							   fakeRoi.eta(),fakeRoi.eta()-0.1,fakeRoi.eta()+0.1,
-							   fakeRoi.phi(),fakeRoi.phi()-0.1,fakeRoi.phi()+0.1,
-							   0.-zspread, zspread);
-  std::string key;
-  m_config->getNavigation()->attachFeature( roiTE, roiDescriptor, HLT::Navigation::ObjectCreatedByNew, key, "initialRoI" );
-
-  // build threshold TE
-  unsigned int teId;
-  TrigConf::HLTTriggerElement::getId(fakeRoi.type().c_str(), teId);
-  m_config->getNavigation()->addNode(roiTE, teId);
-
-  m_roiId++;
-
-  /*
-    if(fakeRoi.type() == m_emRoiLabel) getStepSequencerPointer()->addTE(createSeed((key2keyStore*)0x00000000,fakeRoi.eta(), fakeRoi.phi(), Frame::instance()->getId2Str(m_emRoiLabel), m_roiId++));
-    if(fakeRoi.type() == m_muonRoiLabel) getStepSequencerPointer()->addTE(createSeed((key2keyStore*)0x00000000,fakeRoi.eta(), fakeRoi.phi(), Frame::instance()->getId2Str(m_muonRoiLabel) ,m_roiId++));
-    if(fakeRoi.type() == m_jetRoiLabel) getStepSequencerPointer()->addTE(createSeed((key2keyStore*)0x00000000,fakeRoi.eta(), fakeRoi.phi(), Frame::instance()->getId2Str(m_jetRoiLabel) ,m_roiId++));
-    if(fakeRoi.type() == m_tauRoiLabel) getStepSequencerPointer()->addTE(createSeed((key2keyStore*)0x00000000,fakeRoi.eta(), fakeRoi.phi(), Frame::instance()->getId2Str(m_tauRoiLabel) ,m_roiId++));
-  */
-
-
-  ATH_MSG_DEBUG(" REGTEST created an " <<  fakeRoi.type() << " RoI " << *roiDescriptor);
-
-
-  return StatusCode::SUCCESS;
-}
-
-std::vector<FakeRoI> * FakeLvl1RoIfromKine::createRoIfromMC() {
-
-  std::vector<FakeRoI> *fakeRoiList = new std::vector<FakeRoI>;
-
-  //  Get the collection generator events (physics and pile-up) making up this event
-
-  const McEventCollection* mcEvents;
-  StatusCode sc = evtStore()->retrieve( mcEvents, m_mcEventCollectionName );
-  if( sc.isFailure() ) {
-    ATH_MSG_INFO("Could not retrieve mcEventCollection with key " << m_mcEventCollectionName);
-    return fakeRoiList;
-  };
-
-  // Loop over the generator events
-  McEventCollection::const_iterator  evt = mcEvents->begin();
-  //McEventCollection::const_iterator  lastevt = mcEvents->end();
-
-  // for ( ; evt != lastevt; evt++) {
-  double qq = 0;
-
-  // loop over Particles in this generator event
-  for ( HepMC::GenEvent::particle_const_iterator p = (*evt)->particles_begin();
-	p != (*evt)->particles_end(); ++p ) {
-
-    int pdgid= (*p)->pdg_id();
-
-    std::vector<int>::iterator emParticle=m_emTauRoiParticles.begin();
-    std::vector<int>::iterator lastEmParticle=m_emTauRoiParticles.end();
-    bool formEmTauRoi=false;
-    for ( ; emParticle != lastEmParticle ; emParticle++ ) {
-      if (pdgid == *emParticle && (*p)->momentum().perp() > m_emTauRoiPtMin &&
-	 (*p)->momentum().pseudoRapidity() < m_emTauRoiEtaMax ) formEmTauRoi=true;
-    }
-    if ( formEmTauRoi ) {
-      // temp fix:
-      if (pdgid == 22) {
-	qq = 0.;
-      } else if (pdgid > 0) { qq = -1; } else { qq = 1; };
-      Trajectory track((*p)->momentum().px(), (*p)->momentum().py(), (*p)->momentum().pz(),
-		       (*p)->production_vertex()->position().x(),
-		       (*p)->production_vertex()->position().y(),
-		       (*p)->production_vertex()->position().z(), qq);
-
-      ATH_MSG_VERBOSE(" Forming EMROI (" << m_emRoiLabel << ") from kine ID " << pdgid << " charge " << qq);
-      ATH_MSG_VERBOSE(" Address " << std::hex << (*p) << std::dec);
-      ATH_MSG_VERBOSE(" px " << (*p)->momentum().px() <<
-                      " py " <<  (*p)->momentum().py() << " pz " << (*p)->momentum().pz());
-      ATH_MSG_VERBOSE(" vx " << (*p)->production_vertex()->position().x() <<
-                      " vy " <<  (*p)->production_vertex()->position().y() <<
-                      " vz " << (*p)->production_vertex()->position().z());
-      ATH_MSG_VERBOSE(" pt " << (*p)->momentum().perp() <<
-                      " phi " << (*p)->momentum().phi() << " eta " << track.eta());
-      ATH_MSG_VERBOSE(" Closest approach to origin : d0 " << track.d0() <<
-                      " phi0 " << track.phi0() << " z0 " << track.z0());
-#define RCAL 147.
-#define ZCAL 380.
-      std::pair<double, double> etaPhi = track.etaPhiAtCylinder(RCAL, ZCAL);
-
-      ATH_MSG_VERBOSE(" At calorimeter : phi " << etaPhi.second <<
-	" eta " << etaPhi.first);
-      FakeRoI fakeRoi(m_emRoiLabel, etaPhi.second, etaPhi.first);
-      fakeRoiList->push_back(fakeRoi);
-    }
-
-    // MUONROI
-
-    std::vector<int>::iterator muParticle=m_muonRoiParticles.begin();
-    std::vector<int>::iterator lastMuParticle=m_muonRoiParticles.end();
-    bool formMuonRoi=false;
-    for ( ; muParticle != lastMuParticle ; muParticle++ ) {
-      if (pdgid == *muParticle && (*p)->momentum().perp() > m_muonRoiPtMin &&
-	 (*p)->momentum().pseudoRapidity() < m_muonRoiEtaMax) formMuonRoi=true;
-    }
-    if ( formMuonRoi ) {
-
-      ATH_MSG_VERBOSE(" Forming MUONROI (" << m_muonRoiLabel << ") from kine ID " << pdgid <<
-                      " pt " << (*p)->momentum().perp() <<
-                      " phi " << (*p)->momentum().phi() <<
-                      " eta " << (*p)->momentum().pseudoRapidity());
-
-
-      Trajectory track((*p)->momentum().px(), (*p)->momentum().py(), (*p)->momentum().pz(),
-		       (*p)->production_vertex()->position().x(),
-		       (*p)->production_vertex()->position().y(),
-		       (*p)->production_vertex()->position().z(), qq);
-
-#define RCAL 147.
-#define ZCAL 380.
-      std::pair<double, double> etaPhi = track.etaPhiAtCylinder(RCAL, ZCAL);
-
-      ATH_MSG_VERBOSE(" At ID outer radius : phi " << etaPhi.second <<
-                      " eta " << etaPhi.first);
-      FakeRoI fakeRoi(m_muonRoiLabel, etaPhi.second, etaPhi.first);
-      fakeRoiList->push_back(fakeRoi);
-
-    }
-
-    // JETROI
-
-    std::vector<int>::iterator jetParticle=m_jetRoiParticles.begin();
-    std::vector<int>::iterator lastJetParticle=m_jetRoiParticles.end();
-    bool formJetRoi=false;
-    for ( ; jetParticle != lastJetParticle ; jetParticle++ ) {
-      if (pdgid == *jetParticle && (*p)->momentum().perp() > m_jetRoiPtMin &&
-	 (*p)->momentum().pseudoRapidity() < m_jetRoiEtaMax) formJetRoi=true;
-    }
-    if ( formJetRoi ) {
-
-      ATH_MSG_VERBOSE(" Forming JETROI (" <<  m_jetRoiLabel << ") from kine ID " << pdgid <<
-                      " pt " << (*p)->momentum().perp() <<
-                      " phi " << (*p)->momentum().phi() <<
-                      " eta " << (*p)->momentum().pseudoRapidity());
-      FakeRoI fakeRoi(m_jetRoiLabel,(*p)->momentum().phi() ,(*p)->momentum().pseudoRapidity());
-      fakeRoiList->push_back(fakeRoi);
-    }
-
-  }
-  //}
-  return fakeRoiList;
-}
diff --git a/Trigger/TrigFake/src/FakeLvl1RoIfromKine.h b/Trigger/TrigFake/src/FakeLvl1RoIfromKine.h
deleted file mode 100755
index 230eee2a38e9fb862543c3d5d20ac2b12aa5533e..0000000000000000000000000000000000000000
--- a/Trigger/TrigFake/src/FakeLvl1RoIfromKine.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef FAKELVL1ROIFROMKINE_H
-#define FAKELVL1ROIFROMKINE_H
-
-#include <string>
-#include <vector>
-#include "TrigSteering/LvlConverter.h"
-
-#define DEFAULT_RoIBRDOLocation "/RoIB/RoIBRDOLocation"
-#define DEFAULT_CaloConfigLocation "/Run/CaloTrigConfig"
-
-class StoreGateSvc;
-class FakeRoI;
-class HepLorentzVector;
-class Hep3Vector;
-
-class FakeLvl1RoIfromKine : public HLT::LvlConverter {
- public:
-  FakeLvl1RoIfromKine(const std::string& name, const std::string& type,
-		      const IInterface* parent); //!< constructor
-  ~FakeLvl1RoIfromKine();
-
-  HLT::ErrorCode hltInitialize();
-  HLT::ErrorCode hltExecute(std::vector<HLT::SteeringChain*>& activeSteeringChains);
-  HLT::ErrorCode hltFinalize();
-
- private:
-
-  std::vector<FakeRoI> * createRoIfromMC();
-  StatusCode createRoI(FakeRoI &roi);
-
- private:
-
-  unsigned int m_roiId;
-
-  std::string m_mcEventCollectionName;
-  double m_emTauRoiPtMin;
-  double m_emTauRoiEtaMax;
-  double m_muonRoiPtMin;
-  double m_muonRoiEtaMax;
-  double m_jetRoiPtMin;
-  double m_jetRoiEtaMax;
-  std::vector<int> m_emTauRoiParticles;
-  std::vector<int> m_muonRoiParticles;
-  std::vector<int> m_jetRoiParticles;
-
-  std::string m_emRoiLabel;
-  std::string m_muonRoiLabel;
-  std::string m_jetRoiLabel;
-  std::string m_tauRoiLabel;
-
-};
-
-#endif
diff --git a/Trigger/TrigFake/src/FakeRoI.h b/Trigger/TrigFake/src/FakeRoI.h
deleted file mode 100755
index 22345cd2c6fb8bf2a37082f57aea4bb18857aaef..0000000000000000000000000000000000000000
--- a/Trigger/TrigFake/src/FakeRoI.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef FAKEROI_H
-#define FAKEROI_H
-#include <string> 
-
-class FakeRoI {
- public:
-
-  FakeRoI(std::string type, double phi, double eta) : 
-    m_type(type), m_phi(phi), m_eta(eta) {};
-
-  ~FakeRoI() {};
-  
- public:
-  std::string type () const { return m_type; } ;
-  double phi () const { return m_phi ; } ;
-  double eta () const { return m_eta ; } ;
-  
- private:
-  std::string m_type;
-  double m_phi;
-  double m_eta;
-};
-#endif
diff --git a/Trigger/TrigFake/src/Trajectory.cxx b/Trigger/TrigFake/src/Trajectory.cxx
deleted file mode 100644
index 44113db61aec510ae4655f14dd25034b8ae86b2c..0000000000000000000000000000000000000000
--- a/Trigger/TrigFake/src/Trajectory.cxx
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include<cmath>
-#include "Trajectory.h"
-
-namespace TrigFake{
-Trajectory::Trajectory(double px_MeV, double py_MeV, double pz_MeV, 
-		       double vx_mm, double vy_mm, double vz_mm, double q) {
-
-  double px = px_MeV/1000; // GeV
-  double py = py_MeV/1000; // GeV
-  double pz = pz_MeV/1000; // GeV
-		       
-  double vx = vx_mm/10; // cm
-  double vy = vy_mm/10; // cm
-  double vz = vz_mm/10; // cm
-
-  m_q = q;
-  m_pz = pz; 
-
-  m_pT = sqrt( px*px + py*py ); 
-  m_theta = atan2(m_pT,m_pz);
-  
-  double pzpt=m_pz/m_pT;
-
-  m_eta=log(pzpt+sqrt(1.0+pzpt*pzpt));
-
-  double Rv  = sqrt( vx*vx + vy*vy ); 
-
-  // calculate parameters at closest approach to origin
-  
-#define Bfield 2.
-  m_Rcurv = 100. * m_pT/(0.3*Bfield);  // cm; 
-  
-  if (m_q != 0) {
-    double phiR = atan2(py,px) - m_q*M_PI_2;
-    double Ox = vx + m_Rcurv * cos(phiR);
-    double Oy = vy + m_Rcurv * sin(phiR);
-    double Ro = sqrt(Ox*Ox + Oy*Oy);
-    double d01 = Ro + m_Rcurv;
-    double d02 = Ro - m_Rcurv;
-    if (d01*d02 > 0) {
-      m_d0 = std::min(fabs(d01), fabs(d02));
-    } else {
-      m_d0 = -std::min(fabs(d01), fabs(d02));
-    }
-    m_phi0 = atan2(Oy,Ox) + m_q*M_PI_2;
-    m_z0 = vz - m_pz * (Rv - fabs(m_d0)) / m_pT;
-  } else {
-    m_phi0 = atan2(py,px);
-    m_d0 = fabs(vx * sin(m_phi0) - vy * cos(m_phi0));
-    m_z0 = vz - m_pz * (Rv - m_d0) / m_pT;
-  }
-
-  while (m_phi0 < -M_PI) m_phi0 = m_phi0 + 2.*M_PI;
-  while (m_phi0 > M_PI) m_phi0 = m_phi0 - 2.*M_PI;
-
-}
-
-
-/* ---------------------------------------------------------------------- */
-std::pair<double,double> Trajectory::etaPhiAtCylinder(double rC_mm, double zC_mm) const {
-    
-  double rC = rC_mm/10.; //cm
-  double zC = zC_mm/10.; //cm 
-
-  // Calculate intercept with cylinder
-  
-  double phiC = 0;
-  // double etaC = 0; // etaC is not being used -> compiler warnings
-  if (rC > 0  && fabs(zC) > 0 && m_pT != 0 && fabs(m_z0) < zC) {
-
-    /* r, z of intersection with cylinder */
-    
-    double r;
-    double z = m_z0 + m_pz * (rC - fabs(m_d0)) / m_pT;
-    if (fabs(z) > fabs(zC)) {
-      /* track passes through the end of the cylinder */
-      if (z > 0) z = fabs(zC); else z = -fabs(zC); 
-      r = fabs(m_d0) + (z - m_z0) * m_pT / m_pz;
-      r = fabs(r);   /* NOT SURE IF -ve r is handled correctly */
-    } else r = rC;      /* hits barrel of cylinder */
-    
-    /* etaC is not being used -> compiler warnings
-       double theta = atan2(r, fabs(z)) / 2.;
-
-       if (z > 0) etaC = -log(tan(theta));
-       else etaC = log(tan(theta));
-    */
-
-    /* Now calculate phiC */
-
-    if (m_q == 0) {                /* Neutral Track */
-      if (fabs(m_d0) <= r) phiC = m_phi0 - asin(fabs(m_d0)/r);
-    } else {                      /* Charged track */
-      double xD = 2. * r*(m_Rcurv + m_d0);
-      if (xD != 0) {
-	double xN = m_d0 * m_d0 + r * r + 2. * m_Rcurv * m_d0;
-	if (fabs(xN)/fabs(xD) > 1) {
-	  /* trajectory does not reach r, track loops
-	  ***temporary set dphi to 0 for this case */
-	  phiC = 2. * M_PI;
-	} else {
-	  double dphi = m_q*acos(xN/xD);
-	  /* two solutions from the 2 intersections of the 2 circles,
-	     but phi0 defines a direction, so the first solution
-	     should be the one we want....*/
-	  phiC = m_phi0 - m_q*M_PI_2 + dphi;
-	}
-      }   else phiC = 0; /* means track is orbiting the origin */
-      
-    }
-    /* fold back into 0-2pi */
-    while (phiC > M_PI) phiC = phiC - 2. * M_PI;
-    while (phiC < -M_PI) phiC = phiC + 2. * M_PI;
-  }
-
-  std::pair<double, double> etaPhi(m_eta, phiC);
-  return etaPhi;
-}
-
-}
diff --git a/Trigger/TrigFake/src/Trajectory.h b/Trigger/TrigFake/src/Trajectory.h
deleted file mode 100755
index ccff309d50212056ac1db670da43932f72c94a63..0000000000000000000000000000000000000000
--- a/Trigger/TrigFake/src/Trajectory.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef TRAJECTORY_H
-#define TRAJECTORY_H
-#include <string> 
-#include <utility>
-
-namespace TrigFake{
-
-class Trajectory {
- public:
-  Trajectory(double px, double py, double pz, double vx, double vy, double vz, double q);
-  ~Trajectory(){};
-
- public:
-  
-  double d0() const { return m_d0; };
-  double phi0() const { return m_phi0; };
-  double z0() const { return m_z0; };
-  double Rcurv() const { return m_Rcurv; };
-  double eta() const { return m_eta; };
-  double theta() const { return m_theta; };
-  double pz() const { return m_pz; };
-  double pT() const { return m_pT; };
-
-  std::pair<double,double> etaPhiAtCylinder(double rC, double zC) const ;
-  
-
- private:
-  
-  double m_d0; 
-  double m_phi0;
-  double m_Rcurv;
-  double m_z0;
-  double m_q;
-  double m_eta;
-  double m_theta;
-  double m_pz;
-  double m_pT;
-
-
-};
-}
-#endif
diff --git a/Trigger/TrigFake/src/ZVertexFromKine.cxx b/Trigger/TrigFake/src/ZVertexFromKine.cxx
deleted file mode 100644
index 9b0f9d3b6e1c6e1a58579fb14cb800e45ffcec64..0000000000000000000000000000000000000000
--- a/Trigger/TrigFake/src/ZVertexFromKine.cxx
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/********************************************************************                               
-                               
-NAME:     ZVertexFromKine.cxx                               
-PACKAGE:                                 
-                               
-AUTHOR:   Nikos Konstantinidis
-         
-CREATED:  May 2005                               
-                               
-PURPOSE:  Make z of first MC particle available to algorithms
-                               
-Modified :
-         
-                               
-********************************************************************/                               
-
-#include "AtlasHepMC/GenEvent.h"
-#include "AtlasHepMC/GenParticle.h"
-#include "GeneratorObjects/McEventCollection.h"
-
-#include "TrigInDetEvent/TrigVertexCollection.h"
-#include "TrigInDetEvent/TrigVertex.h"
-
-#include "ZVertexFromKine.h"                               
-
-
-
-      
-////////////////////////////////////////////////////////////////                               
-//  CONSTRUCTOR:                               
-                                   
-ZVertexFromKine::ZVertexFromKine(const std::string& name, ISvcLocator* pSvcLocator):                                
-  AthAlgorithm(name, pSvcLocator)
-{
-
-  declareProperty("McEventCollectionName", m_mcEventCollectionName="GEN_EVENT");
-
-}                               
-                               
-// DESTRUCTOR:                               
-                                  
-ZVertexFromKine::~ZVertexFromKine()                               
-{ }                               
-                               
-/////////////////////////////////////////////////////////////////                               
-// INITIALIZE METHOD:                               
-                                      
-StatusCode ZVertexFromKine::initialize()                               
-{                               
-  return StatusCode::SUCCESS;                               
-}                               
-                               
-/////////////////////////////////////////////////////////////////                               
-// FINALIZE METHOD:                               
-                                 
-StatusCode ZVertexFromKine::finalize() { return StatusCode::SUCCESS; }                               
-                               
-/////////////////////////////////////////////////////////////////                               
-// EXECUTE METHOD:                               
-                                 
-StatusCode ZVertexFromKine::execute()                               
-{                                
-                               
-   ATH_MSG_DEBUG("Executing ZVertexFromKine");
-
-  //  Get the collection generator events (physics and pile-up) making up this event 
-  
-  const McEventCollection* mcEvents;
-  StatusCode sc = evtStore()->retrieve( mcEvents, m_mcEventCollectionName );
-  if( sc.isFailure() ) {
-     ATH_MSG_INFO( "Could not retrieve mcEventCollection with key " << m_mcEventCollectionName); 
-     return StatusCode::SUCCESS; 
-  };
-
-  McEventCollection::const_iterator  event = mcEvents->begin();
-  HepMC::GenVertex* vertex = *((*event)->vertices_begin());
-
-  TrigVertexCollection* zinfo = new TrigVertexCollection();
-  TrigVertex* zvert = new TrigVertex( vertex->position().z() );
-  zinfo->push_back(zvert);
-
-  if( evtStore()->record( zinfo, "TrueTrigVertexColl" ) ) {
-     ATH_MSG_DEBUG("Stored TrueTrigVertexColl");
-  }
-  else {
-     ATH_MSG_WARNING("Failed to Store TrueTrigVertexColl");
-  }
-
-  return StatusCode::SUCCESS;
-}
-
diff --git a/Trigger/TrigFake/src/ZVertexFromKine.h b/Trigger/TrigFake/src/ZVertexFromKine.h
deleted file mode 100755
index 16caa84c5f48bd494ccc35060c8e406fbbff0916..0000000000000000000000000000000000000000
--- a/Trigger/TrigFake/src/ZVertexFromKine.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef ZVERTEXFROMKINE_H
-#define ZVERTEXFROMKINE_H
-
-#include <string>
-
-#include "AthenaBaseComps/AthAlgorithm.h"
-
-class ZVertexFromKine : public AthAlgorithm 
-{
-public:
-  
-   ZVertexFromKine(const std::string& name, ISvcLocator* pSvcLocator);
-   ~ZVertexFromKine();
-  
-   StatusCode initialize();
-   StatusCode execute();
-   StatusCode finalize();
-
-private:
-
-   std::string m_mcEventCollectionName;
-};
-
-
-#endif
diff --git a/Trigger/TrigFake/src/components/TrigFake_entries.cxx b/Trigger/TrigFake/src/components/TrigFake_entries.cxx
deleted file mode 100644
index 78d495b978e998191ded7e3a0ef949e21539dc19..0000000000000000000000000000000000000000
--- a/Trigger/TrigFake/src/components/TrigFake_entries.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "../FakeLvl1RoIatFixedEtaPhi.h"
-#include "../FakeLvl1MultipleRoIsatFixedEtaPhi.h"
-//#include "TrigFake/FakeLvl1ConversionTestBeam.h"
-#include "../FakeLvl1RoIfromKine.h"
-#include "../ZVertexFromKine.h"
-
-
-DECLARE_COMPONENT( FakeLvl1RoIfromKine )
-  //DECLARE_COMPONENT( FakeLvl1ConversionTestBeam )
-DECLARE_COMPONENT( FakeLvl1RoIatFixedEtaPhi )
-DECLARE_COMPONENT( FakeLvl1MultipleRoIsatFixedEtaPhi )
-DECLARE_COMPONENT( ZVertexFromKine )
-
diff --git a/Trigger/TrigMonitoring/TrigCaloMonitoring/src/HLTCaloFEBTool.cxx b/Trigger/TrigMonitoring/TrigCaloMonitoring/src/HLTCaloFEBTool.cxx
index da0752ae2fd2093dfc845227c7bb87f4924215d4..149e560d00ad9f0b854eba2dbe814079406c0ca1 100644
--- a/Trigger/TrigMonitoring/TrigCaloMonitoring/src/HLTCaloFEBTool.cxx
+++ b/Trigger/TrigMonitoring/TrigCaloMonitoring/src/HLTCaloFEBTool.cxx
@@ -42,7 +42,6 @@ HLTCaloFEBTool::HLTCaloFEBTool(const std::string & type, const std::string & nam
         declareProperty ("sigma", m_nsigma);
         declareProperty ("useLoadFullCollection", m_useloadfullcoll);
         declareProperty ("DiffLimit", m_difflimit);
-        declareProperty ("TCRTools", m_tcrAlgTools);
 	// Nothing for the moment
 	return;
 }
diff --git a/Trigger/TrigMonitoring/TrigCostMonitor/share/readTrigCost.py b/Trigger/TrigMonitoring/TrigCostMonitor/share/readTrigCost.py
deleted file mode 100644
index ceff0d601a144c8a1f85eafd50f3b27bceb5c891..0000000000000000000000000000000000000000
--- a/Trigger/TrigMonitoring/TrigCostMonitor/share/readTrigCost.py
+++ /dev/null
@@ -1,119 +0,0 @@
-
-#----------------------------------------------------------------------
-# Global and trigger flags
-#
-
-if (not 'costD3PD_doL2' in dir()):
-  costD3PD_doL2 = False
-
-if (not 'costD3PD_doEF' in dir()):
-  costD3PD_doEF = False
-
-if (not 'costD3PD_doHLT' in dir()):
-  costD3PD_doHLT = True
-
-if (not 'costOutput' in dir()):
-  costOutput = "COST RATE EB"
-
-#BSRDOInput=['data_test.00212967.Single_Stream.daq.RAW._lb0291._Athena._0101.data']
-
-if not ('BSRDOInput' in dir()):
-    print 'ERROR! Please supply a BSRDOInput to run over'
-    sys.exit(1)
-
-if not ('EvtMax' in dir()):
-    EvtMax=-1
-from AthenaCommon.AppMgr import theApp
-theApp.EvtMax = EvtMax
-
-if ('setEvent' in dir()) and type(setEvent) == int:
-    from AthenaCommon.AppMgr import theApp
-    theApp.setEvent = setEvent
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-#athenaCommonFlags.isOnline = True
-athenaCommonFlags.BSRDOInput=BSRDOInput
-
-
-from RecExConfig.RecFlags import rec
-rec.readRDO = False
-rec.AutoConfiguration=['everything']
-
-from AthenaCommon.AlgSequence import AlgSequence
-topSeq = AlgSequence()
-
-#----------------------------------------------------------------------
-# Set services for reading BS files
-#
-include("ByteStreamCnvSvc/BSEventStorageEventSelector_jobOptions.py")
-
-svcMgr.ByteStreamCnvSvc.InitCnvs += [ "EventInfo",
-                                      "HLT::HLTResult"]
-
-svcMgr.ByteStreamAddressProviderSvc.TypeNames += [ "HLT::HLTResult/HLTResult_L2",
-                                                   "HLT::HLTResult/HLTResult_EF",
-                                                   "HLT::HLTResult/HLTResult_HLT"]
-
-
-#----------------------------------------------------------------------
-# Set input files
-#
-if ('BSRDOInput' in dir()):
-    svcMgr.EventSelector.Input = BSRDOInput
-
-if len(svcMgr.EventSelector.Input) == 0:
-    print 'ERROR! svcMgr.EventSelector.Input is empty'
-    sys.exit(1)
-
-#----------------------------------------------------------------------
-# Setup cost algorithm
-#
-from TrigCostMonitor.TrigCostMonitorConfig import prepareCostRun, setupCostDebug
-
-costRunString = " "
-if ('costD3PD_doL2' in dir() and bool(costD3PD_doL2) == True): costRunString += "l2 "
-if ('costD3PD_doEF' in dir() and bool(costD3PD_doEF) == True): costRunString += "ef "
-if ('costD3PD_doHLT' in dir() and bool(costD3PD_doHLT) == True): costRunString += "hlt "
-
-print "Setting up TrigCostRun algorithm: Running over levels - " + costRunString
-runAlg = prepareCostRun('TrigCostRun', costRunString)
-
-#setDebug = 1
-
-if ('enableCostDebug' in dir() and bool(enableCostDebug) == True):
-    print 'Setting TrigCostRun to DEBUG output level'
-    setupCostDebug()
-    runAlg.OutputLevel = DEBUG
-    runAlg.navigation.OutputLevel = DEBUG
-    for tool in runAlg.tools:
-        tool.OutputLevel = DEBUG
-    print runAlg
-
-topSeq += runAlg
-
-from AthenaCommon.Include import include
-if ("COST" in costOutput):
-  include("TrigCostD3PDMaker/TrigCostD3PDMaker_prodJobOFragment.py")
-
-if ("RATE" in costOutput):
-  include("TrigCostD3PDMaker/TrigRateD3PDMaker_prodJobOFragment.py")
-
-if ("EB" in costOutput):
-  include("TrigCostD3PDMaker/TrigEBWeightD3PDMaker_prodJobOFragment.py")
-
-#----------------------------------------------------------------------
-# Message service and loop manager options
-#
-ServiceMgr.MessageSvc.OutputLevel = 3
-#ServiceMgr.MessageSvc.defaultLimit = 0
-#ServiceMgr.MessageSvc.enableSuppression = False
-ServiceMgr.MessageSvc.Format = "% F%35W%S%7W%R%T %0W%M"
-ServiceMgr.MessageSvc.showStats = True
-ServiceMgr.MessageSvc.statLevel = WARNING
-
-if not hasattr(ServiceMgr, "AthenaEventLoopMgr"):
-    from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr
-    ServiceMgr += AthenaEventLoopMgr()
-    
-ServiceMgr.AthenaEventLoopMgr.EventPrintoutInterval = 100
-
diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigGeneralMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigGeneralMonitorAlgorithm.py
new file mode 100644
index 0000000000000000000000000000000000000000..ed93bbc43eacbb79d6155aad14720a7f5963d6d9
--- /dev/null
+++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigGeneralMonitorAlgorithm.py
@@ -0,0 +1,145 @@
+#
+#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+#
+
+'''@file TrigHLTMonitorAlgorithm.py
+@date 2020-09-18
+@brief TrigHLTMonitoring general monitoring
+'''
+
+
+def TrigGeneralMonConfig(inputFlags):
+    '''Function to configure general HLT algorithms in the monitoring system.'''
+
+
+    ### Set up logging functionality 
+    from AthenaCommon.Logging import logging
+    log_trighlt = logging.getLogger( 'TrigGeneralMonitorAlgorithm' )
+
+
+    ################################
+    # HLT general monitoring
+
+    # The following class will make a sequence, configure algorithms, and link
+    # them to GenericMonitoringTools
+    from AthenaMonitoring import AthMonitorCfgHelper
+    helper = AthMonitorCfgHelper(inputFlags,'TrigHLTAthMonitorCfg')
+
+
+    # Adding algorithms to the helper. 
+    # The added algorithm must exist as a .h file 
+
+    from AthenaConfiguration.ComponentFactory import CompFactory
+    cfgsvc = CompFactory.TrigConf.xAODConfigSvc('xAODConfigSvc')
+    helper.resobj.addService(cfgsvc)
+    trigHLTMonAlg = helper.addAlgorithm(CompFactory.TrigHLTMonitorAlgorithm,'TrigHLTMonAlg')
+    trigHLTMonAlg.TrigConfigSvc = cfgsvc
+
+
+
+    # Edit properties of a algorithm
+    # Placeholder
+
+
+    # Add a generic monitoring tool (a "group" in old language). 
+    hltGroup = helper.addGroup(
+        trigHLTMonAlg,
+        'TrigHLTMonitor',
+        'HLT/ResultMon/'
+    )
+
+
+    # Configure histograms
+    #NB! The histograms defined here must match the ones in the cxx file exactly
+
+    ###########################################################
+    ##### HLTResult and ConfigConsistency  ####################
+  
+    hltGroup.defineHistogram('HLTResultHLT', title='HLT Result PLACEHOLDER;result;Events',
+                             path='',xbins=3,xmin=0,xmax=3)
+
+    consistency_names=['SMK DB NULL','SMK BS NULL','SMK Inconsistent','HLT Prescale DB NULL','HLT Prescale BS NULL','HLT Prescale Inconsistent','No HLTResult']
+    hltGroup.defineHistogram('ConfigConsistency_HLT', title='ConfigConsistency_HLT;;Events',
+                             path='',xbins=7,xmin=1,xmax=8,xlabels=consistency_names)
+
+ 
+    ############################################################
+    #### Overall summary histograms ############################
+
+    from AthenaConfiguration.AutoConfigFlags import GetFileMD
+
+    #The HLT chains
+    counter_i = 1
+    for chain_name in GetFileMD(inputFlags.Input.Files)['TriggerMenu']['HLTChains']:
+        counter_i = counter_i+1
+        log_trighlt.debug('HLT chain_name = %s',chain_name)
+    max_hlt_chains = counter_i-1
+    log_trighlt.info('max_hlt_chains = %i', max_hlt_chains)
+
+    #The L1 items
+    counter_L1 = 1
+    for item_name in GetFileMD(inputFlags.Input.Files)['TriggerMenu']['L1Items']:
+        counter_L1 = counter_L1+1
+        log_trighlt.debug('L1 item_name = %s',item_name)
+    max_L1_items = counter_L1-1 
+    log_trighlt.info('max_L1_items = %i', max_L1_items)
+
+    ##### L1 summary histogram ################################
+
+    hltGroup.defineHistogram('L1Events',title='Events per Item at L1;;Events',
+                             path='',xbins=max_L1_items,xmin=1,xmax=max_L1_items+1)
+
+    #### HLT summary histograms #########################
+
+    hltGroup.defineHistogram('HLT_AllChainsRAW',title='AllChains;;Events',
+                             path='AllChains',xbins=max_hlt_chains,
+                             xmin=1,xmax=max_hlt_chains+1)
+
+    hltGroup.defineHistogram('eta,phi;HLT_AllChainsRoIs',type='TH2F',title='AllChains;#eta;#phi',
+                             path='AllChains',xbins=64,xmin=-3.2,xmax=3.2,
+                             ybins=64,ymin=-3.2,ymax=3.2)
+
+
+    #### Summary histograms for the signatures #################
+    hltGroup.defineHistogram('HLT_ElectronsRAW',title='Placeholder;X;Y',
+                             path='Electrons',xbins=1000000,xmin=-0.5,xmax=999999.5)
+
+
+
+    #####################################
+    # Finalize. 
+    return helper.result()
+    
+
+if __name__=='__main__':
+    # Setup the Run III behavior
+    from AthenaCommon.Configurable import Configurable
+    Configurable.configurableRun3Behavior = 1
+
+    # Setup logs
+    from AthenaCommon.Logging import log
+    from AthenaCommon.Constants import DEBUG
+    log.setLevel(DEBUG)
+
+    # Set the Athena configuration flags
+    from AthenaConfiguration.AllConfigFlags import ConfigFlags
+    ConfigFlags.Input.isMC = False
+    ConfigFlags.Output.HISTFileName = 'TrigHLTMonitorOutput.root'
+    
+    ConfigFlags.lock()
+
+    # Initialize configuration object, add accumulator, merge, and run.
+    from AthenaConfiguration.MainServicesConfig import MainServicesCfg 
+    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
+    cfg = MainServicesCfg(ConfigFlags)
+    cfg.merge(PoolReadCfg(ConfigFlags))
+
+    trigHLTMonitorAcc = TrigGeneralMonConfig(ConfigFlags)
+    cfg.merge(trigHLTMonitorAcc)
+
+    # If you want to turn on more detailed messages ...
+    #trigHLTMonitorAcc.getEventAlgo('TrigHLTMonAlg').OutputLevel = 2 # DEBUG
+    cfg.printConfig(withDetails=True) # set True for exhaustive info
+
+    cfg.run() #use cfg.run(20) to only run on first 20 events
+
diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitorAlgorithm.py
index 6d8e29bb010a898932b811bea269d9ef876a7914..12576dc04759831b41554f8f397d680d94cd6f50 100644
--- a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitorAlgorithm.py
+++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitorAlgorithm.py
@@ -4,8 +4,8 @@
 
 '''@file TrigHLTMonitorAlgorithm.py
 @date 2019-09-10
-@date 2020-08-24
-@brief TrigHLTMonitoring top-level files, general monitoring
+@date 2020-09-18
+@brief TrigHLTMonitoring top-level files
 '''
 
 def createHLTDQConfigFlags():
@@ -13,14 +13,14 @@ def createHLTDQConfigFlags():
     acf=AthConfigFlags()
 
     acf.addFlag('DQ.Steering.HLT.doGeneral', True)
-    acf.addFlag('DQ.Steering.HLT.doEgamma', True)
-    acf.addFlag('DQ.Steering.HLT.doMET', True)
-    acf.addFlag('DQ.Steering.HLT.doJet', True)
     acf.addFlag('DQ.Steering.HLT.doBjet', True)
-    acf.addFlag('DQ.Steering.HLT.doCalo', True)
-    acf.addFlag('DQ.Steering.HLT.doMuon', True)
     acf.addFlag('DQ.Steering.HLT.doBphys', True)
+    acf.addFlag('DQ.Steering.HLT.doCalo', True)
+    acf.addFlag('DQ.Steering.HLT.doEgamma', True)
+    acf.addFlag('DQ.Steering.HLT.doJet', True)
+    acf.addFlag('DQ.Steering.HLT.doMET', True)
     acf.addFlag('DQ.Steering.HLT.doMinBias', True)
+    acf.addFlag('DQ.Steering.HLT.doMuon', True)
     acf.addFlag('DQ.Steering.HLT.doTau', True)
 
     return acf
@@ -32,152 +32,51 @@ def TrigHLTMonTopConfig(inputFlags):
     ########
     #HLT top-level steering
 
-    ### STEP 1 ###
     # Define one top-level monitoring algorithm. The new configuration 
     # framework uses a component accumulator.
+
     from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
     result = ComponentAccumulator()
 
     if inputFlags.DQ.Steering.HLT.doGeneral:
-        from TrigHLTMonitoring.TrigHLTMonitorAlgorithm import TrigHLTMonConfig
-        result.merge(TrigHLTMonConfig(inputFlags))
+        from TrigHLTMonitoring.TrigGeneralMonitorAlgorithm import TrigGeneralMonConfig
+        result.merge(TrigGeneralMonConfig(inputFlags))
+
+    if inputFlags.DQ.Steering.HLT.doBjet:
+        from TrigBjetMonitoring.TrigBjetMonitorAlgorithm import TrigBjetMonConfig
+        result.merge(TrigBjetMonConfig(inputFlags))
+
+    if inputFlags.DQ.Steering.HLT.doBphys:
+        from TrigBphysMonitoring.TrigBphysMonitorAlgorithm import TrigBphysMonConfig
+        result.merge(TrigBphysMonConfig(inputFlags))
+
+    if inputFlags.DQ.Steering.HLT.doCalo:
+        from TrigCaloMonitoring.TrigCaloMonitorAlgorithm import TrigCaloMonConfig
+        result.merge(TrigCaloMonConfig(inputFlags))
 
     if inputFlags.DQ.Steering.HLT.doEgamma:
         from TrigEgammaMonitoring.TrigEgammaMonitorAlgorithm import TrigEgammaMonConfig
         result.merge(TrigEgammaMonConfig(inputFlags))
 
-    if inputFlags.DQ.Steering.HLT.doMET:
-        from TrigMETMonitoring.TrigMETMonitorAlgorithm import TrigMETMonConfig
-        result.merge(TrigMETMonConfig(inputFlags))
-
     if inputFlags.DQ.Steering.HLT.doJet:
         from TrigJetMonitoring.TrigJetMonitorAlgorithm import TrigJetMonConfig
         result.merge(TrigJetMonConfig(inputFlags))
 
-    if inputFlags.DQ.Steering.HLT.doBjet:
-        from TrigBjetMonitoring.TrigBjetMonitorAlgorithm import TrigBjetMonConfig
-        result.merge(TrigBjetMonConfig(inputFlags))
+    if inputFlags.DQ.Steering.HLT.doMET:
+        from TrigMETMonitoring.TrigMETMonitorAlgorithm import TrigMETMonConfig
+        result.merge(TrigMETMonConfig(inputFlags))
 
-    if inputFlags.DQ.Steering.HLT.doCalo:
-        from TrigCaloMonitoring.TrigCaloMonitorAlgorithm import TrigCaloMonConfig
-        result.merge(TrigCaloMonConfig(inputFlags))
+    if inputFlags.DQ.Steering.HLT.doMinBias:
+        from TrigMinBiasMonitoring.TrigMinBiasMonitoringMT import TrigMinBias
+        result.merge(TrigMinBias(inputFlags))
 
     if inputFlags.DQ.Steering.HLT.doMuon:
         from TrigMuonMonitoringMT.TrigMuonMonitoringMTConfig import TrigMuonMonConfig
         result.merge(TrigMuonMonConfig(inputFlags))
 
-    if inputFlags.DQ.Steering.HLT.doBphys:
-        from TrigBphysMonitoring.TrigBphysMonitorAlgorithm import TrigBphysMonConfig
-        result.merge(TrigBphysMonConfig(inputFlags))
-        
-    if inputFlags.DQ.Steering.HLT.doMinBias:
-        from TrigMinBiasMonitoring.TrigMinBiasMonitoringMT import TrigMinBias
-        result.merge(TrigMinBias(inputFlags))
-
     if inputFlags.DQ.Steering.HLT.doTau:
         from TrigTauMonitoring.TrigTauMonitorAlgorithm import TrigTauMonConfig
         result.merge(TrigTauMonConfig(inputFlags))
 
     return result
 
-
-
-def TrigHLTMonConfig(inputFlags):
-    '''Function to configure general HLT algorithms in the monitoring system.'''
-
-    ################################
-    # HLT general monitoring
-
-
-    # The following class will make a sequence, configure algorithms, and link
-    # them to GenericMonitoringTools
-    from AthenaMonitoring import AthMonitorCfgHelper
-    helper = AthMonitorCfgHelper(inputFlags,'TrigHLTAthMonitorCfg')
-
-
-    ### STEP 2 ###
-    # Adding algorithms to the helper. 
-    # The added algorithm must exist as a .h file 
-
-    from AthenaConfiguration.ComponentFactory import CompFactory
-    #trigHLTMonAlg = helper.addAlgorithm(CompFactory.TrigHLTMonitorAlgorithm,'TrigHLTMonAlg')
-    cfgsvc = CompFactory.TrigConf.xAODConfigSvc('xAODConfigSvc')
-    helper.resobj.addService(cfgsvc)
-    trigHLTMonAlg = helper.addAlgorithm(CompFactory.TrigHLTMonitorAlgorithm,'TrigHLTMonAlg')
-    trigHLTMonAlg.TrigConfigSvc = cfgsvc
-
-
-
-    #signatureTrigHLTMonAlg = helper.addAlgorithm(CompFactory.TrigHLTMonitorAlgorithm,'SignatureTrigHLTMonAlg')
-
-
-    ### STEP 3 ###
-    # Edit properties of a algorithm
-    # Placeholder
-
-    ### STEP 4 ###
-    # Add a generic monitoring tool (a "group" in old language). 
-    hltGroup = helper.addGroup(
-        trigHLTMonAlg,
-        'TrigHLTMonitor',
-        'HLT/ResultMon/'
-    )
-
-    # Add a GMT for the other example monitor algorithm
-    #signatureGroup = helper.addGroup(signatureTrigHLTMonAlg,'TrigHLTMonitor','HLT/ResultMon/')
-
-    ### STEP 5 ###
-    # Configure histograms
-    #NB! The histograms defined here must match the ones in the cxx file exactly
-    
-    hltGroup.defineHistogram('HLTResultHLT', title='HLT Result PLACEHOLDER;result;Events',
-                            path='',xbins=3,xmin=0,xmax=3)
-
-    consistency_names=['SMK DB NULL','SMK BS NULL','SMK Inconsistent','HLT Prescale DB NULL','HLT Prescale BS NULL','HLT Prescale Inconsistent','No HLTResult']
-    hltGroup.defineHistogram('ConfigConsistency_HLT', title='ConfigConsistency_HLT;;Events',
-                             path='',xbins=7,xmin=1,xmax=8,xlabels=consistency_names)
-
-    hltGroup.defineHistogram('placeholder_hlt',title='Placeholder;X;Y',
-                                  path='AllChains',xbins=1000000,xmin=-0.5,xmax=999999.5)
-
-    #Summary histograms for the signatures
-    hltGroup.defineHistogram('placeholder_ele',title='Placeholder;X;Y',
-                                  path='Electrons',xbins=1000000,xmin=-0.5,xmax=999999.5)
-
-    ### STEP 6 ###
-    # Finalize. 
-    return helper.result()
-    
-
-if __name__=='__main__':
-    # Setup the Run III behavior
-    from AthenaCommon.Configurable import Configurable
-    Configurable.configurableRun3Behavior = 1
-
-    # Setup logs
-    from AthenaCommon.Logging import log
-    from AthenaCommon.Constants import DEBUG
-    log.setLevel(DEBUG)
-
-    # Set the Athena configuration flags
-    from AthenaConfiguration.AllConfigFlags import ConfigFlags
-    ConfigFlags.Input.isMC = False
-    ConfigFlags.Output.HISTFileName = 'TrigHLTMonitorOutput.root'
-    
-    ConfigFlags.lock()
-
-    # Initialize configuration object, add accumulator, merge, and run.
-    from AthenaConfiguration.MainServicesConfig import MainServicesCfg 
-    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
-    cfg = MainServicesCfg(ConfigFlags)
-    cfg.merge(PoolReadCfg(ConfigFlags))
-
-    trigHLTMonitorAcc = TrigHLTMonConfig(ConfigFlags)
-    cfg.merge(trigHLTMonitorAcc)
-
-    # If you want to turn on more detailed messages ...
-    #trigHLTMonitorAcc.getEventAlgo('TrigHLTMonAlg').OutputLevel = 2 # DEBUG
-    cfg.printConfig(withDetails=True) # set True for exhaustive info
-
-    cfg.run() #use cfg.run(20) to only run on first 20 events
-
diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/src/TrigHLTMonitorAlgorithm.cxx b/Trigger/TrigMonitoring/TrigHLTMonitoring/src/TrigHLTMonitorAlgorithm.cxx
index fcaffe752b88f828d44332c77c8f56ebfba33d88..051c8b4cf78034efbd22b0ce5e50cdd9cb2c2b82 100644
--- a/Trigger/TrigMonitoring/TrigHLTMonitoring/src/TrigHLTMonitorAlgorithm.cxx
+++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/src/TrigHLTMonitorAlgorithm.cxx
@@ -4,9 +4,12 @@
 
 #include "TrigHLTMonitorAlgorithm.h"
 
+using namespace TrigCompositeUtils;
+
 TrigHLTMonitorAlgorithm::TrigHLTMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
   : AthMonitorAlgorithm(name,pSvcLocator)
   , m_trigDecTool("Trig::TrigDecisionTool/TrigDecisionTool") 
+
 {
 }
 
@@ -28,27 +31,98 @@ StatusCode TrigHLTMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co
   using namespace Monitored;
   StatusCode sc = StatusCode::FAILURE;
 
-  ////////////////////////////////////
-  // Chain monitoring
+  auto tool = getGroup("TrigHLTMonitor");
 
+  ////////////////////////////////////////
   // Declare the quantities which should be monitored
-  //NB! The variables and histograms defined here must match the ones in the py file exactly!
-  auto placeholder_ele = Monitored::Scalar<int>("placeholder_ele",0);
-  auto placeholder_hlt = Monitored::Scalar<int>("placeholder_hlt",0);
-  
-  //// Set the values of the monitored variables for the event		
-  placeholder_ele = GetEventInfo(ctx)->runNumber(); //DUMMY; to be updated.
-  placeholder_hlt = GetEventInfo(ctx)->runNumber(); //DUMMY; to be updated.
-  
+  // NB! The variables and histograms defined here must match the ones in the py file exactly!
+
+  auto HLT_ElectronsRAW = Monitored::Scalar<int>("HLT_ElectronsRAW",0);
+  auto HLT_AllChainsRAW = Monitored::Scalar<std::string>("HLT_AllChainsRAW");
+  auto L1Events = Monitored::Scalar<std::string>("L1Events");
+
+
+  ////////////////////////////////////
+  // L1 items monitoring
+
+  std::vector<std::string> L1items = m_trigDecTool->getChainGroup("L1_.*")->getListOfTriggers();
+  unsigned int nL1Items = L1items.size();
+
   // Fill. First argument is the tool (GMT) name as defined in the py file, 
   // all others are the variables to be saved.
   // Alternative fill method. Get the group yourself, and pass it to the fill function.
-  auto tool = getGroup("TrigHLTMonitor");
-  
-  fill(tool,placeholder_hlt);
-  fill(tool,placeholder_ele);
-  
+
+  ATH_MSG_INFO("Filling L1Events histogram");
+  for(unsigned int it=0; it<nL1Items; ++it) {
+    if( L1items[it] != "" ) {
+      
+      ATH_MSG_DEBUG("L1Item " << it << " " << L1items << m_trigDecTool->isPassed(L1items[it]));
+      if(m_trigDecTool->isPassed(L1items[it])) {
+	
+	/// Fill L1 histogram
+	L1Events = L1items[it];
+	ATH_MSG_DEBUG("L1Chain " << it << L1items[it]  << " is passed");
+	fill(tool,L1Events);
+      }
+    }
+  }
+
+
+  ////////////////////////////////////
+  // HLT chain monitoring
+
+  //// Set the values of the monitored variables for the event		
+  HLT_ElectronsRAW = GetEventInfo(ctx)->runNumber(); //DUMMY; to be updated.
+
+  ATH_MSG_INFO( "Filling HLT_AllChains and RoI information" );
+  std::vector< std::string > chainNames = m_trigDecTool->getChainGroup("HLT_.*")->getListOfTriggers();
+  unsigned int nHLTChains = chainNames.size();
+
+  for(unsigned int ith=0; ith<nHLTChains; ++ith) {
+    if( chainNames[ith] != "" ) {
+
+      ATH_MSG_DEBUG("HLTChain " << ith << " " << chainNames << m_trigDecTool->isPassed(chainNames[ith]));
+      if(m_trigDecTool->isPassed(chainNames[ith])) {
+	ATH_MSG_DEBUG( "    Chain " << chainNames[ith] << " IS passed");
+
+	/// Fill plain chains histogram
+	HLT_AllChainsRAW = chainNames[ith];
+	ATH_MSG_DEBUG( "Fill HLT_AllChainsRAW" ); // with " << HLT_AllChainsRAW );
+	fill(tool,HLT_AllChainsRAW);
+	
+	/// Fill RoIs histogram
+	ATH_MSG_DEBUG("Fill RoI histograms for chain " << chainNames[ith] );
+	std::vector<LinkInfo<TrigRoiDescriptorCollection>> fvec = m_trigDecTool->features<TrigRoiDescriptorCollection>(chainNames[ith], TrigDefs::Physics, "", TrigDefs::lastFeatureOfType, "initialRoI"); //initialRoiString()
+
+	//Loop over RoIs
+	for (const LinkInfo<TrigRoiDescriptorCollection>& li : fvec) {
+
+	  if( li.isValid() ) {
+	    auto phi = Monitored::Scalar("phi", 0.0);
+	    auto eta = Monitored::Scalar("eta", 0.0);
+	    auto HLT_AllChainsRoIs = Monitored::Group(tool, eta, phi); //filled when going out of scope
+
+	    const TrigRoiDescriptor* roi = *(li.link).cptr();
+    	    eta = roi->eta();
+	    phi = roi->phi();
+	    ATH_MSG_DEBUG( "RoI: eta = " << eta << ", phi = " << phi ); 
+	  }
+
+	  else {
+	    ATH_MSG_WARNING( "TrigRoiDescriptorCollection for chain " << chainNames[ith] << " is not valid");
+	  }
+
+	}//end for (const LinkInfo<TrigRoiDescriptorCollection>& li : fvec)
+      }// end if(m_trigDecTool->isPassed(chainNames[ith]))
+    }// end if( chainNames[ith] != "" )
+  }//end for(unsigned int ith=0; ith<nHLTChains; ++ith)
+
+
+  //Placeholder   
+  ATH_MSG_DEBUG( "Fill HLT_ElectronsRAW with " << HLT_ElectronsRAW );
+  fill(tool,HLT_ElectronsRAW);
   
+
   //////////////////////////////////////
   // HLTResult and ConfigConsistency
   
@@ -57,11 +131,13 @@ StatusCode TrigHLTMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co
   
   //////////////////////////////////////
   // End
+  ATH_MSG_INFO( "Finalizing the TrigHLTMonitorAlgorithm..." );
   return StatusCode::SUCCESS;
 }
 
 
 StatusCode TrigHLTMonitorAlgorithm::fillResultAndConsistencyHistograms( const EventContext& ctx ) const {
+
   using namespace Monitored;
   StatusCode sc_trigDec = StatusCode::FAILURE; 
   StatusCode sc_hltResult = StatusCode::FAILURE; 
@@ -77,9 +153,6 @@ StatusCode TrigHLTMonitorAlgorithm::fillResultAndConsistencyHistograms( const Ev
   //////////////////////////////////////
   // HLTResult and ConfigConsistency
 
-  //Use the m_trigConfigSvc rather than the m_configTool. You should remove the m_configTool.
-  //But use the TrigConf::xAODConfigSvc rather than the old TrigConf::TrigConfigSvc/TrigConfigSvc
-    
   uint32_t bskeys_1 = 9999; uint32_t bskeys_2 = 9999;
   HLTResultHLT = 1; //DUMMY; to be updated.
   sc_hltResult = StatusCode::FAILURE; //no HLTResult yet
@@ -99,7 +172,9 @@ StatusCode TrigHLTMonitorAlgorithm::fillResultAndConsistencyHistograms( const Ev
   }
   else {
     //For now, this will always happen    
-    ATH_MSG_WARNING("No HLTResult found"); //Prints a warning message in the log file
+    ATH_MSG_INFO("No HLTResult monitored (because it has not been implemented yet)");
+    //FIXME: When the HLTResult IS implemented this should be a WARNING // ebergeas Sept 2020
+    //ATH_MSG_WARNING("No HLTResult found"); //Prints a warning message in the log file
     ConfigConsistency_HLT=7;
     fill(tool,ConfigConsistency_HLT); //Fills the warning bin in the ConfigConsistency histogram
     bskeys_1 = 0;
@@ -108,7 +183,6 @@ StatusCode TrigHLTMonitorAlgorithm::fillResultAndConsistencyHistograms( const Ev
 
   }
 
-  
   uint32_t bskeys[] = {bskeys_1, bskeys_2};
   uint32_t dbkeys[2];
   dbkeys[0]=m_trigConfigSvc->masterKey();
@@ -133,7 +207,6 @@ StatusCode TrigHLTMonitorAlgorithm::fillResultAndConsistencyHistograms( const Ev
     } 
   }
     
-
   fill(tool,HLTResultHLT);
 
   return StatusCode::SUCCESS;
diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/src/TrigHLTMonitorAlgorithm.h b/Trigger/TrigMonitoring/TrigHLTMonitoring/src/TrigHLTMonitorAlgorithm.h
index c8ae56432f36af7a998a60e9ff44d20b78754e54..2b5ea0b571d7bdac71e447ff86ed452a5a91b3cb 100644
--- a/Trigger/TrigMonitoring/TrigHLTMonitoring/src/TrigHLTMonitorAlgorithm.h
+++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/src/TrigHLTMonitorAlgorithm.h
@@ -5,11 +5,17 @@
 #ifndef TRIGHLTMONITORING_TRIGHLTMONITORALGORITHM_H
 #define TRIGHLTMONITORING_TRIGHLTMONITORALGORITHM_H
 
+#include <set>
+#include <string>
+#include <vector>
+
 #include "AthenaMonitoring/AthMonitorAlgorithm.h"
 #include "AthenaMonitoringKernel/Monitored.h"
 
 #include "TrigSteeringEvent/HLTResultMT.h"   
 #include "StoreGate/ReadHandleKey.h"
+#include "TrigSteeringEvent/TrigRoiDescriptor.h"
+#include "TrigSteeringEvent/TrigRoiDescriptorCollection.h"
 
 class TrigHLTMonitorAlgorithm : public AthMonitorAlgorithm {
  public:
diff --git a/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py
index a220da0c8d691d0d35dc4de8dfaa7a1ea23f8cee..994f265356beb1d40d11dbdd48aaf9378b191613 100644
--- a/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py
+++ b/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py
@@ -127,9 +127,9 @@ from JetMonitoring.JetMonitoringConfig import JetMonAlgSpec, HistoSpec, EventHis
 
 # All offline jet collections
 ExtraOfflineHists = [
-  HistoSpec('HECFrac', (50,0,1), title="HECFrac;HEC fraction;Entries" ),
-  HistoSpec('EMFrac', (50,0,1), title="EMFrac;EM fraction;Entries" ),
-  HistoSpec('Jvt', (50,-0.1,1), title="JVT;JVT;Entries" ),
+  "EMFrac",
+  "HECFrac",
+  "Jvt",
   "JVFCorr",
   "JvtRpt",
   "NumTrkPt1000[0]",
@@ -140,11 +140,11 @@ ExtraOfflineHists = [
 
 # All online small-R jet collections
 ExtraSmallROnlineHists = [
-  HistoSpec('HECFrac', (50,0,1), title="HECFrac;HEC fraction;Entries" ),
-  HistoSpec('EMFrac', (50,0,1), title="EMFrac;EM fraction;Entries" ),
-  HistoSpec('DetectorEta', (100,-5,5), title="DetectorEta;Detector #eta;Entries" ), 
-  HistoSpec('ActiveArea', (80,0,0.8), title="ActiveArea;Active Area;Entries" ), 
   HistoSpec('et:GeV;eta',  (100,0,750, 50,-5,5) , title='#eta vs E_{T};E_{T} [GeV];#eta;Entries'),
+  "EMFrac",
+  "HECFrac",
+  "DetectorEta",
+  "ActiveArea", 
   "EM3Frac",
   "Tile0Frac",
 ]
@@ -204,8 +204,11 @@ def TrigJetMonConfig(inputFlags):
   # Loop over HLT jet chains
   for chain,jetcoll in Chain2JetCollDict[InputType].items():
     # kinematic plots
-    chainMonitorConf = jetChainMonitoringConfig(inputFlags,jetcoll,chain,AthenaMT)
-    chainMonitorConf.toAlg(helper)
+    if AthenaMT:
+      chainMonitorConfT = jetChainMonitoringConfig(inputFlags,jetcoll,chain,AthenaMT,True)
+      chainMonitorConfT.toAlg(helper)
+    chainMonitorConfF = jetChainMonitoringConfig(inputFlags,jetcoll,chain,AthenaMT,False)
+    chainMonitorConfF.toAlg(helper)
     # efficiency plots
     refChain       = 'NONE'
     offlineJetColl = 'NONE'
@@ -268,7 +271,9 @@ def basicJetMonAlgSpec(jetcoll,isOnline,athenaMT):
     SelectSpec( 'lowmu', 'avgMu<30', path, isEventVariable=True, FillerTools = ["pt","et","m","phi","eta"]),
     SelectSpec( 'highmu', '30<avgMu', path, isEventVariable=True, FillerTools = ["pt","et","m","phi","eta"]),
 
-    EventHistoSpec('njetsPt20', (20,0,20), title='NJetsPt20;NJetsPt20;Entries' ),
+    EventHistoSpec('njets', (25,0,25), title='NJets;NJets;Entries' ),
+    EventHistoSpec('njetsPt20', (25,0,25), title='NJetsPt20;NJetsPt20;Entries' ),
+    EventHistoSpec('njetsPt50', (25,0,25), title='NJetsPt50;NJetsPt50;Entries' ),
     # Jet multiplicity histograms can be added by using an EventHistoSpec
     # Their specifications (pT cut, ET cut, eta cuts) must be defined in the knownEventVar dictionary within JetStandardHistoSpecs.py
     # The following line is an example for a jet multiplicity histogram with ET>40 GeV, 1.0<|eta|<2.0, and binning of (10,0,10):
@@ -331,7 +336,7 @@ def l1JetMonitoringConfig(inputFlags,jetcoll,chain=''):
   conf = L1JetMonAlg(name,jetcoll,chain)
   return conf
 
-def jetChainMonitoringConfig(inputFlags,jetcoll,chain,athenaMT):
+def jetChainMonitoringConfig(inputFlags,jetcoll,chain,athenaMT,onlyUsePassingJets=True):
    '''Function to configures some algorithms in the monitoring system.'''
 
    # Remap online Run 2 jet collections
@@ -347,14 +352,45 @@ def jetChainMonitoringConfig(inputFlags,jetcoll,chain,athenaMT):
    else:
      chainFolder = chain
 
-   trigConf = JetMonAlgSpec( # the usual JetMonAlgSpec
-       chain+"TrigMon",
+   if not athenaMT:
+     onlyUsePassingJets = False #does not work for legacy samples yet
+   jetMonAlgSpecName = chain+"TrigMon"
+   if not onlyUsePassingJets:
+     chainFolder = chainFolder + "/ExpertHistos"
+     jetMonAlgSpecName = jetMonAlgSpecName + "_ExpertHistos"
+
+   # Define helper functions to automatize ET & eta selection strings for NJet histograms of chains
+   def getThreshold(parts):
+     return parts[1].split('_')[0]
+
+   def getEtaRangeString(chain):
+     if 'eta' in chain:
+       etaParts    = chain.split('eta')
+       etaMinTemp  = etaParts[0].split('_')
+       etaMin      = etaMinTemp[len(etaMinTemp)-1]
+       if int(etaMin) > 0 : etaMin = str(int(int(etaMin)/10))
+       etaMax      = etaParts[1].split('_')[0]
+       if int(etaMax) > 0 : etaMax = str(int(int(etaMax)/10))
+       return 'Eta{}_{}'.format(etaMin,etaMax)
+     else: return 'Eta0_32'
+
+   def getNjetHistName(chain):
+     parts         = chain.split('j')
+     # check if it is a multi-threshold multijet chain or a single-threshold multijet chain
+     multiplicity  = parts[0].split('_')[1] # for single-threshold multijet chains
+     if (chain.count('_j')-chain.count('_jes')) > 1  or multiplicity != '':
+       return 'njetsEt{}{}'.format(getThreshold(parts),getEtaRangeString(chain))
+     else: return 'NONE'
+
+   trigConf = JetMonAlgSpec( # the usual JetMonAlgSpec 
+       jetMonAlgSpecName,
        JetContainerName = jetcoll,
        TriggerChain = chain,
        defaultPath = chainFolder,
        topLevelDir="HLT/JetMon/Online/",
        bottomLevelDir=jetcollFolder,
        failureOnMissingContainer=True,
+       onlyPassingJets=onlyUsePassingJets,
        )
    trigConf.appendHistos(
            "pt",
@@ -362,7 +398,16 @@ def jetChainMonitoringConfig(inputFlags,jetcoll,chain,athenaMT):
            "eta",
            "et",
            "phi",
+           EventHistoSpec('njets', (25,0,25), title='njets;njets;Entries' ),
+           EventHistoSpec('njetsEt20Eta0_32', (25,0,25), title='njetsEt20Eta0_32;njetsEt20Eta0_32;Entries' ),
+           EventHistoSpec('njetsEt50Eta0_32', (25,0,25), title='njetsEt50Eta0_32;njetsEt50Eta0_32;Entries' ),
    )
+   NjetHistName = getNjetHistName(chain)
+   from JetMonitoring.JetStandardHistoSpecs import knownEventVar
+   if knownEventVar.get(NjetHistName,None) is not None:
+     trigConf.appendHistos(
+       EventHistoSpec(NjetHistName, (25,0,25), title=NjetHistName+';'+NjetHistName+';Entries' ),
+     )
 
    return trigConf
 
@@ -409,6 +454,7 @@ def jetEfficiencyMonitoringConfig(inputFlags,onlinejetcoll,offlinejetcoll,chain,
        topLevelDir               = "HLT/JetMon/Online/",
        bottomLevelDir            = jetcollFolder,
        failureOnMissingContainer = True,
+       onlyPassingJets           = False,
        )
    trigConf.appendHistos(
        SelectSpec( 'eff', '{}<|eta|<{}'.format(etaMin,etaMax), chainFolder, SelectedIndex=index, FillerTools = [
@@ -442,7 +488,6 @@ def jetEfficiencyMonitoringConfig(inputFlags,onlinejetcoll,offlinejetcoll,chain,
 
    return trigConf
 
-
 if __name__=='__main__':
 
   # Read arguments
@@ -520,11 +565,13 @@ if __name__=='__main__':
 
   # Loop over HLT jet chains
   for chain,jetcoll in Chain2JetCollDict[InputType].items():
-    chainMonitorConf = jetChainMonitoringConfig(ConfigFlags,jetcoll,chain,AthenaMT)
-    chainMonitorConf.toAlg(helper)
+    if AthenaMT:
+      chainMonitorConfT = jetChainMonitoringConfig(ConfigFlags,jetcoll,chain,AthenaMT,True)
+      chainMonitorConfT.toAlg(helper)
+    chainMonitorConfF = jetChainMonitoringConfig(ConfigFlags,jetcoll,chain,AthenaMT,False)
+    chainMonitorConfF.toAlg(helper)
 
-  # Produce efficiency plots
-  for chain in Chain2JetCollDict[InputType]:
+    # Produce efficiency plots
     refChain       = 'NONE'
     offlineJetColl = 'NONE'
     if chain in TurnOnCurves[InputType]:
diff --git a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonTool.cxx b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonTool.cxx
index c8422a49cb086da1416a9e097b8c66cbbb802909..d01ebe5a5513971b98232d90805a1006a964e25e 100755
--- a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonTool.cxx
+++ b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonTool.cxx
@@ -108,9 +108,6 @@ HLTMinBiasMonTool::HLTMinBiasMonTool(const std::string & type, const std::string
 	//Lvl-2 containers
 	declareProperty("SPContainerName", m_spContainerName);
 
-	// Cut made on time over-threshold before any multiplicities are calculated.
-	declareProperty("PixelCLToTCut", m_timeOverThresholdCut = 20.);
-
 	// If set to false the trigger combination of Pixel and SCT is an OR.
 	declareProperty("TriggerTypeAND", m_triggerTypeAND = true);
 
diff --git a/Trigger/TrigSteer/TrigSteering/share/pureSteering_jobOptions.py b/Trigger/TrigSteer/TrigSteering/share/pureSteering_jobOptions.py
index b0661a7e89cc8e7b093533669f78796803309ca8..1f389d2ad7c3f20c71d5663b6ad6c038d4b79f58 100755
--- a/Trigger/TrigSteer/TrigSteering/share/pureSteering_jobOptions.py
+++ b/Trigger/TrigSteer/TrigSteering/share/pureSteering_jobOptions.py
@@ -27,7 +27,6 @@ if not "usePrescaleMenu" in dir(): usePrescaleMenu = False
 if not "useMultiSeedingMenu" in dir(): useMultiSeedingMenu = False
 if not "useMenuWithAcceptInput" in dir(): useMenuWithAcceptInput = False
 if not "useBusyEventSetup" in dir(): useBusyEventSetup = False
-if not "l1SeedingTest" in dir(): l1SeedingTest = False
 
 # Default L1 RoIs if not set otherwise below
 
@@ -100,24 +99,6 @@ EM15i,EM25i
 EM15i,EM25i
 """
 
-elif l1SeedingTest:
-    include("TrigSteering/pureSteering_l1Seeding_menu.py")
-    RoIs = "MU6, MU20\n"*7
-    # see for info about 
-    # 106 is ctp ID of L1_MU06 120 is for L1_MU20 and 121 for L1_MU21
-    #
-    ctpbits = "106:1,0 120:1,1\n" 
-    ctpbits += "106:1,1 120:0,0 121:1,1\n" # L1_MU21 active
-    ctpbits += "106:1,0 120:1,1 121:0,0\n"  # L1_MU20 acts ( the other is inactive )
-    ctpbits += "106:1,1 120:1,1 121:0,0\n"
-    ctpbits += "106:1,1 120:1,1 121:0,0\n"
-    ctpbits += "106:1,1 120:1,1 121:0,0\n"
-    ctpbits += "106:1,1 120:1,0 121:0,0\n" # L1_MU20 activated but prescaled
-
-    ctpfile=open("Lvl1CTPResults.txt", "w")
-    ctpfile.write(ctpbits)
-    ctpfile.close()
-
 else:
     include("TrigSteering/pureSteering_menu.py")
 
@@ -191,21 +172,6 @@ if runMergedSteering:
         hltSteer.ResultBuilder.ErrorStreamTags = ["ABORT_CHAIN ALGO_ERROR GAUDI_EXCEPTION: hltexceptions physics", "ABORT_EVENT ALGO_ERROR TIMEOUT: hlttimeout debug"]
         hltSteer.softEventTimeout = 1 * Units.s
 
-    if l1SeedingTest:
-        from TrigSteering.TestingTrigSteeringConfig import TestingLvl1Converter
-        lvl1Converter = TestingLvl1Converter()
-        hltSteer += lvl1Converter        
-        hltSteer.LvlConverterTool = lvl1Converter
-        hltSteer.LvlConverterTool.useL1Calo = False
-        hltSteer.LvlConverterTool.useL1Muon = False
-        hltSteer.LvlConverterTool.useL1JetEnergy = False
-        hltSteer.LvlConverterTool.OutputLevel = DEBUG
-        from TrigFake.TrigFakeConf import FakeRoIB
-        fakeRoIB = FakeRoIB()
-        fakeRoIB.OutputLevel = DEBUG
-        fakeRoIB.InputFile="Lvl1CTPResults.txt"
-        job += fakeRoIB
-
     job += hltSteer
 
 
diff --git a/Trigger/TrigTools/IDScanHitFilter/src/FilterBin.h b/Trigger/TrigTools/IDScanHitFilter/src/FilterBin.h
index 0263c23f8228700f69a4dc1476af9eedcbedc8c2..c93b01262fdce05f830d9f4abc13d7d473e0cb20 100644
--- a/Trigger/TrigTools/IDScanHitFilter/src/FilterBin.h
+++ b/Trigger/TrigTools/IDScanHitFilter/src/FilterBin.h
@@ -63,10 +63,10 @@ private:
 inline std::ostream& operator<<(std::ostream& s, const FilterBin& f) { 
   s << "[ Nhits="    << f.NumberOfHits() 
     << "\t Nlayers=" << f.NumberOfLayers() << "\taddr=" << (void*)&f << "\t]";
-  
-  std::list<IdScanSpPoint*>::const_iterator spitr(f.hitList().begin());
-  std::list<IdScanSpPoint*>::const_iterator spend(f.hitList().end());
-  for ( ; spitr!=spend ; spitr++ ) s << "\n\t" << *(*spitr);
+
+  for (const IdScanSpPoint* hit : f.hitList()) {
+    s << "\n\t" << *hit;
+  }
   return s;
 }
 
diff --git a/Trigger/TrigTools/IDScanHitFilter/src/FixedBitSet.h b/Trigger/TrigTools/IDScanHitFilter/src/FixedBitSet.h
index 390cb42b1cd6685ddc89be3c9da853fe7cde1d37..da4311ccd464bb58e15478a9f27e6795cb583223 100755
--- a/Trigger/TrigTools/IDScanHitFilter/src/FixedBitSet.h
+++ b/Trigger/TrigTools/IDScanHitFilter/src/FixedBitSet.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
 */
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -26,25 +26,25 @@
 
 
   // Create the masks for each bit.
-  static const int setMask[] = { 
-    ((int) 1<< 0), ((int) 1<< 1), ((int) 1<< 2), ((int) 1<< 3), 
-    ((int) 1<< 4), ((int) 1<< 5), ((int) 1<< 6), ((int) 1<< 7), 
-    ((int) 1<< 8), ((int) 1<< 9), ((int) 1<<10), ((int) 1<<11), 
-    ((int) 1<<12), ((int) 1<<13), ((int) 1<<14), ((int) 1<<15), 
-    ((int) 1<<16), ((int) 1<<17), ((int) 1<<18), ((int) 1<<19), 
-    ((int) 1<<20), ((int) 1<<21), ((int) 1<<22), ((int) 1<<23), 
-    ((int) 1<<24), ((int) 1<<25), ((int) 1<<26), ((int) 1<<27), 
-    ((int) 1<<28), ((int) 1<<29), ((int) 1<<30), ((int) 1<<31)};
+  static const unsigned int setMask[] = { 
+    (1u<< 0), (1u<< 1), (1u<< 2), (1u<< 3), 
+    (1u<< 4), (1u<< 5), (1u<< 6), (1u<< 7), 
+    (1u<< 8), (1u<< 9), (1u<<10), (1u<<11), 
+    (1u<<12), (1u<<13), (1u<<14), (1u<<15), 
+    (1u<<16), (1u<<17), (1u<<18), (1u<<19), 
+    (1u<<20), (1u<<21), (1u<<22), (1u<<23), 
+    (1u<<24), (1u<<25), (1u<<26), (1u<<27), 
+    (1u<<28), (1u<<29), (1u<<30), (1u<<31)};
   
-  static const int clearMask[] = { 
-    ~((int) 1<< 0),~((int) 1<< 1),~((int) 1<< 2),~((int) 1<< 3), 
-    ~((int) 1<< 4),~((int) 1<< 5),~((int) 1<< 6),~((int) 1<< 7), 
-    ~((int) 1<< 8),~((int) 1<< 9),~((int) 1<<10),~((int) 1<<11), 
-    ~((int) 1<<12),~((int) 1<<13),~((int) 1<<14),~((int) 1<<15), 
-    ~((int) 1<<16),~((int) 1<<17),~((int) 1<<18),~((int) 1<<19), 
-    ~((int) 1<<20),~((int) 1<<21),~((int) 1<<22),~((int) 1<<23), 
-    ~((int) 1<<24),~((int) 1<<25),~((int) 1<<26),~((int) 1<<27), 
-    ~((int) 1<<28),~((int) 1<<29),~((int) 1<<30),~((int) 1<<31)};
+  static const unsigned int clearMask[] = { 
+    ~(1u<< 0),~(1u<< 1),~(1u<< 2),~(1u<< 3), 
+    ~(1u<< 4),~(1u<< 5),~(1u<< 6),~(1u<< 7), 
+    ~(1u<< 8),~(1u<< 9),~(1u<<10),~(1u<<11), 
+    ~(1u<<12),~(1u<<13),~(1u<<14),~(1u<<15), 
+    ~(1u<<16),~(1u<<17),~(1u<<18),~(1u<<19), 
+    ~(1u<<20),~(1u<<21),~(1u<<22),~(1u<<23), 
+    ~(1u<<24),~(1u<<25),~(1u<<26),~(1u<<27), 
+    ~(1u<<28),~(1u<<29),~(1u<<30),~(1u<<31)};
 
   static const int countLUT0[] = 
   {0,2,1,3,1,3,2,4,1,3,2,4,2,4,3,5,1,3,2,4,2,4,3,5,2,4,3,5,3,5,4,6,
diff --git a/Trigger/TrigTools/IDScanHitFilter/src/IDScanHitFilter.cxx b/Trigger/TrigTools/IDScanHitFilter/src/IDScanHitFilter.cxx
index 834b751780529c8c2ba5470d9fbfee99e3b780a1..57304efd3e9aa4eb8c4e6b76b26dc4176eee8238 100755
--- a/Trigger/TrigTools/IDScanHitFilter/src/IDScanHitFilter.cxx
+++ b/Trigger/TrigTools/IDScanHitFilter/src/IDScanHitFilter.cxx
@@ -203,10 +203,9 @@ void IDScanHitFilter::makeTracks( GroupList& idScanGroups, TrigInDetTrackCollect
 							      1.0/ptInv );
 
     std::vector<const TrigSiSpacePoint*> spacePointsOnTrack;
-    for(std::list<IdScanSpPoint *>::iterator hitItr=gItr->groupHits().begin();
-	hitItr!=gItr->groupHits().end();hitItr++) 
+    for (IdScanSpPoint* sp : gItr->groupHits())
       {
-	spacePointsOnTrack.push_back( (**hitItr).commonSP() );
+	spacePointsOnTrack.push_back( sp->commonSP() );
       }
     std::vector<const TrigSiSpacePoint*>* spv = new std::vector<const TrigSiSpacePoint*>;
     spv->assign(spacePointsOnTrack.begin(),spacePointsOnTrack.end());
diff --git a/Trigger/TrigTools/IDScanHitFilter/src/iHitFilter.cxx b/Trigger/TrigTools/IDScanHitFilter/src/iHitFilter.cxx
index b40a435d2e46912432619f47fbb55f3b3664f7d6..8812d32fc30732ea6106a8c72cefff4be574e4e3 100755
--- a/Trigger/TrigTools/IDScanHitFilter/src/iHitFilter.cxx
+++ b/Trigger/TrigTools/IDScanHitFilter/src/iHitFilter.cxx
@@ -435,9 +435,7 @@ void iHitFilter::groupCleaner( GroupList::iterator& inputItr, GroupList& cleanGr
 		    << std::endl;
 #endif
 
-	  std::list<IdScanSpPoint *>::iterator hitItr=(*gItr2).groupHits().begin();
-	  for( ; hitItr!=(*gItr2).groupHits().end(); hitItr++) {
-	    IdScanSpPoint* pSP=(*hitItr);
+          for (IdScanSpPoint* pSP : gItr2->groupHits()) {
 	    pSP->setUsed(1);
 #ifdef IDSCAN_DEBUG
 	    std::cout << "IDSCAN_DEBUG: new group - layer = " << pSP->layer()
@@ -451,14 +449,14 @@ void iHitFilter::groupCleaner( GroupList::iterator& inputItr, GroupList& cleanGr
 	  int badHit=0;
 	  //setting used=0 to spacepoints in the same layer
 	  for(std::list<IdScanSpPoint *>::iterator phIt1=(*gItr2).groupHits().begin();
-	      phIt1!=(*gItr2).groupHits().end();phIt1++) 
+	      phIt1!=(*gItr2).groupHits().end();++phIt1) 
 	    {
 	      //if((*phIt1)->used()==0) continue;
 	      int lay1=(*phIt1)->layer();
 	      int type1=((*phIt1)->dz()<(*phIt1)->dr())?1:0;
 	      std::list<IdScanSpPoint *>::iterator phIt2=phIt1;
-	      phIt2++;
-	      for(;phIt2!=(*gItr2).groupHits().end();phIt2++)
+	      ++phIt2;
+	      for(;phIt2!=(*gItr2).groupHits().end();++phIt2)
 		{
 		  //if((*phIt2)->used()==0) continue;
 		  int lay2=(*phIt2)->layer();
@@ -499,7 +497,7 @@ void iHitFilter::groupCleaner( GroupList::iterator& inputItr, GroupList& cleanGr
 		    }
 		  else 
 		    {
-		      hitItr++;pSP->setUsed(1);
+		      ++hitItr;pSP->setUsed(1);
 		    }
 		}
 	    }
@@ -899,10 +897,8 @@ void TrackFilterClass::removeClones(int cut)
       (*pTCCIt)->m_nHitShift=nTrackCounter*nSign;
       memset(nContribHisto,0,sizeof(nContribHisto));
 
-      for(std::list<IdScanSpPoint *>::iterator hitItr=(*pTCCIt)->m_pGroup->groupHits().begin();
-	  hitItr!=(*pTCCIt)->m_pGroup->groupHits().end();hitItr++) 
+      for (IdScanSpPoint* pSP : (*pTCCIt)->m_pGroup->groupHits())
 	{
-	  IdScanSpPoint* pSP=(*hitItr);
 	  if(pSP->used()==0) continue;
 	  if(pSP->used()==1)
 	    pSP->setUsed((*pTCCIt)->m_nHitShift);
@@ -977,17 +973,15 @@ void iHitFilter::fitGroup(Group& G)
 
   double minPhi=(*G.groupHits().begin())->phi();
 
-  for(std::list<IdScanSpPoint *>::iterator hitItr=G.groupHits().begin();
-      hitItr!=G.groupHits().end();hitItr++) 
+  for (IdScanSpPoint* pSP : G.groupHits())
     {
-      if(minPhi>(*hitItr)->phi()) minPhi=(*hitItr)->phi();
-      spVec.push_back((*hitItr));
+      if(minPhi>pSP->phi()) minPhi=pSP->phi();
+      spVec.push_back(pSP);
     }
   std::sort(spVec.begin(),spVec.end(),CompareSpByLayer);
 
-  for(std::vector<IdScanSpPoint *>::iterator hitItr=spVec.begin();hitItr!=spVec.end();hitItr++) 
+  for (IdScanSpPoint* pSP : spVec)
     {
-      IdScanSpPoint* pSP=(*hitItr);
       nHits++;
       double delta=pSP->phi()-minPhi;
       if(std::fabs(delta)>M_PI) delta-=2.0*M_PI;
@@ -999,7 +993,7 @@ void iHitFilter::fitGroup(Group& G)
   printf("Average PHI0=%f Initial Pt=%f\n",averagePhi0,1.0/G.getPtInv());
 #endif
 
-  for(std::vector<IdScanSpPoint *>::reverse_iterator hitItr=spVec.rbegin();hitItr!=spVec.rend();hitItr++) 
+  for(std::vector<IdScanSpPoint *>::reverse_iterator hitItr=spVec.rbegin();hitItr!=spVec.rend();++hitItr) 
     {
       IdScanSpPoint* pSP=(*hitItr);
       if(pSP->used()!=0)
@@ -1309,17 +1303,15 @@ void iHitFilter::fitGroupWithoutHitRemoval(Group& G)
 
   double minPhi=(*G.groupHits().begin())->phi();
 
-  for(std::list<IdScanSpPoint *>::iterator hitItr=G.groupHits().begin();
-      hitItr!=G.groupHits().end();hitItr++) 
+  for (IdScanSpPoint* pSP : G.groupHits())
     {
-      if(minPhi>(*hitItr)->phi()) minPhi=(*hitItr)->phi();
-      spVec.push_back((*hitItr));
+      if(minPhi>pSP->phi()) minPhi=pSP->phi();
+      spVec.push_back(pSP);
     }
   std::sort(spVec.begin(),spVec.end(),CompareSpByLayer);
 
-  for(std::vector<IdScanSpPoint *>::iterator hitItr=spVec.begin();hitItr!=spVec.end();hitItr++) 
+  for (IdScanSpPoint* pSP : spVec)
     {
-      IdScanSpPoint* pSP=(*hitItr);
       if(pSP->used()==0)
 	pSP->setUsed(1);
       nHits++;
@@ -1333,7 +1325,7 @@ void iHitFilter::fitGroupWithoutHitRemoval(Group& G)
   printf("Average PHI0=%f Initial Pt=%f\n",averagePhi0,1.0/G.getPtInv());
 #endif
 
-  for(std::vector<IdScanSpPoint *>::reverse_iterator hitItr=spVec.rbegin();hitItr!=spVec.rend();hitItr++) 
+  for(std::vector<IdScanSpPoint *>::reverse_iterator hitItr=spVec.rbegin();hitItr!=spVec.rend();++hitItr) 
     {
       IdScanSpPoint* pSP=(*hitItr);
       int LayId=pSP->layer();
diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
index a4bf9b02d0957538e73106b6bf5b652a70ce21a2..5b6bf1006e680a28120e394fdda1ba8bc6ada375 100644
--- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
+++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
@@ -115,6 +115,9 @@ TrigSignatureMoniMT                                 INFO -- #1834383636 Features
 TrigSignatureMoniMT                                 INFO HLT_5j70_0eta240_L14J20 #1175391812
 TrigSignatureMoniMT                                 INFO -- #1175391812 Events         7          7          0          0          0          0          0          0          0          0          0          1          -          -          1
 TrigSignatureMoniMT                                 INFO -- #1175391812 Features                             0          0          0          0          0          0          0          0          0          5          -          -
+TrigSignatureMoniMT                                 INFO HLT_alfacalib_AlfaPEB_L1ALFA_ANY #4094852824
+TrigSignatureMoniMT                                 INFO -- #4094852824 Events         0          0          0          -          -          -          -          -          -          -          -          -          -          -          0
+TrigSignatureMoniMT                                 INFO -- #4094852824 Features                             0          -          -          -          -          -          -          -          -          -          -          -
 TrigSignatureMoniMT                                 INFO HLT_beamspot_allTE_trkfast_BeamSpotPEB_L1J15 #3989372080
 TrigSignatureMoniMT                                 INFO -- #3989372080 Events         20         20         20         20         -          -          -          -          -          -          -          -          -          -          20
 TrigSignatureMoniMT                                 INFO -- #3989372080 Features                             20         20         -          -          -          -          -          -          -          -          -          -
diff --git a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
index 19caee227831a31a4abbde6bea42e07ae48bd420..6047fbdf7596761b5d0a124fe3282a0508a31f0a 100644
--- a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
+++ b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
@@ -115,6 +115,9 @@ TrigSignatureMoniMT                                 INFO -- #1834383636 Features
 TrigSignatureMoniMT                                 INFO HLT_5j70_0eta240_L14J20 #1175391812
 TrigSignatureMoniMT                                 INFO -- #1175391812 Events         20         20         0          0          0          0          0          0          0          0          0          0          -          -          0          
 TrigSignatureMoniMT                                 INFO -- #1175391812 Features                             0          0          0          0          0          0          0          0          0          0          -          -          
+TrigSignatureMoniMT                                 INFO HLT_alfacalib_AlfaPEB_L1ALFA_ANY #4094852824
+TrigSignatureMoniMT                                 INFO -- #4094852824 Events         20         20         20         -          -          -          -          -          -          -          -          -          -          -          20         
+TrigSignatureMoniMT                                 INFO -- #4094852824 Features                             20         -          -          -          -          -          -          -          -          -          -          -          
 TrigSignatureMoniMT                                 INFO HLT_beamspot_allTE_trkfast_BeamSpotPEB_L1J15 #3989372080
 TrigSignatureMoniMT                                 INFO -- #3989372080 Events         20         20         20         20         -          -          -          -          -          -          -          -          -          -          20         
 TrigSignatureMoniMT                                 INFO -- #3989372080 Features                             20         20         -          -          -          -          -          -          -          -          -          -          
diff --git a/Trigger/TrigValidation/TriggerTest/share/testCommonSliceAthenaTrigRDO.py b/Trigger/TrigValidation/TriggerTest/share/testCommonSliceAthenaTrigRDO.py
index a679fdd0085f06d52ec906b30641b550359654c1..64f9d5b8d504dcd022568e490e092b341a3ef607 100644
--- a/Trigger/TrigValidation/TriggerTest/share/testCommonSliceAthenaTrigRDO.py
+++ b/Trigger/TrigValidation/TriggerTest/share/testCommonSliceAthenaTrigRDO.py
@@ -17,15 +17,6 @@ if ('enableCostMonitoring' in dir() and bool(enableCostMonitoring) == True):
 else: 
     enableCostMonitoring = False
 
-#RTT runs with costMonitoring on - test whether it is available in a given release
-#test whether a package is useable in this release
-import imp
-try:
-    imp.find_module('TrigCostD3PDMaker')
-except:
-    printfunc ('CostMonitoring packages not available, setting  enableCostMonitoring=False')
-    enableCostMonitoring=False
-
 # flags for RecExCommon
 doTrigger=True
 rec.doWriteAOD=False
@@ -183,7 +174,6 @@ if 'enableCostMonitoring' in dir() and bool(enableCostMonitoring) == True:
     import TriggerJobOpts.Modifiers
     getattr(TriggerJobOpts.Modifiers,'enableCostMonitoring')().postSetup()
     getattr(TriggerJobOpts.Modifiers,'enableCostForCAF')().postSetup()
-    getattr(TriggerJobOpts.Modifiers,'enableCostD3PD')().postSetup()
     # Check if we are debugging the cost mon output - false by default
     if 'enableCostDebug' in dir() and bool(enableCostDebug) == True:
         getattr(TriggerJobOpts.Modifiers,'enableCostDebug')().postSetup()
diff --git a/Trigger/TrigValidation/TriggerTest/share/testCommonSliceAthenaTrigRDOtoAOD.py b/Trigger/TrigValidation/TriggerTest/share/testCommonSliceAthenaTrigRDOtoAOD.py
index ee15054237ea320d5a6ab242a5ae19d438a21bed..8dc63e0d4a18b48b9b1de6839f4f28af9356c6f7 100644
--- a/Trigger/TrigValidation/TriggerTest/share/testCommonSliceAthenaTrigRDOtoAOD.py
+++ b/Trigger/TrigValidation/TriggerTest/share/testCommonSliceAthenaTrigRDOtoAOD.py
@@ -22,15 +22,6 @@ if ('enableCostMonitoring' in dir()):
 else: 
     enableCostMonitoring = False
 
-#RTT runs with costMonitoring on - test whether it is available in a given release
-#test whether a package is useable in this release
-import imp
-try:
-    imp.find_module('TrigCostD3PDMaker')
-except:
-    printfunc ('CostMonitoring packages not available, setting  enableCostMonitoring=False')
-    enableCostMonitoring=False
-
 # flags for RecExCommon
 #thanks to Olya for the "magic" AOD combination - see: https://its.cern.ch/jira/browse/ATR-11211
 doTrigger=True
@@ -208,7 +199,6 @@ if 'enableCostMonitoring' in dir() and bool(enableCostMonitoring) == True:
     import TriggerJobOpts.Modifiers
     getattr(TriggerJobOpts.Modifiers,'enableCostMonitoring')().postSetup()
     getattr(TriggerJobOpts.Modifiers,'enableCostForCAF')().postSetup()
-    getattr(TriggerJobOpts.Modifiers,'enableCostD3PD')().postSetup()
     # Check if we are debugging the cost mon output - false by default
     if 'enableCostDebug' in dir() and bool(enableCostDebug) == True:
         getattr(TriggerJobOpts.Modifiers,'enableCostDebug')().postSetup()
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Modifiers.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Modifiers.py
index 634c3b2c8cdbbb9537e4dea19e346c4cb847d904..1d20e1eb6f905367ad2fddbed3423183f1830631 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/Modifiers.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Modifiers.py
@@ -589,27 +589,6 @@ class forceMuonDataPrep(_modifier):
     def preSetup(self):
         pass  # the actual modifier is implemented in share/Trigger_topOptions_standalone.py
 
-class FakeLVL1(_modifier):
-    """
-    setup fake LVL1 RoIs
-    """
-    def postSetup(self):
-        from TrigFake.TrigFakeConf import FakeLvl1RoIatFixedEtaPhi
-        fake = FakeLvl1RoIatFixedEtaPhi()
-        fake.FakeMuonRoiPhi=TriggerFlags.CosmicSlice.FakeLVL1ROIPhi()
-        fake.FakeMuonRoiEta=TriggerFlags.CosmicSlice.FakeLVL1ROIEta()
-        #fake.FakeMuonRoiEta=0.5
-        fake.FakeMuonRoiLabel=TriggerFlags.CosmicSlice.FakeLVL1Threshold()
-        from AthenaCommon.AlgSequence import AlgSequence
-        topSequence = AlgSequence()
-        if hasattr(topSequence,"TrigSteer_HLT"):
-            topSequence.TrigSteer_HLT.LvlConverterTool =  fake
-            if (TriggerFlags.CosmicSlice.forceLVL2Accept()):
-                svcMgr.HltEventLoopMgr.ForceLvl2Accept =  True
-            if (TriggerFlags.CosmicSlice.filterEmptyROB()):
-                svcMgr.ROBDataProviderSvc.filterEmptyROB=True
-
-
 class rerunLVL1(_modifier):
     """
     Reruns the L1 simulation on real data
@@ -1288,37 +1267,6 @@ class autoConditionsTag(_modifier):
         from RecExConfig.AutoConfiguration import ConfigureConditionsTag
         ConfigureConditionsTag()
 
-
-class enableCostD3PD(_modifier):
-    """
-    Enables creation of Cost D3PD during trigger execution
-    Should be used in conjunction with enableCostMonitoring
-    D3PDMaker packages must be in the release or compiled manually
-    """
-    def postSetup(self):
-        import imp
-        try:
-            imp.find_module('TrigCostD3PDMaker')
-            from AthenaCommon.Include import include, IncludeError
-            include("TrigCostD3PDMaker/TrigCostD3PDMaker_prodJobOFragment.py")
-        except IncludeError:
-            log.error('TrigCostD3PDMaker packages not available, will not produce CostMonitoring D3PD.')
-
-class enableRateD3PD(_modifier):
-    """
-    Enables creation of Rate D3PD during trigger execution
-    Should be used in conjunction with enableCostMonitoring
-    D3PDMaker packages must be in the release or compiled manually
-    """
-    def postSetup(self):
-        import imp
-        try:
-            imp.find_module('TrigCostD3PDMaker')
-            from AthenaCommon.Include import include, IncludeError
-            include("TrigCostD3PDMaker/TrigRateD3PDMaker_prodJobOFragment.py")
-        except IncludeError:
-            log.warning('TrigCostD3PDMaker packages not available, will not produce RateMonitoring D3PD.')
-
 class enableCostDebug(_modifier):
     """
     Enables cost debugging options
@@ -1375,14 +1323,6 @@ class doEnhancedBiasWeights(_modifier):
             costConfig.postSetupEBWeighting()
         except AttributeError:
             log.warning('TrigCostMonitor has no EnhancedBias postSetup option...')
-        # Try to put this in D3PD (will only work offline), still goes in the BS anyway
-        import imp
-        try:
-            imp.find_module('TrigCostD3PDMaker')
-            from AthenaCommon.Include import include, ImportError
-            include("TrigCostD3PDMaker/TrigEBWeightD3PDMaker_prodJobOFragment.py")
-        except ImportError:
-            log.warning('TrigCostD3PDMaker packages not available, will not produce Enhanced Bias weighting D3PD.')
 
 class BeamspotFromSqlite(_modifier):
     """
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py
index dc2a5217125fd6158593a5eb475a5afb7e62826b..764f7f1e0ab96afbb69165c15bc080e1de8749a3 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py
@@ -494,7 +494,9 @@ class readL1TopoConfigFromXML(JobProperty):
 
     def _do_action(self):
         """ setup some consistency """
-        if self.get_Value() is False:
+        if self.get_Value():
+            TriggerFlags.inputL1TopoConfigFile = "TriggerMenuXML/L1Topoconfig_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml"
+        else:
             TriggerFlags.inputL1TopoConfigFile = TriggerFlags.outputL1TopoConfigFile()
 
 _flags.append(readL1TopoConfigFromXML)
@@ -521,6 +523,8 @@ class readLVL1configFromXML(JobProperty):
             TriggerFlags.inputLVL1configFile = TriggerFlags.outputLVL1configFile()
             TriggerFlags.Lvl1.items.set_On()
         else:
+            menuXMLPackage = "TriggerMenuMT" if TriggerFlags.doMT() else "TriggerMenuXML"
+            TriggerFlags.inputLVL1configFile = menuXMLPackage + "/LVL1config_"+_getMenuBaseName(TriggerFlags.triggerMenuSetup())+"_" + TriggerFlags.menuVersion() + ".xml"
             xmlFile=TriggerFlags.inputLVL1configFile()
             from TrigConfigSvc.TrigConfigSvcConfig import findFileInXMLPATH
             if xmlFile!='NONE' and not os.path.exists(findFileInXMLPATH(xmlFile)):
@@ -560,12 +564,11 @@ class readHLTconfigFromXML(JobProperty):
         else:
             if TriggerFlags.inputHLTconfigFile != 'NONE':
                 
-                TriggerFlags.inputHLTconfigFile = "HLTconfig_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml"
+                TriggerFlags.inputHLTconfigFile = "TriggerMenuXML/HLTconfig_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml"
                 nightlyPaths=os.environ['XMLPATH'].split(':')
 
                 for p in nightlyPaths:
-                    #print p+"/TriggerMenuXML/HLTconfig_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml"
-                    full_path_name = p+"/TriggerMenuXML/"+TriggerFlags.inputHLTconfigFile()
+                    full_path_name = p+"/"+TriggerFlags.inputHLTconfigFile()
                     if os.path.exists(full_path_name) is True:
                         log.info("The HLT xml file is: "+full_path_name)
                         success = True
@@ -614,12 +617,7 @@ class outputL1TopoConfigFile(JobProperty):
             # cases, e.g. MC_pp_v5_tight_mc_prescale. Prescaling is
             # not available for L1Topo, therefore that part is being
             # removed.
-            import re
-            menuSetup = TriggerFlags.triggerMenuSetup()
-            m = re.match(r'(.*v\d(?:_primaries)?).*', menuSetup)
-            if m:
-                menuSetup = m.groups()[0]
-            return "L1Topoconfig_" + menuSetup + "_" + TriggerFlags.menuVersion() + ".xml"
+            return "L1Topoconfig_" + _getMenuBaseName(TriggerFlags.triggerMenuSetup()) + "_" + TriggerFlags.menuVersion() + ".xml"
         else:
             return self.get_Value()
         
@@ -672,7 +670,7 @@ class inputL1TopoConfigFile(JobProperty):
     If TriggerFlags.readL1TopoConfigFromXML()==True, then this file is
     used for L1TopoConfiguration.
     
-    Defaults to L1TopoConfig_<triggerMenuSetup>_<menuVersion>.xml
+    Defaults to L1Topoconfig_<triggerMenuSetup>_<menuVersion>.xml
     """
     statusOn=True
     allowedType=['str']
@@ -680,7 +678,7 @@ class inputL1TopoConfigFile(JobProperty):
 
     def __call__(self):
         if self.get_Value() == "":
-            return "L1TopoConfig_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml"
+            return "L1Topoconfig_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml"
         else:
             return self.get_Value()
         
@@ -707,14 +705,11 @@ class inputLVL1configFile(JobProperty):
 _flags.append(inputLVL1configFile)
 
 # remove prescale suffixes
-def _getMenuBaseName( menuName):
-    log = logging.getLogger('TrigConfigSvcCfg')
-    pattern = re.compile(r'_v\d+|DC14')
-    patternPos = pattern.search(menuName)
-    if patternPos:
-        menuName=menuName[:patternPos.end()]
-    else:
-        log.info('Can\'t find pattern to shorten menu name, either non-existent in name or not implemented.')
+def _getMenuBaseName(menuName):
+    log = logging.getLogger(__name__)
+    m = re.match(r'(.*v\d(?:_primaries)?).*', menuName)
+    if m:
+        menuName = m.groups()[0]
     return menuName
 
 
@@ -861,7 +856,7 @@ class triggerMenuSetup(JobProperty):
         elif self.get_Value() == 'InitialBeam_default':
             self.set_Value(self._default_InitialBeam_menu)
             self._log.info("%s - trigger menu 'InitialBeam_default' changed to '%s'", self.__class__.__name__, self.get_Value())
-            
+
         # filenames for LVL1 and HLT
         if TriggerFlags.readLVL1configFromXML() is True:
             TriggerFlags.inputLVL1configFile = "LVL1config_"+_getMenuBaseName(TriggerFlags.triggerMenuSetup())+"_" + TriggerFlags.menuVersion() + ".xml"
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py
index 381efafe28d61dfbe50c59248a0ae24c754c39e4..2a9b7361c5a8f3d487307cb496d8149bcd5a35a5 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py
@@ -30,7 +30,6 @@ class opt:
     doMuon           = True           # ConfigFlags.Trigger.doMuon
     doDBConfig       = None           # dump trigger configuration
     trigBase         = None           # file name for trigger config dump
-    enableCostD3PD   = False          # enable cost monitoring
     doWriteRDOTrigger = False         # Write out RDOTrigger?
     doWriteBS        = True           # Write out BS?
     doL1Unpacking    = True           # decode L1 data in input file if True, else setup emulation
@@ -44,6 +43,10 @@ class opt:
     enableL1Phase1   = False          # Enable Run-3 LVL1 simulation and/or decoding
     enableL1CaloLegacy = True         # Enable Run-2 L1Calo simulation and/or decoding (possible even if enablePhase1 is True)
 #Individual slice flags
+    doCalibSlice        = True
+    doTestSlice         = True
+    doHeavyIonSlice     = True
+    doEnhancedBiasSlice = True
     doEgammaSlice     = True
     doMuonSlice       = True
     doMinBiasSlice    = True
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/CalibChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/CalibChainConfiguration.py
new file mode 100644
index 0000000000000000000000000000000000000000..3a9ea2d4fb545cd950674244e6e012b3383d7268
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/CalibChainConfiguration.py
@@ -0,0 +1,25 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.Logging import logging
+logging.getLogger().info("Importing %s",__name__)
+log = logging.getLogger("TriggerMenuMT.HLTMenuConfig.CalibCosmicMon.CalibChainConfiguration")
+
+from TriggerMenuMT.HLTMenuConfig.Menu.ChainConfigurationBase import ChainConfigurationBase
+
+#----------------------------------------------------------------
+class CalibChainConfiguration(ChainConfigurationBase):
+
+    def __init__(self, chainDict):
+        ChainConfigurationBase.__init__(self,chainDict)
+        
+    # ----------------------
+    # Assemble the chain depending on information from chainName
+    # ----------------------
+    def assembleChain(self):       
+                         
+        chainSteps = []
+        log.debug("Assembling chain for " + self.chainName)
+        myChain = self.buildChain(chainSteps)
+        return myChain
+
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/GenerateCalibChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/GenerateCalibChainDefs.py
new file mode 100644
index 0000000000000000000000000000000000000000..7db53d3b1c51b38e6180e4a61140eddaafe96e22
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/GenerateCalibChainDefs.py
@@ -0,0 +1,38 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitChainDict
+from TriggerMenuMT.HLTMenuConfig.CalibCosmicMon.CalibChainConfiguration import CalibChainConfiguration as CalibChainConfiguration
+from TriggerMenuMT.HLTMenuConfig.Menu.ChainMerging import mergeChainDefs
+
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.CalibCosmicMon.generateChainConfigs' )
+log.info("Importing %s",__name__)
+
+
+
+def generateChainConfigs( chainDict ):
+
+    listOfChainDicts = splitChainDict(chainDict)
+    log.debug("Will generate Config for streamer: %s", chainDict['chainName'])
+
+    listOfChainDefs = []
+        
+    #streamers will never have more than one chainPart but this is still
+    #needed to move to the correct format [{}]->{}
+    for subChainDict in listOfChainDicts:
+        
+        Calib = CalibChainConfiguration(subChainDict).assembleChain() 
+
+        listOfChainDefs += [Calib]
+        log.debug('length of chaindefs %s', len(listOfChainDefs) )
+
+    if len(listOfChainDefs)>1:
+        log.warning("This is a streamer with more than one chainPart, is this really intended?")
+        theChainDef = mergeChainDefs(listOfChainDefs, chainDict)
+    else:
+        theChainDef = listOfChainDefs[0]
+
+    log.debug("theChainDef %s" , theChainDef)
+
+    return theChainDef
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py
index 5c05433350f4a8a1202d877939474eb7391ccc9a..4ac4fbc205233ffd7967e8523b72fdda31af1f9c 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py
@@ -28,12 +28,6 @@ def fastElectronSequence(ConfigFlags):
     viewVerify.DataObjects += [( 'xAOD::TrigEMClusterContainer' , 'StoreGateSvc+' + CaloMenuDefs.L2CaloClusters ),
                                ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+'+RoIs )]
 
-    from IOVDbSvc.CondDB import conddb
-    if not conddb.folderRequested( "/PIXEL/DCS/FSMSTATUS"):
-      viewVerify.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/PIXEL/DCS/FSMSTATUS' )]
-    if not conddb.folderRequested( "/PIXEL/DCS/FSMSTATE"):
-      viewVerify.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/PIXEL/DCS/FSMSTATE' )]
-    
     TrackParticlesName = ""
     for viewAlg in viewAlgs:
         if "InDetTrigTrackParticleCreatorAlg" in viewAlg.name():
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py
index 103ecceeadc503064c1c3443ce3817ba9117a8e8..43c8626b8c53888335abf2fec51b8454c0dc5f05 100755
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py
@@ -273,7 +273,7 @@ def analyseChainName(chainName, L1thresholds, L1item):
             for chainCategory in [(['mb'], 'MinBias', 'mb'),
                                   (['hi'], 'HeavyIon', 'mb'),
                                   (AllowedCosmicChainIdentifiers, 'Cosmic', 'cosmic'),
-                                  (AllowedCalibChainIdentifiers, 'Calibration', 'calib'),
+                                  (AllowedCalibChainIdentifiers, 'Calib', 'calib'),
                                   (AllowedMonitorChainIdentifiers, 'Monitor', 'calib'),
                                   (AllowedBeamspotChainIdentifiers, 'Beamspot', 'beamspot'),
                                   (['eb'], 'EnhancedBias', 'eb') ]:
@@ -357,7 +357,7 @@ def analyseChainName(chainName, L1thresholds, L1item):
 
         log.debug('Chainparts: %s', chainparts)
         if (chainProperties['signature'] != 'Cosmic') \
-                & (chainProperties['signature'] != 'Calibration')\
+                & (chainProperties['signature'] != 'Calib')\
                 & (chainProperties['signature'] != 'Streaming') \
                 & (chainProperties['signature'] != 'Beamspot') \
                 & (chainProperties['signature'] != 'Monitor') :
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
index ed86e2d0c3d480d68d2b59dbda569d63150c8bab..139b8e871d87f2a9faa5eea11c9ae40af521edff 100755
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
@@ -67,7 +67,7 @@ class GenerateMenuMT(object):
         self.allSignatures = ['Egamma', 'Muon', 'Jet', 'Bjet', 'Bphysics', 'MET', 'Tau',
                               'HeavyIon', 'Beamspot', 'Cosmic', 'EnhancedBias',
                               'Monitor', 'Calib', 'Streaming', 'Combined', 'MinBias', 'Test'] #, AFP
-        self.calibCosmicMonSigs = ['Streaming','Monitor','Beamspot','Cosmic'] #others not implemented yet ['Beamspot', 'Cosmic', 'EnhancedBias', 'Monitor', 'Calib', 'Streaming']
+        self.calibCosmicMonSigs = ['Streaming','Monitor','Beamspot','Cosmic', 'Calib'] #others not implemented yet ['Beamspot', 'Cosmic', 'EnhancedBias', 'Monitor', 'Calib', 'Streaming']
 
         # flags
         self.doEgammaChains         = True
@@ -81,7 +81,7 @@ class GenerateMenuMT(object):
         self.doMinBiasChains        = True
         self.doHeavyIonChains       = True
         self.doCosmicChains         = True
-        self.doCalibrationChains    = True
+        self.doCalibChains    = True
         self.doStreamingChains      = True
         self.doMonitorChains        = True
         self.doBeamspotChains       = True
@@ -398,7 +398,11 @@ class GenerateMenuMT(object):
         # Assembles the chain configuration and returns a chain object with (name, L1see and list of ChainSteps)
         """
         # check if all the signature files can be imported files can be imported
+        log.debug("[__generateChainConfig] signaturesToGenerate: %s",  self.signaturesToGenerate)
+
         for sig in self.signaturesToGenerate:
+            log.debug("[__generateChainConfig] sig: %s", sig)
+            
             try:
                 if eval('self.do' + sig + 'Chains'):
                     if sig == 'Egamma':
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
index 4040349be14f40ef0e4b11b9ec6cbbfc852d7123..063988bdec99e2902d1b088e1888f2d54269c185 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
@@ -22,7 +22,8 @@ SliceIDDict = {
     'MinBias' : 'mb',
     'HeavyIon' : 'hi',
     'Cosmic'  : 'cosmic',
-    'Calibration'   : 'calib',
+    'Calib'   : 'calib',
+    #'Calib'   : 'calib',
     'Streaming'     : 'streamer',
     'Monitor'    : 'mon',
     'Beamspot'      : 'beamspot',
@@ -632,8 +633,8 @@ AllowedCalibChainIdentifiers = ['csccalib',     'larcalib',
 ##stramingInfo not use in ChainConfiguration, only to distinguish streaming
 
 CalibChainParts = {
-    'signature'      : ['Calibration'],
-    'alignmentGroup' : ['Calibration'],
+    'signature'      : ['Calib'],
+    'alignmentGroup' : ['Calib'],
     'chainPartName'  : '',
     'L1threshold'    : '',
     'purpose'        : AllowedCalibChainIdentifiers,
@@ -649,14 +650,14 @@ CalibChainParts = {
 
 # ---- Calib Chain Default Dictinary of all allowed Values ----
 CalibChainParts_Default = {
-    'signature'      : ['Calibration'],
-    'alignmentGroup' : ['Calibration'],
+    'signature'      : ['Calib'],
+    'alignmentGroup' : ['Calib'],
     'chainPartName'  : '',
     'L1threshold'    : '',
     'purpose'        : [],
     'addInfo'        : [],
     'hypo'           : '',
-    'hits'           : [],
+    # 'hits'           : [],
     'streamingInfo'  : [],
     'threshold'      : '',
     'multiplicity'   : '',
@@ -849,7 +850,7 @@ def getSignatureInformation(signature):
         return [HeavyIonChainParts_Default, HeavyIonChainParts]
     if signature == "Cosmic":
         return [CosmicChainParts_Default, CosmicChainParts]
-    if signature == "Calibration":
+    if signature == "Calib":
         return [CalibChainParts_Default, CalibChainParts]
     if signature == "Streaming":
         return [StreamingChainParts_Default, StreamingChainParts]
@@ -862,7 +863,7 @@ def getSignatureInformation(signature):
     if signature == "Test":
         return [TestChainParts_Default, TestChainParts]
     else:
-        raise RuntimeError("ERROR Cannot find corresponding dictionary")
+        raise RuntimeError("ERROR Cannot find corresponding dictionary for signature", signature)
 
 #==========================================================
 # Analysis the base pattern: <mult><signatureType><threshold><extraInfo>
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py
index bb92b344c250a61dd3cf1333961e563c861d4b63..be042ccaf556fcabdfc5c31ad41f1992b616aff7 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py
@@ -65,12 +65,6 @@ class MinBiasChainConfig(ChainConfigurationBase):
                                            ( 'PixelID' , 'DetectorStore+PixelID' ),
                                            ( 'TagInfo' , 'DetectorStore+ProcessingTags' )]
 
-        from IOVDbSvc.CondDB import conddb
-        if not conddb.folderRequested( '/PIXEL/DCS/FSMSTATE' ):
-          verifier.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/PIXEL/DCS/FSMSTATE' )]
-        if not conddb.folderRequested( '/PIXEL/DCS/FSMSTATUS' ):
-          verifier.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/PIXEL/DCS/FSMSTATUS' )]
-
         SpList = idAlgs[:-2]
 
         SpCount=TrigCountSpacePointsMT()
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py
index 8ba5a2aee278c62eb0e47a33efc438b7f3da4771..20ae6f40614bdc1609182cc65f0abca6517c0bb3 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py
@@ -130,11 +130,6 @@ def muCombAlgSequence(ConfigFlags):
     muCombFilterSequence = seqAND("l2muCombFilterSequence", [muonChainFilter, muCombRecoSequence])
 
     extraLoads = []
-    from IOVDbSvc.CondDB import conddb
-    if not conddb.folderRequested( '/PIXEL/DCS/FSMSTATUS' ):
-      extraLoads += [( 'CondAttrListCollection' , 'ConditionStore+/PIXEL/DCS/FSMSTATUS' )]
-    if not conddb.folderRequested( '/PIXEL/DCS/FSMSTATE' ):
-      extraLoads += [( 'CondAttrListCollection' , 'ConditionStore+/PIXEL/DCS/FSMSTATE' )]
 
     for decision in muonChainFilter.InputDecisions:
       extraLoads += [( 'xAOD::TrigCompositeContainer' , 'StoreGateSvc+'+decision )]
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py
index 7f7b73870e7b4210a158ee9e73831e91e023b9e5..1ae0bfc23eff876aaed5aaca7be677b46184e1c4 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py
@@ -499,9 +499,6 @@ def muCombRecoSequence( RoIs, name ):
   ViewVerify = CfgMgr.AthViews__ViewDataVerifier("muFastViewDataVerifier")
   ViewVerify.DataObjects = [('xAOD::L2StandAloneMuonContainer','StoreGateSvc+'+muNames.L2SAName)]
 
-  from IOVDbSvc.CondDB import conddb
-  if not conddb.folderRequested( '/TDAQ/Resources/ATLAS/PIXEL/Modules' ):
-    ViewVerify.DataObjects += [( 'CondAttrListCollection', 'ConditionStore+/TDAQ/Resources/ATLAS/PIXEL/Modules' )]
   muCombRecoSequence+=ViewVerify
 
   ### please read out TrigmuCombMTConfig file ###
@@ -568,13 +565,6 @@ def muEFSARecoSequence( RoIs, name ):
                                         ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+'+RoIs )]
   efAlgs.append( EFMuonViewDataVerifier )
 
-  # Only load these objects if they aren't available in conddb
-  from IOVDbSvc.CondDB import conddb
-  if not conddb.folderRequested( "/MDT/DQMF/DEAD_ELEMENT" ):
-    EFMuonViewDataVerifier.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/MDT/DQMF/DEAD_ELEMENT' )]
-  if not conddb.folderRequested( "/MDT/TUBE_STATUS/DEAD_TUBE" ):
-    EFMuonViewDataVerifier.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/MDT/TUBE_STATUS/DEAD_TUBE' )]
-
   #need MdtCondDbAlg for the MuonStationIntersectSvc (required by segment and track finding)
   from AthenaCommon.AlgSequence import AthSequencer
   from MuonCondAlg.MuonTopCondAlgConfigRUN2 import MdtCondDbAlg
@@ -683,12 +673,8 @@ def muEFCBRecoSequence( RoIs, name ):
 
   muEFCBRecoSequence += ViewVerifyMS
 
-  # Add conditions data if not already available
-  from IOVDbSvc.CondDB import conddb
   from AthenaCommon.AlgSequence import AlgSequence
   topSequence = AlgSequence()
-  if not conddb.folderRequested( "/PIXEL/PixdEdx" ):
-    ViewVerifyMS.DataObjects += [( 'AthenaAttributeList' , 'ConditionStore+/PIXEL/PixdEdx' )]
 
   if not globalflags.InputFormat.is_bytestream():
     topSequence.SGInputLoader.Load += [( 'TRT_RDO_Container' , 'StoreGateSvc+TRT_RDOs' )]
@@ -937,9 +923,9 @@ def efmuisoRecoSequence( RoIs, Muons ):
                              ( 'xAOD::MuonContainer' , 'StoreGateSvc+IsoViewMuons' )]
 
   # Make sure required objects are still available at whole-event level
-  from AthenaCommon.AlgSequence import AlgSequence
-  topSequence = AlgSequence()
   if not globalflags.InputFormat.is_bytestream():
+    from AthenaCommon.AlgSequence import AlgSequence
+    topSequence = AlgSequence()
     viewVerify.DataObjects += [( 'TRT_RDO_Container' , 'StoreGateSvc+TRT_RDOs' )]
     topSequence.SGInputLoader.Load += [( 'TRT_RDO_Container' , 'StoreGateSvc+TRT_RDOs' )]
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py
index a09d7e2fec799c2c0b10f24d4f11cf15c9fc73d3..edc78390432053308668e60fe228aace804e3ade 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py
@@ -142,7 +142,6 @@ def tauCaloSequence(ConfigFlags):
     tauCaloRecoVDV = CfgMgr.AthViews__ViewDataVerifier( "tauCaloRecoVDV" )
     tauCaloRecoVDV.DataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+TAUCaloRoIs' ),
                                   ( 'CaloBCIDAverage' , 'StoreGateSvc+CaloBCIDAverage' ),
-                                  ( 'ILArHVScaleCorr' , 'ConditionStore+LArHVScaleCorrRecomputed' ),
                                   ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ),
                                   ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.ActIntPerXDecor' ),
                                   ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.AveIntPerXDecor' )]
@@ -169,7 +168,6 @@ def tauCaloMVASequence(ConfigFlags):
     tauCaloMVARecoVDV = CfgMgr.AthViews__ViewDataVerifier( "tauCaloMVARecoVDV" )
     tauCaloMVARecoVDV.DataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+TAUCaloRoIs' ),
                                      ( 'CaloBCIDAverage' , 'StoreGateSvc+CaloBCIDAverage' ),
-                                     ( 'ILArHVScaleCorr' , 'ConditionStore+LArHVScaleCorrRecomputed' ),
                                      ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ),
                                      ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.ActIntPerXDecor' ),
                                      ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.AveIntPerXDecor' )]
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Menu/Menu_MC_pp_v8.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Menu/Menu_MC_pp_v8.py
index 98149e1c2615fb67ea8f3cb5908881bfd954651c..d4c6cc4797fc6e927ffaa30e3065d0760c354e75 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Menu/Menu_MC_pp_v8.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Menu/Menu_MC_pp_v8.py
@@ -1,3 +1,4 @@
+
 # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 #
 # Run this file in order to print out the empty slots
@@ -387,6 +388,7 @@ def defineMenu():
         'L1_CEP-CJ50' ,
         'L1_CEP-CJ50.ETA21',
 
+        #ATR-21371
         'L1_ALFA_ANY',
         'L1_ALFA_ELAST15', 'L1_ALFA_ELAST18',
         'L1_ALFA_B7L1U','L1_ALFA_B7L1L','L1_ALFA_A7L1U','L1_ALFA_A7L1L','L1_ALFA_A7R1U','L1_ALFA_A7R1L','L1_ALFA_B7R1U','L1_ALFA_B7R1L', # L1_ALFA_Calib
@@ -814,7 +816,7 @@ def defineMenu():
         'L1_eEM15VHI_2eTAU12IM_gXERHO35' : 477,
         'L1_eEM15VH_MU10' : 478,
         'L1_eEM18VHI_3jJ20' : 489,
-        'L1_eEM20VHI_eTAU20IM_2eTAU20_jJ25_3jJ20' :  490,
+        'L1_ALFA_ANY' : 490,
         'L1_eEM20VH_3eEM10VH' : 491,
         'L1_eEM22VHI' : 492,
         'L1_eEM20VHI' : 493, 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/Menu_LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/Menu_LS2_v1.py
index de27d8d0907060465f65e0f3feb42d90625a98db..392cee0fe415902dda6796f308f41b41a57dd818 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/Menu_LS2_v1.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/Menu_LS2_v1.py
@@ -626,6 +626,9 @@ def defineMenu():
         ##     'L1_CALREQ0_P1', 'L1_CALREQ1_P1', 'L1_CALREQ2_P1',
 
         #ALFA
+        'L1_ALFA_ANY',
+        'L1_ALFA_B7L1U','L1_ALFA_B7L1L','L1_ALFA_A7L1U','L1_ALFA_A7L1L','L1_ALFA_A7R1U','L1_ALFA_A7R1L','L1_ALFA_B7R1U','L1_ALFA_B7R1L',
+        
 #        'L1_ALFA_SDIFF5','L1_ALFA_SDIFF6','L1_ALFA_SDIFF7','L1_ALFA_SDIFF8',
 #        'L1_MBTS_1_A_ALFA_C','L1_MBTS_1_C_ALFA_A','L1_MBTS_1_A_ALFA_C_UNPAIRED_ISO','L1_MBTS_1_C_ALFA_A_UNPAIRED_ISO',
 #        'L1_MBTS_2_A_ALFA_C','L1_MBTS_2_C_ALFA_A','L1_MBTS_2_A_ALFA_C_UNPAIRED_ISO','L1_MBTS_2_C_ALFA_A_UNPAIRED_ISO',
@@ -994,7 +997,14 @@ def defineMenu():
         'L1_MBTS_1_1_EMPTY' : 168,
         'L1_BPH-8M15-2MU4-BO' : 165,
         'L1_CALREQ2' : 511,
-
+        'L1_ALFA_B7L1U' : 489,
+        'L1_ALFA_ANY'   : 490,
+        'L1_ALFA_A7L1U' : 491,
+        'L1_ALFA_A7L1L' : 492,
+        'L1_ALFA_A7R1U' : 493,
+        'L1_ALFA_A7R1L' : 494,
+        'L1_ALFA_B7R1U' : 495,
+        'L1_ALFA_B7R1L' : 496,
 }