diff --git a/AtlasTest/ControlTest/test/ProxyProviderSvc_test.cxx b/AtlasTest/ControlTest/test/ProxyProviderSvc_test.cxx
index 1f2613e2486a2af299a180150b9afaecfe1c7708..9d40684058923e1855a38a7bf06d8bd750a60359 100644
--- a/AtlasTest/ControlTest/test/ProxyProviderSvc_test.cxx
+++ b/AtlasTest/ControlTest/test/ProxyProviderSvc_test.cxx
@@ -37,8 +37,6 @@
 #include "GaudiKernel/ClassID.h"
 
 
-#include <string>
-
 using namespace Athena_test;
 using std::cerr;
 using std::cout;
diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/CMakeLists.txt b/AtlasTest/DatabaseTest/AthenaPoolTest/CMakeLists.txt
index 9ae93acd3d74ea1c62d4199ed39c7542fe951559..6a2f55344dd18029ac3b6f54d54f2e6a3e4919f2 100644
--- a/AtlasTest/DatabaseTest/AthenaPoolTest/CMakeLists.txt
+++ b/AtlasTest/DatabaseTest/AthenaPoolTest/CMakeLists.txt
@@ -34,7 +34,7 @@ function (athenapooltest_run_test testName jo pattern)
   atlas_add_test( ${testName}
                   SCRIPT athena.py AthenaPoolTest/${jo}.py
                   LOG_SELECT_PATTERN ${pattern}
-                  LOG_IGNORE_PATTERN "DEBUG Try item:|AthenaAttribute.*DB=|AtlasRelease"
+                  LOG_IGNORE_PATTERN "DEBUG Try item:|AthenaAttribute.*DB=|AtlasRelease|Release version"
                   PROPERTIES TIMEOUT 900 )
   if( ARG_DEPENDS )
     foreach( _dep ${ARG_DEPENDS} )
diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/src/AthenaPoolTestDataReader.cxx b/AtlasTest/DatabaseTest/AthenaPoolTest/src/AthenaPoolTestDataReader.cxx
index b3acf22b6ec1191ed8ba973aa8fc1930fe06e153..e9fccb493c7ff3b16e6e2faf201ce008c3c18eac 100755
--- a/AtlasTest/DatabaseTest/AthenaPoolTest/src/AthenaPoolTestDataReader.cxx
+++ b/AtlasTest/DatabaseTest/AthenaPoolTest/src/AthenaPoolTestDataReader.cxx
@@ -23,7 +23,6 @@
 #include "AthenaPoolTestData/AthenaPoolTestC.h"
 #include "AthenaPoolTestData/AthenaPoolTestD.h"
 #include "AthenaPoolTestData/AthenaPoolTestMatrix.h"
-#include "AthenaPoolTestData/AthenaPoolTestMatrix.h"
 #include "AthenaPoolTestData/AthenaPoolTestMap.h"
 #include "AthenaPoolTestData/dummy_A.h"
 #include "AthenaPoolTestData/dummy_E.h"
diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/src/FakeTrackBuilder.cxx b/AtlasTest/DatabaseTest/AthenaPoolTest/src/FakeTrackBuilder.cxx
index be09258ea15d60bd4dc8a08b587f0324259ca863..47ca2c5e38e5cb05bad7405f0f9d073c5c05c1e4 100644
--- a/AtlasTest/DatabaseTest/AthenaPoolTest/src/FakeTrackBuilder.cxx
+++ b/AtlasTest/DatabaseTest/AthenaPoolTest/src/FakeTrackBuilder.cxx
@@ -25,7 +25,6 @@
 #include "TrkVertexOnTrack/VertexOnTrack.h"
 
 // include InDet EDM
-// #include "InDetRIO_OnTrack/PixelClusterOnTrack.h"
 #include "InDetPrepRawData/SiClusterCollection.h"
 #include "InDetPrepRawData/SiCluster.h"
 #include "Identifier/IdentifierHash.h"
diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/src/TrkTrackFakeWriter.cxx b/AtlasTest/DatabaseTest/AthenaPoolTest/src/TrkTrackFakeWriter.cxx
index 38941d433869292b54274267dafdbb2c8c72faa2..6791ce4da23e660e87558565951d1a35d3793844 100755
--- a/AtlasTest/DatabaseTest/AthenaPoolTest/src/TrkTrackFakeWriter.cxx
+++ b/AtlasTest/DatabaseTest/AthenaPoolTest/src/TrkTrackFakeWriter.cxx
@@ -41,7 +41,6 @@
 #include "TrkMaterialOnTrack/EstimatedBremOnTrack.h"
 
 // include InDet EDM
-// #include "InDetRIO_OnTrack/PixelClusterOnTrack.h"
 #include "InDetPrepRawData/SiClusterCollection.h"
 #include "InDetPrepRawData/SiCluster.h"
 #include "Identifier/IdentifierHash.h"
diff --git a/Calorimeter/CaloExample/CaloTests/src/MyAnalysisCal.cxx b/Calorimeter/CaloExample/CaloTests/src/MyAnalysisCal.cxx
index 378cdcf0a7cf5bf236d10c5765b012cd167f0ddb..c869448e2b44b033cca6513c5eed427d44fc0462 100644
--- a/Calorimeter/CaloExample/CaloTests/src/MyAnalysisCal.cxx
+++ b/Calorimeter/CaloExample/CaloTests/src/MyAnalysisCal.cxx
@@ -66,18 +66,14 @@ namespace MyAnalysisCal {
       {
        McEventCollection::const_iterator itr;
        for (itr = mcCollptr->begin(); itr!=mcCollptr->end(); ++itr) {
-        HepMC::GenEvent::particle_const_iterator itrPart;
-        for (itrPart = (*itr)->particles_begin(); itrPart!=(*itr)->particles_end(); ++itrPart )
+        for (auto part: **itr )
        {
-        HepMC::GenParticle *part=*itrPart;
-         if(  (abs(part->pdg_id())==11 || part->pdg_id()==22)
-              && part->momentum().e()> 5000.)
+         if(  (std::abs(part->pdg_id())==11 || part->pdg_id()==22)&& part->momentum().e()> 5000.)
          {
           e_true = part->momentum().e();
           eta_true = part->momentum().pseudoRapidity();
           phi_true = part->momentum().phi();
-          ATH_MSG_INFO( " true particle found " << part->pdg_id() << " " <<
-                        e_true << " " << eta_true << " " << phi_true  );
+          ATH_MSG_INFO( " true particle found " << part->pdg_id() << " " <<e_true << " " << eta_true << " " << phi_true  );
   
          } // e or gamma found
         }  // loop over particle
diff --git a/Commission/CommissionRec/src/ComTimeRec.cxx b/Commission/CommissionRec/src/ComTimeRec.cxx
index 7d3d63ee31233d69251c61982775b9e214dfce42..fc82bd90879075e676d51e684f1824aad8a659b1 100755
--- a/Commission/CommissionRec/src/ComTimeRec.cxx
+++ b/Commission/CommissionRec/src/ComTimeRec.cxx
@@ -10,13 +10,9 @@
 
 #include "CommissionEvent/ComTime.h"
 
-// #include "TrackRecord/TimedTrackRecordCollection.h"
-// #include "TrackRecord/TimedTrackRecord.h"
 #include "TrackRecord/TrackRecordCollection.h"
 #include "TrackRecord/TrackRecord.h"
 
-#include "CLHEP/Units/SystemOfUnits.h"
-
 #include <algorithm>
 
 //----------------------------------------------------------------
diff --git a/Control/AthAllocators/AthAllocators/Arena.h b/Control/AthAllocators/AthAllocators/Arena.h
index 5875379b98688606e7e8f6c9fe3d749285341228..21a354f3485d40d97564700e60a84bccf5f82bbf 100644
--- a/Control/AthAllocators/AthAllocators/Arena.h
+++ b/Control/AthAllocators/AthAllocators/Arena.h
@@ -222,7 +222,6 @@
 #include "AthAllocators/ArenaAllocatorBase.h"
 #include <cstdlib>
 #include <string>
-#include <string>
 #include <ostream>
 
 
diff --git a/Control/AthenaBaseComps/AthenaBaseComps/AthCommonDataStore.h b/Control/AthenaBaseComps/AthenaBaseComps/AthCommonDataStore.h
index 73d1a3010cba095a21c6a970faec2529788f9871..933172aa014c4aacc03db03c3c82b8f25f6d1a39 100644
--- a/Control/AthenaBaseComps/AthenaBaseComps/AthCommonDataStore.h
+++ b/Control/AthenaBaseComps/AthenaBaseComps/AthCommonDataStore.h
@@ -39,7 +39,6 @@ namespace Gaudi {
 
 #include "GaudiKernel/ServiceHandle.h"
 #include "StoreGate/StoreGateSvc.h"
-#include "StoreGate/VarHandleKeyArray.h"
 #include "StoreGate/VarHandleProperty.h"
 #include "StoreGate/VarHandleKeyProperty.h"
 #include "StoreGate/VarHandleKey.h"
diff --git a/Control/AthenaConfiguration/python/AthConfigFlags.py b/Control/AthenaConfiguration/python/AthConfigFlags.py
index f4c24d09b9a435eaeaa977ab5a2c2c6a175b15f2..b7e8f2a2d0f4f491365c8aa0c080ba0e240661ec 100644
--- a/Control/AthenaConfiguration/python/AthConfigFlags.py
+++ b/Control/AthenaConfiguration/python/AthConfigFlags.py
@@ -302,6 +302,9 @@ class AthConfigFlags(object):
                                + repr(replacementNames - replacedNames))
         newFlags = AthConfigFlags(newFlagDict)
         newFlags._dynaflags = deepcopy(self._dynaflags)
+        
+        if self._locked:
+            newFlags.lock()
         return newFlags
 
 
diff --git a/Control/AthenaConfiguration/python/iconfTool/gui/pad.py b/Control/AthenaConfiguration/python/iconfTool/gui/pad.py
index 15cb2d9d977aa51890c6f9e3cf36e6f21b4b4294..a51659ffd6dc2b05ef0f0abac503eca4e42b8d01 100755
--- a/Control/AthenaConfiguration/python/iconfTool/gui/pad.py
+++ b/Control/AthenaConfiguration/python/iconfTool/gui/pad.py
@@ -5,8 +5,11 @@ import logging
 import sys
 from typing import Dict, List, Set, Tuple
 
-from models.element import Element, GroupingElement
-from models.structure import ComponentsStructure
+from AthenaConfiguration.iconfTool.models.element import (
+    Element,
+    GroupingElement,
+)
+from AthenaConfiguration.iconfTool.models.structure import ComponentsStructure
 
 logger = logging.getLogger(__name__)
 
diff --git a/Control/AthenaConfiguration/python/iconfTool/gui/wrappers.py b/Control/AthenaConfiguration/python/iconfTool/gui/wrappers.py
index 9dca20ae97b15fb7f5d2ac3f876305737708c7e5..84611f2ce9d5f6854eac6ec8826e658b223892c8 100755
--- a/Control/AthenaConfiguration/python/iconfTool/gui/wrappers.py
+++ b/Control/AthenaConfiguration/python/iconfTool/gui/wrappers.py
@@ -4,10 +4,17 @@ import curses
 import logging
 from typing import Any, Tuple
 
-from gui.modals import DoubleHelpModal, SearchModal, SingleHelpModal
-from gui.pad import Pad
-from models.loaders import ComponentsDiffFileLoader, ComponentsFileLoader
-from models.structure import ComponentsStructure
+from AthenaConfiguration.iconfTool.gui.modals import (
+    DoubleHelpModal,
+    SearchModal,
+    SingleHelpModal,
+)
+from AthenaConfiguration.iconfTool.gui.pad import Pad
+from AthenaConfiguration.iconfTool.models.loaders import (
+    ComponentsDiffFileLoader,
+    ComponentsFileLoader,
+)
+from AthenaConfiguration.iconfTool.models.structure import ComponentsStructure
 
 logger = logging.getLogger(__name__)
 
diff --git a/Control/AthenaConfiguration/python/iconfTool/models/loaders.py b/Control/AthenaConfiguration/python/iconfTool/models/loaders.py
index 7b390ac5eb159eedbac29318d7fdc4782bb8e4a6..22002d399f78017aed8ad16bf8d154e8ff8ed4ed 100755
--- a/Control/AthenaConfiguration/python/iconfTool/models/loaders.py
+++ b/Control/AthenaConfiguration/python/iconfTool/models/loaders.py
@@ -4,8 +4,11 @@ import pickle
 import logging
 from typing import Dict, List, Set, Tuple, cast
 
-from models.element import Element, GroupingElement
-from models.structure import ComponentsStructure
+from AthenaConfiguration.iconfTool.models.element import (
+    Element,
+    GroupingElement,
+)
+from AthenaConfiguration.iconfTool.models.structure import ComponentsStructure
 
 logger = logging.getLogger(__name__)
 
diff --git a/Control/AthenaConfiguration/python/iconfTool/models/structure.py b/Control/AthenaConfiguration/python/iconfTool/models/structure.py
index 897f2c5b6441cb376a1ad2b7754df2c227671597..dbaed1e0b997a4aa36d4728966f8c9cfb6be85ad 100755
--- a/Control/AthenaConfiguration/python/iconfTool/models/structure.py
+++ b/Control/AthenaConfiguration/python/iconfTool/models/structure.py
@@ -4,7 +4,7 @@ import ast
 import logging
 from typing import Callable, Dict, List, Sequence, Set, Tuple
 
-from models.element import (
+from AthenaConfiguration.iconfTool.models.element import (
     Element,
     SingleElement,
     GroupingElement,
diff --git a/Control/AthenaConfiguration/share/confTool.py b/Control/AthenaConfiguration/share/confTool.py
index 75e501a0917916bbe41a05b8925f02f9d2b004c3..c46c725b8797f5a49680b757e4b8a1092cf5bec6 100755
--- a/Control/AthenaConfiguration/share/confTool.py
+++ b/Control/AthenaConfiguration/share/confTool.py
@@ -31,7 +31,7 @@ def parse_args():
     parser.add_argument(
         "--diff", dest="diff", action="store_true", help="Diffs two files"
     )
-    parser.add_argument("--toJSON", help="Convert to JSON file")
+    parser.add_argument("--toJSON", action="store_true", help="Convert to JSON file")
     parser.add_argument("--toPickle", help="Convert to pickle file")
 
     parser.add_argument("file", nargs="+", help="Files to work with")
@@ -106,9 +106,9 @@ def main(args):
             sys.exit(
                 "ERROR, can convert single file at a time, got: %s" % args.file
             )
-        conf = _loadSingleFile(args.file[0], args)
-        with open(args.toJSON, "w") as oFile:
-            json.dump(conf, oFile, indent=2, ensure_ascii=True)
+        from TrigConfIO.JsonUtils import create_joboptions_json
+        create_joboptions_json(args.file[0], args.file[0].replace("pkl","json"))
+
 
     if args.toPickle:
         if len(args.file) != 1:
@@ -216,8 +216,18 @@ def _loadSingleFile(fname, args):
         ]
 
     if args.ignoreIrrelevant:
+
         def remove_irrelevant(val_dict):
-            return {key:val for key, val in val_dict.items() if key not in args.ignoreList}
+            return (
+                {
+                    key: val
+                    for key, val in val_dict.items()
+                    if key not in args.ignoreList
+                }
+                if isinstance(val_dict, dict)
+                else val_dict
+            )
+
         conf = [
             {key: remove_irrelevant(value) for (key, value) in dic.items()}
             for dic in conf
diff --git a/Control/AthenaExamples/AthExHive/src/HiveAlgC.h b/Control/AthenaExamples/AthExHive/src/HiveAlgC.h
index e7c1152ca930a3850621b0bc6498c89f2d630125..32f6b2eec36a3d780f4b7f1755224a65c96ddec8 100644
--- a/Control/AthenaExamples/AthExHive/src/HiveAlgC.h
+++ b/Control/AthenaExamples/AthExHive/src/HiveAlgC.h
@@ -15,7 +15,6 @@
 #include "StoreGate/WriteHandleKey.h"
 #include "StoreGate/ReadHandleKey.h"
 #include "AthExHive/HiveDataObj.h"
-#include "HiveAlgBase.h"
 
 #include <string>
 
diff --git a/Control/AthenaExamples/AthExHive/src/condEx/ASCIICondDbSvc.h b/Control/AthenaExamples/AthExHive/src/condEx/ASCIICondDbSvc.h
index 8823698d4d4ceed6b7b16c43ee5c6181718e02b8..d96a51d0605fbe8c46ae713f27ce7d4ad974a6cf 100644
--- a/Control/AthenaExamples/AthExHive/src/condEx/ASCIICondDbSvc.h
+++ b/Control/AthenaExamples/AthExHive/src/condEx/ASCIICondDbSvc.h
@@ -9,7 +9,6 @@
 #include "GaudiKernel/EventIDBase.h"
 #include "GaudiKernel/EventIDRange.h"
 #include "AthenaBaseComps/AthService.h"
-#include "AthenaBaseComps/AthService.h"
 
 #include "AthExHive/IASCIICondDbSvc.h"
 
diff --git a/Control/AthenaKernel/AthenaKernel/IAthenaBarCode.h b/Control/AthenaKernel/AthenaKernel/IAthenaBarCode.h
index 0dfb15ca4b751b21c62d986dfd3a75bc803e0a68..749d9698f024e7abb2076a3db5b5da4041bd119c 100644
--- a/Control/AthenaKernel/AthenaKernel/IAthenaBarCode.h
+++ b/Control/AthenaKernel/AthenaKernel/IAthenaBarCode.h
@@ -19,8 +19,6 @@
 
 
 #include <GaudiKernel/StatusCode.h>
-#include <stdint.h>
-//#include <iostream>
 
 ///////////////////////////////////////////////////////////////////////////////
 //
diff --git a/Control/AthenaKernel/AthenaKernel/MetaCont.h b/Control/AthenaKernel/AthenaKernel/MetaCont.h
index cb3012a1a35455acf4b932a201d90b451200f1bf..c19ee682149a8ab6c08c687781a0b78356d5c38f 100644
--- a/Control/AthenaKernel/AthenaKernel/MetaCont.h
+++ b/Control/AthenaKernel/AthenaKernel/MetaCont.h
@@ -211,7 +211,6 @@ MetaCont<T>::sources() const {
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#include "AthenaKernel/CLASS_DEF.h"
 CLASS_DEF( MetaContBase , 34480469 , 1 )
 
 
diff --git a/Control/AthenaKernel/test/DataBucket_test.cxx b/Control/AthenaKernel/test/DataBucket_test.cxx
index 6df79da82ed138294d2b2f54c4b123cf1a6691cc..9a48b31329214ad9a9c69e03cbde83e0cdab3604 100755
--- a/Control/AthenaKernel/test/DataBucket_test.cxx
+++ b/Control/AthenaKernel/test/DataBucket_test.cxx
@@ -89,12 +89,9 @@ private:
 };
 std::atomic<int> MyDataObj::count;
 
-#include "AthenaKernel/CLASS_DEF.h"
 CLASS_DEF(MyDataObj, 8000, 3) 
 
-#include <cassert>
 #include <vector>
-#include <map>
 
 #include "TestTools/initGaudi.h"
 
diff --git a/Control/AthenaMP/CMakeLists.txt b/Control/AthenaMP/CMakeLists.txt
index 7872826067a75fff878895e4d525ef87b73369c4..e4cf3cb79279bf604d7c5ca8fa78d1f4048aa0a0 100644
--- a/Control/AthenaMP/CMakeLists.txt
+++ b/Control/AthenaMP/CMakeLists.txt
@@ -19,5 +19,4 @@ atlas_add_executable( getSharedMemory
                       src/memory-profiler/getPss.cc )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
-
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Control/AthenaMP/python/PyComps.py b/Control/AthenaMP/python/PyComps.py
index 36ec82c33772e9784a9b0cc12e40c846723a0aa9..63f126375563557cb2fb1a099ced6dc08b139b07 100644
--- a/Control/AthenaMP/python/PyComps.py
+++ b/Control/AthenaMP/python/PyComps.py
@@ -1,12 +1,9 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #-----Python imports---#
-import os, sys, time, shutil
+import os, sys, shutil
 
 #-----Athena imports---#
-import AthenaCommon.SystemOfUnits as Units
-import AthenaPython.PyAthena as PyAthena
-from AthenaPython.PyAthena import StatusCode
 from AthenaCommon.Logging import log as msg
 
 from AthenaMP.AthenaMPConf import AthMpEvtLoopMgr
@@ -57,7 +54,7 @@ class MpEvtLoopMgr(AthMpEvtLoopMgr):
         
     def configureStrategy(self,strategy,pileup,events_before_fork):
         from .AthenaMPFlags import jobproperties as jp
-        from AthenaCommon.ConcurrencyFlags import jobproperties as jp
+        import AthenaCommon.ConcurrencyFlags # noqa: F401
         event_range_channel = jp.AthenaMPFlags.EventRangeChannel()
         if (jp.AthenaMPFlags.ChunkSize() > 0):
             chunk_size = jp.AthenaMPFlags.ChunkSize()
@@ -183,15 +180,15 @@ def setupEvtSelForSeekOps():
    
    if 'AthenaPoolCnvSvc.ReadAthenaPool' not in sys.modules:
       ## user did not import that module so we give up
-      msg.info( "Cannot enable 'seeking' b/c module " + \
-                 "[AthenaPoolCnvSvc.ReadAthenaPool] hasn't been imported..." )
-      msg.info( "Modify your jobOptions to import that module "+ \
-                 "(or just ignore this message)" )
+      msg.info( "Cannot enable 'seeking' b/c module "
+                "[AthenaPoolCnvSvc.ReadAthenaPool] hasn't been imported..." )
+      msg.info( "Modify your jobOptions to import that module "
+                "(or just ignore this message)" )
       return
 
    from AthenaCommon.AppMgr import theApp, AthAppMgr
    if theApp.state() != AthAppMgr.State.OFFLINE:
-      msg.info( "C++ ApplicationMgr already instantiated, probably seeking "+\
+      msg.info( "C++ ApplicationMgr already instantiated, probably seeking "
                 "will be ill-configured..." )
       msg.info( "EventSelector writers should implement updateHandlers" )
    
diff --git a/Control/AthenaMPTools/src/AthenaMPToolBase.cxx b/Control/AthenaMPTools/src/AthenaMPToolBase.cxx
index a4fcd1e2cd04f2df992d74550c206d49ffb515aa..b7d88e76ad044e7213f5fb01037ea8e88dff3d3c 100644
--- a/Control/AthenaMPTools/src/AthenaMPToolBase.cxx
+++ b/Control/AthenaMPTools/src/AthenaMPToolBase.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "AthenaMPToolBase.h"
@@ -21,9 +21,6 @@
 
 #include <iterator>
 
-#include "unistd.h"
-#include <signal.h>
-
 namespace AthenaMPToolBase_d {
   bool sig_done = false;
   void pauseForDebug(int /*sig*/) {
@@ -57,40 +54,23 @@ AthenaMPToolBase::~AthenaMPToolBase()
 StatusCode AthenaMPToolBase::initialize()
 {
   ATH_MSG_DEBUG("In initialize");
-  StatusCode sc = m_evtProcessor.retrieve();
-  if(!sc.isSuccess()) {
-    ATH_MSG_ERROR("Error retrieving wrapped Event Loop Manager");
-    return sc;
-  }
-
-  sc = m_appMgr.retrieve();
-  if(!sc.isSuccess()) {
-    ATH_MSG_ERROR("Error retrieving ApplicationMgr");
-    return sc;
-  }
+  ATH_CHECK(m_evtProcessor.retrieve());
+  ATH_CHECK(m_appMgr.retrieve());
 
   SmartIF<IProperty> prpMgr(serviceLocator());
   if(prpMgr.isValid()) {
     // Get event selector name. Retrieve EventSelector and EventSeek
     m_evtSelName = prpMgr->getProperty("EvtSel").toString();
-    sc = serviceLocator()->service(m_evtSelName,m_evtSelector);
-    if(sc.isFailure() || m_evtSelector==0) {
-      ATH_MSG_ERROR("Error retrieving EventSelector");
-      return StatusCode::FAILURE;
-    }
+    ATH_CHECK(serviceLocator()->service(m_evtSelName,m_evtSelector));
   }
   else {
     ATH_MSG_ERROR("IProperty interface not found in ApplicationMgr");
     return StatusCode::FAILURE;
   }
 
-  sc = m_fileMgr.retrieve();
-  if(!sc.isSuccess()) {
-    ATH_MSG_ERROR("Error retrieving FileMgr");
-    return sc;
-  }
+  ATH_CHECK(m_fileMgr.retrieve());
 
-  SmartIF<IProperty> prpMgr1(&*m_fileMgr);
+  SmartIF<IProperty> prpMgr1(m_fileMgr.get());
   if(prpMgr1.isValid()) {
     m_fileMgrLog = prpMgr1->getProperty("LogFile").toString();
   }
diff --git a/Control/AthenaMPTools/src/SharedHiveEvtQueueConsumer.cxx b/Control/AthenaMPTools/src/SharedHiveEvtQueueConsumer.cxx
index c268827e057c5fbbf6166c11235cf8fac75bb888..a66ab348804a1ded82cc85ca7241115d2687f5b0 100644
--- a/Control/AthenaMPTools/src/SharedHiveEvtQueueConsumer.cxx
+++ b/Control/AthenaMPTools/src/SharedHiveEvtQueueConsumer.cxx
@@ -26,7 +26,6 @@
 #include <stdexcept>
 #include <cmath> // For pow
 
-#include "unistd.h"
 #include <signal.h>
 
 namespace SharedHiveEvtQueueConsumer_d {
diff --git a/Control/AthenaMonitoring/AthenaMonitoring/ManagedMonitorToolBase.h b/Control/AthenaMonitoring/AthenaMonitoring/ManagedMonitorToolBase.h
index aa7a1713616e42b577bba90024b65416c9c38fa2..343756d5a76e33e6f4adf466da04f8c96b915f84 100644
--- a/Control/AthenaMonitoring/AthenaMonitoring/ManagedMonitorToolBase.h
+++ b/Control/AthenaMonitoring/AthenaMonitoring/ManagedMonitorToolBase.h
@@ -23,7 +23,6 @@
 #include "AthenaMonitoring/ITriggerTranslatorTool.h"
 #include "StoreGate/ReadCondHandleKey.h"
 
-#include "GaudiKernel/ToolHandle.h"
 #include "LumiBlockData/LuminosityCondData.h"
 #include "LumiBlockData/LBDurationCondData.h"
 #include "LumiBlockData/TrigLiveFractionCondData.h"
diff --git a/Control/AthenaMonitoring/src/TriggerTranslatorSimple.h b/Control/AthenaMonitoring/src/TriggerTranslatorSimple.h
index 3d1e04d84850734175d0baaf00226e358a05ba78..0395c79ff2ee6ee07a9a5af4d6ae5c9a0e937083 100755
--- a/Control/AthenaMonitoring/src/TriggerTranslatorSimple.h
+++ b/Control/AthenaMonitoring/src/TriggerTranslatorSimple.h
@@ -16,8 +16,6 @@
 
 #include "AthenaMonitoring/ITriggerTranslatorTool.h"
 
-#include "GaudiKernel/ToolHandle.h"
-
 class IInterface;
 
 
diff --git a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.h b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.h
index c9109cf6bc3230a7721672de996ae9860f54861d..9181d5ea11c2450b1110d9eaa8089463bbb26b18 100644
--- a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.h
+++ b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.h
@@ -14,26 +14,24 @@
 #include <string>
 #include <vector>
 
-#include "GaudiKernel/IEvtSelector.h"
 #include "Gaudi/Property.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "GaudiKernel/MsgStream.h"
 #include "GaudiKernel/MinimalEventLoopMgr.h"
 #include "GaudiKernel/IIncidentListener.h"
-#include "AthenaKernel/Timeout.h"
-#include "AthenaKernel/IAthenaEvtLoopPreSelectTool.h"
-#include "AthenaKernel/IEventSeek.h"
-#include "AthenaKernel/ICollectionSize.h"
-#include "AthenaKernel/IConditionsCleanerSvc.h"
-
-//////////////////////////////////////////////////
 #include "GaudiKernel/IAlgResourcePool.h"
 #include "GaudiKernel/IEvtSelector.h"
 #include "GaudiKernel/IHiveWhiteBoard.h"
 #include "GaudiKernel/IScheduler.h"
 #include "GaudiKernel/IAlgExecStateSvc.h"
 
+#include "AthenaKernel/Timeout.h"
+#include "AthenaKernel/IAthenaEvtLoopPreSelectTool.h"
+#include "AthenaKernel/IEventSeek.h"
+#include "AthenaKernel/ICollectionSize.h"
+#include "AthenaKernel/IConditionsCleanerSvc.h"
+
 // Standard includes
 #include <functional>
 
diff --git a/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx b/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx
index 018985b108d762d2242866025b19897210f7fbd0..f46d944f640fc60c4e2abacb0a52c46f01a5484f 100644
--- a/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx
+++ b/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx
@@ -23,11 +23,9 @@
 #include "AthenaKernel/IEventSeek.h"
 #include "AthenaKernel/IEvtSelectorSeek.h"
 #include "GaudiKernel/ISvcLocator.h"
-#include "GaudiKernel/Service.h"
 #include "GaudiKernel/IEvtSelector.h"
 #include "GaudiKernel/IEventProcessor.h"
 #include "GaudiKernel/Service.h"
-// //#include "GaudiKernel/DeclareFactoryEntries.h"
 #include "GaudiKernel/Converter.h"
 #include "GaudiKernel/ConversionSvc.h"
 #include <iostream>
diff --git a/Control/CxxUtils/share/OptionalContainer_test.ref b/Control/CxxUtils/share/OptionalContainer_test.ref
old mode 100644
new mode 100755
diff --git a/Control/DataModelTest/DataModelRunTests/CMakeLists.txt b/Control/DataModelTest/DataModelRunTests/CMakeLists.txt
index 45a3a4dd5c8cdba48c071e7ca6946d2338755d4e..2ac805ba3c0f14e2252c99f0f73c2d9223d75413 100644
--- a/Control/DataModelTest/DataModelRunTests/CMakeLists.txt
+++ b/Control/DataModelTest/DataModelRunTests/CMakeLists.txt
@@ -30,7 +30,7 @@ function (datamodel_run_test testName)
   atlas_add_test( ${testName}
                   SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/datamodel_${testName}.sh
                   PROPERTIES TIMEOUT 300
-                  LOG_IGNORE_PATTERN "has different type than the branch|no dictionary for class|^StorageSvc +INFO|Cache alignment|Unable to locate catalog|IOVDbSvc[0-9 ]+INFO${ARG_EXTRA_IGNORE}"
+                  LOG_IGNORE_PATTERN "has different type than the branch|no dictionary for class|^StorageSvc +INFO|Cache alignment|Unable to locate catalog|IOVDbSvc[0-9 ]+INFO|Invalid ./TagInfo${ARG_EXTRA_IGNORE}"
                   ENVIRONMENT "ATLAS_REFERENCE_TAG=DataModelRunTests/DataModelRunTestsReference-01-00-03"
                    )
   if( ARG_DEPENDS )
diff --git a/Control/DataModelTest/DataModelRunTests/share/xAODTestRead_jo.py b/Control/DataModelTest/DataModelRunTests/share/xAODTestRead_jo.py
index 32f75aa484cfc21f0115d58a90b1f8475775adf7..4b4285cae8969b63ab588433de7ed0c4525c4935 100755
--- a/Control/DataModelTest/DataModelRunTests/share/xAODTestRead_jo.py
+++ b/Control/DataModelTest/DataModelRunTests/share/xAODTestRead_jo.py
@@ -1,6 +1,4 @@
 #
-# $Id$
-#
 # File: share/xAODTestRead_jo.py
 # Author: snyder@bnl.gov
 # Date: May 2014
@@ -79,6 +77,9 @@ fullItemList+=["xAOD::ShallowAuxInfo#scopy_cinfoAux."]
 fullItemList+=["DMTest::HVec#scopy_hvec"]
 fullItemList+=["xAOD::ShallowAuxContainer#scopy_hvecAux."]
 
+fullItemList+=["xAOD::EventInfo#EventInfo"]
+fullItemList+=["xAOD::EventAuxInfo#EventInfoAux."]
+
 ServiceMgr.AthenaPoolCnvSvc.PoolAttributes += ["DEFAULT_SPLITLEVEL='1'"]
 
 from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
diff --git a/Control/DataModelTest/DataModelRunTests/share/xAODTestWrite_jo.py b/Control/DataModelTest/DataModelRunTests/share/xAODTestWrite_jo.py
index 14dde8f7587a223ecb076edf5c921ec8c5e9e719..a4bb02d41b910923bdc5cc6acd2509188a80879b 100755
--- a/Control/DataModelTest/DataModelRunTests/share/xAODTestWrite_jo.py
+++ b/Control/DataModelTest/DataModelRunTests/share/xAODTestWrite_jo.py
@@ -1,6 +1,4 @@
 #
-# $Id$
-#
 # File: share/xAODTestWrite_jo.py
 # Author: snyder@bnl.gov
 # Date: May 2014
@@ -82,6 +80,9 @@ fullItemList+=["DMTest::HAuxContainer#hvecAux."]
 fullItemList+=["DMTest::HView#hview"]
 fullItemList+=["DMTest::S2#S2"]
 
+fullItemList+=["xAOD::EventInfo#EventInfo"]
+fullItemList+=["xAOD::EventAuxInfo#EventInfoAux."]
+
 # Stream's output file
 from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
 Stream1_Augmented = MSMgr.NewPoolStream ('Stream1', 'xaoddata.root', asAlg=True, noTag=True)
diff --git a/Control/IOVSvc/src/CondSvc.h b/Control/IOVSvc/src/CondSvc.h
index 072814fe7562186a0fc5e8e516460647926f66f6..ef50ecdc5fafa803ffbb7e945ebe870549a1e4cc 100644
--- a/Control/IOVSvc/src/CondSvc.h
+++ b/Control/IOVSvc/src/CondSvc.h
@@ -7,7 +7,6 @@
 
 #include "GaudiKernel/ICondSvc.h"
 #include "GaudiKernel/Service.h"
-#include "AthenaBaseComps/AthService.h"
 #include "StoreGate/StoreGateSvc.h"
 #include "AthenaBaseComps/AthService.h"
 #include "ICondSvcSetupDone.h"
diff --git a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonSvc.cxx b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonSvc.cxx
index b11226fd1ff746bf13f8a238b7b07cae4f1ba544..1a9708bbb7e631589c4bfcbc703e1175c251b475 100644
--- a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonSvc.cxx
+++ b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonSvc.cxx
@@ -1459,7 +1459,6 @@ PerfMonSvc::do_io_mon()
 #ifdef __APPLE__
 #include <mach/task.h>
 #include <mach/mach_init.h>
-#include <unistd.h>
 #endif
 
 ///// local utils
diff --git a/Control/PerformanceMonitoring/PerfMonComps/src/SemiDetMisc.h b/Control/PerformanceMonitoring/PerfMonComps/src/SemiDetMisc.h
index edaaa36640bb68f17decbb47321241ff3ee87144..4be847f65babf38be3c193a86c7b0356b62dcd80 100644
--- a/Control/PerformanceMonitoring/PerfMonComps/src/SemiDetMisc.h
+++ b/Control/PerformanceMonitoring/PerfMonComps/src/SemiDetMisc.h
@@ -18,7 +18,6 @@
 #include <ctime>
 #include <cassert>
 #include <cstring>
-#include <cstdlib>
 #include <climits>
 #include <limits>
 #include <sstream>
diff --git a/Control/PileUpComps/src/NoPileUpMuWriter.cxx b/Control/PileUpComps/src/NoPileUpMuWriter.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..a7c8c592ac193a4b084d911cad2092e92cd1131a
--- /dev/null
+++ b/Control/PileUpComps/src/NoPileUpMuWriter.cxx
@@ -0,0 +1,43 @@
+
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "NoPileUpMuWriter.h"
+
+#include <StoreGate/WriteDecorHandle.h>
+
+NoPileUpMuWriter::NoPileUpMuWriter(const std::string& name, ISvcLocator* pSvcLocator)
+  : AthReentrantAlgorithm(name,pSvcLocator)
+{
+}
+
+StatusCode NoPileUpMuWriter::initialize() 
+{
+  ATH_CHECK(m_actMuKey.initialize());
+  ATH_CHECK(m_aveMuKey.initialize());
+  return StatusCode::SUCCESS;
+}
+
+StatusCode NoPileUpMuWriter::execute(const EventContext& ctx)  const
+{
+  SG::WriteDecorHandle<xAOD::EventInfo, float> actMu(m_actMuKey, ctx);
+  if (!actMu.isPresent()) {
+    ATH_MSG_ERROR("actualInteractionsPerCrossing.isPresent check fails");
+    return StatusCode::FAILURE;
+  }
+  if (!actMu.isAvailable()) {
+    actMu(0) = 0.;
+  }
+
+  SG::WriteDecorHandle<xAOD::EventInfo, float> aveMu(m_aveMuKey, ctx);
+  if (!aveMu.isPresent()) {
+    ATH_MSG_ERROR("averageInteractionsPerCrossing.isPresent check fails");
+    return StatusCode::FAILURE;
+  }
+  if (!aveMu.isAvailable()) {
+    aveMu(0) = 0.;
+  }
+
+  return StatusCode::SUCCESS;
+}
diff --git a/Control/PileUpComps/src/NoPileUpMuWriter.h b/Control/PileUpComps/src/NoPileUpMuWriter.h
new file mode 100644
index 0000000000000000000000000000000000000000..e446ee79c67b6620f01a4ad1004e2f83a2cd9f1f
--- /dev/null
+++ b/Control/PileUpComps/src/NoPileUpMuWriter.h
@@ -0,0 +1,39 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef PILEUPCOMPS_NOPILEUPMUWRITER_H
+#define PILEUPCOMPS_NOPILEUPMUWRITER_H
+
+/**
+ * @class NoPileUpMuWriter
+ *
+ * @brief Algorithm to write interactions per crossing (mu) into xAOD::EventInfo as decorations
+ *
+ **/
+
+#include <AthenaBaseComps/AthReentrantAlgorithm.h>
+#include <StoreGate/WriteDecorHandleKey.h>
+#include <xAODEventInfo/EventInfo.h>
+
+class NoPileUpMuWriter : public AthReentrantAlgorithm 
+{
+public:
+  NoPileUpMuWriter(const std::string& name, ISvcLocator* pSvcLocator);
+  
+  virtual StatusCode initialize() override final;
+  virtual StatusCode execute(const EventContext& ctx) const override final;
+  
+private:
+  SG::WriteDecorHandleKey<xAOD::EventInfo> m_actMuKey {this
+      ,"actualInteractionsPerCrossingKey"
+      ,"EventInfo.actualInteractionsPerCrossing"
+      ,"Decoration for Actual Interaction Per Crossing"};
+
+  SG::WriteDecorHandleKey<xAOD::EventInfo> m_aveMuKey {this
+      ,"averageInteractionsPerCrossingKey"
+      ,"EventInfo.averageInteractionsPerCrossing"
+      ,"Decoration for Average Interaction Per Crossing"};
+};
+
+#endif
diff --git a/Control/PileUpComps/src/PileUpEventLoopMgr.cxx b/Control/PileUpComps/src/PileUpEventLoopMgr.cxx
index 8d7218c19ecf2ec9724975674c40220ea3f69be0..73c04aa2a0a5a9bacef2f0880f2b873ef9bee47c 100644
--- a/Control/PileUpComps/src/PileUpEventLoopMgr.cxx
+++ b/Control/PileUpComps/src/PileUpEventLoopMgr.cxx
@@ -42,7 +42,6 @@
 #include "GaudiKernel/IIncidentSvc.h"
 #include "GaudiKernel/Incident.h"
 #include "GaudiKernel/DataIncident.h" // For ContextIncident
-#include "GaudiKernel/IEvtSelector.h"
 #include "GaudiKernel/EventContext.h"
 #include "GaudiKernel/ThreadLocalContext.h"
 #include "GaudiKernel/Algorithm.h"
diff --git a/Control/PileUpComps/src/components/PileUpComps_entries.cxx b/Control/PileUpComps/src/components/PileUpComps_entries.cxx
index bde823f2b37cbd9cd1b2018fd941d310f4808695..61e42bf85fd6ec1d4fcc9d1710cea6131c724740 100644
--- a/Control/PileUpComps/src/components/PileUpComps_entries.cxx
+++ b/Control/PileUpComps/src/components/PileUpComps_entries.cxx
@@ -1,26 +1,27 @@
+#include "../ArrayBM.h"
 #include "../BkgStreamsCache.h"
-#include "../PileUpEventLoopMgr.h"
-#include "../PileUpXingFolder.h"
-#include "../PileUpToolsAlg.h"
 #include "../DigitizationAlg.h"
-#include "../TestPileUpTool.h"
-#include "../FlatBM.h"
-#include "../ArrayBM.h"
-#include "../StepArrayBM.h"
 #include "../FixedArrayBM.h"
+#include "../FlatBM.h"
 #include "../LumiProfileSvc.h"
+#include "../NoPileUpMuWriter.h"
 #include "../NoProfileSvc.h"
+#include "../PileUpEventLoopMgr.h"
+#include "../PileUpToolsAlg.h"
+#include "../PileUpXingFolder.h"
+#include "../StepArrayBM.h"
+#include "../TestPileUpTool.h"
 
-DECLARE_COMPONENT( PileUpEventLoopMgr )
-DECLARE_COMPONENT( FlatBM )
 DECLARE_COMPONENT( ArrayBM )
+DECLARE_COMPONENT( BkgStreamsCache )
+DECLARE_COMPONENT( DigitizationAlg )
 DECLARE_COMPONENT( FixedArrayBM )
-DECLARE_COMPONENT( StepArrayBM )
+DECLARE_COMPONENT( FlatBM )
 DECLARE_COMPONENT( LumiProfileSvc )
+DECLARE_COMPONENT( NoPileUpMuWriter )
 DECLARE_COMPONENT( NoProfileSvc )
-DECLARE_COMPONENT( BkgStreamsCache )
+DECLARE_COMPONENT( PileUpEventLoopMgr )
+DECLARE_COMPONENT( PileUpToolsAlg )
 DECLARE_COMPONENT( PileUpXingFolder )
+DECLARE_COMPONENT( StepArrayBM )
 DECLARE_COMPONENT( TestPileUpTool )
-DECLARE_COMPONENT( PileUpToolsAlg )
-DECLARE_COMPONENT( DigitizationAlg )
-
diff --git a/Control/PileUpTools/src/PileUpMergeSvc.cxx b/Control/PileUpTools/src/PileUpMergeSvc.cxx
index 0a765e9be61f3510c7cdda2263158ae93768f764..2c7f156d8bb924bf018275fe92748c7208511ded 100755
--- a/Control/PileUpTools/src/PileUpMergeSvc.cxx
+++ b/Control/PileUpTools/src/PileUpMergeSvc.cxx
@@ -9,9 +9,6 @@
 #include "SGTools/DataStore.h"
 #include "PileUpTools/IPileUpXingFolder.h"
 
-#include "EventInfo/EventInfo.h"
-#include "xAODEventInfo/EventInfoContainer.h"
-
 #include "EventInfo/EventInfo.h"
 #include "EventInfo/EventID.h"
 #include "EventInfo/EventType.h" 
diff --git a/Control/PyKernel/CMakeLists.txt b/Control/PyKernel/CMakeLists.txt
index ea4f83cdbd8c8c2965b7c5fd81ade97d55403f19..7c73e302094a899d1cbb8c74e6fb6550a97fbf0f 100644
--- a/Control/PyKernel/CMakeLists.txt
+++ b/Control/PyKernel/CMakeLists.txt
@@ -1,6 +1,4 @@
-################################################################################
-# Package: PyKernel
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( PyKernel )
@@ -25,6 +23,6 @@ atlas_add_dictionary( PyKernelDict
                       LINK_LIBRARIES ${ROOT_LIBRARIES} ${Python_LIBRARIES} PyKernel )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/*.py )
 
diff --git a/Control/PyKernel/python/PyKernel.py b/Control/PyKernel/python/PyKernel.py
index 904e0fe7a39940ade5ea4f38b79dbcc512abd02e..bb2e7ef42fed0fc6fd4d97196bcae61a9485412e 100755
--- a/Control/PyKernel/python/PyKernel.py
+++ b/Control/PyKernel/python/PyKernel.py
@@ -1,7 +1,5 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
 """core module for an interactive analysis
 
 Examples are in `PyAnalysisExamples/PlotTest.py`_ and `PyAnalysisExamples/HistTest.py`_
@@ -19,10 +17,9 @@ __docformat__ = "restructuredtext en"
 # remove these lines when epydoc
 #"""
 import re
-import types
 import cppyy
-from math import *
-from AthenaCommon.SystemOfUnits import *
+from math import *  # noqa: F403
+from AthenaCommon.SystemOfUnits import *  # noqa: F403
 
 # global name space
 GNS = cppyy.gbl
@@ -106,7 +103,7 @@ class _SetEventCounter:
             curEvent = curEvent+1
             return GNS.StatusCode(1)
         # call original method
-        return apply(self.methodObj,var)
+        return self.methodObj(var)
     
 
 # retrieve object from StoreGate
@@ -130,7 +127,7 @@ def retrieve (aClass, aKey=None):
     if aClass == GNS.AANT:
         return rootStream
     global storeGate
-    if storeGate == None:
+    if storeGate is None:
         import AthenaPython.PyAthena as PyAthena
         storeGate = PyAthena.py_svc('StoreGateSvc/StoreGateSvc')
     if aKey:
@@ -157,9 +154,9 @@ def retrieveDet (aClass, aKey=None):
     """
     #import workaround    
     global detStore
-    if detStore == None:
+    if detStore is None:
         import AthenaPython.PyAthena as PyAthena
-        storeGate = PyAthena.py_svc('StoreGateSvc/DetectorStore')
+        storeGate = PyAthena.py_svc('StoreGateSvc/DetectorStore')  # noqa: F841
     if aKey:
         ret = detStore.retrieve(aClass,aKey)
     else:
@@ -244,16 +241,16 @@ def fill (hist, classAndKey, value, criteria="True", nEvent=100):
             # if NULL
             if obj == 0:
                 lSize = 0                
-        except:
+        except Exception:
             lSize = 0
 
         # loop over all elements
         for iC in range(lSize):
             # parameter name "x" must be consistent with the parsed strings
             if isCollection:
-                x = obj[iC]
+                x = obj[iC]  # noqa: F841
             else:
-                x = obj
+                x = obj  # noqa: F841
 
             # eval value/criteria commands
             try:
@@ -265,8 +262,8 @@ def fill (hist, classAndKey, value, criteria="True", nEvent=100):
                     if iE < bufEvent:
                         buf.append(vX)
                     else:
-                        h.Fill(vX)
-            except:
+                        h.Fill(vX)  # noqa: F405
+            except Exception:
                 pass
 
             # if not a collection escape from loop
@@ -300,7 +297,7 @@ def fill (hist, classAndKey, value, criteria="True", nEvent=100):
                 maxX = 1
 
             # create histogram if hist is None
-            if hist == None:
+            if hist is None:
                 lpath = '/stat/tmp/PyKernelHist'
                 unregister(lpath)
                 # determine title of histo
@@ -308,7 +305,7 @@ def fill (hist, classAndKey, value, criteria="True", nEvent=100):
                     title = value.__name__
                 else:
                     title = value
-                h = book(lpath, title, 100, minX, maxX)
+                h = book(lpath, title, 100, minX, maxX)  # noqa: F405
             else:
                 h = hist
 
@@ -417,16 +414,16 @@ def fill2 (hist, classAndKey, valueX, valueY, criteria="True", nEvent=100):
             # if NULL
             if obj == 0:
                 lSize = 0                
-        except:
+        except Exception:
             lSize = 0            
         
         # loop over all elements
         for iC in range(lSize):
             # parameter name "x" must be consistent with the parsed strings
             if isCollection:
-                x = obj[iC]
+                x = obj[iC]  # noqa: F841
             else:
-                x = obj
+                x = obj  # noqa: F841
 
             # eval value/criteria commands
             try:
@@ -440,8 +437,8 @@ def fill2 (hist, classAndKey, valueX, valueY, criteria="True", nEvent=100):
                         bufX.append(vX)
                         bufY.append(vY)                        
                     else:
-                        h.Fill(vX,vY)
-            except:
+                        h.Fill(vX,vY)  # noqa: F405
+            except Exception:
                 pass
                             
             # if not a collection escape from loop
@@ -499,7 +496,7 @@ def fill2 (hist, classAndKey, valueX, valueY, criteria="True", nEvent=100):
                 maxY = 1
 
             # create histogram if hist is None
-            if hist == None:
+            if hist is None:
                 lpath = '/stat/tmp/PyKernelHist'
                 unregister(lpath)
                 # determine title of histo
@@ -511,7 +508,7 @@ def fill2 (hist, classAndKey, valueX, valueY, criteria="True", nEvent=100):
                     titleY = valueY.__name__
                 else:
                     titleY = valueY
-                h = book(lpath, titleY+" vs "+titleX, 100, minX, maxX, 100, minY, maxY)
+                h = book(lpath, titleY+" vs "+titleX, 100, minX, maxX, 100, minY, maxY)  # noqa: F405
             else:
                 h = hist
 
@@ -614,16 +611,16 @@ def fillProf (hist, classAndKey, valueX, valueY, criteria="True", nEvent=100):
             # if NULL
             if obj == 0:
                 lSize = 0                
-        except:
+        except Exception:
             lSize = 0            
         
         # loop over all elements
         for iC in range(lSize):
             # parameter name "x" must be consistent with the parsed strings
             if isCollection:
-                x = obj[iC]
+                x = obj[iC]  # noqa: F841
             else:
-                x = obj
+                x = obj  # noqa: F841
 
             # eval value/criteria commands
             try:
@@ -637,8 +634,8 @@ def fillProf (hist, classAndKey, valueX, valueY, criteria="True", nEvent=100):
                         bufX.append(vX)
                         bufY.append(vY)                        
                     else:
-                        h.Fill(vX,vY)
-            except:
+                        h.Fill(vX,vY)  # noqa: F405
+            except Exception:
                 pass
                             
             # if not a collection escape from loop
@@ -672,7 +669,7 @@ def fillProf (hist, classAndKey, valueX, valueY, criteria="True", nEvent=100):
                 maxX = 1
 
             # create histogram if hist is None
-            if hist == None:
+            if hist is None:
                 lpath = '/stat/tmp/PyKernelHist'
                 unregister(lpath)
                 # determine title of histo
@@ -684,7 +681,7 @@ def fillProf (hist, classAndKey, valueX, valueY, criteria="True", nEvent=100):
                     titleY = valueY.__name__
                 else:
                     titleY = valueY                    
-                h = bookProf(lpath, titleY+" vs "+titleX, 100, minX, maxX)
+                h = bookProf(lpath, titleY+" vs "+titleX, 100, minX, maxX)  # noqa: F405
             else:
                 h = hist
 
@@ -721,13 +718,13 @@ def plotProf (classAndKey, valueX="$x", valueY="$x", criteria="True", nEvent=100
 # parse string
 def _parseString (str):
     # remove $
-    str = re.sub("\$", "", str)
+    str = re.sub(r"\$", "", str)
     # replace XXX#YYY with StoreGate access
     cK = re.findall(r'([\w_]+)#([\w_\*]+)',str)
     for iCK in cK:
         # when XXX#*
         if iCK[1]=='*':
-            bStr = iCK[0]+"#\*"
+            bStr = iCK[0]+r"#\*"
             aStr = 'retrieve(GNS.'+iCK[0]+')'
         else:
             bStr = iCK[0]+"#"+iCK[1]
diff --git a/Control/SGComps/src/SGFolder.cxx b/Control/SGComps/src/SGFolder.cxx
index 70a5e47cd053596930e92ce50973b87e81d63980..89d62ab4ad5d6b5bbd5fe7e08e586adf4c084228 100644
--- a/Control/SGComps/src/SGFolder.cxx
+++ b/Control/SGComps/src/SGFolder.cxx
@@ -12,8 +12,6 @@
 #include "GaudiKernel/ISvcLocator.h"
 
 #include "AthenaKernel/DefaultKey.h"
-#include "AthenaKernel/IClassIDSvc.h"
-
 #include "AthenaKernel/IClassIDSvc.h"
 #include "AthenaKernel/ClassID_traits.h"
 
diff --git a/Control/StoreGate/StoreGate/StoreGateSvc.h b/Control/StoreGate/StoreGate/StoreGateSvc.h
index f45e3392be30d296cbe4eb7abe2ffe1b57494eef..81a075c63f41f322c2f657275daf57d93026e11a 100644
--- a/Control/StoreGate/StoreGate/StoreGateSvc.h
+++ b/Control/StoreGate/StoreGate/StoreGateSvc.h
@@ -41,7 +41,6 @@
 #include <type_traits>
 
 #include "AthenaKernel/StoreID.h"
-#include "AthenaKernel/IProxyDict.h"
 #include "AthenaKernel/IOVSvcDefs.h"
 #include "AthenaKernel/DefaultKey.h"
 #include "AthAllocators/Arena.h"
@@ -53,7 +52,6 @@
 #include "AthenaKernel/IResetable.h"
 #include "AthenaKernel/IClassIDSvc.h"
 #include "AthenaKernel/IIOVSvc.h"
-#include "StoreGate/SGHiveEventSlot.h"
 #include "StoreGate/SGIterator.h"
 #include "StoreGate/DataHandle.h"
 #include "StoreGate/SGWPtr.h"
@@ -61,7 +59,6 @@
 #include "StoreGate/SGObjectWithVersion.h"
 #include "CxxUtils/checker_macros.h"
 
-#include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/IIncidentListener.h"
 
 #ifdef SG_DEPRECATION_WARNINGS
diff --git a/Control/StoreGate/StoreGate/tools/SGImplSvc.h b/Control/StoreGate/StoreGate/tools/SGImplSvc.h
index 0e6cb93210b6839ce7686c8fe49b6527692484a5..73ea18e8d81f860d94c5a5863bb7e28e591ed458 100644
--- a/Control/StoreGate/StoreGate/tools/SGImplSvc.h
+++ b/Control/StoreGate/StoreGate/tools/SGImplSvc.h
@@ -37,7 +37,6 @@
 #include <thread>
 
 #include "AthenaKernel/StoreID.h"
-#include "AthenaKernel/IProxyDict.h"
 #include "AthenaKernel/IProxyProviderSvc.h"
 #include "AthenaKernel/IHiveStoreMgr.h"
 #include "AthenaKernel/IOVSvcDefs.h"
@@ -59,7 +58,7 @@
 #include "AthAllocators/Arena.h"
 
 #include "GaudiKernel/IIncidentSvc.h"
-#include "GaudiKernel/ServiceHandle.h"
+
 //forward declarations
 namespace SG {
   class DataProxy;
diff --git a/Control/StoreGate/src/SGImplSvc.cxx b/Control/StoreGate/src/SGImplSvc.cxx
index ed2141f4c4c10925873a29dffb4c7f8d2accac76..66d8f08d59c3160a9dbb9a31ebfc12b2672b89cb 100644
--- a/Control/StoreGate/src/SGImplSvc.cxx
+++ b/Control/StoreGate/src/SGImplSvc.cxx
@@ -21,7 +21,7 @@
 #include "AthenaKernel/IIOVSvc.h"
 #include "AthenaKernel/CLIDRegistry.h"
 #include "AthenaKernel/errorcheck.h"
-//#include "CxxUtils/PageAccessControl.h"
+#include "AthenaKernel/StoreID.h"
 #include "GaudiKernel/IHistorySvc.h"
 #include "GaudiKernel/ISvcLocator.h"
 #include "GaudiKernel/IConversionSvc.h"
@@ -41,8 +41,6 @@
 #include "StoreGate/ActiveStoreSvc.h"
 #include "StoreGate/StoreClearedIncident.h"
 #include "AthAllocators/ArenaHeader.h"
-#include "AthenaKernel/errorcheck.h"
-#include "AthenaKernel/StoreID.h"
 
 // StoreGateSvc. must come before SGImplSvc.h
 #include "StoreGate/StoreGateSvc.h"
diff --git a/Control/StoreGate/test/VarHandleBase_test.cxx b/Control/StoreGate/test/VarHandleBase_test.cxx
index df5283ce6f7db336d8577a83d1154fd3c08f8e4c..6d294f41155446f558ade56fef482b990a8eaf9b 100644
--- a/Control/StoreGate/test/VarHandleBase_test.cxx
+++ b/Control/StoreGate/test/VarHandleBase_test.cxx
@@ -14,7 +14,6 @@
 #include "StoreGate/exceptions.h"
 #include "SGTools/TestStore.h"
 #include "SGTools/DataProxy.h"
-#include "SGTools/TestStore.h"
 #include "TestTools/initGaudi.h"
 #include "TestTools/expect_exception.h"
 #include "AthenaKernel/StorableConversions.h"
diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Concat.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Concat.ref
index 054a6e563a43461cd655834f404e345f03014d00..d2a9fd62a6d37c846696cda44b9c2ca98f21f30c 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Concat.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Concat.ref
@@ -1,17 +1,17 @@
-Thu Nov 19 08:28:54 CET 20?0
+Thu Nov 26 22:58:28 CET 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_ConcatJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5589 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5426 configurables from 28 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 v34r1)
-                                          running on pc-tbed-pub-32.cern.ch on Thu Nov 19 08:29:05 20?0
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v35r0p1)
+                                          running on lxplus742.cern.ch on Thu Nov 26 22:58:39 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -30,8 +30,9 @@ PoolSvc             DEBUG Service base class initialized successfully
 PoolSvc              INFO io_register[PoolSvc](xmlcatalog_file:Catalog1.xml) [ok]
 PoolSvc              INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc              INFO Frontier compression level set to 5
-DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-11-18T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 8 servers found for host pc-tbed-pub-32.cern.ch [ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ]
+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-11-25T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus742.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
@@ -75,10 +76,13 @@ Stream1.Stream1...   INFO Initializing Stream1.Stream1Tool - package version Ath
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
 Stream1.Stream1...   INFO Initializing Stream1.Stream1_MakeEventStreamInfo - package version OutputStreamAthenaPool-00-00-00
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
+Stream1.FileMet...  DEBUG Property update for OutputLevel : new value = 2
+ClassIDSvc           INFO  getRegistryEntries: read 661 CLIDRegistry entries for module ALL
+Stream1.FileMet...  DEBUG Initialising - Package version: xAODMetaDataCnv-00-00-00
+Stream1.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
 Stream1.Thinnin...  DEBUG Property update for OutputLevel : new value = 2
-Stream1              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream1_MakeEventFormat','Athena::ThinningCacheTool/ThinningCacheTool_Stream1'])
+Stream1              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream1_MakeEventFormat','xAODMaker::FileMetaDataCreatorTool/FileMetaDataCreatorTool','Athena::ThinningCacheTool/ThinningCacheTool_Stream1'])
 Stream1              INFO Data output: SimplePoolFile1.root
-ClassIDSvc           INFO  getRegistryEntries: read 171 CLIDRegistry entries for module ALL
 Stream1              INFO I/O reinitialization...
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
 Stream1             DEBUG End initialize
@@ -87,10 +91,13 @@ Stream1             DEBUG output handles: 2
 Stream1             DEBUG Registering all Tools in ToolHandleArray HelperTools
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventStreamInfo (MakeEventStreamInfo)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool)
+Stream1             DEBUG Adding private ToolHandle tool Stream1.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.ThinningCacheTool_Stream1 (Athena::ThinningCacheTool)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1Tool (AthenaOutputStreamTool)
 Stream1             DEBUG Data Deps for Stream1
   + INPUT   ( 'AthenaAttributeList' , 'StoreGateSvc+SimpleTag' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/Simulation/Parameters' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/TagInfo' ) 
   + OUTPUT  ( 'DataHeader' , 'StoreGateSvc+Stream1' ) 
   + OUTPUT  ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream1' ) 
   + OUTPUT  ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream1' ) 
@@ -113,8 +120,11 @@ Stream2.Stream2...   INFO Initializing Stream2.Stream2Tool - package version Ath
 Stream2.Stream2...  DEBUG Property update for OutputLevel : new value = 2
 Stream2.Stream2...   INFO Initializing Stream2.Stream2_MakeEventStreamInfo - package version OutputStreamAthenaPool-00-00-00
 Stream2.Stream2...  DEBUG Property update for OutputLevel : new value = 2
+Stream2.FileMet...  DEBUG Property update for OutputLevel : new value = 2
+Stream2.FileMet...  DEBUG Initialising - Package version: xAODMetaDataCnv-00-00-00
+Stream2.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
 Stream2.Thinnin...  DEBUG Property update for OutputLevel : new value = 2
-Stream2              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream2_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream2_MakeEventFormat','Athena::ThinningCacheTool/ThinningCacheTool_Stream2'])
+Stream2              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream2_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream2_MakeEventFormat','xAODMaker::FileMetaDataCreatorTool/FileMetaDataCreatorTool','Athena::ThinningCacheTool/ThinningCacheTool_Stream2'])
 Stream2              INFO Data output: SimplePoolFile3.root
 Stream2              INFO I/O reinitialization...
 Stream2.Stream2...  DEBUG Property update for OutputLevel : new value = 2
@@ -124,9 +134,12 @@ Stream2             DEBUG output handles: 2
 Stream2             DEBUG Registering all Tools in ToolHandleArray HelperTools
 Stream2             DEBUG Adding private ToolHandle tool Stream2.Stream2_MakeEventStreamInfo (MakeEventStreamInfo)
 Stream2             DEBUG Adding private ToolHandle tool Stream2.Stream2_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool)
+Stream2             DEBUG Adding private ToolHandle tool Stream2.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool)
 Stream2             DEBUG Adding private ToolHandle tool Stream2.ThinningCacheTool_Stream2 (Athena::ThinningCacheTool)
 Stream2             DEBUG Adding private ToolHandle tool Stream2.Stream2Tool (AthenaOutputStreamTool)
 Stream2             DEBUG Data Deps for Stream2
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/Simulation/Parameters' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/TagInfo' ) 
   + INPUT IGNORED  ( 'AthenaAttributeList' , '' ) 
   + OUTPUT  ( 'DataHeader' , 'StoreGateSvc+Stream2' ) 
   + OUTPUT  ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream2' ) 
@@ -375,6 +388,10 @@ SimplePoolFile1...  DEBUG --->Adding Shape[8 , ????]:  [1 Column(s)]
 SimplePoolFile1...  DEBUG ---->Class:float
 SimplePoolFile1...  DEBUG ---->[0]:float Typ:float [10] Size:0 Offset:0 #Elements:1
 ClassIDSvc           INFO  getRegistryEntries: read 83 CLIDRegistry entries for module ALL
+Stream1.FileMet...  DEBUG Valid  'EventInfoKey':'EventInfo' handle
+Stream1.FileMet...  DEBUG setting xAOD::FileMetaData::mcProcID to 0
+Stream1.FileMet...  DEBUG valid  'StreamName':'Stream1' handle
+Stream1.FileMet...  DEBUG set xAOD::FileMetaData::dataType to Stream1
 Stream2             DEBUG addItemObjects(2101,"*") called
 Stream2             DEBUG            Key:*
 Stream2             DEBUG      Comp Attr 0 with 7 mantissa bits.
@@ -458,6 +475,10 @@ SimplePoolFile3...  DEBUG ---->ClassID:????
 SimplePoolFile3...  DEBUG --->Adding Shape[3 , ????]:  [1 Column(s)] 
 SimplePoolFile3...  DEBUG ---->Class:DataHeaderForm_p6
 SimplePoolFile3...  DEBUG ---->[0]:DataHeaderForm_p6 Typ:DataHeaderForm_p6 [21] Size:0 Offset:0 #Elements:1
+Stream2.FileMet...  DEBUG Valid  'EventInfoKey':'EventInfo' handle
+Stream2.FileMet...  DEBUG setting xAOD::FileMetaData::mcProcID to 0
+Stream2.FileMet...  DEBUG valid  'StreamName':'Stream2' handle
+Stream2.FileMet...  DEBUG set xAOD::FileMetaData::dataType to Stream2
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #0, run #1 1 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #1, run #1 1 events processed so far  <<<===
 WriteData           DEBUG in execute()
@@ -1603,12 +1624,23 @@ AthenaEventLoopMgr   INFO   ===>>>  done processing event #19, run #1 20 events
 Stream1             DEBUG AthenaOutputStream Stream1 ::stop()
 Stream2             DEBUG AthenaOutputStream Stream2 ::stop()
 Stream1             DEBUG slot 0  handle() incident type: MetaDataStop
-Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream1]
+Stream1.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
+Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream1, xAOD::FileMetaData#FileMetaData, xAOD::FileMetaDataAuxInfo#FileMetaDataAux.]
+Stream1             DEBUG addItemObjects(73252552,"FileMetaDataAux.") called
+Stream1             DEBUG            Key:FileMetaDataAux.
+Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
+Stream1             DEBUG  Added object 73252552,"FileMetaDataAux."
 Stream1             DEBUG addItemObjects(167728019,"Stream1") called
 Stream1             DEBUG            Key:Stream1
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
 Stream1             DEBUG  Added object 167728019,"Stream1"
+Stream1             DEBUG addItemObjects(178309087,"FileMetaData") called
+Stream1             DEBUG            Key:FileMetaData
+Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
+Stream1             DEBUG  Added object 178309087,"FileMetaData"
 Stream1             DEBUG addItemObjects(243004407,"EventFormatStream1") called
 Stream1             DEBUG            Key:EventFormatStream1
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
@@ -1620,27 +1652,51 @@ Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
 Stream1             DEBUG connectOutput done for SimplePoolFile1.root
 StorageSvc           INFO Building shape according to reflection information using shape ID for:
+StorageSvc           INFO xAOD::FileMetaDataAuxInfo_v1 [????]
+SimplePoolFile1...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) of type ROOT_Tree
+SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (14 , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+SimplePoolFile1...  DEBUG --->Adding Shape[9 , ????]:  [1 Column(s)] 
+SimplePoolFile1...  DEBUG ---->Class:xAOD::FileMetaDataAuxInfo_v1
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
+StorageSvc           INFO Building shape according to reflection information using shape ID for:
 StorageSvc           INFO EventStreamInfo_p3 [????]
 SimplePoolFile1...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(EventStreamInfo_p3/Stream1)
 MetaData(EventS...  DEBUG Opening
 MetaData(EventS...  DEBUG    attributes# = 1
 MetaData(EventS...  DEBUG Branch container 'EventStreamInfo_p3_Stream1'
 MetaData(EventS...  DEBUG Opened container MetaData(EventStreamInfo_p3/Stream1) of type ROOT_Tree
-SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (14 , ffffffff)
+SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (15 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Adding Shape[9 , ????]:  [1 Column(s)] 
+SimplePoolFile1...  DEBUG --->Adding Shape[10 , ????]:  [1 Column(s)] 
 SimplePoolFile1...  DEBUG ---->Class:EventStreamInfo_p3
 SimplePoolFile1...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 StorageSvc           INFO Building shape according to reflection information using shape ID for:
+StorageSvc           INFO xAOD::FileMetaData_v1 [????]
+SimplePoolFile1...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaData_v1/FileMetaData)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaData_v1_FileMetaData'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaData_v1/FileMetaData) of type ROOT_Tree
+SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (16 , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+SimplePoolFile1...  DEBUG --->Adding Shape[11 , ????]:  [1 Column(s)] 
+SimplePoolFile1...  DEBUG ---->Class:xAOD::FileMetaData_v1
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+StorageSvc           INFO Building shape according to reflection information using shape ID for:
 StorageSvc           INFO xAOD::EventFormat_v1 [????]
 SimplePoolFile1...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::EventFormat_v1/EventFormatStream1)
 MetaData(xAOD::...  DEBUG Opening
 MetaData(xAOD::...  DEBUG    attributes# = 1
 MetaData(xAOD::...  DEBUG Branch container 'xAOD::EventFormat_v1_EventFormatStream1'
 MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::EventFormat_v1/EventFormatStream1) of type ROOT_Tree
-SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (15 , ffffffff)
+SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (17 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Adding Shape[10 , ????]:  [1 Column(s)] 
+SimplePoolFile1...  DEBUG --->Adding Shape[12 , ????]:  [1 Column(s)] 
 SimplePoolFile1...  DEBUG ---->Class:xAOD::EventFormat_v1
 SimplePoolFile1...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile1...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdr(DataHeader)
@@ -1648,25 +1704,39 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (16 , ffffffff)
+SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (18 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
 SimplePoolFile1...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
 MetaDataHdrForm...  DEBUG    attributes# = 1
 MetaDataHdrForm...  DEBUG Branch container 'DataHeaderForm'
 MetaDataHdrForm...  DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree
-SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (17 , ffffffff)
+SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (19 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-ClassIDSvc           INFO  getRegistryEntries: read 14 CLIDRegistry entries for module ALL
+MetaData(xAOD::...  DEBUG  SG::IAuxStoreIO* detected in xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.
+MetaData(xAOD::...  DEBUG        Attributes= 1
+MetaData(xAOD::...  DEBUG    Creating branch for new dynamic attribute, Id=52: type=float, mcProcID
+MetaData(xAOD::...  DEBUG createBasicAuxBranch: xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAuxDyn.mcProcID, leaf:mcProcID/F
+ClassIDSvc           INFO  getRegistryEntries: read 55 CLIDRegistry entries for module ALL
 Stream1              INFO Metadata records written: 21
 Stream1             DEBUG Leaving incident handler for MetaDataStop
 Stream2             DEBUG slot 0  handle() incident type: MetaDataStop
-Stream2             DEBUG metadataItemList: [EventStreamInfo#Stream2, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream2]
+Stream2             DEBUG metadataItemList: [EventStreamInfo#Stream2, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream2, xAOD::FileMetaData#FileMetaData, xAOD::FileMetaDataAuxInfo#FileMetaDataAux.]
+Stream2             DEBUG addItemObjects(73252552,"FileMetaDataAux.") called
+Stream2             DEBUG            Key:FileMetaDataAux.
+Stream2             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream2             DEBUG      Comp Attr 0 with 15 mantissa bits.
+Stream2             DEBUG  Added object 73252552,"FileMetaDataAux."
 Stream2             DEBUG addItemObjects(167728019,"Stream2") called
 Stream2             DEBUG            Key:Stream2
 Stream2             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream2             DEBUG      Comp Attr 0 with 15 mantissa bits.
 Stream2             DEBUG  Added object 167728019,"Stream2"
+Stream2             DEBUG addItemObjects(178309087,"FileMetaData") called
+Stream2             DEBUG            Key:FileMetaData
+Stream2             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream2             DEBUG      Comp Attr 0 with 15 mantissa bits.
+Stream2             DEBUG  Added object 178309087,"FileMetaData"
 Stream2             DEBUG addItemObjects(243004407,"EventFormatStream2") called
 Stream2             DEBUG            Key:EventFormatStream2
 Stream2             DEBUG      Comp Attr 0 with 7 mantissa bits.
@@ -1677,24 +1747,44 @@ Stream2             DEBUG            Key:*
 Stream2             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream2             DEBUG      Comp Attr 0 with 15 mantissa bits.
 Stream2             DEBUG connectOutput done for SimplePoolFile3.root
+SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) of type ROOT_Tree
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (7 , ffffffff)
+SimplePoolFile3...  DEBUG ---->ClassID:????
+SimplePoolFile3...  DEBUG --->Adding Shape[4 , ????]:  [1 Column(s)] 
+SimplePoolFile3...  DEBUG ---->Class:xAOD::FileMetaDataAuxInfo_v1
+SimplePoolFile3...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(EventStreamInfo_p3/Stream2)
 MetaData(EventS...  DEBUG Opening
 MetaData(EventS...  DEBUG    attributes# = 1
 MetaData(EventS...  DEBUG Branch container 'EventStreamInfo_p3_Stream2'
 MetaData(EventS...  DEBUG Opened container MetaData(EventStreamInfo_p3/Stream2) of type ROOT_Tree
-SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream2) [20?]  (7 , ffffffff)
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream2) [20?]  (8 , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Adding Shape[4 , ????]:  [1 Column(s)] 
+SimplePoolFile3...  DEBUG --->Adding Shape[5 , ????]:  [1 Column(s)] 
 SimplePoolFile3...  DEBUG ---->Class:EventStreamInfo_p3
 SimplePoolFile3...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaData_v1/FileMetaData)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaData_v1_FileMetaData'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaData_v1/FileMetaData) of type ROOT_Tree
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (9 , ffffffff)
+SimplePoolFile3...  DEBUG ---->ClassID:????
+SimplePoolFile3...  DEBUG --->Adding Shape[6 , ????]:  [1 Column(s)] 
+SimplePoolFile3...  DEBUG ---->Class:xAOD::FileMetaData_v1
+SimplePoolFile3...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::EventFormat_v1/EventFormatStream2)
 MetaData(xAOD::...  DEBUG Opening
 MetaData(xAOD::...  DEBUG    attributes# = 1
 MetaData(xAOD::...  DEBUG Branch container 'xAOD::EventFormat_v1_EventFormatStream2'
 MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::EventFormat_v1/EventFormatStream2) of type ROOT_Tree
-SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream2) [20?]  (8 , ffffffff)
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream2) [20?]  (a , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Adding Shape[5 , ????]:  [1 Column(s)] 
+SimplePoolFile3...  DEBUG --->Adding Shape[7 , ????]:  [1 Column(s)] 
 SimplePoolFile3...  DEBUG ---->Class:xAOD::EventFormat_v1
 SimplePoolFile3...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdr(DataHeader)
@@ -1702,15 +1792,19 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (9 , ffffffff)
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (b , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
 SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
 MetaDataHdrForm...  DEBUG    attributes# = 1
 MetaDataHdrForm...  DEBUG Branch container 'DataHeaderForm'
 MetaDataHdrForm...  DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree
-SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (a , ffffffff)
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (c , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
+MetaData(xAOD::...  DEBUG  SG::IAuxStoreIO* detected in xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.
+MetaData(xAOD::...  DEBUG        Attributes= 1
+MetaData(xAOD::...  DEBUG    Creating branch for new dynamic attribute, Id=52: type=float, mcProcID
+MetaData(xAOD::...  DEBUG createBasicAuxBranch: xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAuxDyn.mcProcID, leaf:mcProcID/F
 Stream2              INFO Metadata records written: 21
 Stream2             DEBUG Leaving incident handler for MetaDataStop
 Domain[ROOT_All]     INFO >   Deaccess DbDomain     READ      [ROOT_All] 
@@ -1737,10 +1831,10 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 *****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] #= 42
-cRep_ALL             INFO Time User   : Tot=   40 [ms] Ave/Min/Max=   0.317(+-    2.16)/       0/      20 [ms] #=126
-cRepR_ALL            INFO Time User   : Tot=   30 [ms] Ave/Min/Max=  0.0765(+-   0.871)/       0/      10 [ms] #=392
-fRep_ALL             INFO Time User   : Tot=   50 [ms] Ave/Min/Max=   0.397(+-    1.95)/       0/      10 [ms] #=126
-ChronoStatSvc        INFO Time User   : Tot=  330 [ms]  #=  1
+cRepR_ALL            INFO Time User   : Tot=   60 [ms] Ave/Min/Max=   0.152(+-    1.41)/       0/      20 [ms] #=396
+cRep_ALL             INFO Time User   : Tot=   50 [ms] Ave/Min/Max=   0.385(+-    2.29)/       0/      20 [ms] #=130
+fRep_ALL             INFO Time User   : Tot=   90 [ms] Ave/Min/Max=   0.692(+-    3.09)/       0/      20 [ms] #=130
+ChronoStatSvc        INFO Time User   : Tot=  420 [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_Copy.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Copy.ref
index b8517ada7497d8c6811ddf9e7c56cb6ea10fc624..72d5c878fb4d0ff2ca758e8cb111a8a114255592 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Copy.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Copy.ref
@@ -1,17 +1,17 @@
-Thu Nov 19 08:27:52 CET 20?0
+Thu Nov 26 23:38:57 CET 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_CopyJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5589 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5426 configurables from 28 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 v34r1)
-                                          running on pc-tbed-pub-32.cern.ch on Thu Nov 19 08:28:03 20?0
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v35r0p1)
+                                          running on lxplus742.cern.ch on Thu Nov 26 23:39:15 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -29,8 +29,9 @@ PoolSvc             DEBUG Service base class initialized successfully
 PoolSvc              INFO io_register[PoolSvc](xmlcatalog_file:Catalog1.xml) [ok]
 PoolSvc              INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc              INFO Frontier compression level set to 5
-DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-11-18T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 8 servers found for host pc-tbed-pub-32.cern.ch [ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ]
+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-11-25T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus742.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
@@ -64,10 +65,14 @@ SimplePoolFile1...  DEBUG ---->[0]:Token Typ:Token [18] Size:0 Offset:0 #Element
 SimplePoolFile1...  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
 SimplePoolFile1...  DEBUG ---->[0]:unsigned int Typ:unsigned int [3] Size:0 Offset:0 #Elements:1
 SimplePoolFile1...  DEBUG --->Reading Shape[6 , ????]: [1 Column(s)]
-SimplePoolFile1...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile1...  DEBUG --->Reading Shape[7 , ????]: [1 Column(s)]
+SimplePoolFile1...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG --->Reading Shape[8 , ????]: [1 Column(s)]
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG --->Reading Shape[9 , ????]: [1 Column(s)]
 SimplePoolFile1...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 8 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 10 Entries in total.
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -90,15 +95,19 @@ SimplePoolFile1...  DEBUG --->Reading Assoc:????/POOLCollectionTree(EventNumber)
 SimplePoolFile1...  DEBUG ---->ClassID:????
 SimplePoolFile1...  DEBUG --->Reading Assoc:????/POOLCollectionTree(MagicNumber) [20?]  (a , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (b , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (b , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (c , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (c , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (d , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (d , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (e , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (e , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (f , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 13 Entries in total.
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (10 , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+##Links             DEBUG No objects passing selection criteria... Container has 15 Entries in total.
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -113,7 +122,7 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-ClassIDSvc           INFO  getRegistryEntries: read 1666 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1716 CLIDRegistry entries for module ALL
 EventPersistenc...   INFO Added successfully Conversion service:AthenaPoolCnvSvc
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
@@ -145,10 +154,13 @@ Stream1.Stream1...   INFO Initializing Stream1.Stream1Tool - package version Ath
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
 Stream1.Stream1...   INFO Initializing Stream1.Stream1_MakeEventStreamInfo - package version OutputStreamAthenaPool-00-00-00
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
+Stream1.FileMet...  DEBUG Property update for OutputLevel : new value = 2
+ClassIDSvc           INFO  getRegistryEntries: read 641 CLIDRegistry entries for module ALL
+Stream1.FileMet...  DEBUG Initialising - Package version: xAODMetaDataCnv-00-00-00
+Stream1.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
 Stream1.Thinnin...  DEBUG Property update for OutputLevel : new value = 2
-Stream1              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream1_MakeEventFormat','Athena::ThinningCacheTool/ThinningCacheTool_Stream1'])
+Stream1              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream1_MakeEventFormat','xAODMaker::FileMetaDataCreatorTool/FileMetaDataCreatorTool','Athena::ThinningCacheTool/ThinningCacheTool_Stream1'])
 Stream1              INFO Data output: SimplePoolReplica1.root
-ClassIDSvc           INFO  getRegistryEntries: read 171 CLIDRegistry entries for module ALL
 Stream1              INFO I/O reinitialization...
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
 Stream1             DEBUG End initialize
@@ -157,10 +169,13 @@ Stream1             DEBUG output handles: 2
 Stream1             DEBUG Registering all Tools in ToolHandleArray HelperTools
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventStreamInfo (MakeEventStreamInfo)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool)
+Stream1             DEBUG Adding private ToolHandle tool Stream1.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.ThinningCacheTool_Stream1 (Athena::ThinningCacheTool)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1Tool (AthenaOutputStreamTool)
 Stream1             DEBUG Data Deps for Stream1
   + INPUT   ( 'AthenaAttributeList' , 'StoreGateSvc+SimpleTag' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/Simulation/Parameters' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/TagInfo' ) 
   + OUTPUT  ( 'DataHeader' , 'StoreGateSvc+Stream1' ) 
   + OUTPUT  ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream1' ) 
   + OUTPUT  ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream1' ) 
@@ -173,6 +188,7 @@ RootDatabase.se...  DEBUG File name SimplePoolFile1.root
 RootDatabase.se...  DEBUG Got tree CollectionTree read entry -1
 RootDatabase.se...  DEBUG Using Tree cache. Size: -1 Nevents to learn with: -1
 AthenaPoolCnvSvc    DEBUG setAttribute TREE_CACHE to -1 for db: SimplePoolFile1.root and cont: CollectionTree
+Stream1.FileMet...   INFO Invalid "/TagInfo" handle
 EventSelector       DEBUG Get AttributeList from the collection
 EventSelector       DEBUG AttributeList size 3
 EventSelector       DEBUG record AthenaAttribute, name = Token = [DB=????][CNT=POOLContainer(DataHeader)][CLID=????][TECH=0000020?][OID=00000005-00000000].
@@ -200,7 +216,7 @@ CollectionTree(...  DEBUG Opened container CollectionTree(EventInfo_p4/McEventIn
 AthenaPoolConve...   INFO massageEventInfo: unable to get OverrideRunNumberFromInput property from EventSelector 
 AthenaEventLoopMgr   INFO   ===>>>  start of run 1    <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #0, run #1 0 events processed so far  <<<===
-ClassIDSvc           INFO  getRegistryEntries: read 31 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 21 CLIDRegistry entries for module ALL
 Stream1             DEBUG addItemObjects(2101,"*") called
 Stream1             DEBUG            Key:*
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
@@ -401,6 +417,10 @@ SimplePoolRepli...  DEBUG ---->ClassID:????
 SimplePoolRepli...  DEBUG --->Adding Shape[8 , ????]:  [1 Column(s)] 
 SimplePoolRepli...  DEBUG ---->Class:float
 SimplePoolRepli...  DEBUG ---->[0]:float Typ:float [10] Size:0 Offset:0 #Elements:1
+Stream1.FileMet...  DEBUG Valid  'EventInfoKey':'EventInfo' handle
+Stream1.FileMet...  DEBUG setting xAOD::FileMetaData::mcProcID to 0
+Stream1.FileMet...  DEBUG valid  'StreamName':'Stream1' handle
+Stream1.FileMet...  DEBUG set xAOD::FileMetaData::dataType to Stream1
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #0, run #1 1 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
 EventSelector       DEBUG AttributeList size 3
@@ -864,12 +884,23 @@ Domain[ROOT_All]     INFO >   Deaccess DbDomain     READ      [ROOT_All]
 AthenaEventLoopMgr   INFO No more events in event selection 
 Stream1             DEBUG AthenaOutputStream Stream1 ::stop()
 Stream1             DEBUG slot 0  handle() incident type: MetaDataStop
-Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream1]
+Stream1.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
+Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream1, xAOD::FileMetaData#FileMetaData, xAOD::FileMetaDataAuxInfo#FileMetaDataAux.]
+Stream1             DEBUG addItemObjects(73252552,"FileMetaDataAux.") called
+Stream1             DEBUG            Key:FileMetaDataAux.
+Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
+Stream1             DEBUG  Added object 73252552,"FileMetaDataAux."
 Stream1             DEBUG addItemObjects(167728019,"Stream1") called
 Stream1             DEBUG            Key:Stream1
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
 Stream1             DEBUG  Added object 167728019,"Stream1"
+Stream1             DEBUG addItemObjects(178309087,"FileMetaData") called
+Stream1             DEBUG            Key:FileMetaData
+Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
+Stream1             DEBUG  Added object 178309087,"FileMetaData"
 Stream1             DEBUG addItemObjects(243004407,"EventFormatStream1") called
 Stream1             DEBUG            Key:EventFormatStream1
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
@@ -881,27 +912,51 @@ Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
 Stream1             DEBUG connectOutput done for SimplePoolReplica1.root
 StorageSvc           INFO Building shape according to reflection information using shape ID for:
+StorageSvc           INFO xAOD::FileMetaDataAuxInfo_v1 [????]
+SimplePoolRepli...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) of type ROOT_Tree
+SimplePoolRepli...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (14 , ffffffff)
+SimplePoolRepli...  DEBUG ---->ClassID:????
+SimplePoolRepli...  DEBUG --->Adding Shape[9 , ????]:  [1 Column(s)] 
+SimplePoolRepli...  DEBUG ---->Class:xAOD::FileMetaDataAuxInfo_v1
+SimplePoolRepli...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
+StorageSvc           INFO Building shape according to reflection information using shape ID for:
 StorageSvc           INFO EventStreamInfo_p3 [????]
 SimplePoolRepli...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(EventStreamInfo_p3/Stream1)
 MetaData(EventS...  DEBUG Opening
 MetaData(EventS...  DEBUG    attributes# = 1
 MetaData(EventS...  DEBUG Branch container 'EventStreamInfo_p3_Stream1'
 MetaData(EventS...  DEBUG Opened container MetaData(EventStreamInfo_p3/Stream1) of type ROOT_Tree
-SimplePoolRepli...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (14 , ffffffff)
+SimplePoolRepli...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (15 , ffffffff)
 SimplePoolRepli...  DEBUG ---->ClassID:????
-SimplePoolRepli...  DEBUG --->Adding Shape[9 , ????]:  [1 Column(s)] 
+SimplePoolRepli...  DEBUG --->Adding Shape[10 , ????]:  [1 Column(s)] 
 SimplePoolRepli...  DEBUG ---->Class:EventStreamInfo_p3
 SimplePoolRepli...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 StorageSvc           INFO Building shape according to reflection information using shape ID for:
+StorageSvc           INFO xAOD::FileMetaData_v1 [????]
+SimplePoolRepli...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaData_v1/FileMetaData)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaData_v1_FileMetaData'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaData_v1/FileMetaData) of type ROOT_Tree
+SimplePoolRepli...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (16 , ffffffff)
+SimplePoolRepli...  DEBUG ---->ClassID:????
+SimplePoolRepli...  DEBUG --->Adding Shape[11 , ????]:  [1 Column(s)] 
+SimplePoolRepli...  DEBUG ---->Class:xAOD::FileMetaData_v1
+SimplePoolRepli...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+StorageSvc           INFO Building shape according to reflection information using shape ID for:
 StorageSvc           INFO xAOD::EventFormat_v1 [????]
 SimplePoolRepli...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::EventFormat_v1/EventFormatStream1)
 MetaData(xAOD::...  DEBUG Opening
 MetaData(xAOD::...  DEBUG    attributes# = 1
 MetaData(xAOD::...  DEBUG Branch container 'xAOD::EventFormat_v1_EventFormatStream1'
 MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::EventFormat_v1/EventFormatStream1) of type ROOT_Tree
-SimplePoolRepli...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (15 , ffffffff)
+SimplePoolRepli...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (17 , ffffffff)
 SimplePoolRepli...  DEBUG ---->ClassID:????
-SimplePoolRepli...  DEBUG --->Adding Shape[10 , ????]:  [1 Column(s)] 
+SimplePoolRepli...  DEBUG --->Adding Shape[12 , ????]:  [1 Column(s)] 
 SimplePoolRepli...  DEBUG ---->Class:xAOD::EventFormat_v1
 SimplePoolRepli...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolRepli...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdr(DataHeader)
@@ -909,16 +964,20 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-SimplePoolRepli...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (16 , ffffffff)
+SimplePoolRepli...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (18 , ffffffff)
 SimplePoolRepli...  DEBUG ---->ClassID:????
 SimplePoolRepli...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
 MetaDataHdrForm...  DEBUG    attributes# = 1
 MetaDataHdrForm...  DEBUG Branch container 'DataHeaderForm'
 MetaDataHdrForm...  DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree
-SimplePoolRepli...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (17 , ffffffff)
+SimplePoolRepli...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (19 , ffffffff)
 SimplePoolRepli...  DEBUG ---->ClassID:????
-ClassIDSvc           INFO  getRegistryEntries: read 7 CLIDRegistry entries for module ALL
+MetaData(xAOD::...  DEBUG  SG::IAuxStoreIO* detected in xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.
+MetaData(xAOD::...  DEBUG        Attributes= 1
+MetaData(xAOD::...  DEBUG    Creating branch for new dynamic attribute, Id=52: type=float, mcProcID
+MetaData(xAOD::...  DEBUG createBasicAuxBranch: xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAuxDyn.mcProcID, leaf:mcProcID/F
+ClassIDSvc           INFO  getRegistryEntries: read 18 CLIDRegistry entries for module ALL
 Stream1              INFO Metadata records written: 21
 Stream1             DEBUG Leaving incident handler for MetaDataStop
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   CREATE    [ROOT_All] ????
@@ -935,12 +994,12 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 *****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] #= 63
+cRep_ALL             INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 65
 cObjR_ALL            INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.154(+-    1.23)/       0/      10 [ms] #= 65
-cObj_ALL             INFO Time User   : Tot=   20 [ms] Ave/Min/Max=   0.323(+-    1.77)/       0/      10 [ms] #= 62
-cRepR_ALL            INFO Time User   : Tot=   30 [ms] Ave/Min/Max=  0.0923(+-   0.956)/       0/      10 [ms] #=325
-fRep_ALL             INFO Time User   : Tot=   50 [ms] Ave/Min/Max=   0.794(+-     2.7)/       0/      10 [ms] #= 63
-ChronoStatSvc        INFO Time User   : Tot=  350 [ms]  #=  1
+cObj_ALL             INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.161(+-    1.26)/       0/      10 [ms] #= 62
+fRep_ALL             INFO Time User   : Tot=   30 [ms] Ave/Min/Max=   0.462(+-     2.1)/       0/      10 [ms] #= 65
+cRepR_ALL            INFO Time User   : Tot=   30 [ms] Ave/Min/Max=  0.0917(+-   0.953)/       0/      10 [ms] #=327
+ChronoStatSvc        INFO Time User   : Tot=  390 [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_RCond.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RCond.ref
index 52bb541adebe1e438623d4adffeec251ff68a57a..6ab064a1bd33d23ee58741753223307b0a5fe1a3 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RCond.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RCond.ref
@@ -1,17 +1,17 @@
-Thu Nov 19 08:29:40 CET 20?0
+Thu Nov 26 23:23:11 CET 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_RCondJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5589 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5426 configurables from 28 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 v34r1)
-                                          running on pc-tbed-pub-32.cern.ch on Thu Nov 19 08:29:51 20?0
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v35r0p1)
+                                          running on lxplus742.cern.ch on Thu Nov 26 23:23:23 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -33,8 +33,9 @@ PoolSvc             DEBUG Property update for OutputLevel : new value = 2
 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 Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-11-18T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 8 servers found for host pc-tbed-pub-32.cern.ch [ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ]
+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-11-25T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus742.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
@@ -77,10 +78,14 @@ SimplePoolFile1...  DEBUG ---->[0]:unsigned long long Typ:unsigned long long [23
 SimplePoolFile1...  DEBUG --->Reading Shape[8 , ????]: [1 Column(s)]
 SimplePoolFile1...  DEBUG ---->[0]:float Typ:float [10] Size:0 Offset:0 #Elements:1
 SimplePoolFile1...  DEBUG --->Reading Shape[9 , ????]: [1 Column(s)]
-SimplePoolFile1...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile1...  DEBUG --->Reading Shape[10 , ????]: [1 Column(s)]
+SimplePoolFile1...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG --->Reading Shape[11 , ????]: [1 Column(s)]
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG --->Reading Shape[12 , ????]: [1 Column(s)]
 SimplePoolFile1...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 11 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 13 Entries in total.
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -121,15 +126,19 @@ SimplePoolFile1...  DEBUG --->Reading Assoc:????/POOLCollectionTree(BunchId) [20
 SimplePoolFile1...  DEBUG ---->ClassID:????
 SimplePoolFile1...  DEBUG --->Reading Assoc:????/POOLCollectionTree(EventWeight) [20?]  (13 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (14 , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (14 , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (15 , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (16 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (15 , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (17 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (16 , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (18 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (17 , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (19 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 22 Entries in total.
+##Links             DEBUG No objects passing selection criteria... Container has 24 Entries in total.
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -144,7 +153,7 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-ClassIDSvc           INFO  getRegistryEntries: read 1666 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1716 CLIDRegistry entries for module ALL
 EventPersistenc...   INFO Added successfully Conversion service:AthenaPoolCnvSvc
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
@@ -976,9 +985,9 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 *****Chrono*****     INFO ****************************************************************************************************
 *****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
 *****Chrono*****     INFO ****************************************************************************************************
-cObjR_ALL            INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 49
-cObj_ALL             INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.222(+-    1.47)/       0/      10 [ms] #= 45
-ChronoStatSvc        INFO Time User   : Tot=  290 [ms]  #=  1
+cObjR_ALL            INFO Time User   : Tot=   20 [ms] Ave/Min/Max=   0.408(+-    1.98)/       0/      10 [ms] #= 49
+cObj_ALL             INFO Time User   : Tot=   30 [ms] Ave/Min/Max=   0.667(+-    2.49)/       0/      10 [ms] #= 45
+ChronoStatSvc        INFO Time User   : Tot=  300 [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_RMeta.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RMeta.ref
index 9b0337beb5ecdf060b0ad1adcf8ee79f1f989ce4..4265520c8b57faee7209b007e77b8500e947e232 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RMeta.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RMeta.ref
@@ -1,17 +1,17 @@
-Thu Nov 19 08:30:11 CET 20?0
+Thu Nov 26 22:51:03 CET 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_RMetaJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5589 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5426 configurables from 28 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 v34r1)
-                                          running on pc-tbed-pub-32.cern.ch on Thu Nov 19 08:30:24 20?0
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v35r0p1)
+                                          running on lxplus742.cern.ch on Thu Nov 26 22:51:14 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -30,8 +30,9 @@ PoolSvc              INFO io_register[PoolSvc](xmlcatalog_file:Catalog2.xml) [ok
 PoolSvc              INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok]
 PoolSvc              INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc              INFO Frontier compression level set to 5
-DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-11-18T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 8 servers found for host pc-tbed-pub-32.cern.ch [ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ]
+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-11-25T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus742.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
@@ -74,10 +75,14 @@ SimplePoolFile5...  DEBUG ---->[0]:unsigned long long Typ:unsigned long long [23
 SimplePoolFile5...  DEBUG --->Reading Shape[8 , ????]: [1 Column(s)]
 SimplePoolFile5...  DEBUG ---->[0]:float Typ:float [10] Size:0 Offset:0 #Elements:1
 SimplePoolFile5...  DEBUG --->Reading Shape[9 , ????]: [1 Column(s)]
-SimplePoolFile5...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile5...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile5...  DEBUG --->Reading Shape[10 , ????]: [1 Column(s)]
+SimplePoolFile5...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile5...  DEBUG --->Reading Shape[11 , ????]: [1 Column(s)]
+SimplePoolFile5...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile5...  DEBUG --->Reading Shape[12 , ????]: [1 Column(s)]
 SimplePoolFile5...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 11 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 13 Entries in total.
 SimplePoolFile5...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -118,17 +123,21 @@ SimplePoolFile5...  DEBUG --->Reading Assoc:????/POOLCollectionTree(BunchId) [20
 SimplePoolFile5...  DEBUG ---->ClassID:????
 SimplePoolFile5...  DEBUG --->Reading Assoc:????/POOLCollectionTree(EventWeight) [20?]  (13 , ffffffff)
 SimplePoolFile5...  DEBUG ---->ClassID:????
-SimplePoolFile5...  DEBUG --->Reading Assoc:????/MetaData(ExampleHitContainer_p1/PedestalWriteData) [20?]  (14 , ffffffff)
+SimplePoolFile5...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (14 , ffffffff)
+SimplePoolFile5...  DEBUG ---->ClassID:????
+SimplePoolFile5...  DEBUG --->Reading Assoc:????/MetaData(ExampleHitContainer_p1/PedestalWriteData) [20?]  (15 , ffffffff)
+SimplePoolFile5...  DEBUG ---->ClassID:????
+SimplePoolFile5...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (16 , ffffffff)
 SimplePoolFile5...  DEBUG ---->ClassID:????
-SimplePoolFile5...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (15 , ffffffff)
+SimplePoolFile5...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (17 , ffffffff)
 SimplePoolFile5...  DEBUG ---->ClassID:????
-SimplePoolFile5...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (16 , ffffffff)
+SimplePoolFile5...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (18 , ffffffff)
 SimplePoolFile5...  DEBUG ---->ClassID:????
-SimplePoolFile5...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (17 , ffffffff)
+SimplePoolFile5...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (19 , ffffffff)
 SimplePoolFile5...  DEBUG ---->ClassID:????
-SimplePoolFile5...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (18 , ffffffff)
+SimplePoolFile5...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (1a , ffffffff)
 SimplePoolFile5...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 23 Entries in total.
+##Links             DEBUG No objects passing selection criteria... Container has 25 Entries in total.
 SimplePoolFile5...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -143,7 +152,7 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-ClassIDSvc           INFO  getRegistryEntries: read 1666 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1716 CLIDRegistry entries for module ALL
 EventPersistenc...   INFO Added successfully Conversion service:AthenaPoolCnvSvc
 SimplePoolFile5...  DEBUG --> Access   DbContainer  READ      [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
@@ -845,9 +854,9 @@ ToolSvc.AthPool...   INFO in finalize()
 *****Chrono*****     INFO ****************************************************************************************************
 *****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
 *****Chrono*****     INFO ****************************************************************************************************
-cObjR_ALL            INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.213(+-    1.44)/       0/      10 [ms] #= 47
-cObj_ALL             INFO Time User   : Tot=   20 [ms] Ave/Min/Max=   0.455(+-    2.08)/       0/      10 [ms] #= 44
-ChronoStatSvc        INFO Time User   : Tot=  260 [ms]  #=  1
+cObjR_ALL            INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 47
+cObj_ALL             INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.227(+-    1.49)/       0/      10 [ms] #= 44
+ChronoStatSvc        INFO Time User   : Tot=  290 [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_ReWrite.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref
index 8a2d1ade0db0a793c731ba8d2417cf0ef2be082f..f59c16bcdff41d561582eba1e1191a4f62eda969 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref
@@ -1,17 +1,17 @@
-Thu Nov 19 08:27:22 CET 20?0
+Thu Nov 26 23:00:12 CET 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 5589 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5426 configurables from 28 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 v34r1)
-                                          running on pc-tbed-pub-32.cern.ch on Thu Nov 19 08:27:33 20?0
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v35r0p1)
+                                          running on lxplus742.cern.ch on Thu Nov 26 23:00:24 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -31,8 +31,9 @@ PoolSvc             DEBUG Property update for OutputLevel : new value = 2
 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 Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-11-18T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 8 servers found for host pc-tbed-pub-32.cern.ch [ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ]
+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-11-25T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus742.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
@@ -69,10 +70,14 @@ SimplePoolFile1...  DEBUG ---->[0]:Token Typ:Token [18] Size:0 Offset:0 #Element
 SimplePoolFile1...  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
 SimplePoolFile1...  DEBUG ---->[0]:unsigned int Typ:unsigned int [3] Size:0 Offset:0 #Elements:1
 SimplePoolFile1...  DEBUG --->Reading Shape[6 , ????]: [1 Column(s)]
-SimplePoolFile1...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile1...  DEBUG --->Reading Shape[7 , ????]: [1 Column(s)]
+SimplePoolFile1...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG --->Reading Shape[8 , ????]: [1 Column(s)]
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG --->Reading Shape[9 , ????]: [1 Column(s)]
 SimplePoolFile1...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 8 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 10 Entries in total.
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -95,15 +100,19 @@ SimplePoolFile1...  DEBUG --->Reading Assoc:????/POOLCollectionTree(EventNumber)
 SimplePoolFile1...  DEBUG ---->ClassID:????
 SimplePoolFile1...  DEBUG --->Reading Assoc:????/POOLCollectionTree(MagicNumber) [20?]  (a , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (b , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (b , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (c , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (c , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (d , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (d , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (e , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (e , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (f , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 13 Entries in total.
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (10 , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+##Links             DEBUG No objects passing selection criteria... Container has 15 Entries in total.
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -118,7 +127,7 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-ClassIDSvc           INFO  getRegistryEntries: read 1666 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1716 CLIDRegistry entries for module ALL
 EventPersistenc...   INFO Added successfully Conversion service:AthenaPoolCnvSvc
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
@@ -169,10 +178,13 @@ Stream1.Stream1...   INFO Initializing Stream1.Stream1Tool - package version Ath
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
 Stream1.Stream1...   INFO Initializing Stream1.Stream1_MakeEventStreamInfo - package version OutputStreamAthenaPool-00-00-00
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
+Stream1.FileMet...  DEBUG Property update for OutputLevel : new value = 2
+ClassIDSvc           INFO  getRegistryEntries: read 641 CLIDRegistry entries for module ALL
+Stream1.FileMet...  DEBUG Initialising - Package version: xAODMetaDataCnv-00-00-00
+Stream1.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
 Stream1.Thinnin...  DEBUG Property update for OutputLevel : new value = 2
-Stream1              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream1_MakeEventFormat','Athena::ThinningCacheTool/ThinningCacheTool_Stream1'])
+Stream1              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream1_MakeEventFormat','xAODMaker::FileMetaDataCreatorTool/FileMetaDataCreatorTool','Athena::ThinningCacheTool/ThinningCacheTool_Stream1'])
 Stream1              INFO Data output: SimplePoolFile3.root
-ClassIDSvc           INFO  getRegistryEntries: read 171 CLIDRegistry entries for module ALL
 MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 167728019
 Stream1              INFO I/O reinitialization...
 MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 167728019
@@ -183,10 +195,13 @@ Stream1             DEBUG output handles: 2
 Stream1             DEBUG Registering all Tools in ToolHandleArray HelperTools
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventStreamInfo (MakeEventStreamInfo)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool)
+Stream1             DEBUG Adding private ToolHandle tool Stream1.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.ThinningCacheTool_Stream1 (Athena::ThinningCacheTool)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1Tool (AthenaOutputStreamTool)
 Stream1             DEBUG Data Deps for Stream1
   + INPUT   ( 'AthenaAttributeList' , 'StoreGateSvc+MagicTag' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/Simulation/Parameters' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/TagInfo' ) 
   + OUTPUT  ( 'DataHeader' , 'StoreGateSvc+Stream1' ) 
   + OUTPUT  ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream1' ) 
   + OUTPUT  ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream1' ) 
@@ -203,6 +218,7 @@ MetaDataSvc         DEBUG handle() BeginInputFile for SimplePoolFile1.root
 MetaDataSvc         DEBUG initInputMetaDataStore: file name SimplePoolFile1.root
 MetaDataSvc         DEBUG Loaded input meta data store proxies
 MetaDataSvc         DEBUG  calling beginInputFile for ToolSvc.IOVDbMetaDataTool
+Stream1.FileMet...   INFO Invalid "/TagInfo" handle
 EventSelector       DEBUG Get AttributeList from the collection
 EventSelector       DEBUG AttributeList size 3
 EventSelector       DEBUG record AthenaAttribute, name = Token = [DB=????][CNT=POOLContainer(DataHeader)][CLID=????][TECH=0000020?][OID=00000005-00000000].
@@ -416,6 +432,10 @@ MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 167728019
 MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 167728019
 MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 243004407
 MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 243004407
+Stream1.FileMet...  DEBUG Valid  'EventInfoKey':'EventInfo' handle
+Stream1.FileMet...  DEBUG setting xAOD::FileMetaData::mcProcID to 0
+Stream1.FileMet...  DEBUG valid  'StreamName':'Stream1' handle
+Stream1.FileMet...  DEBUG set xAOD::FileMetaData::dataType to Stream1
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #0, run #1 1 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
 EventSelector       DEBUG AttributeList size 3
@@ -1889,15 +1909,32 @@ AthenaEventLoopMgr   INFO No more events in event selection
 Stream1             DEBUG AthenaOutputStream Stream1 ::stop()
 MetaDataSvc         DEBUG MetaDataSvc::stop()
 Stream1             DEBUG slot 0  handle() incident type: MetaDataStop
+Stream1.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
+MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 178309087
+MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 178309087
+MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 73252552
+MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 73252552
 MetaDataSvc         DEBUG  calling metaDataStop for ToolSvc.IOVDbMetaDataTool
 MetaDataSvc         DEBUG Locking metadata tools
-Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream1]
+Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream1, xAOD::FileMetaData#FileMetaData, xAOD::FileMetaDataAuxInfo#FileMetaDataAux.]
+Stream1             DEBUG addItemObjects(73252552,"FileMetaDataAux.") called
+Stream1             DEBUG            Key:FileMetaDataAux.
+Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
+MetaDataSvc         DEBUG Transforming MetaCont<xAOD::FileMetaDataAuxInfo> to xAOD::FileMetaDataAuxInfo for output
+Stream1             DEBUG  Added object 73252552,"FileMetaDataAux."
 Stream1             DEBUG addItemObjects(167728019,"Stream1") called
 Stream1             DEBUG            Key:Stream1
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
 MetaDataSvc         DEBUG Transforming MetaCont<EventStreamInfo> to EventStreamInfo for output
 Stream1             DEBUG  Added object 167728019,"Stream1"
+Stream1             DEBUG addItemObjects(178309087,"FileMetaData") called
+Stream1             DEBUG            Key:FileMetaData
+Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
+MetaDataSvc         DEBUG Transforming MetaCont<xAOD::FileMetaData> to xAOD::FileMetaData for output
+Stream1             DEBUG  Added object 178309087,"FileMetaData"
 Stream1             DEBUG addItemObjects(243004407,"EventFormatStream1") called
 Stream1             DEBUG            Key:EventFormatStream1
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
@@ -1911,27 +1948,51 @@ Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
 MetaDataSvc         DEBUG Not translating metadata item ID #1316383046
 Stream1             DEBUG connectOutput done for SimplePoolFile3.root
 StorageSvc           INFO Building shape according to reflection information using shape ID for:
+StorageSvc           INFO xAOD::FileMetaDataAuxInfo_v1 [????]
+SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) of type ROOT_Tree
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (b , ffffffff)
+SimplePoolFile3...  DEBUG ---->ClassID:????
+SimplePoolFile3...  DEBUG --->Adding Shape[6 , ????]:  [1 Column(s)] 
+SimplePoolFile3...  DEBUG ---->Class:xAOD::FileMetaDataAuxInfo_v1
+SimplePoolFile3...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
+StorageSvc           INFO Building shape according to reflection information using shape ID for:
 StorageSvc           INFO EventStreamInfo_p3 [????]
 SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(EventStreamInfo_p3/Stream1)
 MetaData(EventS...  DEBUG Opening
 MetaData(EventS...  DEBUG    attributes# = 1
 MetaData(EventS...  DEBUG Branch container 'EventStreamInfo_p3_Stream1'
 MetaData(EventS...  DEBUG Opened container MetaData(EventStreamInfo_p3/Stream1) of type ROOT_Tree
-SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (b , ffffffff)
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (c , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Adding Shape[6 , ????]:  [1 Column(s)] 
+SimplePoolFile3...  DEBUG --->Adding Shape[7 , ????]:  [1 Column(s)] 
 SimplePoolFile3...  DEBUG ---->Class:EventStreamInfo_p3
 SimplePoolFile3...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 StorageSvc           INFO Building shape according to reflection information using shape ID for:
+StorageSvc           INFO xAOD::FileMetaData_v1 [????]
+SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaData_v1/FileMetaData)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaData_v1_FileMetaData'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaData_v1/FileMetaData) of type ROOT_Tree
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (d , ffffffff)
+SimplePoolFile3...  DEBUG ---->ClassID:????
+SimplePoolFile3...  DEBUG --->Adding Shape[8 , ????]:  [1 Column(s)] 
+SimplePoolFile3...  DEBUG ---->Class:xAOD::FileMetaData_v1
+SimplePoolFile3...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+StorageSvc           INFO Building shape according to reflection information using shape ID for:
 StorageSvc           INFO xAOD::EventFormat_v1 [????]
 SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::EventFormat_v1/EventFormatStream1)
 MetaData(xAOD::...  DEBUG Opening
 MetaData(xAOD::...  DEBUG    attributes# = 1
 MetaData(xAOD::...  DEBUG Branch container 'xAOD::EventFormat_v1_EventFormatStream1'
 MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::EventFormat_v1/EventFormatStream1) of type ROOT_Tree
-SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (c , ffffffff)
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (e , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Adding Shape[7 , ????]:  [1 Column(s)] 
+SimplePoolFile3...  DEBUG --->Adding Shape[9 , ????]:  [1 Column(s)] 
 SimplePoolFile3...  DEBUG ---->Class:xAOD::EventFormat_v1
 SimplePoolFile3...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdr(DataHeader)
@@ -1939,16 +2000,20 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (d , ffffffff)
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (f , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
 SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
 MetaDataHdrForm...  DEBUG    attributes# = 1
 MetaDataHdrForm...  DEBUG Branch container 'DataHeaderForm'
 MetaDataHdrForm...  DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree
-SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (e , ffffffff)
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (10 , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-ClassIDSvc           INFO  getRegistryEntries: read 7 CLIDRegistry entries for module ALL
+MetaData(xAOD::...  DEBUG  SG::IAuxStoreIO* detected in xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.
+MetaData(xAOD::...  DEBUG        Attributes= 1
+MetaData(xAOD::...  DEBUG    Creating branch for new dynamic attribute, Id=52: type=float, mcProcID
+MetaData(xAOD::...  DEBUG createBasicAuxBranch: xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAuxDyn.mcProcID, leaf:mcProcID/F
+ClassIDSvc           INFO  getRegistryEntries: read 18 CLIDRegistry entries for module ALL
 Stream1              INFO Metadata records written: 21
 MetaDataSvc         DEBUG Unlocking metadata tools
 Stream1             DEBUG Leaving incident handler for MetaDataStop
@@ -1969,13 +2034,13 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 *****Chrono*****     INFO ****************************************************************************************************
 *****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
 *****Chrono*****     INFO ****************************************************************************************************
-cRep_ALL             INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 63
+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] #= 65
 cObjR_ALL            INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 66
-commitOutput         INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.476(+-    2.13)/       0/      10 [ms] #= 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=   50 [ms] Ave/Min/Max=   0.794(+-     2.7)/       0/      10 [ms] #= 63
-cRepR_ALL            INFO Time User   : Tot=   50 [ms] Ave/Min/Max=   0.345(+-    1.82)/       0/      10 [ms] #=145
-ChronoStatSvc        INFO Time User   : Tot=  380 [ms]  #=  1
+cRepR_ALL            INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.068(+-   0.822)/       0/      10 [ms] #=147
+fRep_ALL             INFO Time User   : Tot=   20 [ms] Ave/Min/Max=   0.308(+-    1.73)/       0/      10 [ms] #= 65
+ChronoStatSvc        INFO Time User   : Tot=  390 [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 c95f20eebce588b41f3fb34cdd74156dd750a29f..69b1edba3e59a9b46ad353bf310f8fb66333c3ad 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref
@@ -1,17 +1,17 @@
-Thu Nov 19 08:28:08 CET 20?0
+Thu Nov 26 23:39:25 CET 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 5589 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5426 configurables from 28 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 v34r1)
-                                          running on pc-tbed-pub-32.cern.ch on Thu Nov 19 08:28:19 20?0
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v35r0p1)
+                                          running on lxplus742.cern.ch on Thu Nov 26 23:39:43 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -31,8 +31,9 @@ PoolSvc             DEBUG Property update for OutputLevel : new value = 2
 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 Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-11-18T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 8 servers found for host pc-tbed-pub-32.cern.ch [ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ]
+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-11-25T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus742.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
@@ -75,10 +76,14 @@ SimplePoolRepli...  DEBUG ---->[0]:unsigned long long Typ:unsigned long long [23
 SimplePoolRepli...  DEBUG --->Reading Shape[8 , ????]: [1 Column(s)]
 SimplePoolRepli...  DEBUG ---->[0]:float Typ:float [10] Size:0 Offset:0 #Elements:1
 SimplePoolRepli...  DEBUG --->Reading Shape[9 , ????]: [1 Column(s)]
-SimplePoolRepli...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolRepli...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolRepli...  DEBUG --->Reading Shape[10 , ????]: [1 Column(s)]
+SimplePoolRepli...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolRepli...  DEBUG --->Reading Shape[11 , ????]: [1 Column(s)]
+SimplePoolRepli...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolRepli...  DEBUG --->Reading Shape[12 , ????]: [1 Column(s)]
 SimplePoolRepli...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 11 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 13 Entries in total.
 SimplePoolRepli...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -119,15 +124,19 @@ SimplePoolRepli...  DEBUG --->Reading Assoc:????/POOLCollectionTree(BunchId) [20
 SimplePoolRepli...  DEBUG ---->ClassID:????
 SimplePoolRepli...  DEBUG --->Reading Assoc:????/POOLCollectionTree(EventWeight) [20?]  (13 , ffffffff)
 SimplePoolRepli...  DEBUG ---->ClassID:????
-SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (14 , ffffffff)
+SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (14 , ffffffff)
+SimplePoolRepli...  DEBUG ---->ClassID:????
+SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (15 , ffffffff)
 SimplePoolRepli...  DEBUG ---->ClassID:????
-SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (15 , ffffffff)
+SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (16 , ffffffff)
 SimplePoolRepli...  DEBUG ---->ClassID:????
-SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (16 , ffffffff)
+SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (17 , ffffffff)
 SimplePoolRepli...  DEBUG ---->ClassID:????
-SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (17 , ffffffff)
+SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (18 , ffffffff)
 SimplePoolRepli...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 22 Entries in total.
+SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (19 , ffffffff)
+SimplePoolRepli...  DEBUG ---->ClassID:????
+##Links             DEBUG No objects passing selection criteria... Container has 24 Entries in total.
 SimplePoolRepli...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -142,7 +151,7 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-ClassIDSvc           INFO  getRegistryEntries: read 1666 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1716 CLIDRegistry entries for module ALL
 EventPersistenc...   INFO Added successfully Conversion service:AthenaPoolCnvSvc
 SimplePoolRepli...  DEBUG --> Access   DbContainer  READ      [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
@@ -193,10 +202,13 @@ Stream1.Stream1...   INFO Initializing Stream1.Stream1Tool - package version Ath
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
 Stream1.Stream1...   INFO Initializing Stream1.Stream1_MakeEventStreamInfo - package version OutputStreamAthenaPool-00-00-00
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
+Stream1.FileMet...  DEBUG Property update for OutputLevel : new value = 2
+ClassIDSvc           INFO  getRegistryEntries: read 641 CLIDRegistry entries for module ALL
+Stream1.FileMet...  DEBUG Initialising - Package version: xAODMetaDataCnv-00-00-00
+Stream1.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
 Stream1.Thinnin...  DEBUG Property update for OutputLevel : new value = 2
-Stream1              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream1_MakeEventFormat','Athena::ThinningCacheTool/ThinningCacheTool_Stream1'])
+Stream1              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream1_MakeEventFormat','xAODMaker::FileMetaDataCreatorTool/FileMetaDataCreatorTool','Athena::ThinningCacheTool/ThinningCacheTool_Stream1'])
 Stream1              INFO Data output: SimplePoolFile3.root
-ClassIDSvc           INFO  getRegistryEntries: read 171 CLIDRegistry entries for module ALL
 MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 167728019
 Stream1              INFO I/O reinitialization...
 MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 167728019
@@ -207,10 +219,13 @@ Stream1             DEBUG output handles: 2
 Stream1             DEBUG Registering all Tools in ToolHandleArray HelperTools
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventStreamInfo (MakeEventStreamInfo)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool)
+Stream1             DEBUG Adding private ToolHandle tool Stream1.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.ThinningCacheTool_Stream1 (Athena::ThinningCacheTool)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1Tool (AthenaOutputStreamTool)
 Stream1             DEBUG Data Deps for Stream1
   + INPUT   ( 'AthenaAttributeList' , 'StoreGateSvc+MagicTag' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/Simulation/Parameters' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/TagInfo' ) 
   + OUTPUT  ( 'DataHeader' , 'StoreGateSvc+Stream1' ) 
   + OUTPUT  ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream1' ) 
   + OUTPUT  ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream1' ) 
@@ -227,6 +242,7 @@ MetaDataSvc         DEBUG handle() BeginInputFile for SimplePoolReplica1.root
 MetaDataSvc         DEBUG initInputMetaDataStore: file name SimplePoolReplica1.root
 MetaDataSvc         DEBUG Loaded input meta data store proxies
 MetaDataSvc         DEBUG  calling beginInputFile for ToolSvc.IOVDbMetaDataTool
+Stream1.FileMet...   INFO Invalid "/TagInfo" handle
 EventSelector       DEBUG Get AttributeList from the collection
 EventSelector       DEBUG AttributeList size 12
 EventSelector       DEBUG record AthenaAttribute, name = Token = [DB=????][CNT=POOLContainer(DataHeader)][CLID=????][TECH=0000020?][OID=00000005-00000000].
@@ -439,6 +455,10 @@ MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 167728019
 MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 167728019
 MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 243004407
 MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 243004407
+Stream1.FileMet...  DEBUG Valid  'EventInfoKey':'EventInfo' handle
+Stream1.FileMet...  DEBUG setting xAOD::FileMetaData::mcProcID to 0
+Stream1.FileMet...  DEBUG valid  'StreamName':'Stream1' handle
+Stream1.FileMet...  DEBUG set xAOD::FileMetaData::dataType to Stream1
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #0, run #1 1 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
 EventSelector       DEBUG AttributeList size 12
@@ -1912,15 +1932,32 @@ AthenaEventLoopMgr   INFO No more events in event selection
 Stream1             DEBUG AthenaOutputStream Stream1 ::stop()
 MetaDataSvc         DEBUG MetaDataSvc::stop()
 Stream1             DEBUG slot 0  handle() incident type: MetaDataStop
+Stream1.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
+MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 178309087
+MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 178309087
+MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 73252552
+MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 73252552
 MetaDataSvc         DEBUG  calling metaDataStop for ToolSvc.IOVDbMetaDataTool
 MetaDataSvc         DEBUG Locking metadata tools
-Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream1]
+Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream1, xAOD::FileMetaData#FileMetaData, xAOD::FileMetaDataAuxInfo#FileMetaDataAux.]
+Stream1             DEBUG addItemObjects(73252552,"FileMetaDataAux.") called
+Stream1             DEBUG            Key:FileMetaDataAux.
+Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
+MetaDataSvc         DEBUG Transforming MetaCont<xAOD::FileMetaDataAuxInfo> to xAOD::FileMetaDataAuxInfo for output
+Stream1             DEBUG  Added object 73252552,"FileMetaDataAux."
 Stream1             DEBUG addItemObjects(167728019,"Stream1") called
 Stream1             DEBUG            Key:Stream1
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
 MetaDataSvc         DEBUG Transforming MetaCont<EventStreamInfo> to EventStreamInfo for output
 Stream1             DEBUG  Added object 167728019,"Stream1"
+Stream1             DEBUG addItemObjects(178309087,"FileMetaData") called
+Stream1             DEBUG            Key:FileMetaData
+Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
+MetaDataSvc         DEBUG Transforming MetaCont<xAOD::FileMetaData> to xAOD::FileMetaData for output
+Stream1             DEBUG  Added object 178309087,"FileMetaData"
 Stream1             DEBUG addItemObjects(243004407,"EventFormatStream1") called
 Stream1             DEBUG            Key:EventFormatStream1
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
@@ -1934,27 +1971,51 @@ Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
 MetaDataSvc         DEBUG Not translating metadata item ID #1316383046
 Stream1             DEBUG connectOutput done for SimplePoolFile3.root
 StorageSvc           INFO Building shape according to reflection information using shape ID for:
+StorageSvc           INFO xAOD::FileMetaDataAuxInfo_v1 [????]
+SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) of type ROOT_Tree
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (b , ffffffff)
+SimplePoolFile3...  DEBUG ---->ClassID:????
+SimplePoolFile3...  DEBUG --->Adding Shape[6 , ????]:  [1 Column(s)] 
+SimplePoolFile3...  DEBUG ---->Class:xAOD::FileMetaDataAuxInfo_v1
+SimplePoolFile3...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
+StorageSvc           INFO Building shape according to reflection information using shape ID for:
 StorageSvc           INFO EventStreamInfo_p3 [????]
 SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(EventStreamInfo_p3/Stream1)
 MetaData(EventS...  DEBUG Opening
 MetaData(EventS...  DEBUG    attributes# = 1
 MetaData(EventS...  DEBUG Branch container 'EventStreamInfo_p3_Stream1'
 MetaData(EventS...  DEBUG Opened container MetaData(EventStreamInfo_p3/Stream1) of type ROOT_Tree
-SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (b , ffffffff)
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (c , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Adding Shape[6 , ????]:  [1 Column(s)] 
+SimplePoolFile3...  DEBUG --->Adding Shape[7 , ????]:  [1 Column(s)] 
 SimplePoolFile3...  DEBUG ---->Class:EventStreamInfo_p3
 SimplePoolFile3...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 StorageSvc           INFO Building shape according to reflection information using shape ID for:
+StorageSvc           INFO xAOD::FileMetaData_v1 [????]
+SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaData_v1/FileMetaData)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaData_v1_FileMetaData'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaData_v1/FileMetaData) of type ROOT_Tree
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (d , ffffffff)
+SimplePoolFile3...  DEBUG ---->ClassID:????
+SimplePoolFile3...  DEBUG --->Adding Shape[8 , ????]:  [1 Column(s)] 
+SimplePoolFile3...  DEBUG ---->Class:xAOD::FileMetaData_v1
+SimplePoolFile3...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+StorageSvc           INFO Building shape according to reflection information using shape ID for:
 StorageSvc           INFO xAOD::EventFormat_v1 [????]
 SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::EventFormat_v1/EventFormatStream1)
 MetaData(xAOD::...  DEBUG Opening
 MetaData(xAOD::...  DEBUG    attributes# = 1
 MetaData(xAOD::...  DEBUG Branch container 'xAOD::EventFormat_v1_EventFormatStream1'
 MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::EventFormat_v1/EventFormatStream1) of type ROOT_Tree
-SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (c , ffffffff)
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (e , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Adding Shape[7 , ????]:  [1 Column(s)] 
+SimplePoolFile3...  DEBUG --->Adding Shape[9 , ????]:  [1 Column(s)] 
 SimplePoolFile3...  DEBUG ---->Class:xAOD::EventFormat_v1
 SimplePoolFile3...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdr(DataHeader)
@@ -1962,16 +2023,20 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (d , ffffffff)
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (f , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
 SimplePoolFile3...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
 MetaDataHdrForm...  DEBUG    attributes# = 1
 MetaDataHdrForm...  DEBUG Branch container 'DataHeaderForm'
 MetaDataHdrForm...  DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree
-SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (e , ffffffff)
+SimplePoolFile3...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (10 , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-ClassIDSvc           INFO  getRegistryEntries: read 7 CLIDRegistry entries for module ALL
+MetaData(xAOD::...  DEBUG  SG::IAuxStoreIO* detected in xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.
+MetaData(xAOD::...  DEBUG        Attributes= 1
+MetaData(xAOD::...  DEBUG    Creating branch for new dynamic attribute, Id=52: type=float, mcProcID
+MetaData(xAOD::...  DEBUG createBasicAuxBranch: xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAuxDyn.mcProcID, leaf:mcProcID/F
+ClassIDSvc           INFO  getRegistryEntries: read 18 CLIDRegistry entries for module ALL
 Stream1              INFO Metadata records written: 21
 MetaDataSvc         DEBUG Unlocking metadata tools
 Stream1             DEBUG Leaving incident handler for MetaDataStop
@@ -1992,13 +2057,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] #= 63
 cObjR_ALL            INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 65
-cObj_ALL             INFO Time User   : Tot=   30 [ms] Ave/Min/Max=   0.476(+-    2.13)/       0/      10 [ms] #= 63
-fRep_ALL             INFO Time User   : Tot=   30 [ms] Ave/Min/Max=   0.476(+-    2.13)/       0/      10 [ms] #= 63
-cRepR_ALL            INFO Time User   : Tot=   30 [ms] Ave/Min/Max=   0.207(+-    1.42)/       0/      10 [ms] #=145
-ChronoStatSvc        INFO Time User   : Tot=  350 [ms]  #=  1
+commitOutput         INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.476(+-    2.13)/       0/      10 [ms] #= 21
+cRep_ALL             INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.154(+-    1.23)/       0/      10 [ms] #= 65
+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=   30 [ms] Ave/Min/Max=   0.204(+-    1.83)/       0/      20 [ms] #=147
+fRep_ALL             INFO Time User   : Tot=   40 [ms] Ave/Min/Max=   0.615(+-    2.98)/       0/      20 [ms] #= 65
+ChronoStatSvc        INFO Time User   : Tot=  460 [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 76f8ef7242538273b9688ad32f31c50b31255912..f3db9bc8957631eca47bc2cbf72bd25797649bd9 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref
@@ -1,17 +1,17 @@
-Thu Nov 19 08:28:24 CET 20?0
+Thu Nov 26 23:39:50 CET 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 5589 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5426 configurables from 28 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 v34r1)
-                                          running on pc-tbed-pub-32.cern.ch on Thu Nov 19 08:28:35 20?0
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v35r0p1)
+                                          running on lxplus742.cern.ch on Thu Nov 26 23:40:09 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -31,8 +31,9 @@ PoolSvc             DEBUG Property update for OutputLevel : new value = 2
 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 Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-11-18T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 8 servers found for host pc-tbed-pub-32.cern.ch [ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ]
+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-11-25T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus742.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
@@ -69,10 +70,14 @@ SimplePoolFile3...  DEBUG ---->[0]:Token Typ:Token [18] Size:0 Offset:0 #Element
 SimplePoolFile3...  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
 SimplePoolFile3...  DEBUG ---->[0]:unsigned int Typ:unsigned int [3] Size:0 Offset:0 #Elements:1
 SimplePoolFile3...  DEBUG --->Reading Shape[6 , ????]: [1 Column(s)]
-SimplePoolFile3...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile3...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile3...  DEBUG --->Reading Shape[7 , ????]: [1 Column(s)]
+SimplePoolFile3...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile3...  DEBUG --->Reading Shape[8 , ????]: [1 Column(s)]
+SimplePoolFile3...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile3...  DEBUG --->Reading Shape[9 , ????]: [1 Column(s)]
 SimplePoolFile3...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 8 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 10 Entries in total.
 SimplePoolFile3...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -95,15 +100,19 @@ SimplePoolFile3...  DEBUG --->Reading Assoc:????/POOLCollectionTree(EventNumber)
 SimplePoolFile3...  DEBUG ---->ClassID:????
 SimplePoolFile3...  DEBUG --->Reading Assoc:????/POOLCollectionTree(MagicNumber) [20?]  (a , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (b , ffffffff)
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (b , ffffffff)
+SimplePoolFile3...  DEBUG ---->ClassID:????
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (c , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (c , ffffffff)
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (d , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (d , ffffffff)
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (e , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (e , ffffffff)
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (f , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 13 Entries in total.
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (10 , ffffffff)
+SimplePoolFile3...  DEBUG ---->ClassID:????
+##Links             DEBUG No objects passing selection criteria... Container has 15 Entries in total.
 SimplePoolFile3...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -118,7 +127,7 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-ClassIDSvc           INFO  getRegistryEntries: read 1666 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1716 CLIDRegistry entries for module ALL
 EventPersistenc...   INFO Added successfully Conversion service:AthenaPoolCnvSvc
 SimplePoolFile3...  DEBUG --> Access   DbContainer  READ      [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
@@ -169,10 +178,13 @@ Stream1.Stream1...   INFO Initializing Stream1.Stream1Tool - package version Ath
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
 Stream1.Stream1...   INFO Initializing Stream1.Stream1_MakeEventStreamInfo - package version OutputStreamAthenaPool-00-00-00
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
+Stream1.FileMet...  DEBUG Property update for OutputLevel : new value = 2
+ClassIDSvc           INFO  getRegistryEntries: read 641 CLIDRegistry entries for module ALL
+Stream1.FileMet...  DEBUG Initialising - Package version: xAODMetaDataCnv-00-00-00
+Stream1.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
 Stream1.Thinnin...  DEBUG Property update for OutputLevel : new value = 2
-Stream1              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream1_MakeEventFormat','Athena::ThinningCacheTool/ThinningCacheTool_Stream1'])
+Stream1              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream1_MakeEventFormat','xAODMaker::FileMetaDataCreatorTool/FileMetaDataCreatorTool','Athena::ThinningCacheTool/ThinningCacheTool_Stream1'])
 Stream1              INFO Data output: SimplePoolFile4.root
-ClassIDSvc           INFO  getRegistryEntries: read 171 CLIDRegistry entries for module ALL
 MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 167728019
 Stream1              INFO I/O reinitialization...
 MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 167728019
@@ -183,10 +195,13 @@ Stream1             DEBUG output handles: 2
 Stream1             DEBUG Registering all Tools in ToolHandleArray HelperTools
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventStreamInfo (MakeEventStreamInfo)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool)
+Stream1             DEBUG Adding private ToolHandle tool Stream1.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.ThinningCacheTool_Stream1 (Athena::ThinningCacheTool)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1Tool (AthenaOutputStreamTool)
 Stream1             DEBUG Data Deps for Stream1
   + INPUT   ( 'AthenaAttributeList' , 'StoreGateSvc+MagicTag' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/Simulation/Parameters' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/TagInfo' ) 
   + OUTPUT  ( 'DataHeader' , 'StoreGateSvc+Stream1' ) 
   + OUTPUT  ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream1' ) 
   + OUTPUT  ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream1' ) 
@@ -203,6 +218,7 @@ MetaDataSvc         DEBUG handle() BeginInputFile for SimplePoolFile3.root
 MetaDataSvc         DEBUG initInputMetaDataStore: file name SimplePoolFile3.root
 MetaDataSvc         DEBUG Loaded input meta data store proxies
 MetaDataSvc         DEBUG  calling beginInputFile for ToolSvc.IOVDbMetaDataTool
+Stream1.FileMet...   INFO Invalid "/TagInfo" handle
 EventSelector       DEBUG Get AttributeList from the collection
 EventSelector       DEBUG AttributeList size 3
 EventSelector       DEBUG record AthenaAttribute, name = Token = [DB=????][CNT=POOLContainer(DataHeader)][CLID=????][TECH=0000020?][OID=00000005-00000000].
@@ -382,6 +398,10 @@ MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 167728019
 MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 167728019
 MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 243004407
 MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 243004407
+Stream1.FileMet...  DEBUG Valid  'EventInfoKey':'EventInfo' handle
+Stream1.FileMet...  DEBUG setting xAOD::FileMetaData::mcProcID to 0
+Stream1.FileMet...  DEBUG valid  'StreamName':'Stream1' handle
+Stream1.FileMet...  DEBUG set xAOD::FileMetaData::dataType to Stream1
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #0, run #1 1 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
 EventSelector       DEBUG AttributeList size 3
@@ -1247,15 +1267,32 @@ AthenaEventLoopMgr   INFO No more events in event selection
 Stream1             DEBUG AthenaOutputStream Stream1 ::stop()
 MetaDataSvc         DEBUG MetaDataSvc::stop()
 Stream1             DEBUG slot 0  handle() incident type: MetaDataStop
+Stream1.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
+MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 178309087
+MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 178309087
+MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 73252552
+MetaDataSvc         DEBUG MetaDataSvc will handle ClassID 73252552
 MetaDataSvc         DEBUG  calling metaDataStop for ToolSvc.IOVDbMetaDataTool
 MetaDataSvc         DEBUG Locking metadata tools
-Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream1]
+Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream1, xAOD::FileMetaData#FileMetaData, xAOD::FileMetaDataAuxInfo#FileMetaDataAux.]
+Stream1             DEBUG addItemObjects(73252552,"FileMetaDataAux.") called
+Stream1             DEBUG            Key:FileMetaDataAux.
+Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
+MetaDataSvc         DEBUG Transforming MetaCont<xAOD::FileMetaDataAuxInfo> to xAOD::FileMetaDataAuxInfo for output
+Stream1             DEBUG  Added object 73252552,"FileMetaDataAux."
 Stream1             DEBUG addItemObjects(167728019,"Stream1") called
 Stream1             DEBUG            Key:Stream1
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
 MetaDataSvc         DEBUG Transforming MetaCont<EventStreamInfo> to EventStreamInfo for output
 Stream1             DEBUG  Added object 167728019,"Stream1"
+Stream1             DEBUG addItemObjects(178309087,"FileMetaData") called
+Stream1             DEBUG            Key:FileMetaData
+Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
+MetaDataSvc         DEBUG Transforming MetaCont<xAOD::FileMetaData> to xAOD::FileMetaData for output
+Stream1             DEBUG  Added object 178309087,"FileMetaData"
 Stream1             DEBUG addItemObjects(243004407,"EventFormatStream1") called
 Stream1             DEBUG            Key:EventFormatStream1
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
@@ -1269,27 +1306,51 @@ Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
 MetaDataSvc         DEBUG Not translating metadata item ID #1316383046
 Stream1             DEBUG connectOutput done for SimplePoolFile4.root
 StorageSvc           INFO Building shape according to reflection information using shape ID for:
+StorageSvc           INFO xAOD::FileMetaDataAuxInfo_v1 [????]
+SimplePoolFile4...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) of type ROOT_Tree
+SimplePoolFile4...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (b , ffffffff)
+SimplePoolFile4...  DEBUG ---->ClassID:????
+SimplePoolFile4...  DEBUG --->Adding Shape[6 , ????]:  [1 Column(s)] 
+SimplePoolFile4...  DEBUG ---->Class:xAOD::FileMetaDataAuxInfo_v1
+SimplePoolFile4...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
+StorageSvc           INFO Building shape according to reflection information using shape ID for:
 StorageSvc           INFO EventStreamInfo_p3 [????]
 SimplePoolFile4...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(EventStreamInfo_p3/Stream1)
 MetaData(EventS...  DEBUG Opening
 MetaData(EventS...  DEBUG    attributes# = 1
 MetaData(EventS...  DEBUG Branch container 'EventStreamInfo_p3_Stream1'
 MetaData(EventS...  DEBUG Opened container MetaData(EventStreamInfo_p3/Stream1) of type ROOT_Tree
-SimplePoolFile4...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (b , ffffffff)
+SimplePoolFile4...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (c , ffffffff)
 SimplePoolFile4...  DEBUG ---->ClassID:????
-SimplePoolFile4...  DEBUG --->Adding Shape[6 , ????]:  [1 Column(s)] 
+SimplePoolFile4...  DEBUG --->Adding Shape[7 , ????]:  [1 Column(s)] 
 SimplePoolFile4...  DEBUG ---->Class:EventStreamInfo_p3
 SimplePoolFile4...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 StorageSvc           INFO Building shape according to reflection information using shape ID for:
+StorageSvc           INFO xAOD::FileMetaData_v1 [????]
+SimplePoolFile4...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaData_v1/FileMetaData)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaData_v1_FileMetaData'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaData_v1/FileMetaData) of type ROOT_Tree
+SimplePoolFile4...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (d , ffffffff)
+SimplePoolFile4...  DEBUG ---->ClassID:????
+SimplePoolFile4...  DEBUG --->Adding Shape[8 , ????]:  [1 Column(s)] 
+SimplePoolFile4...  DEBUG ---->Class:xAOD::FileMetaData_v1
+SimplePoolFile4...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+StorageSvc           INFO Building shape according to reflection information using shape ID for:
 StorageSvc           INFO xAOD::EventFormat_v1 [????]
 SimplePoolFile4...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::EventFormat_v1/EventFormatStream1)
 MetaData(xAOD::...  DEBUG Opening
 MetaData(xAOD::...  DEBUG    attributes# = 1
 MetaData(xAOD::...  DEBUG Branch container 'xAOD::EventFormat_v1_EventFormatStream1'
 MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::EventFormat_v1/EventFormatStream1) of type ROOT_Tree
-SimplePoolFile4...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (c , ffffffff)
+SimplePoolFile4...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (e , ffffffff)
 SimplePoolFile4...  DEBUG ---->ClassID:????
-SimplePoolFile4...  DEBUG --->Adding Shape[7 , ????]:  [1 Column(s)] 
+SimplePoolFile4...  DEBUG --->Adding Shape[9 , ????]:  [1 Column(s)] 
 SimplePoolFile4...  DEBUG ---->Class:xAOD::EventFormat_v1
 SimplePoolFile4...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile4...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdr(DataHeader)
@@ -1297,16 +1358,20 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-SimplePoolFile4...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (d , ffffffff)
+SimplePoolFile4...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (f , ffffffff)
 SimplePoolFile4...  DEBUG ---->ClassID:????
 SimplePoolFile4...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
 MetaDataHdrForm...  DEBUG    attributes# = 1
 MetaDataHdrForm...  DEBUG Branch container 'DataHeaderForm'
 MetaDataHdrForm...  DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree
-SimplePoolFile4...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (e , ffffffff)
+SimplePoolFile4...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (10 , ffffffff)
 SimplePoolFile4...  DEBUG ---->ClassID:????
-ClassIDSvc           INFO  getRegistryEntries: read 7 CLIDRegistry entries for module ALL
+MetaData(xAOD::...  DEBUG  SG::IAuxStoreIO* detected in xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.
+MetaData(xAOD::...  DEBUG        Attributes= 1
+MetaData(xAOD::...  DEBUG    Creating branch for new dynamic attribute, Id=52: type=float, mcProcID
+MetaData(xAOD::...  DEBUG createBasicAuxBranch: xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAuxDyn.mcProcID, leaf:mcProcID/F
+ClassIDSvc           INFO  getRegistryEntries: read 18 CLIDRegistry entries for module ALL
 Stream1              INFO Metadata records written: 21
 MetaDataSvc         DEBUG Unlocking metadata tools
 Stream1             DEBUG Leaving incident handler for MetaDataStop
@@ -1327,13 +1392,13 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 *****Chrono*****     INFO ****************************************************************************************************
 *****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
 *****Chrono*****     INFO ****************************************************************************************************
-cRep_ALL             INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 63
-commitOutput         INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.476(+-    2.13)/       0/      10 [ms] #= 21
-cRepR_ALL            INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.069(+-   0.828)/       0/      10 [ms] #=145
-fRep_ALL             INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.159(+-    1.25)/       0/      10 [ms] #= 63
-cObjR_ALL            INFO Time User   : Tot=   20 [ms] Ave/Min/Max=   0.308(+-    1.73)/       0/      10 [ms] #= 65
-cObj_ALL             INFO Time User   : Tot=   20 [ms] Ave/Min/Max=   0.317(+-    1.75)/       0/      10 [ms] #= 63
-ChronoStatSvc        INFO Time User   : Tot=  370 [ms]  #=  1
+commitOutput         INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 21
+cObjR_ALL            INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 65
+cRep_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.068(+-   0.822)/       0/      10 [ms] #=147
+cObj_ALL             INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 63
+fRep_ALL             INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.154(+-    1.23)/       0/      10 [ms] #= 65
+ChronoStatSvc        INFO Time User   : Tot=  390 [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_Read.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Read.ref
index 45a63b269f31ca16ca81872413e44531839ab045..8a75c9f577ca22948d5deb3f7aa4dc55f3190e8d 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Read.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Read.ref
@@ -1,17 +1,17 @@
-Thu Nov 19 08:27:37 CET 20?0
+Thu Nov 26 23:21:18 CET 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_ReadJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5589 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5426 configurables from 28 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 v34r1)
-                                          running on pc-tbed-pub-32.cern.ch on Thu Nov 19 08:27:48 20?0
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v35r0p1)
+                                          running on lxplus742.cern.ch on Thu Nov 26 23:21:30 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -28,8 +28,9 @@ PoolSvc             DEBUG Property update for OutputLevel : new value = 2
 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 Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-11-18T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 8 servers found for host pc-tbed-pub-32.cern.ch [ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ]
+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-11-25T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus742.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
@@ -53,29 +54,37 @@ EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Shape
 ##Shapes            DEBUG    attributes# = 1
 ##Shapes            DEBUG Opened container ##Shapes of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Shape[0 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[1 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[2 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[3 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[4 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
 EmptyPoolFile.root  DEBUG ---->[0]:DataHeaderForm_p6 Typ:DataHeaderForm_p6 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 4 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 6 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
 ##Links             DEBUG Opened container ##Links of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Assoc:????/##Params [200]  (2 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (4 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (4 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (5 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (5 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (6 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (6 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (7 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 5 Entries in total.
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (8 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+##Links             DEBUG No objects passing selection criteria... Container has 7 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -114,10 +123,14 @@ SimplePoolFile1...  DEBUG ---->[0]:Token Typ:Token [18] Size:0 Offset:0 #Element
 SimplePoolFile1...  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
 SimplePoolFile1...  DEBUG ---->[0]:unsigned int Typ:unsigned int [3] Size:0 Offset:0 #Elements:1
 SimplePoolFile1...  DEBUG --->Reading Shape[6 , ????]: [1 Column(s)]
-SimplePoolFile1...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile1...  DEBUG --->Reading Shape[7 , ????]: [1 Column(s)]
+SimplePoolFile1...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG --->Reading Shape[8 , ????]: [1 Column(s)]
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG --->Reading Shape[9 , ????]: [1 Column(s)]
 SimplePoolFile1...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 8 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 10 Entries in total.
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -140,15 +153,19 @@ SimplePoolFile1...  DEBUG --->Reading Assoc:????/POOLCollectionTree(EventNumber)
 SimplePoolFile1...  DEBUG ---->ClassID:????
 SimplePoolFile1...  DEBUG --->Reading Assoc:????/POOLCollectionTree(MagicNumber) [20?]  (a , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (b , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (b , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (c , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (d , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (c , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (e , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (d , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (f , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (e , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (10 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 13 Entries in total.
+##Links             DEBUG No objects passing selection criteria... Container has 15 Entries in total.
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -163,7 +180,7 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-ClassIDSvc           INFO  getRegistryEntries: read 1666 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1716 CLIDRegistry entries for module ALL
 EventPersistenc...   INFO Added successfully Conversion service:AthenaPoolCnvSvc
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
@@ -194,29 +211,37 @@ EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Shape
 ##Shapes            DEBUG    attributes# = 1
 ##Shapes            DEBUG Opened container ##Shapes of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Shape[0 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[1 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[2 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[3 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[4 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
 EmptyPoolFile.root  DEBUG ---->[0]:DataHeaderForm_p6 Typ:DataHeaderForm_p6 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 4 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 6 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
 ##Links             DEBUG Opened container ##Links of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Assoc:????/##Params [200]  (2 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (3 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (4 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (4 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (5 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (5 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (6 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (6 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 5 Entries in total.
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (7 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (8 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+##Links             DEBUG No objects passing selection criteria... Container has 7 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -331,7 +356,7 @@ ReadData             INFO Hit x = 1020.49 y = 63.5816 z = -951.864 detector = Du
 ReadData             INFO Hit x = 1023.7 y = 57.9027 z = -953.684 detector = DummyHitDetector
 ReadData             INFO Hit x = 1026.91 y = 52.2238 z = -955.073 detector = DummyHitDetector
 ReadData             INFO Hit x = 1030.12 y = 46.5449 z = -956.169 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 21713
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23067
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #10, run #1 1 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -365,7 +390,7 @@ ReadData             INFO Hit x = 1120.49 y = 63.5816 z = -1051.86 detector = Du
 ReadData             INFO Hit x = 1123.7 y = 57.9027 z = -1053.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1126.91 y = 52.2238 z = -1055.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1130.12 y = 46.5449 z = -1056.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 21713
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23067
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #11, run #1 2 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -398,7 +423,7 @@ ReadData             INFO Hit x = 1220.49 y = 63.5816 z = -1151.86 detector = Du
 ReadData             INFO Hit x = 1223.7 y = 57.9027 z = -1153.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1226.91 y = 52.2238 z = -1155.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1230.12 y = 46.5449 z = -1156.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 21713
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23067
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #12, run #1 3 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -431,7 +456,7 @@ ReadData             INFO Hit x = 1320.49 y = 63.5816 z = -1251.86 detector = Du
 ReadData             INFO Hit x = 1323.7 y = 57.9027 z = -1253.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1326.91 y = 52.2238 z = -1255.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1330.12 y = 46.5449 z = -1256.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 21713
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23067
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #13, run #1 4 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -464,7 +489,7 @@ ReadData             INFO Hit x = 1420.49 y = 63.5816 z = -1351.86 detector = Du
 ReadData             INFO Hit x = 1423.7 y = 57.9027 z = -1353.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1426.91 y = 52.2238 z = -1355.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1430.12 y = 46.5449 z = -1356.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 21713
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23067
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #14, run #1 5 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -497,7 +522,7 @@ ReadData             INFO Hit x = 1520.49 y = 63.5816 z = -1451.86 detector = Du
 ReadData             INFO Hit x = 1523.7 y = 57.9027 z = -1453.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1526.91 y = 52.2238 z = -1455.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1530.12 y = 46.5449 z = -1456.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 21713
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23067
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #15, run #1 6 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -530,7 +555,7 @@ ReadData             INFO Hit x = 1620.49 y = 63.5816 z = -1551.86 detector = Du
 ReadData             INFO Hit x = 1623.7 y = 57.9027 z = -1553.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1626.91 y = 52.2238 z = -1555.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1630.12 y = 46.5449 z = -1556.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 21713
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23067
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #16, run #1 7 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -563,7 +588,7 @@ ReadData             INFO Hit x = 1720.49 y = 63.5816 z = -1651.86 detector = Du
 ReadData             INFO Hit x = 1723.7 y = 57.9027 z = -1653.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1726.91 y = 52.2238 z = -1655.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1730.12 y = 46.5449 z = -1656.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 21713
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23067
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #17, run #1 8 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -596,7 +621,7 @@ ReadData             INFO Hit x = 1820.49 y = 63.5816 z = -1751.86 detector = Du
 ReadData             INFO Hit x = 1823.7 y = 57.9027 z = -1753.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1826.91 y = 52.2238 z = -1755.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1830.12 y = 46.5449 z = -1756.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 21713
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23067
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #18, run #1 9 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -629,7 +654,7 @@ ReadData             INFO Hit x = 1920.49 y = 63.5816 z = -1851.86 detector = Du
 ReadData             INFO Hit x = 1923.7 y = 57.9027 z = -1853.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1926.91 y = 52.2238 z = -1855.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1930.12 y = 46.5449 z = -1856.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 21713
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23067
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #19, run #1 10 events processed so far  <<<===
 MetaDataSvc         DEBUG handle() EndInputFile for FID:????
@@ -648,29 +673,37 @@ EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Shape
 ##Shapes            DEBUG    attributes# = 1
 ##Shapes            DEBUG Opened container ##Shapes of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Shape[0 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[1 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[2 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[3 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[4 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
 EmptyPoolFile.root  DEBUG ---->[0]:DataHeaderForm_p6 Typ:DataHeaderForm_p6 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 4 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 6 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
 ##Links             DEBUG Opened container ##Links of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Assoc:????/##Params [200]  (2 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (4 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (4 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (5 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (5 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (6 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (6 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (7 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 5 Entries in total.
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (8 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+##Links             DEBUG No objects passing selection criteria... Container has 7 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -717,10 +750,14 @@ SimplePoolFile2...  DEBUG ---->[0]:Token Typ:Token [18] Size:0 Offset:0 #Element
 SimplePoolFile2...  DEBUG --->Reading Shape[4 , ????]: [1 Column(s)]
 SimplePoolFile2...  DEBUG ---->[0]:unsigned int Typ:unsigned int [3] Size:0 Offset:0 #Elements:1
 SimplePoolFile2...  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
-SimplePoolFile2...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile2...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile2...  DEBUG --->Reading Shape[6 , ????]: [1 Column(s)]
+SimplePoolFile2...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile2...  DEBUG --->Reading Shape[7 , ????]: [1 Column(s)]
+SimplePoolFile2...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile2...  DEBUG --->Reading Shape[8 , ????]: [1 Column(s)]
 SimplePoolFile2...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 7 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 9 Entries in total.
 SimplePoolFile2...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -741,15 +778,19 @@ SimplePoolFile2...  DEBUG --->Reading Assoc:????/POOLCollectionTree(EventNumber)
 SimplePoolFile2...  DEBUG ---->ClassID:????
 SimplePoolFile2...  DEBUG --->Reading Assoc:????/POOLCollectionTree(MagicNumber) [20?]  (9 , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream2) [20?]  (a , ffffffff)
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (a , ffffffff)
+SimplePoolFile2...  DEBUG ---->ClassID:????
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream2) [20?]  (b , ffffffff)
+SimplePoolFile2...  DEBUG ---->ClassID:????
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (c , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream2) [20?]  (b , ffffffff)
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream2) [20?]  (d , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (c , ffffffff)
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (e , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (d , ffffffff)
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (f , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 12 Entries in total.
+##Links             DEBUG No objects passing selection criteria... Container has 14 Entries in total.
 SimplePoolFile2...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -823,7 +864,7 @@ ReadData             INFO EventInfo event: 0 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #0, run #1 11 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -845,7 +886,7 @@ ReadData             INFO EventInfo event: 1 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #1, run #1 12 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -867,7 +908,7 @@ ReadData             INFO EventInfo event: 2 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #2, run #1 13 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -889,7 +930,7 @@ ReadData             INFO EventInfo event: 3 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #3, run #1 14 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -911,7 +952,7 @@ ReadData             INFO EventInfo event: 4 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #4, run #1 15 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -933,7 +974,7 @@ ReadData             INFO EventInfo event: 5 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #5, run #1 16 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -955,7 +996,7 @@ ReadData             INFO EventInfo event: 6 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #6, run #1 17 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -977,7 +1018,7 @@ ReadData             INFO EventInfo event: 7 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #7, run #1 18 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -999,7 +1040,7 @@ ReadData             INFO EventInfo event: 8 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #8, run #1 19 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1021,7 +1062,7 @@ ReadData             INFO EventInfo event: 9 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #9, run #1 20 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1043,7 +1084,7 @@ ReadData             INFO EventInfo event: 10 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #10, run #1 21 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1065,7 +1106,7 @@ ReadData             INFO EventInfo event: 11 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #11, run #1 22 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1087,7 +1128,7 @@ ReadData             INFO EventInfo event: 12 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #12, run #1 23 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1109,7 +1150,7 @@ ReadData             INFO EventInfo event: 13 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #13, run #1 24 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1131,7 +1172,7 @@ ReadData             INFO EventInfo event: 14 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #14, run #1 25 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1153,7 +1194,7 @@ ReadData             INFO EventInfo event: 15 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #15, run #1 26 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1175,7 +1216,7 @@ ReadData             INFO EventInfo event: 16 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #16, run #1 27 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1197,7 +1238,7 @@ ReadData             INFO EventInfo event: 17 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #17, run #1 28 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1219,7 +1260,7 @@ ReadData             INFO EventInfo event: 18 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #18, run #1 29 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1241,7 +1282,7 @@ ReadData             INFO EventInfo event: 19 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19775
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #19, run #1 30 events processed so far  <<<===
 MetaDataSvc         DEBUG handle() EndInputFile for FID:????
@@ -1272,10 +1313,14 @@ SimplePoolFile3...  DEBUG ---->[0]:Token Typ:Token [18] Size:0 Offset:0 #Element
 SimplePoolFile3...  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
 SimplePoolFile3...  DEBUG ---->[0]:unsigned int Typ:unsigned int [3] Size:0 Offset:0 #Elements:1
 SimplePoolFile3...  DEBUG --->Reading Shape[6 , ????]: [1 Column(s)]
-SimplePoolFile3...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile3...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile3...  DEBUG --->Reading Shape[7 , ????]: [1 Column(s)]
+SimplePoolFile3...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile3...  DEBUG --->Reading Shape[8 , ????]: [1 Column(s)]
+SimplePoolFile3...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile3...  DEBUG --->Reading Shape[9 , ????]: [1 Column(s)]
 SimplePoolFile3...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 8 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 10 Entries in total.
 SimplePoolFile3...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -1298,15 +1343,19 @@ SimplePoolFile3...  DEBUG --->Reading Assoc:????/POOLCollectionTree(EventNumber)
 SimplePoolFile3...  DEBUG ---->ClassID:????
 SimplePoolFile3...  DEBUG --->Reading Assoc:????/POOLCollectionTree(MagicNumber) [20?]  (a , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (b , ffffffff)
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (b , ffffffff)
+SimplePoolFile3...  DEBUG ---->ClassID:????
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (c , ffffffff)
+SimplePoolFile3...  DEBUG ---->ClassID:????
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (d , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (c , ffffffff)
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (e , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (d , ffffffff)
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (f , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (e , ffffffff)
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (10 , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 13 Entries in total.
+##Links             DEBUG No objects passing selection criteria... Container has 15 Entries in total.
 SimplePoolFile3...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -1389,7 +1438,7 @@ ReadData             INFO Track pt = 74.8928 eta = 3.1676 phi = 2.6161 detector
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #0, run #1 31 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1415,7 +1464,7 @@ ReadData             INFO Track pt = 137.584 eta = -39.525 phi = 17.2679 detecto
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #1, run #1 32 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1441,7 +1490,7 @@ ReadData             INFO Track pt = 228.154 eta = -6.2704 phi = 31.9197 detecto
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #2, run #1 33 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1467,7 +1516,7 @@ ReadData             INFO Track pt = 324.306 eta = -15.8941 phi = 46.5715 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #3, run #1 34 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1493,7 +1542,7 @@ ReadData             INFO Track pt = 422.255 eta = -13.279 phi = 61.2233 detecto
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #4, run #1 35 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1519,7 +1568,7 @@ ReadData             INFO Track pt = 520.987 eta = -12.3511 phi = 75.8751 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #5, run #1 36 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1545,7 +1594,7 @@ ReadData             INFO Track pt = 620.127 eta = -11.8468 phi = 90.5269 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #6, run #1 37 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1571,7 +1620,7 @@ ReadData             INFO Track pt = 719.507 eta = -11.5247 phi = 105.179 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #7, run #1 38 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1597,7 +1646,7 @@ ReadData             INFO Track pt = 819.038 eta = -11.2998 phi = 119.831 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #8, run #1 39 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1623,7 +1672,7 @@ ReadData             INFO Track pt = 918.671 eta = -11.1334 phi = 134.482 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #9, run #1 40 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1649,7 +1698,7 @@ ReadData             INFO Track pt = 1018.38 eta = -11.0052 phi = 149.134 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #10, run #1 41 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1675,7 +1724,7 @@ ReadData             INFO Track pt = 1118.13 eta = -10.9031 phi = 163.786 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #11, run #1 42 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1701,7 +1750,7 @@ ReadData             INFO Track pt = 1217.93 eta = -10.82 phi = 178.438 detector
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #12, run #1 43 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1727,7 +1776,7 @@ ReadData             INFO Track pt = 1317.76 eta = -10.751 phi = 193.09 detector
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #13, run #1 44 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1753,7 +1802,7 @@ ReadData             INFO Track pt = 1417.61 eta = -10.6927 phi = 207.741 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #14, run #1 45 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1779,7 +1828,7 @@ ReadData             INFO Track pt = 1517.49 eta = -10.6429 phi = 222.393 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #15, run #1 46 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1805,7 +1854,7 @@ ReadData             INFO Track pt = 1617.37 eta = -10.5997 phi = 237.045 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #16, run #1 47 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1831,7 +1880,7 @@ ReadData             INFO Track pt = 1717.27 eta = -10.562 phi = 251.697 detecto
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #17, run #1 48 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1857,7 +1906,7 @@ ReadData             INFO Track pt = 1817.19 eta = -10.5288 phi = 266.349 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #18, run #1 49 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1883,7 +1932,7 @@ ReadData             INFO Track pt = 1917.11 eta = -10.4993 phi = 281 detector =
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20710
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 22092
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #19, run #1 50 events processed so far  <<<===
 MetaDataSvc         DEBUG handle() EndInputFile for FID:????
@@ -1902,9 +1951,9 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 *****Chrono*****     INFO ****************************************************************************************************
 *****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
 *****Chrono*****     INFO ****************************************************************************************************
-cObjR_ALL            INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.068(+-   0.822)/       0/      10 [ms] #=147
-cObj_ALL             INFO Time User   : Tot=   30 [ms] Ave/Min/Max=   0.216(+-    1.45)/       0/      10 [ms] #=139
-ChronoStatSvc        INFO Time User   : Tot=  240 [ms]  #=  1
+cObjR_ALL            INFO Time User   : Tot=   30 [ms] Ave/Min/Max=   0.204(+-    1.41)/       0/      10 [ms] #=147
+cObj_ALL             INFO Time User   : Tot=   40 [ms] Ave/Min/Max=   0.288(+-    1.67)/       0/      10 [ms] #=139
+ChronoStatSvc        INFO Time User   : Tot=  310 [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_ReadAgain.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadAgain.ref
index 6fd0f6cf1976fa5e6e3e416bfbc5c96fa0baa69e..3b284314ed1505f31931de19fb94925ae853360b 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadAgain.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadAgain.ref
@@ -1,17 +1,17 @@
-Thu Nov 19 08:28:39 CET 20?0
+Thu Nov 26 22:58:14 CET 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_ReadAgainJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5589 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5426 configurables from 28 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 v34r1)
-                                          running on pc-tbed-pub-32.cern.ch on Thu Nov 19 08:28:49 20?0
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v35r0p1)
+                                          running on lxplus742.cern.ch on Thu Nov 26 22:58:25 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -29,8 +29,9 @@ PoolSvc             DEBUG Property update for OutputLevel : new value = 2
 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 Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-11-18T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 8 servers found for host pc-tbed-pub-32.cern.ch [ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ]
+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-11-25T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus742.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
@@ -54,29 +55,37 @@ EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Shape
 ##Shapes            DEBUG    attributes# = 1
 ##Shapes            DEBUG Opened container ##Shapes of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Shape[0 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[1 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[2 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[3 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[4 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
 EmptyPoolFile.root  DEBUG ---->[0]:DataHeaderForm_p6 Typ:DataHeaderForm_p6 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 4 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 6 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
 ##Links             DEBUG Opened container ##Links of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Assoc:????/##Params [200]  (2 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (4 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (4 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (5 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (5 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (6 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (6 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (7 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 5 Entries in total.
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (8 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+##Links             DEBUG No objects passing selection criteria... Container has 7 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -121,10 +130,14 @@ SimplePoolRepli...  DEBUG ---->[0]:unsigned long long Typ:unsigned long long [23
 SimplePoolRepli...  DEBUG --->Reading Shape[8 , ????]: [1 Column(s)]
 SimplePoolRepli...  DEBUG ---->[0]:float Typ:float [10] Size:0 Offset:0 #Elements:1
 SimplePoolRepli...  DEBUG --->Reading Shape[9 , ????]: [1 Column(s)]
-SimplePoolRepli...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolRepli...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolRepli...  DEBUG --->Reading Shape[10 , ????]: [1 Column(s)]
+SimplePoolRepli...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolRepli...  DEBUG --->Reading Shape[11 , ????]: [1 Column(s)]
+SimplePoolRepli...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolRepli...  DEBUG --->Reading Shape[12 , ????]: [1 Column(s)]
 SimplePoolRepli...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 11 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 13 Entries in total.
 SimplePoolRepli...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -165,15 +178,19 @@ SimplePoolRepli...  DEBUG --->Reading Assoc:????/POOLCollectionTree(BunchId) [20
 SimplePoolRepli...  DEBUG ---->ClassID:????
 SimplePoolRepli...  DEBUG --->Reading Assoc:????/POOLCollectionTree(EventWeight) [20?]  (13 , ffffffff)
 SimplePoolRepli...  DEBUG ---->ClassID:????
-SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (14 , ffffffff)
+SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (14 , ffffffff)
+SimplePoolRepli...  DEBUG ---->ClassID:????
+SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (15 , ffffffff)
+SimplePoolRepli...  DEBUG ---->ClassID:????
+SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (16 , ffffffff)
 SimplePoolRepli...  DEBUG ---->ClassID:????
-SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (15 , ffffffff)
+SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (17 , ffffffff)
 SimplePoolRepli...  DEBUG ---->ClassID:????
-SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (16 , ffffffff)
+SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (18 , ffffffff)
 SimplePoolRepli...  DEBUG ---->ClassID:????
-SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (17 , ffffffff)
+SimplePoolRepli...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (19 , ffffffff)
 SimplePoolRepli...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 22 Entries in total.
+##Links             DEBUG No objects passing selection criteria... Container has 24 Entries in total.
 SimplePoolRepli...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -188,7 +205,7 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-ClassIDSvc           INFO  getRegistryEntries: read 1666 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1716 CLIDRegistry entries for module ALL
 EventPersistenc...   INFO Added successfully Conversion service:AthenaPoolCnvSvc
 SimplePoolRepli...  DEBUG --> Access   DbContainer  READ      [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
@@ -224,29 +241,37 @@ EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Shape
 ##Shapes            DEBUG    attributes# = 1
 ##Shapes            DEBUG Opened container ##Shapes of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Shape[0 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[1 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[2 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[3 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[4 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
 EmptyPoolFile.root  DEBUG ---->[0]:DataHeaderForm_p6 Typ:DataHeaderForm_p6 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 4 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 6 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
 ##Links             DEBUG Opened container ##Links of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Assoc:????/##Params [200]  (2 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (3 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (4 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (4 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (5 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (5 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (6 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (6 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 5 Entries in total.
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (7 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (8 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+##Links             DEBUG No objects passing selection criteria... Container has 7 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -361,7 +386,7 @@ ReadData             INFO Hit x = 1020.49 y = 63.5816 z = -951.864 detector = Du
 ReadData             INFO Hit x = 1023.7 y = 57.9027 z = -953.684 detector = DummyHitDetector
 ReadData             INFO Hit x = 1026.91 y = 52.2238 z = -955.073 detector = DummyHitDetector
 ReadData             INFO Hit x = 1030.12 y = 46.5449 z = -956.169 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 22526
+PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 23861
 PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [READ_CALLS]: 23
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #10, run #1 1 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -395,7 +420,7 @@ ReadData             INFO Hit x = 1120.49 y = 63.5816 z = -1051.86 detector = Du
 ReadData             INFO Hit x = 1123.7 y = 57.9027 z = -1053.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1126.91 y = 52.2238 z = -1055.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1130.12 y = 46.5449 z = -1056.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 22526
+PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 23861
 PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [READ_CALLS]: 23
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #11, run #1 2 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -428,7 +453,7 @@ ReadData             INFO Hit x = 1220.49 y = 63.5816 z = -1151.86 detector = Du
 ReadData             INFO Hit x = 1223.7 y = 57.9027 z = -1153.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1226.91 y = 52.2238 z = -1155.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1230.12 y = 46.5449 z = -1156.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 22526
+PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 23861
 PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [READ_CALLS]: 23
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #12, run #1 3 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -461,7 +486,7 @@ ReadData             INFO Hit x = 1320.49 y = 63.5816 z = -1251.86 detector = Du
 ReadData             INFO Hit x = 1323.7 y = 57.9027 z = -1253.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1326.91 y = 52.2238 z = -1255.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1330.12 y = 46.5449 z = -1256.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 22526
+PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 23861
 PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [READ_CALLS]: 23
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #13, run #1 4 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -494,7 +519,7 @@ ReadData             INFO Hit x = 1420.49 y = 63.5816 z = -1351.86 detector = Du
 ReadData             INFO Hit x = 1423.7 y = 57.9027 z = -1353.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1426.91 y = 52.2238 z = -1355.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1430.12 y = 46.5449 z = -1356.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 22526
+PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 23861
 PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [READ_CALLS]: 23
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #14, run #1 5 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -527,7 +552,7 @@ ReadData             INFO Hit x = 1520.49 y = 63.5816 z = -1451.86 detector = Du
 ReadData             INFO Hit x = 1523.7 y = 57.9027 z = -1453.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1526.91 y = 52.2238 z = -1455.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1530.12 y = 46.5449 z = -1456.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 22526
+PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 23861
 PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [READ_CALLS]: 23
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #15, run #1 6 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -560,7 +585,7 @@ ReadData             INFO Hit x = 1620.49 y = 63.5816 z = -1551.86 detector = Du
 ReadData             INFO Hit x = 1623.7 y = 57.9027 z = -1553.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1626.91 y = 52.2238 z = -1555.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1630.12 y = 46.5449 z = -1556.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 22526
+PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 23861
 PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [READ_CALLS]: 23
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #16, run #1 7 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -593,7 +618,7 @@ ReadData             INFO Hit x = 1720.49 y = 63.5816 z = -1651.86 detector = Du
 ReadData             INFO Hit x = 1723.7 y = 57.9027 z = -1653.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1726.91 y = 52.2238 z = -1655.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1730.12 y = 46.5449 z = -1656.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 22526
+PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 23861
 PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [READ_CALLS]: 23
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #17, run #1 8 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -626,7 +651,7 @@ ReadData             INFO Hit x = 1820.49 y = 63.5816 z = -1751.86 detector = Du
 ReadData             INFO Hit x = 1823.7 y = 57.9027 z = -1753.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1826.91 y = 52.2238 z = -1755.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1830.12 y = 46.5449 z = -1756.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 22526
+PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 23861
 PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [READ_CALLS]: 23
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #18, run #1 9 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -659,7 +684,7 @@ ReadData             INFO Hit x = 1920.49 y = 63.5816 z = -1851.86 detector = Du
 ReadData             INFO Hit x = 1923.7 y = 57.9027 z = -1853.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1926.91 y = 52.2238 z = -1855.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1930.12 y = 46.5449 z = -1856.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 22526
+PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [BYTES_READ]: 23861
 PoolSvc              INFO Database (SimplePoolReplica1.root) attribute [READ_CALLS]: 23
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #19, run #1 10 events processed so far  <<<===
 MetaDataSvc         DEBUG handle() EndInputFile for FID:????
@@ -678,29 +703,37 @@ EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Shape
 ##Shapes            DEBUG    attributes# = 1
 ##Shapes            DEBUG Opened container ##Shapes of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Shape[0 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[1 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[2 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[3 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[4 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
 EmptyPoolFile.root  DEBUG ---->[0]:DataHeaderForm_p6 Typ:DataHeaderForm_p6 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 4 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 6 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
 ##Links             DEBUG Opened container ##Links of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Assoc:????/##Params [200]  (2 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (4 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (4 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (5 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (5 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (6 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (6 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (7 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 5 Entries in total.
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (8 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+##Links             DEBUG No objects passing selection criteria... Container has 7 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -747,10 +780,14 @@ SimplePoolFile2...  DEBUG ---->[0]:Token Typ:Token [18] Size:0 Offset:0 #Element
 SimplePoolFile2...  DEBUG --->Reading Shape[4 , ????]: [1 Column(s)]
 SimplePoolFile2...  DEBUG ---->[0]:unsigned int Typ:unsigned int [3] Size:0 Offset:0 #Elements:1
 SimplePoolFile2...  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
-SimplePoolFile2...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile2...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile2...  DEBUG --->Reading Shape[6 , ????]: [1 Column(s)]
+SimplePoolFile2...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile2...  DEBUG --->Reading Shape[7 , ????]: [1 Column(s)]
+SimplePoolFile2...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile2...  DEBUG --->Reading Shape[8 , ????]: [1 Column(s)]
 SimplePoolFile2...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 7 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 9 Entries in total.
 SimplePoolFile2...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -771,15 +808,19 @@ SimplePoolFile2...  DEBUG --->Reading Assoc:????/POOLCollectionTree(EventNumber)
 SimplePoolFile2...  DEBUG ---->ClassID:????
 SimplePoolFile2...  DEBUG --->Reading Assoc:????/POOLCollectionTree(MagicNumber) [20?]  (9 , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream2) [20?]  (a , ffffffff)
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (a , ffffffff)
+SimplePoolFile2...  DEBUG ---->ClassID:????
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream2) [20?]  (b , ffffffff)
+SimplePoolFile2...  DEBUG ---->ClassID:????
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (c , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream2) [20?]  (b , ffffffff)
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream2) [20?]  (d , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (c , ffffffff)
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (e , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (d , ffffffff)
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (f , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 12 Entries in total.
+##Links             DEBUG No objects passing selection criteria... Container has 14 Entries in total.
 SimplePoolFile2...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -853,7 +894,7 @@ ReadData             INFO EventInfo event: 0 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #0, run #1 11 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -875,7 +916,7 @@ ReadData             INFO EventInfo event: 1 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #1, run #1 12 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -897,7 +938,7 @@ ReadData             INFO EventInfo event: 2 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #2, run #1 13 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -919,7 +960,7 @@ ReadData             INFO EventInfo event: 3 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #3, run #1 14 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -941,7 +982,7 @@ ReadData             INFO EventInfo event: 4 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #4, run #1 15 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -963,7 +1004,7 @@ ReadData             INFO EventInfo event: 5 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #5, run #1 16 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -985,7 +1026,7 @@ ReadData             INFO EventInfo event: 6 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #6, run #1 17 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1007,7 +1048,7 @@ ReadData             INFO EventInfo event: 7 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #7, run #1 18 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1029,7 +1070,7 @@ ReadData             INFO EventInfo event: 8 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #8, run #1 19 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1051,7 +1092,7 @@ ReadData             INFO EventInfo event: 9 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #9, run #1 20 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1073,7 +1114,7 @@ ReadData             INFO EventInfo event: 10 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #10, run #1 21 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1095,7 +1136,7 @@ ReadData             INFO EventInfo event: 11 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #11, run #1 22 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1117,7 +1158,7 @@ ReadData             INFO EventInfo event: 12 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #12, run #1 23 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1139,7 +1180,7 @@ ReadData             INFO EventInfo event: 13 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #13, run #1 24 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1161,7 +1202,7 @@ ReadData             INFO EventInfo event: 14 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #14, run #1 25 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1183,7 +1224,7 @@ ReadData             INFO EventInfo event: 15 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #15, run #1 26 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1205,7 +1246,7 @@ ReadData             INFO EventInfo event: 16 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #16, run #1 27 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1227,7 +1268,7 @@ ReadData             INFO EventInfo event: 17 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #17, run #1 28 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1249,7 +1290,7 @@ ReadData             INFO EventInfo event: 18 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #18, run #1 29 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1271,7 +1312,7 @@ ReadData             INFO EventInfo event: 19 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #19, run #1 30 events processed so far  <<<===
 MetaDataSvc         DEBUG handle() EndInputFile for FID:????
@@ -1302,10 +1343,14 @@ SimplePoolFile4...  DEBUG ---->[0]:Token Typ:Token [18] Size:0 Offset:0 #Element
 SimplePoolFile4...  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
 SimplePoolFile4...  DEBUG ---->[0]:unsigned int Typ:unsigned int [3] Size:0 Offset:0 #Elements:1
 SimplePoolFile4...  DEBUG --->Reading Shape[6 , ????]: [1 Column(s)]
-SimplePoolFile4...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile4...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile4...  DEBUG --->Reading Shape[7 , ????]: [1 Column(s)]
+SimplePoolFile4...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile4...  DEBUG --->Reading Shape[8 , ????]: [1 Column(s)]
+SimplePoolFile4...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile4...  DEBUG --->Reading Shape[9 , ????]: [1 Column(s)]
 SimplePoolFile4...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 8 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 10 Entries in total.
 SimplePoolFile4...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -1328,15 +1373,19 @@ SimplePoolFile4...  DEBUG --->Reading Assoc:????/POOLCollectionTree(EventNumber)
 SimplePoolFile4...  DEBUG ---->ClassID:????
 SimplePoolFile4...  DEBUG --->Reading Assoc:????/POOLCollectionTree(MagicNumber) [20?]  (a , ffffffff)
 SimplePoolFile4...  DEBUG ---->ClassID:????
-SimplePoolFile4...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (b , ffffffff)
+SimplePoolFile4...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (b , ffffffff)
+SimplePoolFile4...  DEBUG ---->ClassID:????
+SimplePoolFile4...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (c , ffffffff)
+SimplePoolFile4...  DEBUG ---->ClassID:????
+SimplePoolFile4...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (d , ffffffff)
 SimplePoolFile4...  DEBUG ---->ClassID:????
-SimplePoolFile4...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (c , ffffffff)
+SimplePoolFile4...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (e , ffffffff)
 SimplePoolFile4...  DEBUG ---->ClassID:????
-SimplePoolFile4...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (d , ffffffff)
+SimplePoolFile4...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (f , ffffffff)
 SimplePoolFile4...  DEBUG ---->ClassID:????
-SimplePoolFile4...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (e , ffffffff)
+SimplePoolFile4...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (10 , ffffffff)
 SimplePoolFile4...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 13 Entries in total.
+##Links             DEBUG No objects passing selection criteria... Container has 15 Entries in total.
 SimplePoolFile4...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -1419,7 +1468,7 @@ ReadData             INFO Track pt = 74.8928 eta = 3.1676 phi = 2.6161 detector
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #0, run #1 31 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1445,7 +1494,7 @@ ReadData             INFO Track pt = 137.584 eta = -39.525 phi = 17.2679 detecto
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #1, run #1 32 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1471,7 +1520,7 @@ ReadData             INFO Track pt = 228.154 eta = -6.2704 phi = 31.9197 detecto
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #2, run #1 33 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1497,7 +1546,7 @@ ReadData             INFO Track pt = 324.306 eta = -15.8941 phi = 46.5715 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #3, run #1 34 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1523,7 +1572,7 @@ ReadData             INFO Track pt = 422.255 eta = -13.279 phi = 61.2233 detecto
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #4, run #1 35 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1549,7 +1598,7 @@ ReadData             INFO Track pt = 520.987 eta = -12.3511 phi = 75.8751 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #5, run #1 36 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1575,7 +1624,7 @@ ReadData             INFO Track pt = 620.127 eta = -11.8468 phi = 90.5269 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #6, run #1 37 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1601,7 +1650,7 @@ ReadData             INFO Track pt = 719.507 eta = -11.5247 phi = 105.179 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #7, run #1 38 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1627,7 +1676,7 @@ ReadData             INFO Track pt = 819.038 eta = -11.2998 phi = 119.831 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #8, run #1 39 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1653,7 +1702,7 @@ ReadData             INFO Track pt = 918.671 eta = -11.1334 phi = 134.482 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #9, run #1 40 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1679,7 +1728,7 @@ ReadData             INFO Track pt = 1018.38 eta = -11.0052 phi = 149.134 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #10, run #1 41 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1705,7 +1754,7 @@ ReadData             INFO Track pt = 1118.13 eta = -10.9031 phi = 163.786 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #11, run #1 42 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1731,7 +1780,7 @@ ReadData             INFO Track pt = 1217.93 eta = -10.82 phi = 178.438 detector
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #12, run #1 43 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1757,7 +1806,7 @@ ReadData             INFO Track pt = 1317.76 eta = -10.751 phi = 193.09 detector
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #13, run #1 44 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1783,7 +1832,7 @@ ReadData             INFO Track pt = 1417.61 eta = -10.6927 phi = 207.741 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #14, run #1 45 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1809,7 +1858,7 @@ ReadData             INFO Track pt = 1517.49 eta = -10.6429 phi = 222.393 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #15, run #1 46 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1835,7 +1884,7 @@ ReadData             INFO Track pt = 1617.37 eta = -10.5997 phi = 237.045 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #16, run #1 47 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1861,7 +1910,7 @@ ReadData             INFO Track pt = 1717.27 eta = -10.562 phi = 251.697 detecto
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #17, run #1 48 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1887,7 +1936,7 @@ ReadData             INFO Track pt = 1817.19 eta = -10.5288 phi = 266.349 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #18, run #1 49 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1913,7 +1962,7 @@ ReadData             INFO Track pt = 1917.11 eta = -10.4993 phi = 281 detector =
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 20794
+PoolSvc              INFO Database (SimplePoolFile4.root) attribute [BYTES_READ]: 22190
 PoolSvc              INFO Database (SimplePoolFile4.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #19, run #1 50 events processed so far  <<<===
 MetaDataSvc         DEBUG handle() EndInputFile for FID:????
@@ -1932,9 +1981,9 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 *****Chrono*****     INFO ****************************************************************************************************
 *****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
 *****Chrono*****     INFO ****************************************************************************************************
-cObjR_ALL            INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #=146
 cObj_ALL             INFO Time User   : Tot=   10 [ms] Ave/Min/Max=  0.0719(+-   0.845)/       0/      10 [ms] #=139
-ChronoStatSvc        INFO Time User   : Tot=  270 [ms]  #=  1
+cObjR_ALL            INFO Time User   : Tot=   10 [ms] Ave/Min/Max=  0.0685(+-   0.825)/       0/      10 [ms] #=146
+ChronoStatSvc        INFO Time User   : Tot=  350 [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_ReadConcat.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadConcat.ref
index a2f077821594c1a5eed6b00a96da7b8288bc58e6..4e10b02a962334bb14611a98d40e4aa2836a82bc 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadConcat.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadConcat.ref
@@ -1,17 +1,17 @@
-Thu Nov 19 08:29:09 CET 20?0
+Thu Nov 26 23:41:13 CET 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_ReadJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5589 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5426 configurables from 28 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 v34r1)
-                                          running on pc-tbed-pub-32.cern.ch on Thu Nov 19 08:29:21 20?0
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v35r0p1)
+                                          running on lxplus742.cern.ch on Thu Nov 26 23:41:28 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -28,8 +28,9 @@ PoolSvc             DEBUG Property update for OutputLevel : new value = 2
 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 Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-11-18T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 8 servers found for host pc-tbed-pub-32.cern.ch [ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ]
+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-11-25T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus742.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
@@ -53,29 +54,37 @@ EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Shape
 ##Shapes            DEBUG    attributes# = 1
 ##Shapes            DEBUG Opened container ##Shapes of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Shape[0 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[1 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[2 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[3 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[4 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
 EmptyPoolFile.root  DEBUG ---->[0]:DataHeaderForm_p6 Typ:DataHeaderForm_p6 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 4 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 6 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
 ##Links             DEBUG Opened container ##Links of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Assoc:????/##Params [200]  (2 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (4 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (4 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (5 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (5 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (6 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (6 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (7 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 5 Entries in total.
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (8 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+##Links             DEBUG No objects passing selection criteria... Container has 7 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -120,10 +129,14 @@ SimplePoolFile1...  DEBUG ---->[0]:unsigned long long Typ:unsigned long long [23
 SimplePoolFile1...  DEBUG --->Reading Shape[8 , ????]: [1 Column(s)]
 SimplePoolFile1...  DEBUG ---->[0]:float Typ:float [10] Size:0 Offset:0 #Elements:1
 SimplePoolFile1...  DEBUG --->Reading Shape[9 , ????]: [1 Column(s)]
-SimplePoolFile1...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile1...  DEBUG --->Reading Shape[10 , ????]: [1 Column(s)]
+SimplePoolFile1...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG --->Reading Shape[11 , ????]: [1 Column(s)]
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG --->Reading Shape[12 , ????]: [1 Column(s)]
 SimplePoolFile1...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 11 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 13 Entries in total.
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -164,15 +177,19 @@ SimplePoolFile1...  DEBUG --->Reading Assoc:????/POOLCollectionTree(BunchId) [20
 SimplePoolFile1...  DEBUG ---->ClassID:????
 SimplePoolFile1...  DEBUG --->Reading Assoc:????/POOLCollectionTree(EventWeight) [20?]  (13 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (14 , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (14 , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (15 , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (16 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (15 , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (17 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (16 , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (18 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (17 , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (19 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 22 Entries in total.
+##Links             DEBUG No objects passing selection criteria... Container has 24 Entries in total.
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -187,7 +204,7 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-ClassIDSvc           INFO  getRegistryEntries: read 1666 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1716 CLIDRegistry entries for module ALL
 EventPersistenc...   INFO Added successfully Conversion service:AthenaPoolCnvSvc
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
@@ -218,29 +235,37 @@ EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Shape
 ##Shapes            DEBUG    attributes# = 1
 ##Shapes            DEBUG Opened container ##Shapes of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Shape[0 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[1 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[2 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[3 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[4 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
 EmptyPoolFile.root  DEBUG ---->[0]:DataHeaderForm_p6 Typ:DataHeaderForm_p6 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 4 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 6 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
 ##Links             DEBUG Opened container ##Links of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Assoc:????/##Params [200]  (2 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (3 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (4 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (4 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (5 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (5 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (6 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (6 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 5 Entries in total.
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (7 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (8 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+##Links             DEBUG No objects passing selection criteria... Container has 7 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -349,7 +374,7 @@ ReadData             INFO Hit x = 1020.49 y = 63.5816 z = -951.864 detector = Du
 ReadData             INFO Hit x = 1023.7 y = 57.9027 z = -953.684 detector = DummyHitDetector
 ReadData             INFO Hit x = 1026.91 y = 52.2238 z = -955.073 detector = DummyHitDetector
 ReadData             INFO Hit x = 1030.12 y = 46.5449 z = -956.169 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 22164
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23522
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #10, run #1 1 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -383,7 +408,7 @@ ReadData             INFO Hit x = 1120.49 y = 63.5816 z = -1051.86 detector = Du
 ReadData             INFO Hit x = 1123.7 y = 57.9027 z = -1053.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1126.91 y = 52.2238 z = -1055.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1130.12 y = 46.5449 z = -1056.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 22164
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23522
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #11, run #1 2 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -416,7 +441,7 @@ ReadData             INFO Hit x = 1220.49 y = 63.5816 z = -1151.86 detector = Du
 ReadData             INFO Hit x = 1223.7 y = 57.9027 z = -1153.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1226.91 y = 52.2238 z = -1155.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1230.12 y = 46.5449 z = -1156.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 22164
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23522
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #12, run #1 3 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -449,7 +474,7 @@ ReadData             INFO Hit x = 1320.49 y = 63.5816 z = -1251.86 detector = Du
 ReadData             INFO Hit x = 1323.7 y = 57.9027 z = -1253.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1326.91 y = 52.2238 z = -1255.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1330.12 y = 46.5449 z = -1256.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 22164
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23522
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #13, run #1 4 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -482,7 +507,7 @@ ReadData             INFO Hit x = 1420.49 y = 63.5816 z = -1351.86 detector = Du
 ReadData             INFO Hit x = 1423.7 y = 57.9027 z = -1353.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1426.91 y = 52.2238 z = -1355.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1430.12 y = 46.5449 z = -1356.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 22164
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23522
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #14, run #1 5 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -515,7 +540,7 @@ ReadData             INFO Hit x = 1520.49 y = 63.5816 z = -1451.86 detector = Du
 ReadData             INFO Hit x = 1523.7 y = 57.9027 z = -1453.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1526.91 y = 52.2238 z = -1455.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1530.12 y = 46.5449 z = -1456.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 22164
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23522
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #15, run #1 6 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -548,7 +573,7 @@ ReadData             INFO Hit x = 1620.49 y = 63.5816 z = -1551.86 detector = Du
 ReadData             INFO Hit x = 1623.7 y = 57.9027 z = -1553.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1626.91 y = 52.2238 z = -1555.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1630.12 y = 46.5449 z = -1556.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 22164
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23522
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #16, run #1 7 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -581,7 +606,7 @@ ReadData             INFO Hit x = 1720.49 y = 63.5816 z = -1651.86 detector = Du
 ReadData             INFO Hit x = 1723.7 y = 57.9027 z = -1653.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1726.91 y = 52.2238 z = -1655.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1730.12 y = 46.5449 z = -1656.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 22164
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23522
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #17, run #1 8 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -614,7 +639,7 @@ ReadData             INFO Hit x = 1820.49 y = 63.5816 z = -1751.86 detector = Du
 ReadData             INFO Hit x = 1823.7 y = 57.9027 z = -1753.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1826.91 y = 52.2238 z = -1755.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1830.12 y = 46.5449 z = -1756.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 22164
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23522
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #18, run #1 9 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -647,7 +672,7 @@ ReadData             INFO Hit x = 1920.49 y = 63.5816 z = -1851.86 detector = Du
 ReadData             INFO Hit x = 1923.7 y = 57.9027 z = -1853.68 detector = DummyHitDetector
 ReadData             INFO Hit x = 1926.91 y = 52.2238 z = -1855.07 detector = DummyHitDetector
 ReadData             INFO Hit x = 1930.12 y = 46.5449 z = -1856.17 detector = DummyHitDetector
-PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 22164
+PoolSvc              INFO Database (SimplePoolFile1.root) attribute [BYTES_READ]: 23522
 PoolSvc              INFO Database (SimplePoolFile1.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #19, run #1 10 events processed so far  <<<===
 MetaDataSvc         DEBUG handle() EndInputFile for FID:????
@@ -666,29 +691,37 @@ EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Shape
 ##Shapes            DEBUG    attributes# = 1
 ##Shapes            DEBUG Opened container ##Shapes of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Shape[0 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[1 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[2 , ????]: [1 Column(s)]
-EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --->Reading Shape[3 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[4 , ????]: [1 Column(s)]
+EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
 EmptyPoolFile.root  DEBUG ---->[0]:DataHeaderForm_p6 Typ:DataHeaderForm_p6 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 4 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 6 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
 ##Links             DEBUG Opened container ##Links of type ROOT_Tree
 EmptyPoolFile.root  DEBUG --->Reading Assoc:????/##Params [200]  (2 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (4 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (4 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (5 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (5 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (6 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (6 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (7 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 5 Entries in total.
+EmptyPoolFile.root  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (8 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+##Links             DEBUG No objects passing selection criteria... Container has 7 Entries in total.
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -735,10 +768,14 @@ SimplePoolFile2...  DEBUG ---->[0]:Token Typ:Token [18] Size:0 Offset:0 #Element
 SimplePoolFile2...  DEBUG --->Reading Shape[4 , ????]: [1 Column(s)]
 SimplePoolFile2...  DEBUG ---->[0]:unsigned int Typ:unsigned int [3] Size:0 Offset:0 #Elements:1
 SimplePoolFile2...  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
-SimplePoolFile2...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile2...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile2...  DEBUG --->Reading Shape[6 , ????]: [1 Column(s)]
+SimplePoolFile2...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile2...  DEBUG --->Reading Shape[7 , ????]: [1 Column(s)]
+SimplePoolFile2...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile2...  DEBUG --->Reading Shape[8 , ????]: [1 Column(s)]
 SimplePoolFile2...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 7 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 9 Entries in total.
 SimplePoolFile2...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -759,15 +796,19 @@ SimplePoolFile2...  DEBUG --->Reading Assoc:????/POOLCollectionTree(EventNumber)
 SimplePoolFile2...  DEBUG ---->ClassID:????
 SimplePoolFile2...  DEBUG --->Reading Assoc:????/POOLCollectionTree(MagicNumber) [20?]  (9 , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream2) [20?]  (a , ffffffff)
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (a , ffffffff)
+SimplePoolFile2...  DEBUG ---->ClassID:????
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream2) [20?]  (b , ffffffff)
+SimplePoolFile2...  DEBUG ---->ClassID:????
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (c , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream2) [20?]  (b , ffffffff)
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream2) [20?]  (d , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (c , ffffffff)
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (e , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (d , ffffffff)
+SimplePoolFile2...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (f , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 12 Entries in total.
+##Links             DEBUG No objects passing selection criteria... Container has 14 Entries in total.
 SimplePoolFile2...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -842,7 +883,7 @@ ReadData             INFO EventInfo event: 0 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #0, run #1 11 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -864,7 +905,7 @@ ReadData             INFO EventInfo event: 1 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #1, run #1 12 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -886,7 +927,7 @@ ReadData             INFO EventInfo event: 2 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #2, run #1 13 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -908,7 +949,7 @@ ReadData             INFO EventInfo event: 3 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #3, run #1 14 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -930,7 +971,7 @@ ReadData             INFO EventInfo event: 4 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #4, run #1 15 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -952,7 +993,7 @@ ReadData             INFO EventInfo event: 5 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #5, run #1 16 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -974,7 +1015,7 @@ ReadData             INFO EventInfo event: 6 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #6, run #1 17 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -996,7 +1037,7 @@ ReadData             INFO EventInfo event: 7 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #7, run #1 18 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1018,7 +1059,7 @@ ReadData             INFO EventInfo event: 8 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #8, run #1 19 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1040,7 +1081,7 @@ ReadData             INFO EventInfo event: 9 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #9, run #1 20 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1062,7 +1103,7 @@ ReadData             INFO EventInfo event: 10 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #10, run #1 21 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1084,7 +1125,7 @@ ReadData             INFO EventInfo event: 11 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #11, run #1 22 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1106,7 +1147,7 @@ ReadData             INFO EventInfo event: 12 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #12, run #1 23 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1128,7 +1169,7 @@ ReadData             INFO EventInfo event: 13 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #13, run #1 24 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1150,7 +1191,7 @@ ReadData             INFO EventInfo event: 14 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #14, run #1 25 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1172,7 +1213,7 @@ ReadData             INFO EventInfo event: 15 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #15, run #1 26 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1194,7 +1235,7 @@ ReadData             INFO EventInfo event: 16 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #16, run #1 27 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1216,7 +1257,7 @@ ReadData             INFO EventInfo event: 17 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #17, run #1 28 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1238,7 +1279,7 @@ ReadData             INFO EventInfo event: 18 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #18, run #1 29 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1260,7 +1301,7 @@ ReadData             INFO EventInfo event: 19 run: 1
 ReadData             INFO Get Smart data ptr 1
 ReadData             INFO Could not find ExampleTrackContainer/MyTracks
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 18398
+PoolSvc              INFO Database (SimplePoolFile2.root) attribute [BYTES_READ]: 19794
 PoolSvc              INFO Database (SimplePoolFile2.root) attribute [READ_CALLS]: 21
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #19, run #1 30 events processed so far  <<<===
 MetaDataSvc         DEBUG handle() EndInputFile for FID:????
@@ -1287,10 +1328,14 @@ SimplePoolFile3...  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 O
 SimplePoolFile3...  DEBUG --->Reading Shape[3 , ????]: [1 Column(s)]
 SimplePoolFile3...  DEBUG ---->[0]:DataHeaderForm_p6 Typ:DataHeaderForm_p6 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile3...  DEBUG --->Reading Shape[4 , ????]: [1 Column(s)]
-SimplePoolFile3...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile3...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile3...  DEBUG --->Reading Shape[5 , ????]: [1 Column(s)]
+SimplePoolFile3...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile3...  DEBUG --->Reading Shape[6 , ????]: [1 Column(s)]
+SimplePoolFile3...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile3...  DEBUG --->Reading Shape[7 , ????]: [1 Column(s)]
 SimplePoolFile3...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 6 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 8 Entries in total.
 SimplePoolFile3...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -1305,15 +1350,19 @@ SimplePoolFile3...  DEBUG --->Reading Assoc:????/POOLContainer(DataHeader) [20?]
 SimplePoolFile3...  DEBUG ---->ClassID:????
 SimplePoolFile3...  DEBUG --->Reading Assoc:????/POOLContainerForm(DataHeaderForm) [20?]  (6 , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream2) [20?]  (7 , ffffffff)
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (7 , ffffffff)
+SimplePoolFile3...  DEBUG ---->ClassID:????
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream2) [20?]  (8 , ffffffff)
+SimplePoolFile3...  DEBUG ---->ClassID:????
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (9 , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream2) [20?]  (8 , ffffffff)
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream2) [20?]  (a , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (9 , ffffffff)
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (b , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (a , ffffffff)
+SimplePoolFile3...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (c , ffffffff)
 SimplePoolFile3...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 9 Entries in total.
+##Links             DEBUG No objects passing selection criteria... Container has 11 Entries in total.
 SimplePoolFile3...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -1396,7 +1445,7 @@ ReadData             INFO Track pt = 74.8928 eta = 3.1676 phi = 2.6161 detector
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #0, run #1 31 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1422,7 +1471,7 @@ ReadData             INFO Track pt = 137.584 eta = -39.525 phi = 17.2679 detecto
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #1, run #1 32 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1448,7 +1497,7 @@ ReadData             INFO Track pt = 228.154 eta = -6.2704 phi = 31.9197 detecto
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #2, run #1 33 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1474,7 +1523,7 @@ ReadData             INFO Track pt = 324.306 eta = -15.8941 phi = 46.5715 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #3, run #1 34 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1500,7 +1549,7 @@ ReadData             INFO Track pt = 422.255 eta = -13.279 phi = 61.2233 detecto
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #4, run #1 35 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1526,7 +1575,7 @@ ReadData             INFO Track pt = 520.987 eta = -12.3511 phi = 75.8751 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #5, run #1 36 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1552,7 +1601,7 @@ ReadData             INFO Track pt = 620.127 eta = -11.8468 phi = 90.5269 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #6, run #1 37 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1578,7 +1627,7 @@ ReadData             INFO Track pt = 719.507 eta = -11.5247 phi = 105.179 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #7, run #1 38 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1604,7 +1653,7 @@ ReadData             INFO Track pt = 819.038 eta = -11.2998 phi = 119.831 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #8, run #1 39 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1630,7 +1679,7 @@ ReadData             INFO Track pt = 918.671 eta = -11.1334 phi = 134.482 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #9, run #1 40 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1656,7 +1705,7 @@ ReadData             INFO Track pt = 1018.38 eta = -11.0052 phi = 149.134 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #10, run #1 41 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1682,7 +1731,7 @@ ReadData             INFO Track pt = 1118.13 eta = -10.9031 phi = 163.786 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #11, run #1 42 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1708,7 +1757,7 @@ ReadData             INFO Track pt = 1217.93 eta = -10.82 phi = 178.438 detector
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #12, run #1 43 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1734,7 +1783,7 @@ ReadData             INFO Track pt = 1317.76 eta = -10.751 phi = 193.09 detector
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #13, run #1 44 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1760,7 +1809,7 @@ ReadData             INFO Track pt = 1417.61 eta = -10.6927 phi = 207.741 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #14, run #1 45 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1786,7 +1835,7 @@ ReadData             INFO Track pt = 1517.49 eta = -10.6429 phi = 222.393 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #15, run #1 46 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1812,7 +1861,7 @@ ReadData             INFO Track pt = 1617.37 eta = -10.5997 phi = 237.045 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #16, run #1 47 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1838,7 +1887,7 @@ ReadData             INFO Track pt = 1717.27 eta = -10.562 phi = 251.697 detecto
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #17, run #1 48 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1864,7 +1913,7 @@ ReadData             INFO Track pt = 1817.19 eta = -10.5288 phi = 266.349 detect
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #18, run #1 49 events processed so far  <<<===
 EventSelector       DEBUG Get AttributeList from the collection
@@ -1890,7 +1939,7 @@ ReadData             INFO Track pt = 1917.11 eta = -10.4993 phi = 281 detector =
 DataProxy         WARNING accessData:  IOA pointer not set
 ReadData          WARNING Could not follow ExampleTrackContainer/MyTracks ElementLinks to ExampleHitContainer/MyHits
 ReadData             INFO Could not find ExampleHitContainer/MyHits
-PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 20?67
+PoolSvc              INFO Database (SimplePoolFile3.root) attribute [BYTES_READ]: 21767
 PoolSvc              INFO Database (SimplePoolFile3.root) attribute [READ_CALLS]: 22
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #19, run #1 50 events processed so far  <<<===
 MetaDataSvc         DEBUG handle() EndInputFile for FID:????
@@ -1910,8 +1959,8 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 *****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
 *****Chrono*****     INFO ****************************************************************************************************
 cObjR_ALL            INFO Time User   : Tot=   10 [ms] Ave/Min/Max=  0.0725(+-   0.848)/       0/      10 [ms] #=138
-cObj_ALL             INFO Time User   : Tot=   10 [ms] Ave/Min/Max=  0.0775(+-   0.877)/       0/      10 [ms] #=129
-ChronoStatSvc        INFO Time User   : Tot=  270 [ms]  #=  1
+cObj_ALL             INFO Time User   : Tot=   50 [ms] Ave/Min/Max=   0.388(+-    1.93)/       0/      10 [ms] #=129
+ChronoStatSvc        INFO Time User   : Tot=  370 [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_WCond.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WCond.ref
index d43e8ff2b73c3ba501a91ff1412bf5c70970c489..deb12fd3bf5156c8001aa26c1f8454251b627f71 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WCond.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WCond.ref
@@ -1,17 +1,17 @@
-Thu Nov 19 08:29:24 CET 20?0
+Thu Nov 26 23:41:32 CET 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_WCondJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5589 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5426 configurables from 28 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 v34r1)
-                                          running on pc-tbed-pub-32.cern.ch on Thu Nov 19 08:29:36 20?0
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v35r0p1)
+                                          running on lxplus742.cern.ch on Thu Nov 26 23:41:55 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -26,8 +26,9 @@ PoolSvc             DEBUG Property update for OutputLevel : new value = 2
 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 Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-11-18T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 8 servers found for host pc-tbed-pub-32.cern.ch [ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ]
+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-11-25T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus742.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
@@ -76,10 +77,14 @@ SimplePoolFile1...  DEBUG ---->[0]:unsigned long long Typ:unsigned long long [23
 SimplePoolFile1...  DEBUG --->Reading Shape[8 , ????]: [1 Column(s)]
 SimplePoolFile1...  DEBUG ---->[0]:float Typ:float [10] Size:0 Offset:0 #Elements:1
 SimplePoolFile1...  DEBUG --->Reading Shape[9 , ????]: [1 Column(s)]
-SimplePoolFile1...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile1...  DEBUG --->Reading Shape[10 , ????]: [1 Column(s)]
+SimplePoolFile1...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG --->Reading Shape[11 , ????]: [1 Column(s)]
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile1...  DEBUG --->Reading Shape[12 , ????]: [1 Column(s)]
 SimplePoolFile1...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
-##Shapes            DEBUG No objects passing selection criteria... Container has 11 Entries in total.
+##Shapes            DEBUG No objects passing selection criteria... Container has 13 Entries in total.
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Links
 ##Links             DEBUG Opening
 ##Links             DEBUG    attributes# = 1
@@ -120,15 +125,19 @@ SimplePoolFile1...  DEBUG --->Reading Assoc:????/POOLCollectionTree(BunchId) [20
 SimplePoolFile1...  DEBUG ---->ClassID:????
 SimplePoolFile1...  DEBUG --->Reading Assoc:????/POOLCollectionTree(EventWeight) [20?]  (13 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (14 , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (14 , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (15 , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (16 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (15 , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (17 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (16 , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdr(DataHeader) [20?]  (18 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (17 , ffffffff)
+SimplePoolFile1...  DEBUG --->Reading Assoc:????/MetaDataHdrForm(DataHeaderForm) [20?]  (19 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-##Links             DEBUG No objects passing selection criteria... Container has 22 Entries in total.
+##Links             DEBUG No objects passing selection criteria... Container has 24 Entries in total.
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_All] ##Params
 ##Params            DEBUG Opening
 ##Params            DEBUG    attributes# = 1
@@ -143,7 +152,7 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-ClassIDSvc           INFO  getRegistryEntries: read 1660 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1710 CLIDRegistry entries for module ALL
 EventPersistenc...   INFO Added successfully Conversion service:AthenaPoolCnvSvc
 SimplePoolFile1...  DEBUG --> Access   DbContainer  READ      [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
@@ -1150,11 +1159,11 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 *****Chrono*****     INFO ****************************************************************************************************
 commitOutput         INFO Time User   : Tot=    0 [us]  #=  1
 cRep_ALL             INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #=  2
-cObjR_ALL            INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #= 46
+cRepR_ALL            INFO Time User   : Tot=    0 [us] Ave/Min/Max=       0(+-       0)/       0/       0 [us] #=  3
 fRep_ALL             INFO Time User   : Tot=   10 [ms] Ave/Min/Max=       5(+-       5)/       0/      10 [ms] #=  2
-cRepR_ALL            INFO Time User   : Tot=   10 [ms] Ave/Min/Max=    3.33(+-    4.71)/       0/      10 [ms] #=  3
+cObjR_ALL            INFO Time User   : Tot=   10 [ms] Ave/Min/Max=   0.217(+-    1.46)/       0/      10 [ms] #= 46
 cObj_ALL             INFO Time User   : Tot=   20 [ms] Ave/Min/Max=   0.465(+-    2.11)/       0/      10 [ms] #= 43
-ChronoStatSvc        INFO Time User   : Tot=  260 [ms]  #=  1
+ChronoStatSvc        INFO Time User   : Tot=  360 [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_WMeta.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WMeta.ref
index 8bee7f6c1a4f0e8a00e7a8909e42f0f2bd27a684..a3596372151a52f08b03b9d9ba7878d701ade20b 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WMeta.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WMeta.ref
@@ -1,17 +1,17 @@
-Thu Nov 19 08:29:55 CET 20?0
+Thu Nov 26 23:02:36 CET 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_WMetaJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5589 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5426 configurables from 28 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 v34r1)
-                                          running on pc-tbed-pub-32.cern.ch on Thu Nov 19 08:30:06 20?0
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v35r0p1)
+                                          running on lxplus742.cern.ch on Thu Nov 26 23:02:48 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -30,8 +30,9 @@ PoolSvc             DEBUG Service base class initialized successfully
 PoolSvc              INFO io_register[PoolSvc](xmlcatalog_file:Catalog2.xml) [ok]
 PoolSvc              INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc              INFO Frontier compression level set to 5
-DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-11-18T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 8 servers found for host pc-tbed-pub-32.cern.ch [ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ]
+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-11-25T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus742.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
@@ -69,10 +70,13 @@ Stream1.Stream1...   INFO Initializing Stream1.Stream1Tool - package version Ath
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
 Stream1.Stream1...   INFO Initializing Stream1.Stream1_MakeEventStreamInfo - package version OutputStreamAthenaPool-00-00-00
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
+Stream1.FileMet...  DEBUG Property update for OutputLevel : new value = 2
+ClassIDSvc           INFO  getRegistryEntries: read 661 CLIDRegistry entries for module ALL
+Stream1.FileMet...  DEBUG Initialising - Package version: xAODMetaDataCnv-00-00-00
+Stream1.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
 Stream1.Thinnin...  DEBUG Property update for OutputLevel : new value = 2
-Stream1              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream1_MakeEventFormat','Athena::ThinningCacheTool/ThinningCacheTool_Stream1'])
+Stream1              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream1_MakeEventFormat','xAODMaker::FileMetaDataCreatorTool/FileMetaDataCreatorTool','Athena::ThinningCacheTool/ThinningCacheTool_Stream1'])
 Stream1              INFO Data output: ROOTTREE:SimplePoolFile5.root
-ClassIDSvc           INFO  getRegistryEntries: read 171 CLIDRegistry entries for module ALL
 Stream1              INFO I/O reinitialization...
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
 Stream1             DEBUG End initialize
@@ -81,10 +85,13 @@ Stream1             DEBUG output handles: 2
 Stream1             DEBUG Registering all Tools in ToolHandleArray HelperTools
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventStreamInfo (MakeEventStreamInfo)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool)
+Stream1             DEBUG Adding private ToolHandle tool Stream1.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.ThinningCacheTool_Stream1 (Athena::ThinningCacheTool)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1Tool (AthenaOutputStreamTool)
 Stream1             DEBUG Data Deps for Stream1
   + INPUT   ( 'AthenaAttributeList' , 'StoreGateSvc+SimpleTag' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/Simulation/Parameters' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/TagInfo' ) 
   + OUTPUT  ( 'DataHeader' , 'StoreGateSvc+Stream1' ) 
   + OUTPUT  ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream1' ) 
   + OUTPUT  ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream1' ) 
@@ -318,6 +325,10 @@ SimplePoolFile5...  DEBUG --->Adding Shape[8 , ????]:  [1 Column(s)]
 SimplePoolFile5...  DEBUG ---->Class:float
 SimplePoolFile5...  DEBUG ---->[0]:float Typ:float [10] Size:0 Offset:0 #Elements:1
 ClassIDSvc           INFO  getRegistryEntries: read 83 CLIDRegistry entries for module ALL
+Stream1.FileMet...  DEBUG Valid  'EventInfoKey':'EventInfo' handle
+Stream1.FileMet...  DEBUG setting xAOD::FileMetaData::mcProcID to 0
+Stream1.FileMet...  DEBUG valid  'StreamName':'Stream1' handle
+Stream1.FileMet...  DEBUG set xAOD::FileMetaData::dataType to Stream1
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #0, run #0 1 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #1, run #0 1 events processed so far  <<<===
 EventInfoTagBui...   INFO No input attribute list
@@ -913,17 +924,28 @@ WriteCond            INFO in finalize()
 WriteCond            INFO Pedestal x = 193136 y = -5580.01 z = -175208 string = <..........o..........o..........o..........o..........o..........o..........o..........o..........o..........o..........o..........o..........o..........o..........o..........o..........o..........o..........o..........o>
 Stream1             DEBUG AthenaOutputStream Stream1 ::stop()
 Stream1             DEBUG slot 0  handle() incident type: MetaDataStop
-Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream1, ExampleHitContainer#PedestalWriteData]
+Stream1.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
+Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream1, xAOD::FileMetaData#FileMetaData, xAOD::FileMetaDataAuxInfo#FileMetaDataAux., ExampleHitContainer#PedestalWriteData]
 Stream1             DEBUG addItemObjects(9102,"PedestalWriteData") called
 Stream1             DEBUG            Key:PedestalWriteData
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
 Stream1             DEBUG  Added object 9102,"PedestalWriteData"
+Stream1             DEBUG addItemObjects(73252552,"FileMetaDataAux.") called
+Stream1             DEBUG            Key:FileMetaDataAux.
+Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
+Stream1             DEBUG  Added object 73252552,"FileMetaDataAux."
 Stream1             DEBUG addItemObjects(167728019,"Stream1") called
 Stream1             DEBUG            Key:Stream1
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
 Stream1             DEBUG  Added object 167728019,"Stream1"
+Stream1             DEBUG addItemObjects(178309087,"FileMetaData") called
+Stream1             DEBUG            Key:FileMetaData
+Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
+Stream1             DEBUG  Added object 178309087,"FileMetaData"
 Stream1             DEBUG addItemObjects(243004407,"EventFormatStream1") called
 Stream1             DEBUG            Key:EventFormatStream1
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
@@ -934,12 +956,24 @@ Stream1             DEBUG            Key:*
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
 Stream1             DEBUG connectOutput done for ROOTTREE:SimplePoolFile5.root
+StorageSvc           INFO Building shape according to reflection information using shape ID for:
+StorageSvc           INFO xAOD::FileMetaDataAuxInfo_v1 [????]
+SimplePoolFile5...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) of type ROOT_Tree
+SimplePoolFile5...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (14 , ffffffff)
+SimplePoolFile5...  DEBUG ---->ClassID:????
+SimplePoolFile5...  DEBUG --->Adding Shape[9 , ????]:  [1 Column(s)] 
+SimplePoolFile5...  DEBUG ---->Class:xAOD::FileMetaDataAuxInfo_v1
+SimplePoolFile5...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile5...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(ExampleHitContainer_p1/PedestalWriteData)
 MetaData(Exampl...  DEBUG Opening
 MetaData(Exampl...  DEBUG    attributes# = 1
 MetaData(Exampl...  DEBUG Branch container 'ExampleHitContainer_p1_PedestalWriteData'
 MetaData(Exampl...  DEBUG Opened container MetaData(ExampleHitContainer_p1/PedestalWriteData) of type ROOT_Tree
-SimplePoolFile5...  DEBUG --->Adding Assoc :????/MetaData(ExampleHitContainer_p1/PedestalWriteData) [20?]  (14 , ffffffff)
+SimplePoolFile5...  DEBUG --->Adding Assoc :????/MetaData(ExampleHitContainer_p1/PedestalWriteData) [20?]  (15 , ffffffff)
 SimplePoolFile5...  DEBUG ---->ClassID:????
 StorageSvc           INFO Building shape according to reflection information using shape ID for:
 StorageSvc           INFO EventStreamInfo_p3 [????]
@@ -948,21 +982,33 @@ MetaData(EventS...  DEBUG Opening
 MetaData(EventS...  DEBUG    attributes# = 1
 MetaData(EventS...  DEBUG Branch container 'EventStreamInfo_p3_Stream1'
 MetaData(EventS...  DEBUG Opened container MetaData(EventStreamInfo_p3/Stream1) of type ROOT_Tree
-SimplePoolFile5...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (15 , ffffffff)
+SimplePoolFile5...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (16 , ffffffff)
 SimplePoolFile5...  DEBUG ---->ClassID:????
-SimplePoolFile5...  DEBUG --->Adding Shape[9 , ????]:  [1 Column(s)] 
+SimplePoolFile5...  DEBUG --->Adding Shape[10 , ????]:  [1 Column(s)] 
 SimplePoolFile5...  DEBUG ---->Class:EventStreamInfo_p3
 SimplePoolFile5...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 StorageSvc           INFO Building shape according to reflection information using shape ID for:
+StorageSvc           INFO xAOD::FileMetaData_v1 [????]
+SimplePoolFile5...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaData_v1/FileMetaData)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaData_v1_FileMetaData'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaData_v1/FileMetaData) of type ROOT_Tree
+SimplePoolFile5...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (17 , ffffffff)
+SimplePoolFile5...  DEBUG ---->ClassID:????
+SimplePoolFile5...  DEBUG --->Adding Shape[11 , ????]:  [1 Column(s)] 
+SimplePoolFile5...  DEBUG ---->Class:xAOD::FileMetaData_v1
+SimplePoolFile5...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+StorageSvc           INFO Building shape according to reflection information using shape ID for:
 StorageSvc           INFO xAOD::EventFormat_v1 [????]
 SimplePoolFile5...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::EventFormat_v1/EventFormatStream1)
 MetaData(xAOD::...  DEBUG Opening
 MetaData(xAOD::...  DEBUG    attributes# = 1
 MetaData(xAOD::...  DEBUG Branch container 'xAOD::EventFormat_v1_EventFormatStream1'
 MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::EventFormat_v1/EventFormatStream1) of type ROOT_Tree
-SimplePoolFile5...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (16 , ffffffff)
+SimplePoolFile5...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (18 , ffffffff)
 SimplePoolFile5...  DEBUG ---->ClassID:????
-SimplePoolFile5...  DEBUG --->Adding Shape[10 , ????]:  [1 Column(s)] 
+SimplePoolFile5...  DEBUG --->Adding Shape[12 , ????]:  [1 Column(s)] 
 SimplePoolFile5...  DEBUG ---->Class:xAOD::EventFormat_v1
 SimplePoolFile5...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile5...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdr(DataHeader)
@@ -970,16 +1016,20 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-SimplePoolFile5...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (17 , ffffffff)
+SimplePoolFile5...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (19 , ffffffff)
 SimplePoolFile5...  DEBUG ---->ClassID:????
 SimplePoolFile5...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
 MetaDataHdrForm...  DEBUG    attributes# = 1
 MetaDataHdrForm...  DEBUG Branch container 'DataHeaderForm'
 MetaDataHdrForm...  DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree
-SimplePoolFile5...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (18 , ffffffff)
+SimplePoolFile5...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (1a , ffffffff)
 SimplePoolFile5...  DEBUG ---->ClassID:????
-ClassIDSvc           INFO  getRegistryEntries: read 14 CLIDRegistry entries for module ALL
+MetaData(xAOD::...  DEBUG  SG::IAuxStoreIO* detected in xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.
+MetaData(xAOD::...  DEBUG        Attributes= 1
+MetaData(xAOD::...  DEBUG    Creating branch for new dynamic attribute, Id=52: type=float, mcProcID
+MetaData(xAOD::...  DEBUG createBasicAuxBranch: xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAuxDyn.mcProcID, leaf:mcProcID/F
+ClassIDSvc           INFO  getRegistryEntries: read 55 CLIDRegistry entries for module ALL
 Stream1              INFO Metadata records written: 21
 Stream1             DEBUG Leaving incident handler for MetaDataStop
 Domain[ROOT_All]     INFO >   Deaccess DbDomain     READ      [ROOT_All] 
@@ -1001,10 +1051,10 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 *****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
-cRepR_ALL            INFO Time User   : Tot=   40 [ms] Ave/Min/Max=   0.122(+-     1.1)/       0/      10 [ms] #=327
-cRep_ALL             INFO Time User   : Tot=   50 [ms] Ave/Min/Max=   0.781(+-    3.21)/       0/      20 [ms] #= 64
-fRep_ALL             INFO Time User   : Tot=   60 [ms] Ave/Min/Max=   0.938(+-    2.91)/       0/      10 [ms] #= 64
-ChronoStatSvc        INFO Time User   : Tot=  350 [ms]  #=  1
+cRepR_ALL            INFO Time User   : Tot=   40 [ms] Ave/Min/Max=   0.122(+-     1.1)/       0/      10 [ms] #=329
+fRep_ALL             INFO Time User   : Tot=   60 [ms] Ave/Min/Max=   0.909(+-    2.87)/       0/      10 [ms] #= 66
+cRep_ALL             INFO Time User   : Tot=   60 [ms] Ave/Min/Max=   0.909(+-    2.87)/       0/      10 [ms] #= 66
+ChronoStatSvc        INFO Time User   : Tot=  330 [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_Write.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Write.ref
index 0c43ca0de9b2ab4e752a7c884b6e0e7bee5340ca..e95598dcdbf1c328f7b2c4650f58c602b8649d9f 100644
--- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Write.ref
+++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Write.ref
@@ -1,17 +1,17 @@
-Thu Nov 19 08:27:01 CET 20?0
+Thu Nov 26 22:56:43 CET 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_WriteJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5589 configurables from 4 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5426 configurables from 28 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 v34r1)
-                                          running on pc-tbed-pub-32.cern.ch on Thu Nov 19 08:27:15 20?0
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v35r0p1)
+                                          running on lxplus742.cern.ch on Thu Nov 26 22:56:56 20?0
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 AthDictLoaderSvc     INFO in initialize...
@@ -19,7 +19,7 @@ AthDictLoaderSvc     INFO acquired Dso-registry
 ClassIDSvc           INFO  getRegistryEntries: read 3311 CLIDRegistry entries for module ALL
 AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
 ClassIDSvc           INFO  getRegistryEntries: read 722 CLIDRegistry entries for module ALL
-ClassIDSvc           INFO  getRegistryEntries: read 858 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 859 CLIDRegistry entries for module ALL
 ClassIDSvc           INFO  getRegistryEntries: read 591 CLIDRegistry entries for module ALL
 ClassIDSvc           INFO  getRegistryEntries: read 350 CLIDRegistry entries for module ALL
 xAODMaker::Even...   INFO Initializing - Package version: xAODEventInfoCnv-00-00-00
@@ -31,8 +31,9 @@ PoolSvc             DEBUG Service base class initialized successfully
 PoolSvc              INFO io_register[PoolSvc](xmlcatalog_file:Catalog1.xml) [ok]
 PoolSvc              INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc              INFO Frontier compression level set to 5
-DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/20?0-11-18T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 8 servers found for host pc-tbed-pub-32.cern.ch [ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ]
+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-11-25T2101/Athena/22.0.21/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus742.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
@@ -72,10 +73,13 @@ Stream1.Stream1...   INFO Initializing Stream1.Stream1Tool - package version Ath
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
 Stream1.Stream1...   INFO Initializing Stream1.Stream1_MakeEventStreamInfo - package version OutputStreamAthenaPool-00-00-00
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
+Stream1.FileMet...  DEBUG Property update for OutputLevel : new value = 2
+ClassIDSvc           INFO  getRegistryEntries: read 371 CLIDRegistry entries for module ALL
+Stream1.FileMet...  DEBUG Initialising - Package version: xAODMetaDataCnv-00-00-00
+Stream1.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
 Stream1.Thinnin...  DEBUG Property update for OutputLevel : new value = 2
-Stream1              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream1_MakeEventFormat','Athena::ThinningCacheTool/ThinningCacheTool_Stream1'])
+Stream1              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream1_MakeEventFormat','xAODMaker::FileMetaDataCreatorTool/FileMetaDataCreatorTool','Athena::ThinningCacheTool/ThinningCacheTool_Stream1'])
 Stream1              INFO Data output: SimplePoolFile1.root
-ClassIDSvc           INFO  getRegistryEntries: read 171 CLIDRegistry entries for module ALL
 Stream1              INFO I/O reinitialization...
 Stream1.Stream1...  DEBUG Property update for OutputLevel : new value = 2
 Stream1             DEBUG End initialize
@@ -84,10 +88,13 @@ Stream1             DEBUG output handles: 2
 Stream1             DEBUG Registering all Tools in ToolHandleArray HelperTools
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventStreamInfo (MakeEventStreamInfo)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool)
+Stream1             DEBUG Adding private ToolHandle tool Stream1.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.ThinningCacheTool_Stream1 (Athena::ThinningCacheTool)
 Stream1             DEBUG Adding private ToolHandle tool Stream1.Stream1Tool (AthenaOutputStreamTool)
 Stream1             DEBUG Data Deps for Stream1
   + INPUT   ( 'AthenaAttributeList' , 'StoreGateSvc+MagicTag' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/Simulation/Parameters' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/TagInfo' ) 
   + OUTPUT  ( 'DataHeader' , 'StoreGateSvc+Stream1' ) 
   + OUTPUT  ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream1' ) 
   + OUTPUT  ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream1' ) 
@@ -108,8 +115,11 @@ Stream2.Stream2...   INFO Initializing Stream2.Stream2Tool - package version Ath
 Stream2.Stream2...  DEBUG Property update for OutputLevel : new value = 2
 Stream2.Stream2...   INFO Initializing Stream2.Stream2_MakeEventStreamInfo - package version OutputStreamAthenaPool-00-00-00
 Stream2.Stream2...  DEBUG Property update for OutputLevel : new value = 2
+Stream2.FileMet...  DEBUG Property update for OutputLevel : new value = 2
+Stream2.FileMet...  DEBUG Initialising - Package version: xAODMetaDataCnv-00-00-00
+Stream2.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
 Stream2.Thinnin...  DEBUG Property update for OutputLevel : new value = 2
-Stream2              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream2_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream2_MakeEventFormat','Athena::ThinningCacheTool/ThinningCacheTool_Stream2'])
+Stream2              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream2_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream2_MakeEventFormat','xAODMaker::FileMetaDataCreatorTool/FileMetaDataCreatorTool','Athena::ThinningCacheTool/ThinningCacheTool_Stream2'])
 Stream2              INFO Data output: SimplePoolFile2.root
 Stream2              INFO I/O reinitialization...
 Stream2.Stream2...  DEBUG Property update for OutputLevel : new value = 2
@@ -119,17 +129,20 @@ Stream2             DEBUG output handles: 2
 Stream2             DEBUG Registering all Tools in ToolHandleArray HelperTools
 Stream2             DEBUG Adding private ToolHandle tool Stream2.Stream2_MakeEventStreamInfo (MakeEventStreamInfo)
 Stream2             DEBUG Adding private ToolHandle tool Stream2.Stream2_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool)
+Stream2             DEBUG Adding private ToolHandle tool Stream2.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool)
 Stream2             DEBUG Adding private ToolHandle tool Stream2.ThinningCacheTool_Stream2 (Athena::ThinningCacheTool)
 Stream2             DEBUG Adding private ToolHandle tool Stream2.Stream2Tool (AthenaOutputStreamTool)
 Stream2             DEBUG Data Deps for Stream2
   + INPUT   ( 'AthenaAttributeList' , 'StoreGateSvc+RunEventTag' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/Simulation/Parameters' ) 
+  + INPUT   ( 'IOVMetaDataContainer' , 'InputMetaDataStore+/TagInfo' ) 
   + OUTPUT  ( 'DataHeader' , 'StoreGateSvc+Stream2' ) 
   + OUTPUT  ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream2' ) 
   + OUTPUT  ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream2' ) 
 DecisionSvc          INFO Inserting stream: Stream3 with no Algs
 Stream3.Stream3...   INFO Initializing Stream3.Stream3Tool - package version AthenaServices-00-00-00
 Stream3.Stream3...   INFO Initializing Stream3.Stream3_MakeEventStreamInfo - package version OutputStreamAthenaPool-00-00-00
-Stream3              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream3_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream3_MakeEventFormat','Athena::ThinningCacheTool/ThinningCacheTool_Stream3'])
+Stream3              INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream3_MakeEventStreamInfo','xAODMaker::EventFormatStreamHelperTool/Stream3_MakeEventFormat','xAODMaker::FileMetaDataCreatorTool/FileMetaDataCreatorTool','Athena::ThinningCacheTool/ThinningCacheTool_Stream3'])
 Stream3              INFO Data output: EmptyPoolFile.root
 Stream3              INFO I/O reinitialization...
 EventSelector        INFO  Enter McEventSelector Initialization 
@@ -282,6 +295,10 @@ POOLCollectionT...  DEBUG Opened container POOLCollectionTree(MagicNumber) of ty
 SimplePoolFile1...  DEBUG --->Adding Assoc :????/POOLCollectionTree(MagicNumber) [20?]  (a , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
 ClassIDSvc           INFO  getRegistryEntries: read 83 CLIDRegistry entries for module ALL
+Stream1.FileMet...  DEBUG Valid  'EventInfoKey':'EventInfo' handle
+Stream1.FileMet...  DEBUG setting xAOD::FileMetaData::mcProcID to 0
+Stream1.FileMet...  DEBUG valid  'StreamName':'Stream1' handle
+Stream1.FileMet...  DEBUG set xAOD::FileMetaData::dataType to Stream1
 Stream2             DEBUG addItemObjects(2101,"*") called
 Stream2             DEBUG            Key:*
 Stream2             DEBUG      Comp Attr 0 with 7 mantissa bits.
@@ -386,6 +403,11 @@ POOLCollectionT...  DEBUG Branch container 'MagicNumber'
 POOLCollectionT...  DEBUG Opened container POOLCollectionTree(MagicNumber) of type ROOT_Tree
 SimplePoolFile2...  DEBUG --->Adding Assoc :????/POOLCollectionTree(MagicNumber) [20?]  (9 , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
+Stream2.FileMet...  DEBUG Valid  'EventInfoKey':'EventInfo' handle
+Stream2.FileMet...  DEBUG setting xAOD::FileMetaData::mcProcID to 0
+Stream2.FileMet...  DEBUG valid  'StreamName':'Stream2' handle
+Stream2.FileMet...  DEBUG set xAOD::FileMetaData::dataType to Stream2
+Stream3.FileMet...WARNING No  'StreamName':'Stream3'
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #0, run #1 1 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #1, run #1 1 events processed so far  <<<===
 WriteData           DEBUG in execute()
@@ -1164,12 +1186,23 @@ AthenaEventLoopMgr   INFO   ===>>>  done processing event #19, run #1 20 events
 Stream1             DEBUG AthenaOutputStream Stream1 ::stop()
 Stream2             DEBUG AthenaOutputStream Stream2 ::stop()
 Stream1             DEBUG slot 0  handle() incident type: MetaDataStop
-Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream1]
+Stream1.FileMet...  DEBUG Creating new xAOD::FileMetaData object to output
+Stream1             DEBUG metadataItemList: [EventStreamInfo#Stream1, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream1, xAOD::FileMetaData#FileMetaData, xAOD::FileMetaDataAuxInfo#FileMetaDataAux.]
+Stream1             DEBUG addItemObjects(73252552,"FileMetaDataAux.") called
+Stream1             DEBUG            Key:FileMetaDataAux.
+Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
+Stream1             DEBUG  Added object 73252552,"FileMetaDataAux."
 Stream1             DEBUG addItemObjects(167728019,"Stream1") called
 Stream1             DEBUG            Key:Stream1
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
 Stream1             DEBUG  Added object 167728019,"Stream1"
+Stream1             DEBUG addItemObjects(178309087,"FileMetaData") called
+Stream1             DEBUG            Key:FileMetaData
+Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
+Stream1             DEBUG  Added object 178309087,"FileMetaData"
 Stream1             DEBUG addItemObjects(243004407,"EventFormatStream1") called
 Stream1             DEBUG            Key:EventFormatStream1
 Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
@@ -1181,27 +1214,51 @@ Stream1             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream1             DEBUG      Comp Attr 0 with 15 mantissa bits.
 Stream1             DEBUG connectOutput done for SimplePoolFile1.root
 StorageSvc           INFO Building shape according to reflection information using shape ID for:
+StorageSvc           INFO xAOD::FileMetaDataAuxInfo_v1 [????]
+SimplePoolFile1...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) of type ROOT_Tree
+SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (b , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+SimplePoolFile1...  DEBUG --->Adding Shape[6 , ????]:  [1 Column(s)] 
+SimplePoolFile1...  DEBUG ---->Class:xAOD::FileMetaDataAuxInfo_v1
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
+StorageSvc           INFO Building shape according to reflection information using shape ID for:
 StorageSvc           INFO EventStreamInfo_p3 [????]
 SimplePoolFile1...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(EventStreamInfo_p3/Stream1)
 MetaData(EventS...  DEBUG Opening
 MetaData(EventS...  DEBUG    attributes# = 1
 MetaData(EventS...  DEBUG Branch container 'EventStreamInfo_p3_Stream1'
 MetaData(EventS...  DEBUG Opened container MetaData(EventStreamInfo_p3/Stream1) of type ROOT_Tree
-SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (b , ffffffff)
+SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream1) [20?]  (c , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Adding Shape[6 , ????]:  [1 Column(s)] 
+SimplePoolFile1...  DEBUG --->Adding Shape[7 , ????]:  [1 Column(s)] 
 SimplePoolFile1...  DEBUG ---->Class:EventStreamInfo_p3
 SimplePoolFile1...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
 StorageSvc           INFO Building shape according to reflection information using shape ID for:
+StorageSvc           INFO xAOD::FileMetaData_v1 [????]
+SimplePoolFile1...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaData_v1/FileMetaData)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaData_v1_FileMetaData'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaData_v1/FileMetaData) of type ROOT_Tree
+SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (d , ffffffff)
+SimplePoolFile1...  DEBUG ---->ClassID:????
+SimplePoolFile1...  DEBUG --->Adding Shape[8 , ????]:  [1 Column(s)] 
+SimplePoolFile1...  DEBUG ---->Class:xAOD::FileMetaData_v1
+SimplePoolFile1...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
+StorageSvc           INFO Building shape according to reflection information using shape ID for:
 StorageSvc           INFO xAOD::EventFormat_v1 [????]
 SimplePoolFile1...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::EventFormat_v1/EventFormatStream1)
 MetaData(xAOD::...  DEBUG Opening
 MetaData(xAOD::...  DEBUG    attributes# = 1
 MetaData(xAOD::...  DEBUG Branch container 'xAOD::EventFormat_v1_EventFormatStream1'
 MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::EventFormat_v1/EventFormatStream1) of type ROOT_Tree
-SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (c , ffffffff)
+SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream1) [20?]  (e , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-SimplePoolFile1...  DEBUG --->Adding Shape[7 , ????]:  [1 Column(s)] 
+SimplePoolFile1...  DEBUG --->Adding Shape[9 , ????]:  [1 Column(s)] 
 SimplePoolFile1...  DEBUG ---->Class:xAOD::EventFormat_v1
 SimplePoolFile1...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile1...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdr(DataHeader)
@@ -1209,25 +1266,39 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (d , ffffffff)
+SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (f , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
 SimplePoolFile1...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
 MetaDataHdrForm...  DEBUG    attributes# = 1
 MetaDataHdrForm...  DEBUG Branch container 'DataHeaderForm'
 MetaDataHdrForm...  DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree
-SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (e , ffffffff)
+SimplePoolFile1...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (10 , ffffffff)
 SimplePoolFile1...  DEBUG ---->ClassID:????
-ClassIDSvc           INFO  getRegistryEntries: read 14 CLIDRegistry entries for module ALL
+MetaData(xAOD::...  DEBUG  SG::IAuxStoreIO* detected in xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.
+MetaData(xAOD::...  DEBUG        Attributes= 1
+MetaData(xAOD::...  DEBUG    Creating branch for new dynamic attribute, Id=79: type=float, mcProcID
+MetaData(xAOD::...  DEBUG createBasicAuxBranch: xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAuxDyn.mcProcID, leaf:mcProcID/F
+ClassIDSvc           INFO  getRegistryEntries: read 55 CLIDRegistry entries for module ALL
 Stream1              INFO Metadata records written: 21
 Stream1             DEBUG Leaving incident handler for MetaDataStop
 Stream2             DEBUG slot 0  handle() incident type: MetaDataStop
-Stream2             DEBUG metadataItemList: [EventStreamInfo#Stream2, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream2]
+Stream2             DEBUG metadataItemList: [EventStreamInfo#Stream2, IOVMetaDataContainer#*, xAOD::EventFormat#EventFormatStream2, xAOD::FileMetaData#FileMetaData, xAOD::FileMetaDataAuxInfo#FileMetaDataAux.]
+Stream2             DEBUG addItemObjects(73252552,"FileMetaDataAux.") called
+Stream2             DEBUG            Key:FileMetaDataAux.
+Stream2             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream2             DEBUG      Comp Attr 0 with 15 mantissa bits.
+Stream2             DEBUG  Added object 73252552,"FileMetaDataAux."
 Stream2             DEBUG addItemObjects(167728019,"Stream2") called
 Stream2             DEBUG            Key:Stream2
 Stream2             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream2             DEBUG      Comp Attr 0 with 15 mantissa bits.
 Stream2             DEBUG  Added object 167728019,"Stream2"
+Stream2             DEBUG addItemObjects(178309087,"FileMetaData") called
+Stream2             DEBUG            Key:FileMetaData
+Stream2             DEBUG      Comp Attr 0 with 7 mantissa bits.
+Stream2             DEBUG      Comp Attr 0 with 15 mantissa bits.
+Stream2             DEBUG  Added object 178309087,"FileMetaData"
 Stream2             DEBUG addItemObjects(243004407,"EventFormatStream2") called
 Stream2             DEBUG            Key:EventFormatStream2
 Stream2             DEBUG      Comp Attr 0 with 7 mantissa bits.
@@ -1238,24 +1309,44 @@ Stream2             DEBUG            Key:*
 Stream2             DEBUG      Comp Attr 0 with 7 mantissa bits.
 Stream2             DEBUG      Comp Attr 0 with 15 mantissa bits.
 Stream2             DEBUG connectOutput done for SimplePoolFile2.root
+SimplePoolFile2...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) of type ROOT_Tree
+SimplePoolFile2...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (a , ffffffff)
+SimplePoolFile2...  DEBUG ---->ClassID:????
+SimplePoolFile2...  DEBUG --->Adding Shape[5 , ????]:  [1 Column(s)] 
+SimplePoolFile2...  DEBUG ---->Class:xAOD::FileMetaDataAuxInfo_v1
+SimplePoolFile2...  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile2...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(EventStreamInfo_p3/Stream2)
 MetaData(EventS...  DEBUG Opening
 MetaData(EventS...  DEBUG    attributes# = 1
 MetaData(EventS...  DEBUG Branch container 'EventStreamInfo_p3_Stream2'
 MetaData(EventS...  DEBUG Opened container MetaData(EventStreamInfo_p3/Stream2) of type ROOT_Tree
-SimplePoolFile2...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream2) [20?]  (a , ffffffff)
+SimplePoolFile2...  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream2) [20?]  (b , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-SimplePoolFile2...  DEBUG --->Adding Shape[5 , ????]:  [1 Column(s)] 
+SimplePoolFile2...  DEBUG --->Adding Shape[6 , ????]:  [1 Column(s)] 
 SimplePoolFile2...  DEBUG ---->Class:EventStreamInfo_p3
 SimplePoolFile2...  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+SimplePoolFile2...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaData_v1/FileMetaData)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaData_v1_FileMetaData'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaData_v1/FileMetaData) of type ROOT_Tree
+SimplePoolFile2...  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (c , ffffffff)
+SimplePoolFile2...  DEBUG ---->ClassID:????
+SimplePoolFile2...  DEBUG --->Adding Shape[7 , ????]:  [1 Column(s)] 
+SimplePoolFile2...  DEBUG ---->Class:xAOD::FileMetaData_v1
+SimplePoolFile2...  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile2...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::EventFormat_v1/EventFormatStream2)
 MetaData(xAOD::...  DEBUG Opening
 MetaData(xAOD::...  DEBUG    attributes# = 1
 MetaData(xAOD::...  DEBUG Branch container 'xAOD::EventFormat_v1_EventFormatStream2'
 MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::EventFormat_v1/EventFormatStream2) of type ROOT_Tree
-SimplePoolFile2...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream2) [20?]  (b , ffffffff)
+SimplePoolFile2...  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream2) [20?]  (d , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
-SimplePoolFile2...  DEBUG --->Adding Shape[6 , ????]:  [1 Column(s)] 
+SimplePoolFile2...  DEBUG --->Adding Shape[8 , ????]:  [1 Column(s)] 
 SimplePoolFile2...  DEBUG ---->Class:xAOD::EventFormat_v1
 SimplePoolFile2...  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
 SimplePoolFile2...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdr(DataHeader)
@@ -1263,15 +1354,19 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-SimplePoolFile2...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (c , ffffffff)
+SimplePoolFile2...  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (e , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
 SimplePoolFile2...  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
 MetaDataHdrForm...  DEBUG Opening
 MetaDataHdrForm...  DEBUG    attributes# = 1
 MetaDataHdrForm...  DEBUG Branch container 'DataHeaderForm'
 MetaDataHdrForm...  DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree
-SimplePoolFile2...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (d , ffffffff)
+SimplePoolFile2...  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (f , ffffffff)
 SimplePoolFile2...  DEBUG ---->ClassID:????
+MetaData(xAOD::...  DEBUG  SG::IAuxStoreIO* detected in xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.
+MetaData(xAOD::...  DEBUG        Attributes= 1
+MetaData(xAOD::...  DEBUG    Creating branch for new dynamic attribute, Id=79: type=float, mcProcID
+MetaData(xAOD::...  DEBUG createBasicAuxBranch: xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAuxDyn.mcProcID, leaf:mcProcID/F
 Stream2              INFO Metadata records written: 21
 Stream2             DEBUG Leaving incident handler for MetaDataStop
 DbSession            INFO     Open     DbSession    
@@ -1302,24 +1397,44 @@ EmptyPoolFile.root  DEBUG --->Adding Assoc :????/##Params [200]  (2 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
 ##Params            DEBUG No objects passing selection criteria... Container has 0 Entries in total.
 AthenaPoolCnvSvc    DEBUG setAttribute CONTAINER_SPLITLEVEL to 0 for db: EmptyPoolFile.root and cont: TTree=POOLContainerForm(DataHeaderForm)
+EmptyPoolFile.root  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) of type ROOT_Tree
+EmptyPoolFile.root  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaDataAuxInfo_v1/FileMetaDataAux.) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+EmptyPoolFile.root  DEBUG --->Adding Shape[0 , ????]:  [1 Column(s)] 
+EmptyPoolFile.root  DEBUG ---->Class:xAOD::FileMetaDataAuxInfo_v1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaDataAuxInfo_v1 Typ:xAOD::FileMetaDataAuxInfo_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(EventStreamInfo_p3/Stream3)
 MetaData(EventS...  DEBUG Opening
 MetaData(EventS...  DEBUG    attributes# = 1
 MetaData(EventS...  DEBUG Branch container 'EventStreamInfo_p3_Stream3'
 MetaData(EventS...  DEBUG Opened container MetaData(EventStreamInfo_p3/Stream3) of type ROOT_Tree
-EmptyPoolFile.root  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (3 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Adding Assoc :????/MetaData(EventStreamInfo_p3/Stream3) [20?]  (4 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Adding Shape[0 , ????]:  [1 Column(s)] 
+EmptyPoolFile.root  DEBUG --->Adding Shape[1 , ????]:  [1 Column(s)] 
 EmptyPoolFile.root  DEBUG ---->Class:EventStreamInfo_p3
 EmptyPoolFile.root  DEBUG ---->[0]:EventStreamInfo_p3 Typ:EventStreamInfo_p3 [21] Size:0 Offset:0 #Elements:1
+EmptyPoolFile.root  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::FileMetaData_v1/FileMetaData)
+MetaData(xAOD::...  DEBUG Opening
+MetaData(xAOD::...  DEBUG    attributes# = 1
+MetaData(xAOD::...  DEBUG Branch container 'xAOD::FileMetaData_v1_FileMetaData'
+MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::FileMetaData_v1/FileMetaData) of type ROOT_Tree
+EmptyPoolFile.root  DEBUG --->Adding Assoc :????/MetaData(xAOD::FileMetaData_v1/FileMetaData) [20?]  (5 , ffffffff)
+EmptyPoolFile.root  DEBUG ---->ClassID:????
+EmptyPoolFile.root  DEBUG --->Adding Shape[2 , ????]:  [1 Column(s)] 
+EmptyPoolFile.root  DEBUG ---->Class:xAOD::FileMetaData_v1
+EmptyPoolFile.root  DEBUG ---->[0]:xAOD::FileMetaData_v1 Typ:xAOD::FileMetaData_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaData(xAOD::EventFormat_v1/EventFormatStream3)
 MetaData(xAOD::...  DEBUG Opening
 MetaData(xAOD::...  DEBUG    attributes# = 1
 MetaData(xAOD::...  DEBUG Branch container 'xAOD::EventFormat_v1_EventFormatStream3'
 MetaData(xAOD::...  DEBUG Opened container MetaData(xAOD::EventFormat_v1/EventFormatStream3) of type ROOT_Tree
-EmptyPoolFile.root  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (4 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Adding Assoc :????/MetaData(xAOD::EventFormat_v1/EventFormatStream3) [20?]  (6 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Adding Shape[1 , ????]:  [1 Column(s)] 
+EmptyPoolFile.root  DEBUG --->Adding Shape[3 , ????]:  [1 Column(s)] 
 EmptyPoolFile.root  DEBUG ---->Class:xAOD::EventFormat_v1
 EmptyPoolFile.root  DEBUG ---->[0]:xAOD::EventFormat_v1 Typ:xAOD::EventFormat_v1 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdr(DataHeader)
@@ -1327,9 +1442,9 @@ MetaDataHdr(Dat...  DEBUG Opening
 MetaDataHdr(Dat...  DEBUG    attributes# = 1
 MetaDataHdr(Dat...  DEBUG Branch container 'DataHeader'
 MetaDataHdr(Dat...  DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree
-EmptyPoolFile.root  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (5 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Adding Assoc :????/MetaDataHdr(DataHeader) [20?]  (7 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Adding Shape[2 , ????]:  [1 Column(s)] 
+EmptyPoolFile.root  DEBUG --->Adding Shape[4 , ????]:  [1 Column(s)] 
 EmptyPoolFile.root  DEBUG ---->Class:DataHeader_p6
 EmptyPoolFile.root  DEBUG ---->[0]:DataHeader_p6 Typ:DataHeader_p6 [21] Size:0 Offset:0 #Elements:1
 EmptyPoolFile.root  DEBUG --> Access   DbContainer  CREA/UPDA [ROOT_Tree] MetaDataHdrForm(DataHeaderForm)
@@ -1337,11 +1452,15 @@ MetaDataHdrForm...  DEBUG Opening
 MetaDataHdrForm...  DEBUG    attributes# = 1
 MetaDataHdrForm...  DEBUG Branch container 'DataHeaderForm'
 MetaDataHdrForm...  DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree
-EmptyPoolFile.root  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (6 , ffffffff)
+EmptyPoolFile.root  DEBUG --->Adding Assoc :????/MetaDataHdrForm(DataHeaderForm) [20?]  (8 , ffffffff)
 EmptyPoolFile.root  DEBUG ---->ClassID:????
-EmptyPoolFile.root  DEBUG --->Adding Shape[3 , ????]:  [1 Column(s)] 
+EmptyPoolFile.root  DEBUG --->Adding Shape[5 , ????]:  [1 Column(s)] 
 EmptyPoolFile.root  DEBUG ---->Class:DataHeaderForm_p6
 EmptyPoolFile.root  DEBUG ---->[0]:DataHeaderForm_p6 Typ:DataHeaderForm_p6 [21] Size:0 Offset:0 #Elements:1
+MetaData(xAOD::...  DEBUG  SG::IAuxStoreIO* detected in xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAux.
+MetaData(xAOD::...  DEBUG        Attributes= 1
+MetaData(xAOD::...  DEBUG    Creating branch for new dynamic attribute, Id=79: type=float, mcProcID
+MetaData(xAOD::...  DEBUG createBasicAuxBranch: xAOD::FileMetaDataAuxInfo_v1_FileMetaDataAuxDyn.mcProcID, leaf:mcProcID/F
 Stream3              INFO Metadata records written: 1
 Domain[ROOT_All]     INFO >   Deaccess DbDomain     READ      [ROOT_All] 
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   CREATE    [ROOT_All] ????
@@ -1371,10 +1490,10 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 *****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] #= 43
-cRepR_ALL            INFO Time User   : Tot=   40 [ms] Ave/Min/Max=   0.145(+-     1.2)/       0/      10 [ms] #=275
-cRep_ALL             INFO Time User   : Tot=   50 [ms] Ave/Min/Max=   0.459(+-    2.49)/       0/      20 [ms] #=109
-fRep_ALL             INFO Time User   : Tot=   70 [ms] Ave/Min/Max=   0.642(+-    2.45)/       0/      10 [ms] #=109
-ChronoStatSvc        INFO Time User   : Tot=  410 [ms]  #=  1
+cRepR_ALL            INFO Time User   : Tot=   60 [ms] Ave/Min/Max=   0.214(+-    1.67)/       0/      20 [ms] #=281
+cRep_ALL             INFO Time User   : Tot=   60 [ms] Ave/Min/Max=   0.522(+-    2.59)/       0/      20 [ms] #=115
+fRep_ALL             INFO Time User   : Tot=   80 [ms] Ave/Min/Max=   0.696(+-    2.87)/       0/      20 [ms] #=115
+ChronoStatSvc        INFO Time User   : Tot=  400 [ms]  #=  1
 *****Chrono*****     INFO ****************************************************************************************************
 ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
diff --git a/Database/CoolRunQuery/python/utils/AtlRunQueryLookup.py b/Database/CoolRunQuery/python/utils/AtlRunQueryLookup.py
index ab25d7a26041f80226a2ebcd2eb43b26a906371d..8ec5fe7d99dda009536c6bcfcae8f404d3d7920f 100644
--- a/Database/CoolRunQuery/python/utils/AtlRunQueryLookup.py
+++ b/Database/CoolRunQuery/python/utils/AtlRunQueryLookup.py
@@ -333,7 +333,7 @@ def InitDetectorMaskDecoderRun2():
 
     NotInAll = map(lambda x: ' NotInAll' if x in notInAll else '', dName)
 
-    vetoedbits = [3, 41, 42, 44, 50, 51, 52, 53, 55, 57, 58, 59] + range(64,128)
+    vetoedbits = [3, 41, 42, 44, 50, 51, 52, 53, 55, 57, 58, 59] + [x for x in range(64,128)] #+ range(64,128)
 
     return (dName, NotInAll, vetoedbits)
 
diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGMJobProperties.py b/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGMJobProperties.py
index 0d1df8db4b4425ea7ae8dd456cc9ddf2488a7277..ff17d174aaed3eb2bc92e2cf5f1ddd7ef6ceaa65 100755
--- a/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGMJobProperties.py
+++ b/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGMJobProperties.py
@@ -155,14 +155,6 @@ class InDetGeometryFlags_JobProperties(JobPropertyContainer):
         self.GeoVersionName.set_Value_and_Lock(InDetGeoFlags.getValue("VersionName"))
         self.GeoLayout.set_Value_and_Lock(InDetGeoFlags.getValue("Layout"))
 
-    def setupDynamicAlignFolders(self):
-        from AthenaCommon.GlobalFlags import globalflags
-        from IOVDbSvc.CondDB import conddb
-        # Disable for MC or for Run 1 (AlignL* folders are not in COMP200).
-        if globalflags.DataSource.get_Value() != 'data' or conddb.dbname == 'COMP200':
-            self.useDynamicAlignFolders.set_Value_and_Lock(False)
-
-
     def reset(self,geoTagName="none"):
         
         self.isSLHC.unlock()
@@ -197,6 +189,5 @@ jobproperties.InDetGeometryFlags_JobProperties.add_JobProperty(useDynamicAlignFo
 
 InDetGeometryFlags = jobproperties.InDetGeometryFlags_JobProperties
 InDetGeometryFlags.setupValuesFromDB()
-InDetGeometryFlags.setupDynamicAlignFolders()
 
 
diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoVisitVolumes.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoVisitVolumes.cxx
index e1cb4ef40a8f433a920292f61426a0c1408594c6..33de1a7d6d237c53fad0e0772193b9d7277915dd 100644
--- a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoVisitVolumes.cxx
+++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoVisitVolumes.cxx
@@ -10,10 +10,6 @@
  * Based on GeoAccessVolumeAction.
  */
 
-
-#include "GeoModelUtilities/GeoVisitVolumes.h"
-
-
 #include "GeoModelUtilities/GeoVisitVolumes.h"
 #include "GeoModelKernel/GeoNameTag.h"
 #include "GeoModelKernel/GeoSerialDenominator.h"
diff --git a/DetectorDescription/GeoModelXml/src/MakeElement.cxx b/DetectorDescription/GeoModelXml/src/MakeElement.cxx
index c12e1fe38f720eeb06f93548e217314e841d12a6..e37ceffd21495532bdda03e7b925a1ecc73e99c6 100644
--- a/DetectorDescription/GeoModelXml/src/MakeElement.cxx
+++ b/DetectorDescription/GeoModelXml/src/MakeElement.cxx
@@ -6,7 +6,6 @@
 #include <xercesc/dom/DOM.hpp>
 #include "GeoModelKernel/RCBase.h"
 #include "GeoModelKernel/Units.h"
-#include "GeoModelKernel/Units.h"
 #include "GeoModelKernel/GeoElement.h"
 #include "GeoModelXml/translate.h"
 #include "GeoModelXml/GmxUtil.h"
diff --git a/DetectorDescription/IdDictDetDescrCnv/share/IdDictDetDescrCnv_joboptions.py b/DetectorDescription/IdDictDetDescrCnv/share/IdDictDetDescrCnv_joboptions.py
index 8fd587c2d63e9aab2da7e3df586ecba732cf709d..520c0cddab2c7fef91ecc7ee478836c46b16e6cf 100755
--- a/DetectorDescription/IdDictDetDescrCnv/share/IdDictDetDescrCnv_joboptions.py
+++ b/DetectorDescription/IdDictDetDescrCnv/share/IdDictDetDescrCnv_joboptions.py
@@ -2,6 +2,17 @@
 #  Joboptions for the loading of the of InDetDDMgr
 #
 
+_log = logging.getLogger( 'IdDictDetDescrCnv_joboptions' )
+from AthenaCommon.GlobalFlags  import globalflags
+from IOVDbSvc.CondDB import conddb
+
+# Disable for MC or for Run 1 (AlignL* folders are not in COMP200).
+if globalflags.DataSource.get_Value() != 'data' or conddb.dbname == 'COMP200':
+    _log.info("Disabling ID dynamic alignment")
+    from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags
+    InDetGeometryFlags.useDynamicAlignFolders=False
+
 # DLLs 
 theApp.Dlls += [ "IdDictDetDescrCnv" ]
 
+del _log
diff --git a/DetectorDescription/IdDictParser/data/IdDictMuonSpectrometer_R.10.00.xml b/DetectorDescription/IdDictParser/data/IdDictMuonSpectrometer_R.10.00.xml
index f4e2f008220f35279df3e434f893fbb7a62034f0..fb566c218bb1cf793ca62a0508306ff041b8d90c 100755
--- a/DetectorDescription/IdDictParser/data/IdDictMuonSpectrometer_R.10.00.xml
+++ b/DetectorDescription/IdDictParser/data/IdDictMuonSpectrometer_R.10.00.xml
@@ -337,7 +337,7 @@
     <range field="technology" value="MDT" />
     <range field="multiLayer" minvalue="1" maxvalue="2" />
     <range field="tubeLayer" minvalue="1" maxvalue="4" />
-    <range field="tube" minvalue="1" maxvalue="36" />
+    <range field="tube" minvalue="1" maxvalue="72" />
   </region>
   
   <region group="mdt">
@@ -347,7 +347,7 @@
     <range field="technology" value="MDT" />
     <range field="multiLayer" minvalue="1" maxvalue="2" />
     <range field="tubeLayer" minvalue="1" maxvalue="4" />
-    <range field="tube" minvalue="1" maxvalue="30" />
+    <range field="tube" minvalue="1" maxvalue="59" />
   </region>
   
   <region group="mdt">
@@ -357,7 +357,7 @@
     <range field="technology" value="MDT" />
     <range field="multiLayer" minvalue="1" maxvalue="2" />
     <range field="tubeLayer" minvalue="1" maxvalue="4" />
-    <range field="tube" minvalue="1" maxvalue="30" />
+    <range field="tube" minvalue="1" maxvalue="59" />
   </region>
   
   <region group="mdt">
@@ -367,7 +367,7 @@
     <range field="technology" value="MDT" />
     <range field="multiLayer" minvalue="1" maxvalue="2" />
     <range field="tubeLayer" minvalue="1" maxvalue="4" />
-    <range field="tube" minvalue="1" maxvalue="30" />
+    <range field="tube" minvalue="1" maxvalue="59" />
   </region>
   
   <region group="mdt">
@@ -377,7 +377,7 @@
     <range field="technology" value="MDT" />
     <range field="multiLayer" minvalue="1" maxvalue="2" />
     <range field="tubeLayer" minvalue="1" maxvalue="4" />
-    <range field="tube" minvalue="1" maxvalue="30" />
+    <range field="tube" minvalue="1" maxvalue="59" />
   </region>
   
   <region group="mdt">
@@ -387,7 +387,7 @@
     <range field="technology" value="MDT" />
     <range field="multiLayer" minvalue="1" maxvalue="2" />
     <range field="tubeLayer" minvalue="1" maxvalue="4" />
-    <range field="tube" minvalue="1" maxvalue="30" />
+    <range field="tube" minvalue="1" maxvalue="59" />
   </region>
 
   <region group="mdt">
diff --git a/Event/xAOD/xAODMissingET/Root/MissingETAssociation_v1.cxx b/Event/xAOD/xAODMissingET/Root/MissingETAssociation_v1.cxx
index 7b15541dee16289431eb641dfdb797c5818af885..9e4a626858ee930986a15c477821415d447b363e 100644
--- a/Event/xAOD/xAODMissingET/Root/MissingETAssociation_v1.cxx
+++ b/Event/xAOD/xAODMissingET/Root/MissingETAssociation_v1.cxx
@@ -41,14 +41,14 @@ namespace xAOD {
     return *this;
   }
 
-  MissingETAssociation_v1::ConstVec& MissingETAssociation_v1::ConstVec::operator*=(double scale)
+  MissingETAssociation_v1::ConstVec& MissingETAssociation_v1::ConstVec::operator*=(float scale)
   {
     this->cpx() *= scale; this->cpy() *= scale; this->cpz() *= scale; this->ce() *= scale;
     this->sumpt() *= scale;
     return *this;
   }
 
-  MissingETAssociation_v1::ConstVec& MissingETAssociation_v1::ConstVec::operator/=(double scale)
+  MissingETAssociation_v1::ConstVec& MissingETAssociation_v1::ConstVec::operator/=(float scale)
   {
     if ( scale <1e-9 ) { this->cpx() = 0.; this->cpy() = 0.; this->cpz() = 0.; this->ce() = 0.; this->sumpt() = 0.; return *this; }
     else { return this->operator*=(1./scale); }
@@ -64,7 +64,7 @@ namespace xAOD {
       MissingETBase::Numerical::isEqual(this->sumpt(),cvec.sumpt());
   }
 
-  double MissingETAssociation_v1::ConstVec::cpt() const
+  float MissingETAssociation_v1::ConstVec::cpt() const
   {
     return sqrt(this->cpx()*this->cpx()+this->cpy()*this->cpy());
   }
@@ -276,47 +276,47 @@ namespace xAOD {
   // Setters //
   /////////////
 
-  bool MissingETAssociation_v1::setCalPx(const std::vector<double>& calpxvec)
+  bool MissingETAssociation_v1::setCalPx(const std::vector<float>& calpxvec)
   { this->f_calpx().clear(); this->f_calpx().insert(this->f_calpx().end(),calpxvec.begin(),calpxvec.end()); return !this->f_calpx().empty(); }
-  bool MissingETAssociation_v1::setCalPy(const std::vector<double>& calpyvec)
+  bool MissingETAssociation_v1::setCalPy(const std::vector<float>& calpyvec)
   { this->f_calpy().clear(); this->f_calpy().insert(this->f_calpy().end(),calpyvec.begin(),calpyvec.end()); return !this->f_calpy().empty(); }
-  bool MissingETAssociation_v1::setCalPz(const std::vector<double>& calpzvec)
+  bool MissingETAssociation_v1::setCalPz(const std::vector<float>& calpzvec)
   { this->f_calpz().clear(); this->f_calpz().insert(this->f_calpz().end(),calpzvec.begin(),calpzvec.end()); return !this->f_calpz().empty(); }
-  bool MissingETAssociation_v1::setCalE(const std::vector<double>& calevec)
+  bool MissingETAssociation_v1::setCalE(const std::vector<float>& calevec)
   { this->f_cale().clear(); this->f_cale().insert(this->f_cale().end(),calevec.begin(),calevec.end()); return !this->f_cale().empty(); }
-  bool MissingETAssociation_v1::setCalSumpt(const std::vector<double>& calsumptvec)
+  bool MissingETAssociation_v1::setCalSumpt(const std::vector<float>& calsumptvec)
   { this->f_calsumpt().clear(); this->f_calsumpt().insert(this->f_calsumpt().end(),calsumptvec.begin(),calsumptvec.end()); return !this->f_calsumpt().empty(); }
   bool MissingETAssociation_v1::setCalKey(const std::vector<MissingETBase::Types::bitmask_t>& calkeyvec)
   { this->f_calkey().clear(); this->f_calkey().insert(this->f_calkey().end(),calkeyvec.begin(),calkeyvec.end()); return !this->f_calkey().empty(); }
 
-  bool MissingETAssociation_v1::setTrkPx(const std::vector<double>& trkpxvec)
+  bool MissingETAssociation_v1::setTrkPx(const std::vector<float>& trkpxvec)
   { this->f_trkpx().clear(); this->f_trkpx().insert(this->f_trkpx().end(),trkpxvec.begin(),trkpxvec.end()); return !this->f_trkpx().empty(); }
-  bool MissingETAssociation_v1::setTrkPy(const std::vector<double>& trkpyvec)
+  bool MissingETAssociation_v1::setTrkPy(const std::vector<float>& trkpyvec)
   { this->f_trkpy().clear(); this->f_trkpy().insert(this->f_trkpy().end(),trkpyvec.begin(),trkpyvec.end()); return !this->f_trkpy().empty(); }
-  bool MissingETAssociation_v1::setTrkPz(const std::vector<double>& trkpzvec)
+  bool MissingETAssociation_v1::setTrkPz(const std::vector<float>& trkpzvec)
   { this->f_trkpz().clear(); this->f_trkpz().insert(this->f_trkpz().end(),trkpzvec.begin(),trkpzvec.end()); return !this->f_trkpz().empty(); }
-  bool MissingETAssociation_v1::setTrkE(const std::vector<double>& trkevec)
+  bool MissingETAssociation_v1::setTrkE(const std::vector<float>& trkevec)
   { this->f_trke().clear(); this->f_trke().insert(this->f_trke().end(),trkevec.begin(),trkevec.end()); return !this->f_trke().empty(); }
-  bool MissingETAssociation_v1::setTrkSumpt(const std::vector<double>& trksumptvec)
+  bool MissingETAssociation_v1::setTrkSumpt(const std::vector<float>& trksumptvec)
   { this->f_trksumpt().clear(); this->f_trksumpt().insert(this->f_trksumpt().end(),trksumptvec.begin(),trksumptvec.end()); return !this->f_trksumpt().empty(); }
   bool MissingETAssociation_v1::setTrkKey(const std::vector<MissingETBase::Types::bitmask_t>& trkkeyvec)
   { this->f_trkkey().clear(); this->f_trkkey().insert(this->f_trkkey().end(),trkkeyvec.begin(),trkkeyvec.end()); return !this->f_trkkey().empty(); }
 
   //////////
   // FIXME: failsafe implementation checks on invalidKey and vector index - vector index may be sufficient?
-  bool MissingETAssociation_v1::setCalPx(size_t keyIdx,double calpx)
+  bool MissingETAssociation_v1::setCalPx(size_t keyIdx,float calpx)
   { if ( keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->f_calpx().size() ) { this->f_calpx()[keyIdx] = calpx; return true; } else { return false; } }
-  bool MissingETAssociation_v1::setCalPy(size_t keyIdx,double calpy)
+  bool MissingETAssociation_v1::setCalPy(size_t keyIdx,float calpy)
   { if ( keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->f_calpy().size() ) { this->f_calpy()[keyIdx] = calpy; return true; } else { return false; } }
-  bool MissingETAssociation_v1::setCalPz(size_t keyIdx,double calpz)
+  bool MissingETAssociation_v1::setCalPz(size_t keyIdx,float calpz)
   { if ( keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->f_calpz().size() ) { this->f_calpz()[keyIdx] = calpz; return true; } else { return false; } }
-  bool MissingETAssociation_v1::setCalE(size_t keyIdx,double cale)
+  bool MissingETAssociation_v1::setCalE(size_t keyIdx,float cale)
   { if ( keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->f_cale().size() ) { this->f_cale()[keyIdx] = cale; return true; } else { return false; } }
-  bool MissingETAssociation_v1::setCalSumpt(size_t keyIdx,double calsumpt)
+  bool MissingETAssociation_v1::setCalSumpt(size_t keyIdx,float calsumpt)
   { if ( keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->f_calsumpt().size() ) { this->f_calsumpt()[keyIdx] = calsumpt; return true; } else { return false; } }
   bool MissingETAssociation_v1::setCalKey(size_t keyIdx,MissingETBase::Types::bitmask_t calkey)
   { if ( keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->f_calkey().size() ) { this->f_calkey()[keyIdx] = calkey; return true; } else { return false; } }
-  bool MissingETAssociation_v1::setCalVec(size_t keyIdx,double calpx,double calpy,double calpz,double cale,double sumpt)
+  bool MissingETAssociation_v1::setCalVec(size_t keyIdx,float calpx,float calpy,float calpz,float cale,float sumpt)
   {
     if ( keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->f_cale().size() ) {
       this->f_calpx()[keyIdx] = calpx;  this->f_calpy()[keyIdx] = calpy;
@@ -324,7 +324,7 @@ namespace xAOD {
       this->f_calsumpt()[keyIdx] = sumpt; return true;
     } else { return false; }
   }
-  bool MissingETAssociation_v1::addCalVec(MissingETBase::Types::bitmask_t key,double calpx,double calpy,double calpz,double cale,double sumpt) {
+  bool MissingETAssociation_v1::addCalVec(MissingETBase::Types::bitmask_t key,float calpx,float calpy,float calpz,float cale,float sumpt) {
     for(MissingETBase::Types::bitmask_t testkey : this->f_calkey()) {
       // quit if key already exists.
       if(key==testkey) return false;
@@ -338,19 +338,19 @@ namespace xAOD {
     return true;
   }
 
-  bool MissingETAssociation_v1::setTrkPx(size_t keyIdx,double trkpx)
+  bool MissingETAssociation_v1::setTrkPx(size_t keyIdx,float trkpx)
   { if ( keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->f_trkpx().size() ) { this->f_trkpx()[keyIdx] = trkpx; return true; } else { return false; } }
-  bool MissingETAssociation_v1::setTrkPy(size_t keyIdx,double trkpy)
+  bool MissingETAssociation_v1::setTrkPy(size_t keyIdx,float trkpy)
   { if ( keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->f_trkpy().size() ) { this->f_trkpy()[keyIdx] = trkpy; return true; } else { return false; } }
-  bool MissingETAssociation_v1::setTrkPz(size_t keyIdx,double trkpz)
+  bool MissingETAssociation_v1::setTrkPz(size_t keyIdx,float trkpz)
   { if ( keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->f_trkpz().size() ) { this->f_trkpz()[keyIdx] = trkpz; return true; } else { return false; } }
-  bool MissingETAssociation_v1::setTrkE(size_t keyIdx,double trke)
+  bool MissingETAssociation_v1::setTrkE(size_t keyIdx,float trke)
   { if ( keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->f_trke().size() ) { this->f_trke()[keyIdx] = trke; return true; } else { return false; } }
-  bool MissingETAssociation_v1::setTrkSumpt(size_t keyIdx,double trksumpt)
+  bool MissingETAssociation_v1::setTrkSumpt(size_t keyIdx,float trksumpt)
   { if ( keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->f_trksumpt().size() ) { this->f_trksumpt()[keyIdx] = trksumpt; return true; } else { return false; } }
   bool MissingETAssociation_v1::setTrkKey(size_t keyIdx,MissingETBase::Types::bitmask_t trkkey)
   { if ( keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->f_trkkey().size() ) { this->f_trkkey()[keyIdx] = trkkey; return true; } else { return false; } }
-  bool MissingETAssociation_v1::setTrkVec(size_t keyIdx,double trkpx,double trkpy,double trkpz,double trke,double sumpt)
+  bool MissingETAssociation_v1::setTrkVec(size_t keyIdx,float trkpx,float trkpy,float trkpz,float trke,float sumpt)
   { 
     if ( keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->f_trke().size() ) {
       this->f_trkpx()[keyIdx] = trkpx;  this->f_trkpy()[keyIdx] = trkpy;
@@ -358,7 +358,7 @@ namespace xAOD {
       this->f_trksumpt()[keyIdx] = sumpt; return true; 
     } else { return false; }
   }
-  bool MissingETAssociation_v1::addTrkVec(MissingETBase::Types::bitmask_t key,double trkpx,double trkpy,double trkpz,double trke,double sumpt) {
+  bool MissingETAssociation_v1::addTrkVec(MissingETBase::Types::bitmask_t key,float trkpx,float trkpy,float trkpz,float trke,float sumpt) {
     for(MissingETBase::Types::bitmask_t testkey : this->f_trkkey()) {
       // quit if key already exists.
       if(key==testkey) return false;
@@ -373,17 +373,17 @@ namespace xAOD {
   }
 
 
-  void MissingETAssociation_v1::setJetTrkPx(double px)
+  void MissingETAssociation_v1::setJetTrkPx(float px)
   { this->f_jettrkpx() = px; }
-  void MissingETAssociation_v1::setJetTrkPy(double py)
+  void MissingETAssociation_v1::setJetTrkPy(float py)
   { this->f_jettrkpy() = py; }
-  void MissingETAssociation_v1::setJetTrkPz(double pz)
+  void MissingETAssociation_v1::setJetTrkPz(float pz)
   { this->f_jettrkpz() = pz; }
-  void MissingETAssociation_v1::setJetTrkE(double e)
+  void MissingETAssociation_v1::setJetTrkE(float e)
   { this->f_jettrke() = e; }
-  void MissingETAssociation_v1::setJetTrkSumpt(double sumpt)
+  void MissingETAssociation_v1::setJetTrkSumpt(float sumpt)
   { this->f_jettrksumpt() = sumpt; }
-  void MissingETAssociation_v1::setJetTrkVec(double px,double py,double pz,double e,double sumpt)
+  void MissingETAssociation_v1::setJetTrkVec(float px,float py,float pz,float e,float sumpt)
   {
     this->f_jettrkpx() = px;  this->f_jettrkpy() = py;
     this->f_jettrkpz() = pz;  this->f_jettrke() = e; 
@@ -446,28 +446,28 @@ namespace xAOD {
   // Getters //
   /////////////
   
-  double MissingETAssociation_v1::calpx(size_t keyIdx) const
+  float MissingETAssociation_v1::calpx(size_t keyIdx) const
   { return keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->sizeCal() ? this->calpx()[keyIdx] : MissingETBase::Numerical::cpxError(); }
-  double MissingETAssociation_v1::calpy(size_t keyIdx) const
+  float MissingETAssociation_v1::calpy(size_t keyIdx) const
   { return keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->sizeCal() ? this->calpy()[keyIdx] : MissingETBase::Numerical::cpyError(); }
-  double MissingETAssociation_v1::calpz(size_t keyIdx) const
+  float MissingETAssociation_v1::calpz(size_t keyIdx) const
   { return keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->sizeCal() ? this->calpz()[keyIdx] : MissingETBase::Numerical::cpzError(); }
-  double MissingETAssociation_v1::cale(size_t keyIdx) const
+  float MissingETAssociation_v1::cale(size_t keyIdx) const
   { return keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->sizeCal() ? this->cale()[keyIdx] : MissingETBase::Numerical::ceError(); }
-  double MissingETAssociation_v1::calsumpt(size_t keyIdx) const
+  float MissingETAssociation_v1::calsumpt(size_t keyIdx) const
   { return keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->sizeCal() ? this->calsumpt()[keyIdx] : MissingETBase::Numerical::sumptError(); }
   MissingETBase::Types::bitmask_t MissingETAssociation_v1::calkey(size_t keyIdx) const
   { return keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->sizeCal() ? this->calkey()[keyIdx] : MissingETBase::Numerical::invalidIndex(); }
 
-  double MissingETAssociation_v1::trkpx(size_t keyIdx) const
+  float MissingETAssociation_v1::trkpx(size_t keyIdx) const
   { return keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->sizeTrk() ? this->trkpx()[keyIdx] : MissingETBase::Numerical::cpxError(); }
-  double MissingETAssociation_v1::trkpy(size_t keyIdx) const
+  float MissingETAssociation_v1::trkpy(size_t keyIdx) const
   { return keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->sizeTrk() ? this->trkpy()[keyIdx] : MissingETBase::Numerical::cpyError(); }
-  double MissingETAssociation_v1::trkpz(size_t keyIdx) const
+  float MissingETAssociation_v1::trkpz(size_t keyIdx) const
   { return keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->sizeTrk() ? this->trkpz()[keyIdx] : MissingETBase::Numerical::cpzError(); }
-  double MissingETAssociation_v1::trke(size_t keyIdx) const
+  float MissingETAssociation_v1::trke(size_t keyIdx) const
   { return keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->sizeTrk() ? this->trke()[keyIdx] : MissingETBase::Numerical::ceError(); }
-  double MissingETAssociation_v1::trksumpt(size_t keyIdx) const
+  float MissingETAssociation_v1::trksumpt(size_t keyIdx) const
   { return keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->sizeTrk() ? this->trksumpt()[keyIdx] : MissingETBase::Numerical::sumptError(); }
   MissingETBase::Types::bitmask_t MissingETAssociation_v1::trkkey(size_t keyIdx) const
   { return keyIdx != MissingETBase::Numerical::invalidIndex() && keyIdx < this->sizeTrk() ? this->trkkey()[keyIdx] : MissingETBase::Numerical::invalidIndex(); }
@@ -501,12 +501,12 @@ namespace xAOD {
     return pVec;
   }
                                                                                    
-  std::vector<const IParticle*> MissingETAssociation_v1::objects(const std::vector<double>*& calpxPtr,const std::vector<double>*& calpyPtr,
-                                                                 const std::vector<double>*& calpzPtr,const std::vector<double>*& calePtr,
-                                                                 const std::vector<double>*& calsumptPtr,
-                                                                 const std::vector<double>*& trkpxPtr,const std::vector<double>*& trkpyPtr,
-                                                                 const std::vector<double>*& trkpzPtr,const std::vector<double>*& trkePtr,
-                                                                 const std::vector<double>*& trksumptPtr) const
+  std::vector<const IParticle*> MissingETAssociation_v1::objects(const std::vector<float>*& calpxPtr,const std::vector<float>*& calpyPtr,
+                                                                 const std::vector<float>*& calpzPtr,const std::vector<float>*& calePtr,
+                                                                 const std::vector<float>*& calsumptPtr,
+                                                                 const std::vector<float>*& trkpxPtr,const std::vector<float>*& trkpyPtr,
+                                                                 const std::vector<float>*& trkpzPtr,const std::vector<float>*& trkePtr,
+                                                                 const std::vector<float>*& trksumptPtr) const
   {
     calpxPtr = &(this->calpx()); calpyPtr = &(this->calpy()); calpzPtr = &(this->calpz()); calePtr = &(this->cale()); calsumptPtr = &(this->calsumpt());
     trkpxPtr = &(this->trkpx()); trkpyPtr = &(this->trkpy()); trkpzPtr = &(this->trkpz()); trkePtr = &(this->trke()); trksumptPtr = &(this->trksumpt());
diff --git a/Event/xAOD/xAODMissingET/Root/MissingET_v1.cxx b/Event/xAOD/xAODMissingET/Root/MissingET_v1.cxx
index dd3a22701fe48d7fd2b7e3414af8d1ff02fccf45..9b40d5bcacd68950e29dc1330e8f7e4dbbda367d 100644
--- a/Event/xAOD/xAODMissingET/Root/MissingET_v1.cxx
+++ b/Event/xAOD/xAODMissingET/Root/MissingET_v1.cxx
@@ -29,7 +29,7 @@ MissingET_v1::MissingET_v1( const std::string& name,
 
 }
 
-MissingET_v1::MissingET_v1( double mpx, double mpy, double sumet,
+MissingET_v1::MissingET_v1( float mpx, float mpy, float sumet,
                             const std::string& name,
                             MissingETBase::Types::bitmask_t src )
    : SG::AuxElement() {
@@ -70,23 +70,23 @@ MissingET_v1::~MissingET_v1()
 void MissingET_v1::add(const IParticle* particle)
 {
   // retrieve kinematics
-  EXTRACT_PX( double, px, (*particle) );
-  EXTRACT_PY( double, py, (*particle) );
+  EXTRACT_PX( float, px, (*particle) );
+  EXTRACT_PY( float, py, (*particle) );
   // add
   this->add(px,py,particle->pt());
 }
 
-void MissingET_v1::add(const IParticle* particle,double scale)
+void MissingET_v1::add(const IParticle* particle,float scale)
 {
   // retrieve kinematics
-  EXTRACT_SCALED_PX( double, px, (*particle), scale);
-  EXTRACT_SCALED_PY( double ,py, (*particle), scale);
-  double pt(particle->pt()*scale);
+  EXTRACT_SCALED_PX( float, px, (*particle), scale);
+  EXTRACT_SCALED_PY( float ,py, (*particle), scale);
+  float pt(particle->pt()*scale);
   // add
   this->add(px,py,pt);
 }
 
-void xAOD::MissingET_v1::add(double px,double py, double pt)
+void xAOD::MissingET_v1::add(float px,float py, float pt)
 { this->f_mpx() -= px; this->f_mpy() -= py; this->f_sumet() += pt; }
 
 MissingET_v1& MissingET_v1::operator=(const MissingET_v1& met)
@@ -101,8 +101,8 @@ MissingET_v1& MissingET_v1::operator=(const MissingET_v1& met)
 
 MissingET_v1& MissingET_v1::operator-=(const IParticle* particle)
 {
-  EXTRACT_PX( double, px, (*particle) );
-  EXTRACT_PY( double, py, (*particle) );
+  EXTRACT_PX( float, px, (*particle) );
+  EXTRACT_PY( float, py, (*particle) );
   this->add(-px,-py,-particle->pt());
   return *this;
 }
diff --git a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.h b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.h
index 0b064821c8f05748d4c44079c2c312199648e49c..65691c9afc91bd4eb1f1fe9965d2ef6a4c18f85d 100644
--- a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.h
+++ b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.h
@@ -36,38 +36,38 @@ namespace xAOD
     {
     public:
       ConstVec();                                 /*!< @brief Default constructor */
-      ConstVec(double cpx,double cpy,double cpz,double ce,double sumpt); /*!< @brief Constructor with parameters */
+      ConstVec(float cpx,float cpy,float cpz,float ce,float sumpt); /*!< @brief Constructor with parameters */
       ConstVec(const IParticle& ipar);            /*!< @brief Constructor from IParticle */
       // ConstVec(const ConstVec& cvec);             /*!< @brief Copy constructor */
       ~ConstVec();                                /*!< @brief Data class destructor */
       /*! @name Accessors */
       /*!@{*/
-      double cpx() const; /*!< @brief Returns @f$ c_{x} @f$ */
-      double cpy() const; /*!< @brief Returns @f$ c_{y} @f$ */
-      double cpz() const; /*!< @brief Returns @f$ c_{z} @f$ */
-      double cpt() const; /*!< @brief Returns @f$ c_{T} @f$ */
-      double ce() const;  /*!< @brief Returns @f$ c_{e} @f$ */
-      double sumpt() const;  /*!< @brief Returns sum of component pt */
+      float cpx() const; /*!< @brief Returns @f$ c_{x} @f$ */
+      float cpy() const; /*!< @brief Returns @f$ c_{y} @f$ */
+      float cpz() const; /*!< @brief Returns @f$ c_{z} @f$ */
+      float cpt() const; /*!< @brief Returns @f$ c_{T} @f$ */
+      float ce() const;  /*!< @brief Returns @f$ c_{e} @f$ */
+      float sumpt() const;  /*!< @brief Returns sum of component pt */
       /*!@}*/
       /*! @name Setters */
       /*!@{*/
-      void setCpx(double px); /*!< @brief Set @f$ c_{x} @f$ */
-      void setCpy(double py); /*!< @brief Set @f$ c_{y} @f$ */
-      void setCpz(double pz); /*!< @brief Set @f$ c_{z} @f$ */
-      void setCe (double e);  /*!< @brief Set @f$ c_{e} @f$ */
-      void setSumpt (double sumpt);  /*!< @brief Set sumpt */
+      void setCpx(float px); /*!< @brief Set @f$ c_{x} @f$ */
+      void setCpy(float py); /*!< @brief Set @f$ c_{y} @f$ */
+      void setCpz(float pz); /*!< @brief Set @f$ c_{z} @f$ */
+      void setCe (float e);  /*!< @brief Set @f$ c_{e} @f$ */
+      void setSumpt (float sumpt);  /*!< @brief Set sumpt */
       /*!@}*/
       /*! @name Modifiers for constituent vector */
       /*!@{*/
-      double& cpx(); /*!< @brief Returns reference to modifiable data word storing @f$ c_{x} @f$ */
-      double& cpy(); /*!< @brief Returns reference to modifiable data word storing @f$ c_{y} @f$ */
-      double& cpz(); /*!< @brief Returns reference to modifiable data word storing @f$ c_{z} @f$ */
-      double& ce();  /*!< @brief Returns reference to modifiable data word storing @f$ c_{e} @f$ */
-      double& sumpt(); /*!< @brief Returns reference to modifiable data word storing sum of component pt */
+      float& cpx(); /*!< @brief Returns reference to modifiable data word storing @f$ c_{x} @f$ */
+      float& cpy(); /*!< @brief Returns reference to modifiable data word storing @f$ c_{y} @f$ */
+      float& cpz(); /*!< @brief Returns reference to modifiable data word storing @f$ c_{z} @f$ */
+      float& ce();  /*!< @brief Returns reference to modifiable data word storing @f$ c_{e} @f$ */
+      float& sumpt(); /*!< @brief Returns reference to modifiable data word storing sum of component pt */
       ConstVec& operator+=(const ConstVec& cvec); /*!< @brief Add another vector */
       ConstVec& operator-=(const ConstVec& cvec); /*!< @brief Subtract another vector */
-      ConstVec& operator*=(double scale);         /*!< @brief Scale vector by multiplication */ 
-      ConstVec& operator/=(double scale);         /*!< @brief Scale vector by division */
+      ConstVec& operator*=(float scale);         /*!< @brief Scale vector by multiplication */ 
+      ConstVec& operator/=(float scale);         /*!< @brief Scale vector by division */
       /*!@}*/
       /*! @name Comparators */
       /*!@{*/
@@ -77,11 +77,11 @@ namespace xAOD
      private:
       /*! @name Cache for vectors */
       /*!@{*/
-      double m_cpx; /*!< @brief @f$ P_{x} @f$ */
-      double m_cpy; /*!< @brief @f$ P_{y} @f$ */
-      double m_cpz; /*!< @brief @f$ P_{y} @f$ */
-      double m_ce;  /*!< @brief @f$ E @f$ */
-      double m_sumpt;  /*!< @brief @f$ E @f$ */
+      float m_cpx; /*!< @brief @f$ P_{x} @f$ */
+      float m_cpy; /*!< @brief @f$ P_{y} @f$ */
+      float m_cpz; /*!< @brief @f$ P_{y} @f$ */
+      float m_ce;  /*!< @brief @f$ E @f$ */
+      float m_sumpt;  /*!< @brief @f$ E @f$ */
       /*!@}*/
     }; // MissingETComponent_v1::ConstVec
 
@@ -111,36 +111,36 @@ namespace xAOD
      *  @anchor contrib_convention
      */
     /*!@{*/
-    const std::vector<double>& calpx() const;                /*!< @brief Get the vector of @f$ P_{x} @f$  */
-    double calpx(const IParticle* pPart) const;              /*!< @brief Get the vector @f$ P_{x} @f$ for a given object referenced by pointer */
-    double calpx(size_t keyIdx) const;                       /*!< @brief Get the vector @f$ P_{x} @f$ for a given object referenced by index */
+    const std::vector<float>& calpx() const;                /*!< @brief Get the vector of @f$ P_{x} @f$  */
+    float calpx(const IParticle* pPart) const;              /*!< @brief Get the vector @f$ P_{x} @f$ for a given object referenced by pointer */
+    float calpx(size_t keyIdx) const;                       /*!< @brief Get the vector @f$ P_{x} @f$ for a given object referenced by index */
     //
-    bool setCalPx(const std::vector<double>& calpxvec);      /*!< @brief Set the vector of @f$ P_{x} @f$  */
-    bool setCalPx(size_t keyIdx,double calpx);               /*!< @brief Set calo constituent vector @f$ P_{x} @f$ for a given contributing object referenced by index */
+    bool setCalPx(const std::vector<float>& calpxvec);      /*!< @brief Set the vector of @f$ P_{x} @f$  */
+    bool setCalPx(size_t keyIdx,float calpx);               /*!< @brief Set calo constituent vector @f$ P_{x} @f$ for a given contributing object referenced by index */
     //
-    const std::vector<double>& calpy() const;                /*!< @brief Get the vector of @f$ P_{y} @f$  */
-    double calpy(size_t keyIdx) const;                       /*!< @brief Get the vector @f$ P_{y} @f$ for a given object referenced by index */
+    const std::vector<float>& calpy() const;                /*!< @brief Get the vector of @f$ P_{y} @f$  */
+    float calpy(size_t keyIdx) const;                       /*!< @brief Get the vector @f$ P_{y} @f$ for a given object referenced by index */
     //
-    bool setCalPy(const std::vector<double>& calpyvec);      /*!< @brief Set the vector of @f$ P_{y} @f$  */
-    bool setCalPy(size_t keyIdx,double calpy);               /*!< @brief Set calo constituent vector @f$ P_{y} @f$ for a given contributing object referenced by index */
+    bool setCalPy(const std::vector<float>& calpyvec);      /*!< @brief Set the vector of @f$ P_{y} @f$  */
+    bool setCalPy(size_t keyIdx,float calpy);               /*!< @brief Set calo constituent vector @f$ P_{y} @f$ for a given contributing object referenced by index */
     //
-    const std::vector<double>& calpz() const;                /*!< @brief Get the vector of @f$ P_{z} @f$  */
-    double calpz(size_t keyIdx) const;                       /*!< @brief Get the vector @f$ P_{z} @f$ for a given object referenced by index */
+    const std::vector<float>& calpz() const;                /*!< @brief Get the vector of @f$ P_{z} @f$  */
+    float calpz(size_t keyIdx) const;                       /*!< @brief Get the vector @f$ P_{z} @f$ for a given object referenced by index */
     //
-    bool setCalPz(const std::vector<double>& calpzvec);      /*!< @brief Set the vector of @f$ P_{z} @f$  */
-    bool setCalPz(size_t keyIdx,double calpz);               /*!< @brief Set calo constituent vector @f$ P_{z} @f$ for a given contributing object referenced by index */
+    bool setCalPz(const std::vector<float>& calpzvec);      /*!< @brief Set the vector of @f$ P_{z} @f$  */
+    bool setCalPz(size_t keyIdx,float calpz);               /*!< @brief Set calo constituent vector @f$ P_{z} @f$ for a given contributing object referenced by index */
     //
-    const std::vector<double>& cale() const;                 /*!< @brief Get the vector of @f$ E @f$  */
-    double cale(size_t keyIdx) const;                        /*!< @brief Get the vector @f$ E @f$ for a given object referenced by index */
+    const std::vector<float>& cale() const;                 /*!< @brief Get the vector of @f$ E @f$  */
+    float cale(size_t keyIdx) const;                        /*!< @brief Get the vector @f$ E @f$ for a given object referenced by index */
     //
-    bool setCalE(const std::vector<double>& calevec);        /*!< @brief Set the vector of @f$ E @f$  */
-    bool setCalE(size_t keyIdx,double cale);                 /*!< @brief Set calo constituent vector @f$ E @f$ for a given contributing object referenced by index */
+    bool setCalE(const std::vector<float>& calevec);        /*!< @brief Set the vector of @f$ E @f$  */
+    bool setCalE(size_t keyIdx,float cale);                 /*!< @brief Set calo constituent vector @f$ E @f$ for a given contributing object referenced by index */
     //
-    const std::vector<double>& calsumpt() const;             /*!< @brief Get the vector of sumpt  */
-    double calsumpt(size_t keyIdx) const;                    /*!< @brief Get the sumpt for a given object referenced by index */
+    const std::vector<float>& calsumpt() const;             /*!< @brief Get the vector of sumpt  */
+    float calsumpt(size_t keyIdx) const;                    /*!< @brief Get the sumpt for a given object referenced by index */
     //
-    bool setCalSumpt(const std::vector<double>& calsumptvec); /*!< @brief Set the vector of sumpt  */
-    bool setCalSumpt(size_t keyIdx,double calsumpt);          /*!< @brief Set calo constituent sumpt for a given contributing object referenced by index */
+    bool setCalSumpt(const std::vector<float>& calsumptvec); /*!< @brief Set the vector of sumpt  */
+    bool setCalSumpt(size_t keyIdx,float calsumpt);          /*!< @brief Set calo constituent sumpt for a given contributing object referenced by index */
     //
     const std::vector<MissingETBase::Types::bitmask_t>& calkey() const;   /*!< @brief Get the vector of cal keys */
     MissingETBase::Types::bitmask_t calkey(size_t keyIdx) const;          /*!< @brief Get the key for a given entry referenced by index */
@@ -149,42 +149,42 @@ namespace xAOD
     bool setCalKey(size_t keyIdx,MissingETBase::Types::bitmask_t calkey);          /*!< @brief Set calo key for a given contributing entry referenced by index */
     //
     bool setCalVec(size_t keyIdx,const ConstVec& cvec=ConstVec());           /*!< @brief Set the calo constituent vector of an object contribution referenced by index */
-    bool setCalVec(size_t keyIdx,double calpx,double calpy,double calpz,double ce,double sumpt);            /*!< @brief Set the calo constituent vectors of an object contribution referenced by index */
+    bool setCalVec(size_t keyIdx,float calpx,float calpy,float calpz,float ce,float sumpt);            /*!< @brief Set the calo constituent vectors of an object contribution referenced by index */
     //
-    bool addCalVec(MissingETBase::Types::bitmask_t key,double calpx,double calpy,double calpz,double cale,double sumpt);            /*!< @brief Add a key/vector pair for calo contributions */
+    bool addCalVec(MissingETBase::Types::bitmask_t key,float calpx,float calpy,float calpz,float cale,float sumpt);            /*!< @brief Add a key/vector pair for calo contributions */
     //
     bool clearCalVecs();           /*!< @brief Reset the calo constituent vectors and keys */
     //
     /*!@{*/
-    const std::vector<double>& trkpx() const;                /*!< @brief Get the vector of @f$ P_{x} @f$  */
-    double trkpx(size_t keyIdx) const;                       /*!< @brief Get the vector @f$ P_{x} @f$ for a given object referenced by index */
+    const std::vector<float>& trkpx() const;                /*!< @brief Get the vector of @f$ P_{x} @f$  */
+    float trkpx(size_t keyIdx) const;                       /*!< @brief Get the vector @f$ P_{x} @f$ for a given object referenced by index */
     //
-    bool setTrkPx(const std::vector<double>& trkpxvec);      /*!< @brief Set the vector of @f$ P_{x} @f$  */
-    bool setTrkPx(size_t keyIdx,double trkpx);               /*!< @brief Set track constituent vector @f$ P_{x} @f$ for a given contributing object referenced by index */
+    bool setTrkPx(const std::vector<float>& trkpxvec);      /*!< @brief Set the vector of @f$ P_{x} @f$  */
+    bool setTrkPx(size_t keyIdx,float trkpx);               /*!< @brief Set track constituent vector @f$ P_{x} @f$ for a given contributing object referenced by index */
     //
-    const std::vector<double>& trkpy() const;                /*!< @brief Get the vector of @f$ P_{y} @f$  */
-    double trkpy(size_t keyIdx) const;                       /*!< @brief Get the vector @f$ P_{y} @f$ for a given object referenced by index */
+    const std::vector<float>& trkpy() const;                /*!< @brief Get the vector of @f$ P_{y} @f$  */
+    float trkpy(size_t keyIdx) const;                       /*!< @brief Get the vector @f$ P_{y} @f$ for a given object referenced by index */
     //
-    bool setTrkPy(const std::vector<double>& trkpyvec);      /*!< @brief Set the vector of @f$ P_{y} @f$  */
-    bool setTrkPy(size_t keyIdx,double trkpy);               /*!< @brief Set track constituent vector @f$ P_{y} @f$ for a given contributing object referenced by index */
+    bool setTrkPy(const std::vector<float>& trkpyvec);      /*!< @brief Set the vector of @f$ P_{y} @f$  */
+    bool setTrkPy(size_t keyIdx,float trkpy);               /*!< @brief Set track constituent vector @f$ P_{y} @f$ for a given contributing object referenced by index */
     //
-    const std::vector<double>& trkpz() const;                /*!< @brief Get the vector of @f$ P_{z} @f$  */
-    double trkpz(size_t keyIdx) const;                       /*!< @brief Get the vector @f$ P_{z} @f$ for a given object referenced by index */
+    const std::vector<float>& trkpz() const;                /*!< @brief Get the vector of @f$ P_{z} @f$  */
+    float trkpz(size_t keyIdx) const;                       /*!< @brief Get the vector @f$ P_{z} @f$ for a given object referenced by index */
     //
-    bool setTrkPz(const std::vector<double>& trkpzvec);      /*!< @brief Set the vector of @f$ P_{z} @f$  */
-    bool setTrkPz(size_t keyIdx,double trkpz);               /*!< @brief Set track constituent vector @f$ P_{z} @f$ for a given contributing object referenced by index */
+    bool setTrkPz(const std::vector<float>& trkpzvec);      /*!< @brief Set the vector of @f$ P_{z} @f$  */
+    bool setTrkPz(size_t keyIdx,float trkpz);               /*!< @brief Set track constituent vector @f$ P_{z} @f$ for a given contributing object referenced by index */
     //
-    const std::vector<double>& trke() const;                 /*!< @brief Get the vector of @f$ E @f$  */
-    double trke(size_t keyIdx) const;                        /*!< @brief Get the vector @f$ E @f$ for a given object referenced by index */
+    const std::vector<float>& trke() const;                 /*!< @brief Get the vector of @f$ E @f$  */
+    float trke(size_t keyIdx) const;                        /*!< @brief Get the vector @f$ E @f$ for a given object referenced by index */
     //
-    bool setTrkE(const std::vector<double>& trkevec);        /*!< @brief Set the vector of @f$ E @f$  */
-    bool setTrkE(size_t keyIdx,double trke);                 /*!< @brief Set track constituent vector @f$ E @f$ for a given contributing object referenced by index */
+    bool setTrkE(const std::vector<float>& trkevec);        /*!< @brief Set the vector of @f$ E @f$  */
+    bool setTrkE(size_t keyIdx,float trke);                 /*!< @brief Set track constituent vector @f$ E @f$ for a given contributing object referenced by index */
     //
-    const std::vector<double>& trksumpt() const;             /*!< @brief Get the vector of @f$ E @f$  */
-    double trksumpt(size_t keyIdx) const;                    /*!< @brief Get the vector @f$ E @f$ for a given object referenced by index */
+    const std::vector<float>& trksumpt() const;             /*!< @brief Get the vector of @f$ E @f$  */
+    float trksumpt(size_t keyIdx) const;                    /*!< @brief Get the vector @f$ E @f$ for a given object referenced by index */
     //
-    bool setTrkSumpt(const std::vector<double>& trksumptvec); /*!< @brief Set the vector of @f$ E @f$  */
-    bool setTrkSumpt(size_t keyIdx,double trksumpt);          /*!< @brief Set track constituent vector @f$ E @f$ for a given contributing object referenced by index */
+    bool setTrkSumpt(const std::vector<float>& trksumptvec); /*!< @brief Set the vector of @f$ E @f$  */
+    bool setTrkSumpt(size_t keyIdx,float trksumpt);          /*!< @brief Set track constituent vector @f$ E @f$ for a given contributing object referenced by index */
     //
     const std::vector<MissingETBase::Types::bitmask_t>& trkkey() const;   /*!< @brief Get the vector of trk keys */
     MissingETBase::Types::bitmask_t trkkey(size_t keyIdx) const;          /*!< @brief Get the key for a given entry referenced by index */
@@ -193,26 +193,26 @@ namespace xAOD
     bool setTrkKey(size_t keyIdx,MissingETBase::Types::bitmask_t trkkey);          /*!< @brief Set trk key for a given contributing entry referenced by index */
     //
     bool setTrkVec(size_t keyIdx,const ConstVec& cvec=ConstVec());           /*!< @brief Set the track constituent vector of an object contribution referenced by index */
-    bool setTrkVec(size_t keyIdx,double trkpx,double trkpy,double trkpz,double trke,double sumpt);            /*!< @brief Set the track constituent vectors of an object contribution referenced by index */
+    bool setTrkVec(size_t keyIdx,float trkpx,float trkpy,float trkpz,float trke,float sumpt);            /*!< @brief Set the track constituent vectors of an object contribution referenced by index */
     //
-    bool addTrkVec(MissingETBase::Types::bitmask_t key,double trkpx,double trkpy,double trkpz,double ce,double sumpt);            /*!< @brief Add a key/vector pair for calo contributions */
+    bool addTrkVec(MissingETBase::Types::bitmask_t key,float trkpx,float trkpy,float trkpz,float ce,float sumpt);            /*!< @brief Add a key/vector pair for calo contributions */
     //
     bool clearTrkVecs();           /*!< @brief Reset the track constituent vectors and keys */
     //
     /*!@{*/
-    double jettrkpx() const;              /*!< @brief Get the vector @f$ P_{x} @f$ for a given object referenced by index */
-    double jettrkpy() const;              /*!< @brief Get the vector @f$ P_{y} @f$ for a given object referenced by pointer */
-    double jettrkpz() const;              /*!< @brief Get the vector @f$ P_{z} @f$ for a given object referenced by pointer */
-    double jettrke() const;               /*!< @brief Get the vector @f$ E @f$ for a given object referenced by index */
-    double jettrksumpt() const;           /*!< @brief Get the sumpt for a given object referenced by index */
-    //
-    void setJetTrkPx(double px);    /*!< @brief Set track constituent vector @f$ P_{x} @f$ for the reference jet */
-    void setJetTrkPy(double py);    /*!< @brief Set track constituent vector @f$ P_{y} @f$ for the reference jet */
-    void setJetTrkPz(double pz);    /*!< @brief Set track constituent vector @f$ P_{z} @f$ for the reference jet */
-    void setJetTrkE(double e);      /*!< @brief Set track constituent vector @f$ E @f$ for the reference jet */
-    void setJetTrkSumpt(double sumpt);      /*!< @brief Set track constituent vector @f$ E @f$ for the reference jet */
+    float jettrkpx() const;              /*!< @brief Get the vector @f$ P_{x} @f$ for a given object referenced by index */
+    float jettrkpy() const;              /*!< @brief Get the vector @f$ P_{y} @f$ for a given object referenced by pointer */
+    float jettrkpz() const;              /*!< @brief Get the vector @f$ P_{z} @f$ for a given object referenced by pointer */
+    float jettrke() const;               /*!< @brief Get the vector @f$ E @f$ for a given object referenced by index */
+    float jettrksumpt() const;           /*!< @brief Get the sumpt for a given object referenced by index */
+    //
+    void setJetTrkPx(float px);    /*!< @brief Set track constituent vector @f$ P_{x} @f$ for the reference jet */
+    void setJetTrkPy(float py);    /*!< @brief Set track constituent vector @f$ P_{y} @f$ for the reference jet */
+    void setJetTrkPz(float pz);    /*!< @brief Set track constituent vector @f$ P_{z} @f$ for the reference jet */
+    void setJetTrkE(float e);      /*!< @brief Set track constituent vector @f$ E @f$ for the reference jet */
+    void setJetTrkSumpt(float sumpt);      /*!< @brief Set track constituent vector @f$ E @f$ for the reference jet */
     void setJetTrkVec(const ConstVec& cvec=ConstVec());  /*!< @brief Set the track constituent vector for the reference jet */
-    void setJetTrkVec(double px,double py,double pz,double ce,double sumpt);    /*!< @brief Set the track constituent vector for the reference jet */
+    void setJetTrkVec(float px,float py,float pz,float ce,float sumpt);    /*!< @brief Set the track constituent vector for the reference jet */
     //
     const MissingETBase::Types::jetlink_t& jetLink() const;                     /*!< @brief Get the link to the reference jet */
     bool setJetLink(const MissingETBase::Types::jetlink_t& jetLnk);             /*!< @brief Set the link to the reference jet */
@@ -260,16 +260,16 @@ namespace xAOD
     size_t refJetIndex() const;                               /*!< @brief Access index of reference jet in its container */
     std::vector<const IParticle*> objects() const;            /*!< @brief Access contributing objects */
     std::vector<const IParticle*> objects(std::vector<ConstVec>& calVecs,std::vector<ConstVec>& trkVecs) const; /*!< @brief Access contributing objects and retrieve constituent vectors */
-    std::vector<const IParticle*> objects(const std::vector<double>*& calpxPtr,    
-					  const std::vector<double>*& calpyPtr,
-					  const std::vector<double>*& calpzPtr,
-					  const std::vector<double>*& calePtr,
-					  const std::vector<double>*& calsumptPtr,
-					  const std::vector<double>*& trkpxPtr,
-					  const std::vector<double>*& trkpyPtr,
-					  const std::vector<double>*& trkpzPtr,
-					  const std::vector<double>*& trkePtr,
-					  const std::vector<double>*& trksumptPtr) const; /*!< @brief Access contributing objects and retrieve constituent vectors */
+    std::vector<const IParticle*> objects(const std::vector<float>*& calpxPtr,    
+					  const std::vector<float>*& calpyPtr,
+					  const std::vector<float>*& calpzPtr,
+					  const std::vector<float>*& calePtr,
+					  const std::vector<float>*& calsumptPtr,
+					  const std::vector<float>*& trkpxPtr,
+					  const std::vector<float>*& trkpyPtr,
+					  const std::vector<float>*& trkpzPtr,
+					  const std::vector<float>*& trkePtr,
+					  const std::vector<float>*& trksumptPtr) const; /*!< @brief Access contributing objects and retrieve constituent vectors */
     ConstVec calVec(const IParticle* pPart) const;            /*!< @brief Get calo constituent vector for a given object */
     ConstVec calVec(size_t keyIdx) const;                     /*!< @brief Get calo constituent vector for a given entry (index) in the contributing object list */
     ConstVec trkVec(const IParticle* pPart) const;            /*!< @brief Get track constituent vector for a given object */
@@ -366,25 +366,25 @@ namespace xAOD
     MissingETBase::Types::objlink_vector_t&  f_objectLinks(); /*!< @brief Non-const link reference */
     MissingETBase::Types::jetlink_t&         f_jetLink();     /*!< @brief Non-const link reference  */
     //
-    std::vector<double>&                     f_calpx();
-    std::vector<double>&                     f_calpy();
-    std::vector<double>&                     f_calpz();
-    std::vector<double>&                     f_cale();
-    std::vector<double>&                     f_calsumpt();
+    std::vector<float>&                     f_calpx();
+    std::vector<float>&                     f_calpy();
+    std::vector<float>&                     f_calpz();
+    std::vector<float>&                     f_cale();
+    std::vector<float>&                     f_calsumpt();
     std::vector<MissingETBase::Types::bitmask_t>& f_calkey();
     //
-    std::vector<double>&                     f_trkpx();
-    std::vector<double>&                     f_trkpy();
-    std::vector<double>&                     f_trkpz();
-    std::vector<double>&                     f_trke();
-    std::vector<double>&                     f_trksumpt();
+    std::vector<float>&                     f_trkpx();
+    std::vector<float>&                     f_trkpy();
+    std::vector<float>&                     f_trkpz();
+    std::vector<float>&                     f_trke();
+    std::vector<float>&                     f_trksumpt();
     std::vector<MissingETBase::Types::bitmask_t>& f_trkkey();
     //
-    double&                                  f_jettrkpx();
-    double&                                  f_jettrkpy();
-    double&                                  f_jettrkpz();
-    double&                                  f_jettrke();
-    double&                                  f_jettrksumpt();
+    float&                                  f_jettrkpx();
+    float&                                  f_jettrkpy();
+    float&                                  f_jettrkpz();
+    float&                                  f_jettrke();
+    float&                                  f_jettrksumpt();
     //
     char&                                    f_isMisc();
     //
@@ -446,11 +446,11 @@ MissingETBase::Types::constvec_t operator+(const MissingETBase::Types::constvec_
 /*! @brief Subtract constituent vectors */
 MissingETBase::Types::constvec_t operator-(const MissingETBase::Types::constvec_t& v0,const MissingETBase::Types::constvec_t& v2);
 /*! @brief Scale constituent vector by multiplication */
-MissingETBase::Types::constvec_t operator*(const MissingETBase::Types::constvec_t& cvec,double scale);
+MissingETBase::Types::constvec_t operator*(const MissingETBase::Types::constvec_t& cvec,float scale);
 /*! @brief Scale constituent vector by multiplication */
-MissingETBase::Types::constvec_t operator*(double scale,const MissingETBase::Types::constvec_t& cvec);
+MissingETBase::Types::constvec_t operator*(float scale,const MissingETBase::Types::constvec_t& cvec);
 /*! @brief Scale constituent vector by division */
-MissingETBase::Types::constvec_t operator/(const MissingETBase::Types::constvec_t& cvec,double scale);
+MissingETBase::Types::constvec_t operator/(const MissingETBase::Types::constvec_t& cvec,float scale);
 /*!@}*/
 #include "xAODMissingET/versions/MissingETAssociation_v1.icc"
 #endif
diff --git a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.icc b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.icc
index 412ef66de23a8246e1a7c0d0a7ffb4658a4e7c5a..983d8490ff3b9d88efd792c864ec5c4dca9f0db1 100644
--- a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.icc
+++ b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.icc
@@ -17,7 +17,7 @@ inline xAOD::MissingETAssociation_v1::ConstVec::ConstVec()
   , m_sumpt(MissingETBase::Numerical::sumptDefault())
 { }
 
-inline xAOD::MissingETAssociation_v1::ConstVec::ConstVec(double cpx,double cpy,double cpz,double ce,double sumpt)
+inline xAOD::MissingETAssociation_v1::ConstVec::ConstVec(float cpx,float cpy,float cpz,float ce,float sumpt)
   : m_cpx(cpx), m_cpy(cpy), m_cpz(cpz), m_ce(ce), m_sumpt(sumpt)
 {}
 
@@ -36,23 +36,23 @@ inline bool xAOD::MissingETAssociation_v1::ConstVec::operator!=(const ConstVec&
 { return !this->operator==(cvec); }
 
 // ------------------------------------------------------------------ Accessors
-inline double  xAOD::MissingETAssociation_v1::ConstVec::cpx() const { return m_cpx; }
-inline double  xAOD::MissingETAssociation_v1::ConstVec::cpy() const { return m_cpy; }
-inline double  xAOD::MissingETAssociation_v1::ConstVec::cpz() const { return m_cpz; }
-inline double  xAOD::MissingETAssociation_v1::ConstVec::ce() const { return m_ce; }
-inline double  xAOD::MissingETAssociation_v1::ConstVec::sumpt() const { return m_sumpt; }
-inline double& xAOD::MissingETAssociation_v1::ConstVec::cpx() { return m_cpx; }
-inline double& xAOD::MissingETAssociation_v1::ConstVec::cpy() { return m_cpy; }
-inline double& xAOD::MissingETAssociation_v1::ConstVec::cpz() { return m_cpz; }
-inline double& xAOD::MissingETAssociation_v1::ConstVec::ce() { return m_ce; }
-inline double& xAOD::MissingETAssociation_v1::ConstVec::sumpt() { return m_sumpt; }
+inline float  xAOD::MissingETAssociation_v1::ConstVec::cpx() const { return m_cpx; }
+inline float  xAOD::MissingETAssociation_v1::ConstVec::cpy() const { return m_cpy; }
+inline float  xAOD::MissingETAssociation_v1::ConstVec::cpz() const { return m_cpz; }
+inline float  xAOD::MissingETAssociation_v1::ConstVec::ce() const { return m_ce; }
+inline float  xAOD::MissingETAssociation_v1::ConstVec::sumpt() const { return m_sumpt; }
+inline float& xAOD::MissingETAssociation_v1::ConstVec::cpx() { return m_cpx; }
+inline float& xAOD::MissingETAssociation_v1::ConstVec::cpy() { return m_cpy; }
+inline float& xAOD::MissingETAssociation_v1::ConstVec::cpz() { return m_cpz; }
+inline float& xAOD::MissingETAssociation_v1::ConstVec::ce() { return m_ce; }
+inline float& xAOD::MissingETAssociation_v1::ConstVec::sumpt() { return m_sumpt; }
 
 // -------------------------------------------------------------------- Setters 
-inline void xAOD::MissingETAssociation_v1::ConstVec::setCpx(double cpx) { this->cpx() = cpx; }
-inline void xAOD::MissingETAssociation_v1::ConstVec::setCpy(double cpy) { this->cpy() = cpy; }
-inline void xAOD::MissingETAssociation_v1::ConstVec::setCpz(double cpz) { this->cpz() = cpz; }
-inline void xAOD::MissingETAssociation_v1::ConstVec::setCe(double ce) { this->ce() = ce; }
-inline void xAOD::MissingETAssociation_v1::ConstVec::setSumpt(double sumpt) { this->sumpt() = sumpt; }
+inline void xAOD::MissingETAssociation_v1::ConstVec::setCpx(float cpx) { this->cpx() = cpx; }
+inline void xAOD::MissingETAssociation_v1::ConstVec::setCpy(float cpy) { this->cpy() = cpy; }
+inline void xAOD::MissingETAssociation_v1::ConstVec::setCpz(float cpz) { this->cpz() = cpz; }
+inline void xAOD::MissingETAssociation_v1::ConstVec::setCe(float ce) { this->ce() = ce; }
+inline void xAOD::MissingETAssociation_v1::ConstVec::setSumpt(float sumpt) { this->sumpt() = sumpt; }
 
 ////////////////////////////////////////////
 // Inlined Methods for MissingETAssociation //
@@ -100,73 +100,73 @@ inline MissingETBase::Types::objlink_vector_t& xAOD::MissingETAssociation_v1::f_
 
 // ---------------------------------------------------------- constituent vectors
 
-inline const std::vector<double>& xAOD::MissingETAssociation_v1::calpx() const
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("calpx"); return acc(*this); }
-inline double xAOD::MissingETAssociation_v1::calpx(const IParticle* pPart) const
+inline const std::vector<float>& xAOD::MissingETAssociation_v1::calpx() const
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calpx"); return acc(*this); }
+inline float xAOD::MissingETAssociation_v1::calpx(const IParticle* pPart) const
 { return this->calpx(this->findIndex(pPart)); }
-inline const std::vector<double>& xAOD::MissingETAssociation_v1::calpy() const
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("calpy"); return acc(*this); }
-inline const std::vector<double>& xAOD::MissingETAssociation_v1::calpz() const
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("calpz"); return acc(*this); }
-inline const std::vector<double>& xAOD::MissingETAssociation_v1::cale() const
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("cale"); return acc(*this); }
-inline const std::vector<double>& xAOD::MissingETAssociation_v1::calsumpt() const
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("calsumpt"); return acc(*this); }
-
-inline std::vector<double>& xAOD::MissingETAssociation_v1::f_calpx() 
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("calpx"); return acc(*this); }
-inline std::vector<double>& xAOD::MissingETAssociation_v1::f_calpy() 
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("calpy"); return acc(*this); }
-inline std::vector<double>& xAOD::MissingETAssociation_v1::f_calpz() 
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("calpz"); return acc(*this); }
-inline std::vector<double>& xAOD::MissingETAssociation_v1::f_cale() 
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("cale"); return acc(*this); }
-inline std::vector<double>& xAOD::MissingETAssociation_v1::f_calsumpt() 
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("calsumpt"); return acc(*this); }
-
-inline const std::vector<double>& xAOD::MissingETAssociation_v1::trkpx() const
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("trkpx"); return acc(*this); }
-inline const std::vector<double>& xAOD::MissingETAssociation_v1::trkpy() const
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("trkpy"); return acc(*this); }
-inline const std::vector<double>& xAOD::MissingETAssociation_v1::trkpz() const
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("trkpz"); return acc(*this); }
-inline const std::vector<double>& xAOD::MissingETAssociation_v1::trke() const
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("trke"); return acc(*this); }
-inline const std::vector<double>& xAOD::MissingETAssociation_v1::trksumpt() const
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("trksumpt"); return acc(*this); }
-
-inline std::vector<double>& xAOD::MissingETAssociation_v1::f_trkpx() 
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("trkpx"); return acc(*this); }
-inline std::vector<double>& xAOD::MissingETAssociation_v1::f_trkpy() 
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("trkpy"); return acc(*this); }
-inline std::vector<double>& xAOD::MissingETAssociation_v1::f_trkpz() 
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("trkpz"); return acc(*this); }
-inline std::vector<double>& xAOD::MissingETAssociation_v1::f_trke() 
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("trke"); return acc(*this); }
-inline std::vector<double>& xAOD::MissingETAssociation_v1::f_trksumpt() 
-{ static const SG::AuxElement::Accessor<std::vector<double> > acc("trksumpt"); return acc(*this); }
-
-inline double xAOD::MissingETAssociation_v1::jettrkpx() const
-{ static const SG::AuxElement::Accessor<double > acc("jettrkpx"); return acc(*this); }
-inline double xAOD::MissingETAssociation_v1::jettrkpy() const
-{ static const SG::AuxElement::Accessor<double > acc("jettrkpy"); return acc(*this); }
-inline double xAOD::MissingETAssociation_v1::jettrkpz() const
-{ static const SG::AuxElement::Accessor<double > acc("jettrkpz"); return acc(*this); }
-inline double xAOD::MissingETAssociation_v1::jettrke() const
-{ static const SG::AuxElement::Accessor<double > acc("jettrke"); return acc(*this); }
-inline double xAOD::MissingETAssociation_v1::jettrksumpt() const
-{ static const SG::AuxElement::Accessor<double > acc("jettrksumpt"); return acc(*this); }
-
-inline double& xAOD::MissingETAssociation_v1::f_jettrkpx() 
-{ static const SG::AuxElement::Accessor<double > acc("jettrkpx"); return acc(*this); }
-inline double& xAOD::MissingETAssociation_v1::f_jettrkpy() 
-{ static const SG::AuxElement::Accessor<double > acc("jettrkpy"); return acc(*this); }
-inline double& xAOD::MissingETAssociation_v1::f_jettrkpz() 
-{ static const SG::AuxElement::Accessor<double > acc("jettrkpz"); return acc(*this); }
-inline double& xAOD::MissingETAssociation_v1::f_jettrke() 
-{ static const SG::AuxElement::Accessor<double > acc("jettrke"); return acc(*this); }
-inline double& xAOD::MissingETAssociation_v1::f_jettrksumpt() 
-{ static const SG::AuxElement::Accessor<double > acc("jettrksumpt"); return acc(*this); }
+inline const std::vector<float>& xAOD::MissingETAssociation_v1::calpy() const
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calpy"); return acc(*this); }
+inline const std::vector<float>& xAOD::MissingETAssociation_v1::calpz() const
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calpz"); return acc(*this); }
+inline const std::vector<float>& xAOD::MissingETAssociation_v1::cale() const
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("cale"); return acc(*this); }
+inline const std::vector<float>& xAOD::MissingETAssociation_v1::calsumpt() const
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calsumpt"); return acc(*this); }
+
+inline std::vector<float>& xAOD::MissingETAssociation_v1::f_calpx() 
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calpx"); return acc(*this); }
+inline std::vector<float>& xAOD::MissingETAssociation_v1::f_calpy() 
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calpy"); return acc(*this); }
+inline std::vector<float>& xAOD::MissingETAssociation_v1::f_calpz() 
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calpz"); return acc(*this); }
+inline std::vector<float>& xAOD::MissingETAssociation_v1::f_cale() 
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("cale"); return acc(*this); }
+inline std::vector<float>& xAOD::MissingETAssociation_v1::f_calsumpt() 
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calsumpt"); return acc(*this); }
+
+inline const std::vector<float>& xAOD::MissingETAssociation_v1::trkpx() const
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trkpx"); return acc(*this); }
+inline const std::vector<float>& xAOD::MissingETAssociation_v1::trkpy() const
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trkpy"); return acc(*this); }
+inline const std::vector<float>& xAOD::MissingETAssociation_v1::trkpz() const
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trkpz"); return acc(*this); }
+inline const std::vector<float>& xAOD::MissingETAssociation_v1::trke() const
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trke"); return acc(*this); }
+inline const std::vector<float>& xAOD::MissingETAssociation_v1::trksumpt() const
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trksumpt"); return acc(*this); }
+
+inline std::vector<float>& xAOD::MissingETAssociation_v1::f_trkpx() 
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trkpx"); return acc(*this); }
+inline std::vector<float>& xAOD::MissingETAssociation_v1::f_trkpy() 
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trkpy"); return acc(*this); }
+inline std::vector<float>& xAOD::MissingETAssociation_v1::f_trkpz() 
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trkpz"); return acc(*this); }
+inline std::vector<float>& xAOD::MissingETAssociation_v1::f_trke() 
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trke"); return acc(*this); }
+inline std::vector<float>& xAOD::MissingETAssociation_v1::f_trksumpt() 
+{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trksumpt"); return acc(*this); }
+
+inline float xAOD::MissingETAssociation_v1::jettrkpx() const
+{ static const SG::AuxElement::Accessor<float > acc("jettrkpx"); return acc(*this); }
+inline float xAOD::MissingETAssociation_v1::jettrkpy() const
+{ static const SG::AuxElement::Accessor<float > acc("jettrkpy"); return acc(*this); }
+inline float xAOD::MissingETAssociation_v1::jettrkpz() const
+{ static const SG::AuxElement::Accessor<float > acc("jettrkpz"); return acc(*this); }
+inline float xAOD::MissingETAssociation_v1::jettrke() const
+{ static const SG::AuxElement::Accessor<float > acc("jettrke"); return acc(*this); }
+inline float xAOD::MissingETAssociation_v1::jettrksumpt() const
+{ static const SG::AuxElement::Accessor<float > acc("jettrksumpt"); return acc(*this); }
+
+inline float& xAOD::MissingETAssociation_v1::f_jettrkpx() 
+{ static const SG::AuxElement::Accessor<float > acc("jettrkpx"); return acc(*this); }
+inline float& xAOD::MissingETAssociation_v1::f_jettrkpy() 
+{ static const SG::AuxElement::Accessor<float > acc("jettrkpy"); return acc(*this); }
+inline float& xAOD::MissingETAssociation_v1::f_jettrkpz() 
+{ static const SG::AuxElement::Accessor<float > acc("jettrkpz"); return acc(*this); }
+inline float& xAOD::MissingETAssociation_v1::f_jettrke() 
+{ static const SG::AuxElement::Accessor<float > acc("jettrke"); return acc(*this); }
+inline float& xAOD::MissingETAssociation_v1::f_jettrksumpt() 
+{ static const SG::AuxElement::Accessor<float > acc("jettrksumpt"); return acc(*this); }
 
 // --------------------------------------------------------- misc association flag
 inline bool xAOD::MissingETAssociation_v1::isMisc() const 
@@ -282,13 +282,13 @@ inline MissingETBase::Types::constvec_t operator+(const MissingETBase::Types::co
 inline MissingETBase::Types::constvec_t operator-(const MissingETBase::Types::constvec_t& v0,const MissingETBase::Types::constvec_t& v1)
 { MissingETBase::Types::constvec_t v(v0); v -= v1; return v; }
 
-inline MissingETBase::Types::constvec_t operator*(const MissingETBase::Types::constvec_t& cvec,double scale)
+inline MissingETBase::Types::constvec_t operator*(const MissingETBase::Types::constvec_t& cvec,float scale)
 { MissingETBase::Types::constvec_t v(cvec); v *= scale; return v; }
 
-inline MissingETBase::Types::constvec_t operator*(double scale,const MissingETBase::Types::constvec_t& cvec)
+inline MissingETBase::Types::constvec_t operator*(float scale,const MissingETBase::Types::constvec_t& cvec)
 { MissingETBase::Types::constvec_t v(cvec); v *= scale; return v; }
 
-inline MissingETBase::Types::constvec_t operator/(const MissingETBase::Types::constvec_t& cvec,double scale)
+inline MissingETBase::Types::constvec_t operator/(const MissingETBase::Types::constvec_t& cvec,float scale)
 { MissingETBase::Types::constvec_t v(cvec); v /= scale; return v; } 
 
 ///////////////////////////////////////////////////////////////
diff --git a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAuxAssociationMap_v1.h b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAuxAssociationMap_v1.h
index 5f0f495bb6ee9002a80ad0880b04c6496503f375..05075180d31c138f899cf15a134de70ce7df4985 100644
--- a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAuxAssociationMap_v1.h
+++ b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAuxAssociationMap_v1.h
@@ -37,23 +37,23 @@ namespace xAOD
     /*!@{*/
     std::vector<MissingETBase::Types::jetlink_t> jetLink;            ///< @brief Link to MissingET_v1 object
     std::vector<MissingETBase::Types::objlink_vector_t> objectLinks; ///< @brief Link to object contributing to the MissingET_v1 object
-    std::vector<std::vector<double> > calpx;                         ///< @brief Object constituent calo 4-vector @f$ P_{x} @f$ for overlap removal
-    std::vector<std::vector<double> > calpy;                         ///< @brief Object constituent calo 4-vector @f$ P_{y} @f$ for overlap removal
-    std::vector<std::vector<double> > calpz;                         ///< @brief Object constituent calo 4-vector @f$ P_{z} @f$ for overlap removal
-    std::vector<std::vector<double> > cale;                          ///< @brief Object constituent calo 4-vector @f$ E @f$ for overlap removal
-    std::vector<std::vector<double> > calsumpt;                      ///< @brief Object constituent calo 4-vector sumpt for overlap removal
+    std::vector<std::vector<float> > calpx;                          ///< @brief Object constituent calo 4-vector @f$ P_{x} @f$ for overlap removal
+    std::vector<std::vector<float> > calpy;                          ///< @brief Object constituent calo 4-vector @f$ P_{y} @f$ for overlap removal
+    std::vector<std::vector<float> > calpz;                          ///< @brief Object constituent calo 4-vector @f$ P_{z} @f$ for overlap removal
+    std::vector<std::vector<float> > cale;                           ///< @brief Object constituent calo 4-vector @f$ E @f$ for overlap removal
+    std::vector<std::vector<float> > calsumpt;                       ///< @brief Object constituent calo 4-vector sumpt for overlap removal
     //
-    std::vector<std::vector<double> > trkpx;                         ///< @brief Object constituent track 4-vector @f$ P_{x} @f$ for overlap removal
-    std::vector<std::vector<double> > trkpy;                         ///< @brief Object constituent track 4-vector @f$ P_{y} @f$ for overlap removal
-    std::vector<std::vector<double> > trkpz;                         ///< @brief Object constituent track 4-vector @f$ P_{z} @f$ for overlap removal
-    std::vector<std::vector<double> > trke;                          ///< @brief Object constituent track 4-vector @f$ E @f$ for overlap removal
-    std::vector<std::vector<double> > trksumpt;                      ///< @brief Object constituent track 4-vector sumpt for overlap removal
+    std::vector<std::vector<float> > trkpx;                          ///< @brief Object constituent track 4-vector @f$ P_{x} @f$ for overlap removal
+    std::vector<std::vector<float> > trkpy;                          ///< @brief Object constituent track 4-vector @f$ P_{y} @f$ for overlap removal
+    std::vector<std::vector<float> > trkpz;                          ///< @brief Object constituent track 4-vector @f$ P_{z} @f$ for overlap removal
+    std::vector<std::vector<float> > trke;                           ///< @brief Object constituent track 4-vector @f$ E @f$ for overlap removal
+    std::vector<std::vector<float> > trksumpt;                       ///< @brief Object constituent track 4-vector sumpt for overlap removal
     //
-    std::vector<double> jettrkpx;                                    ///< @brief Jet track 4-vector @f$ P_{x} @f$ for overlap removal
-    std::vector<double> jettrkpy;                                    ///< @brief Jet track 4-vector @f$ P_{y} @f$ for overlap removal
-    std::vector<double> jettrkpz;                                    ///< @brief Jet track 4-vector @f$ P_{z} @f$ for overlap removal
-    std::vector<double> jettrke;                                     ///< @brief Jet track 4-vector @f$ E @f$ for overlap removal
-    std::vector<double> jettrksumpt;                                 ///< @brief Jet track 4-vector sumpt for overlap removal
+    std::vector<float> jettrkpx;                                     ///< @brief Jet track 4-vector @f$ P_{x} @f$ for overlap removal
+    std::vector<float> jettrkpy;                                     ///< @brief Jet track 4-vector @f$ P_{y} @f$ for overlap removal
+    std::vector<float> jettrkpz;                                     ///< @brief Jet track 4-vector @f$ P_{z} @f$ for overlap removal
+    std::vector<float> jettrke;                                      ///< @brief Jet track 4-vector @f$ E @f$ for overlap removal
+    std::vector<float> jettrksumpt;                                  ///< @brief Jet track 4-vector sumpt for overlap removal
     //
     std::vector<std::vector<std::vector<size_t> > > overlapIndices;  ///< @brief Indices of objects that overlap one another in an association
     std::vector<std::vector<std::vector<unsigned char> > > overlapTypes;  ///< @brief Types of overlap between matched objects
diff --git a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAuxAssociationMap_v2.h b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAuxAssociationMap_v2.h
index a4c080e063a937ba1a77afa9fa02258bca56de09..9fa739cc753d59ab434e399f0d308e520a009d26 100644
--- a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAuxAssociationMap_v2.h
+++ b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAuxAssociationMap_v2.h
@@ -37,25 +37,25 @@ namespace xAOD
     /*!@{*/
     std::vector<MissingETBase::Types::jetlink_t> jetLink;            ///< @brief Link to MissingET_v2 object
     std::vector<MissingETBase::Types::objlink_vector_t> objectLinks; ///< @brief Link to object contributing to the MissingET_v2 object
-    std::vector<std::vector<double> > calpx;                         ///< @brief Object constituent calo 4-vector @f$ P_{x} @f$ for overlap removal
-    std::vector<std::vector<double> > calpy;                         ///< @brief Object constituent calo 4-vector @f$ P_{y} @f$ for overlap removal
-    std::vector<std::vector<double> > calpz;                         ///< @brief Object constituent calo 4-vector @f$ P_{z} @f$ for overlap removal
-    std::vector<std::vector<double> > cale;                          ///< @brief Object constituent calo 4-vector @f$ E @f$ for overlap removal
-    std::vector<std::vector<double> > calsumpt;                      ///< @brief Object constituent calo 4-vector sumpt for overlap removal
+    std::vector<std::vector<float> > calpx;                          ///< @brief Object constituent calo 4-vector @f$ P_{x} @f$ for overlap removal
+    std::vector<std::vector<float> > calpy;                          ///< @brief Object constituent calo 4-vector @f$ P_{y} @f$ for overlap removal
+    std::vector<std::vector<float> > calpz;                          ///< @brief Object constituent calo 4-vector @f$ P_{z} @f$ for overlap removal
+    std::vector<std::vector<float> > cale;                           ///< @brief Object constituent calo 4-vector @f$ E @f$ for overlap removal
+    std::vector<std::vector<float> > calsumpt;                       ///< @brief Object constituent calo 4-vector sumpt for overlap removal
     std::vector<std::vector<MissingETBase::Types::bitmask_t> > calkey;                        ///< @brief Object constituent calo region key for overlap removal
     //
-    std::vector<std::vector<double> > trkpx;                         ///< @brief Object constituent track 4-vector @f$ P_{x} @f$ for overlap removal
-    std::vector<std::vector<double> > trkpy;                         ///< @brief Object constituent track 4-vector @f$ P_{y} @f$ for overlap removal
-    std::vector<std::vector<double> > trkpz;                         ///< @brief Object constituent track 4-vector @f$ P_{z} @f$ for overlap removal
-    std::vector<std::vector<double> > trke;                          ///< @brief Object constituent track 4-vector @f$ E @f$ for overlap removal
-    std::vector<std::vector<double> > trksumpt;                      ///< @brief Object constituent track 4-vector sumpt for overlap removal
+    std::vector<std::vector<float> > trkpx;                          ///< @brief Object constituent track 4-vector @f$ P_{x} @f$ for overlap removal
+    std::vector<std::vector<float> > trkpy;                          ///< @brief Object constituent track 4-vector @f$ P_{y} @f$ for overlap removal
+    std::vector<std::vector<float> > trkpz;                          ///< @brief Object constituent track 4-vector @f$ P_{z} @f$ for overlap removal
+    std::vector<std::vector<float> > trke;                           ///< @brief Object constituent track 4-vector @f$ E @f$ for overlap removal
+    std::vector<std::vector<float> > trksumpt;                       ///< @brief Object constituent track 4-vector sumpt for overlap removal
     std::vector<std::vector<MissingETBase::Types::bitmask_t> > trkkey;                        ///< @brief Object constituent track region key for overlap removal
     //
-    std::vector<double> jettrkpx;                                    ///< @brief Jet track 4-vector @f$ P_{x} @f$ for overlap removal
-    std::vector<double> jettrkpy;                                    ///< @brief Jet track 4-vector @f$ P_{y} @f$ for overlap removal
-    std::vector<double> jettrkpz;                                    ///< @brief Jet track 4-vector @f$ P_{z} @f$ for overlap removal
-    std::vector<double> jettrke;                                     ///< @brief Jet track 4-vector @f$ E @f$ for overlap removal
-    std::vector<double> jettrksumpt;                                 ///< @brief Jet track 4-vector sumpt for overlap removal
+    std::vector<float> jettrkpx;                                     ///< @brief Jet track 4-vector @f$ P_{x} @f$ for overlap removal
+    std::vector<float> jettrkpy;                                     ///< @brief Jet track 4-vector @f$ P_{y} @f$ for overlap removal
+    std::vector<float> jettrkpz;                                     ///< @brief Jet track 4-vector @f$ P_{z} @f$ for overlap removal
+    std::vector<float> jettrke;                                      ///< @brief Jet track 4-vector @f$ E @f$ for overlap removal
+    std::vector<float> jettrksumpt;                                  ///< @brief Jet track 4-vector sumpt for overlap removal
     //
     std::vector<std::vector<std::vector<size_t> > > overlapIndices;  ///< @brief Indices of objects that overlap one another in an association
     std::vector<std::vector<std::vector<unsigned char> > > overlapTypes;  ///< @brief Types of overlap between matched objects
diff --git a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAuxContainer_v1.h b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAuxContainer_v1.h
index acd87ef2480b83a3f5ec400fa00ebd88045e7dd4..4651e600cf8b6d57e8fbaa53e5aefc346198a625 100644
--- a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAuxContainer_v1.h
+++ b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAuxContainer_v1.h
@@ -36,9 +36,9 @@ namespace xAOD
      *         exactly the same spelling as the variable names.
      */
     /*!@{*/
-    std::vector<double>                          mpx;    ///< @brief @f$ p_{x,{\rm miss}} = -\sum p_{x} @f$
-    std::vector<double>                          mpy;    ///< @brief @f$ p_{y,{\rm miss}} = -\sum p_{x} @f$
-    std::vector<double>                          sumet;  ///< @brief @f$ \sigma E_{\rm T} = \sum p_{\rm T} @f$
+    std::vector<float>                           mpx;    ///< @brief @f$ p_{x,{\rm miss}} = -\sum p_{x} @f$
+    std::vector<float>                           mpy;    ///< @brief @f$ p_{y,{\rm miss}} = -\sum p_{x} @f$
+    std::vector<float>                           sumet;  ///< @brief @f$ \sigma E_{\rm T} = \sum p_{\rm T} @f$
     std::vector<std::string>                     name;   ///< @brief Name of MET contribution
     std::vector<MissingETBase::Types::bitmask_t> source; ///< @brief Source of MET contribution
     /*!@}*/
diff --git a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.h b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.h
index 854abb445508edd76135c5e14cd719002f1f0470..58e83cf9d96fdb3fffff9479f7d7689d8957cc94 100644
--- a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.h
+++ b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.h
@@ -31,7 +31,7 @@ namespace xAOD
 		 MissingETBase::Types::bitmask_t src=MissingETBase::Source::unknown()); /*!< @brief Constructor with identifiers */
     MissingET_v1(const IParticle* particle, const std::string& name="MissingET",
 		 MissingETBase::Types::bitmask_t src=MissingETBase::Source::unknown()); /*!< @brief Constructor with particle */
-    MissingET_v1(double mpx,double mpy,double sumet,const std::string& name="MissingET",
+    MissingET_v1(float mpx,float mpy,float sumet,const std::string& name="MissingET",
 		 MissingETBase::Types::bitmask_t src=MissingETBase::Source::unknown()); /*!< @brief Constructor with initial kinematics */
     MissingET_v1(const MissingET_v1& met);                                              /*!< @brief Copy constructor */
     ~MissingET_v1();                                                                    /*!< @brief Implementation class destructor */
@@ -39,18 +39,18 @@ namespace xAOD
 
     /*! @name Kinematic accessors */
     /*!@{*/
-    double mpx()    const; /*!< @brief Returns @f$ p_{x}^{\rm miss} @f$ */
-    double mpy()    const; /*!< @brief Returns @f$ p_{y}^{\rm miss} @f$ */
-    double met()   const; /*!< @brief Returns @f$ E_{\rm T}^{\rm miss} = \sqrt{(p_{x}^{\rm miss})^{2} + (p_{y}^{\rm miss})^{2}} @f$ */
-    double phi()   const; /*!< @brief Returns @f$ \phi(E_{\rm T}^{\rm miss}) @f$ */
-    double sumet() const; /*!< @brief Returns */
+    float mpx()    const; /*!< @brief Returns @f$ p_{x}^{\rm miss} @f$ */
+    float mpy()    const; /*!< @brief Returns @f$ p_{y}^{\rm miss} @f$ */
+    float met()   const; /*!< @brief Returns @f$ E_{\rm T}^{\rm miss} = \sqrt{(p_{x}^{\rm miss})^{2} + (p_{y}^{\rm miss})^{2}} @f$ */
+    float phi()   const; /*!< @brief Returns @f$ \phi(E_{\rm T}^{\rm miss}) @f$ */
+    float sumet() const; /*!< @brief Returns */
     /*!@}*/
 
     /*! @name Kinematic setters */
     /*@{*/
-    void setMpx(double value);    /*!< @brief Set the @f$ p_{x}^{\rm miss} @f$ component */
-    void setMpy(double value);    /*!< @brief Set the @f$ p_{y}^{\rm miss} @f$ component */
-    void setSumet(double value); /*!< @brief Set @f$ \Sigma E_{\rm T} @f$ */
+    void setMpx(float value);    /*!< @brief Set the @f$ p_{x}^{\rm miss} @f$ component */
+    void setMpy(float value);    /*!< @brief Set the @f$ p_{y}^{\rm miss} @f$ component */
+    void setSumet(float value); /*!< @brief Set @f$ \Sigma E_{\rm T} @f$ */
     /*@}*/
 
     /*! @brief Identifier getters */
@@ -70,8 +70,8 @@ namespace xAOD
     /*! @name Manipulating the kinematic data */
     /*!@{*/
     void add(const IParticle* particle);                 /*!< @brief Add particle kinematics to MET */
-    void add(const IParticle* particle,double scale);    /*!< @brief Add scaled particle kinematics to MET */
-    void add(double px,double py,double pt);             /*!< @brief Add kinematic variables to MET */
+    void add(const IParticle* particle,float scale);    /*!< @brief Add scaled particle kinematics to MET */
+    void add(float px,float py,float pt);             /*!< @brief Add kinematic variables to MET */
     MissingET_v1& operator=(const MissingET_v1& met); /*!< @brief Add particle kinematics to MET */
     MissingET_v1& operator+=(const IParticle* particle); /*!< @brief Add particle kinematics to MET */
     MissingET_v1& operator-=(const IParticle* part);     /*!< @brief Remove particle kinematics to MET */
@@ -81,8 +81,8 @@ namespace xAOD
     /*!@{*/
     MissingET_v1& operator+=(const MissingET_v1& met); /*!< @brief Add another MET object */
     MissingET_v1& operator-=(const MissingET_v1& met); /*!< @brief Subtract another MET object */
-    MissingET_v1& operator*=(double scale);            /*!< @brief Applying a scale factor */
-    MissingET_v1& operator/=(double scale);            /*!< @brief Dividing by a scale factor */
+    MissingET_v1& operator*=(float scale);            /*!< @brief Applying a scale factor */
+    MissingET_v1& operator/=(float scale);            /*!< @brief Dividing by a scale factor */
     /*!@}*/
 
     /*! @name Stored data management */
@@ -104,9 +104,9 @@ namespace xAOD
 
     /*! @name Internal data modification support */
     /*!@{*/
-    double&                           f_mpx();     /*!< @brief Returns reference to @f$ p_{x} @f$ store */
-    double&                           f_mpy();     /*!< @brief Returns reference to @f$ p_{y} @f$ store */
-    double&                           f_sumet();  /*!< @brief Returns reference to @f$ \Sigma E_{\rm T} @f$ store */
+    float&                           f_mpx();     /*!< @brief Returns reference to @f$ p_{x} @f$ store */
+    float&                           f_mpy();     /*!< @brief Returns reference to @f$ p_{y} @f$ store */
+    float&                           f_sumet();  /*!< @brief Returns reference to @f$ \Sigma E_{\rm T} @f$ store */
     std::string&                      f_name();   /*!< @brief Returns reference to MET object name store */
     const std::string&                f_nameConst(); /*!< @brief Returns const reference to the MET object name store*/
     MissingETBase::Types::bitmask_t&  f_source(); /*!< @brief Returns reference to MET object source store */
@@ -123,9 +123,9 @@ namespace xAOD
 /*!@{*/
 xAOD::MissingET_v1 operator+(const xAOD::MissingET_v1& met0,const xAOD::MissingET_v1& met1); /*!< @brief Create new MET object from sum of two MissingET_v1 objects */
 xAOD::MissingET_v1 operator-(const xAOD::MissingET_v1& met0,const xAOD::MissingET_v1& met1); /*!< @brief Create new MET object from difference between two MissingET_v1 objects */
-xAOD::MissingET_v1 operator*(const xAOD::MissingET_v1& met,double scale);                    /*!< @brief Create new MET object from source with scaled (weighted) kinematics */
-xAOD::MissingET_v1 operator*(double scale,const xAOD::MissingET_v1& met);                    /*!< @brief Create new MET object from source with scaled (weighted) kinematics */
-xAOD::MissingET_v1 operator/(const xAOD::MissingET_v1& met,double scale);                    /*!< @brief Create new MET object from source with scaled kinematics */
+xAOD::MissingET_v1 operator*(const xAOD::MissingET_v1& met,float scale);                    /*!< @brief Create new MET object from source with scaled (weighted) kinematics */
+xAOD::MissingET_v1 operator*(float scale,const xAOD::MissingET_v1& met);                    /*!< @brief Create new MET object from source with scaled (weighted) kinematics */
+xAOD::MissingET_v1 operator/(const xAOD::MissingET_v1& met,float scale);                    /*!< @brief Create new MET object from source with scaled kinematics */
 /*!@}*/
 
 #include "xAODMissingET/versions/MissingET_v1.icc"
diff --git a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.icc b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.icc
index f40b1a4e35b4b51c08f70163791be92c708993cf..b7edcdda604231a6e3fb2174380a3d6b9d0d05ba 100644
--- a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.icc
+++ b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.icc
@@ -9,11 +9,11 @@
 // MissingET_v1 Inline Functions: Getters //
 ////////////////////////////////////////////
 
-inline double xAOD::MissingET_v1::met()   const { return sqrt(this->mpx()*this->mpx()+this->mpy()*this->mpy()); }
-inline double xAOD::MissingET_v1::phi()   const { return atan2(this->mpy(),this->mpx()); }
-inline double xAOD::MissingET_v1::mpx()   const { static const SG::AuxElement::Accessor<double> acc("mpx"); return acc(*this); }
-inline double xAOD::MissingET_v1::mpy()   const { static const SG::AuxElement::Accessor<double> acc("mpy"); return acc(*this); }
-inline double xAOD::MissingET_v1::sumet() const { static const SG::AuxElement::Accessor<double> acc("sumet"); return acc(*this); }
+inline float xAOD::MissingET_v1::met()   const { return sqrt(this->mpx()*this->mpx()+this->mpy()*this->mpy()); }
+inline float xAOD::MissingET_v1::phi()   const { return atan2(this->mpy(),this->mpx()); }
+inline float xAOD::MissingET_v1::mpx()   const { static const SG::AuxElement::Accessor<float> acc("mpx"); return acc(*this); }
+inline float xAOD::MissingET_v1::mpy()   const { static const SG::AuxElement::Accessor<float> acc("mpy"); return acc(*this); }
+inline float xAOD::MissingET_v1::sumet() const { static const SG::AuxElement::Accessor<float> acc("sumet"); return acc(*this); }
 
 inline const std::string&              xAOD::MissingET_v1::name()     const { static const SG::AuxElement::Accessor<std::string> acc("name"); return acc(*this); }
 inline std::size_t xAOD::MissingET_v1::nameHash() const { return m_nameHash; }
@@ -23,17 +23,17 @@ inline MissingETBase::Types::bitmask_t xAOD::MissingET_v1::source()   const { st
 // MissingET_v1 Inline Functions: Setters //
 ////////////////////////////////////////////
 
-inline double& xAOD::MissingET_v1::f_mpx()   { static const SG::AuxElement::Accessor<double> acc("mpx"); return acc(*this); }
-inline double& xAOD::MissingET_v1::f_mpy()   { static const SG::AuxElement::Accessor<double> acc("mpy"); return acc(*this); }
-inline double& xAOD::MissingET_v1::f_sumet() { static const SG::AuxElement::Accessor<double> acc("sumet"); return acc(*this); }
+inline float& xAOD::MissingET_v1::f_mpx()   { static const SG::AuxElement::Accessor<float> acc("mpx"); return acc(*this); }
+inline float& xAOD::MissingET_v1::f_mpy()   { static const SG::AuxElement::Accessor<float> acc("mpy"); return acc(*this); }
+inline float& xAOD::MissingET_v1::f_sumet() { static const SG::AuxElement::Accessor<float> acc("sumet"); return acc(*this); }
 
 inline std::string& xAOD::MissingET_v1::f_name()                       { static const SG::AuxElement::Accessor<std::string> acc("name"); return acc(*this); }
 inline const std::string& xAOD::MissingET_v1::f_nameConst()            { static const SG::AuxElement::ConstAccessor<std::string> acc("name"); return acc(*this); }
 inline MissingETBase::Types::bitmask_t& xAOD::MissingET_v1::f_source() { static const SG::AuxElement::Accessor<MissingETBase::Types::bitmask_t> acc("source"); return acc(*this); }
 
-inline void xAOD::MissingET_v1::setMpx(double mpx)     { this->f_mpx() = mpx; }
-inline void xAOD::MissingET_v1::setMpy(double mpy)     { this->f_mpy() = mpy; }
-inline void xAOD::MissingET_v1::setSumet(double sumet) { this->f_sumet() = sumet; }
+inline void xAOD::MissingET_v1::setMpx(float mpx)     { this->f_mpx() = mpx; }
+inline void xAOD::MissingET_v1::setMpy(float mpy)     { this->f_mpy() = mpy; }
+inline void xAOD::MissingET_v1::setSumet(float sumet) { this->f_sumet() = sumet; }
 
 inline void xAOD::MissingET_v1::setName(const std::string& name) {
   this->f_name() = name;
@@ -56,11 +56,11 @@ inline xAOD::MissingET_v1& xAOD::MissingET_v1::operator+=(const MissingET_v1& me
 inline xAOD::MissingET_v1& xAOD::MissingET_v1::operator-=(const MissingET_v1& met)
 { this->f_mpx() -= met.mpx(); this->f_mpy() -= met.mpy(); this->f_sumet() -= met.sumet(); return *this; }
 
-inline xAOD::MissingET_v1& xAOD::MissingET_v1::operator*=(double scale)
+inline xAOD::MissingET_v1& xAOD::MissingET_v1::operator*=(float scale)
 { this->f_mpx() *= scale; this->f_mpy() *= scale; this->f_sumet() *= scale; return *this; }
 
-inline xAOD::MissingET_v1& xAOD::MissingET_v1::operator/=(double scale)
-{ double f(MissingETBase::Numerical::divide(1.,scale)); this->operator*=(f); return *this; }
+inline xAOD::MissingET_v1& xAOD::MissingET_v1::operator/=(float scale)
+{ float f(MissingETBase::Numerical::divide(1.,scale)); this->operator*=(f); return *this; }
 
 ///////////////////////////////////////////////////////////////////////
 // MissingET_v1 Inline Functions: Object Algebra in Global Namespace //
@@ -72,14 +72,14 @@ inline xAOD::MissingET_v1 operator+(const xAOD::MissingET_v1& met0,const xAOD::M
 inline xAOD::MissingET_v1 operator-(const xAOD::MissingET_v1& met0,const xAOD::MissingET_v1& met1)
 { return xAOD::MissingET_v1(met0.mpx()-met1.mpx(),met0.mpy()-met1.mpy(),met0.sumet()-met1.sumet()); }
 
-inline xAOD::MissingET_v1 operator*(const xAOD::MissingET_v1& met,double scale)
+inline xAOD::MissingET_v1 operator*(const xAOD::MissingET_v1& met,float scale)
 { return xAOD::MissingET_v1(met.mpx()*scale,met.mpy()*scale,met.sumet()*scale); }
 
-inline xAOD::MissingET_v1 operator*(double scale,const xAOD::MissingET_v1& met)
+inline xAOD::MissingET_v1 operator*(float scale,const xAOD::MissingET_v1& met)
 { return met * scale; }
 
-inline xAOD::MissingET_v1 operator/(const xAOD::MissingET_v1& met,double scale)
-{ double f(MissingETBase::Numerical::divide(1.,scale)); return f * met; }
+inline xAOD::MissingET_v1 operator/(const xAOD::MissingET_v1& met,float scale)
+{ float f(MissingETBase::Numerical::divide(1.,scale)); return f * met; }
 
 ////////////////////////////////////////////////
 // MissingET_v1 Inline Functions: Comparators //
@@ -110,7 +110,7 @@ inline void xAOD::MissingET_v1::clear()
  *  The latter is supported by constructors with just @link xAOD::MissingET_v1::MissingET_v1(const std::string&,MissingETBase::Types::bitmask_t) name and source indicator @endlink,
  *  initial kinematics are set to zero), and constructors storing (initial or final) kinematic contributions, either from a
  *  @link xAOD::MissingET_v1::MissingET_v1(const IParticle*,const std::string&,MissingETBase::Types::bitmask_t) physics or signal object reference @endlink
- *  or from @link xAOD::MissingET_v1::MissingET_v1(double,double,double,const std::string&,MissingETBase::Types::bitmask_t) individually specified kinematics @endlink.
+ *  or from @link xAOD::MissingET_v1::MissingET_v1(float,float,float,const std::string&,MissingETBase::Types::bitmask_t) individually specified kinematics @endlink.
  *
  *  @note This object is designed to store only the summed kinematics of a MET term, together with some identifiers. The actual contribution to this term from
  *        any physics or signal object to this MET term is not stored here, but in a dedicated @link xAOD::MissingETComponent_v1 MET component object @endlink.
@@ -179,7 +179,7 @@ inline void xAOD::MissingET_v1::clear()
  *        object instantiated this way is not storable, it is otherwise a fully usable.
  */
 
-/*! @fn xAOD::MissingET_v1::MissingET_v1(double mpx,double mpy,double pt,const std::string& name,MissingETBase::Types::bitmask_t src);
+/*! @fn xAOD::MissingET_v1::MissingET_v1(float mpx,float mpy,float pt,const std::string& name,MissingETBase::Types::bitmask_t src);
  *
  *  A MET object with a name (optional) and a source indicator (optional) is constructed. The initial MET components
  *  @f$ (p_{x},p_{y},\Sigma E_{\rm T}) @f$ are given in the argument list.
@@ -209,7 +209,7 @@ inline void xAOD::MissingET_v1::clear()
 // Setters //
 /////////////
 
-/*! @fn void xAOD::MissingET_v1::setMpx(double value)
+/*! @fn void xAOD::MissingET_v1::setMpx(float value)
  *
  *  @param[in] value new value for component.
  *
@@ -219,12 +219,12 @@ inline void xAOD::MissingET_v1::clear()
  *           xAOD::MissingET_v1::add methods for coherent update of all related data.
  */
 
-/*! @fn void xAOD::MissingET_v1::setMpy(double value)
- *  @copydetails xAOD::MissingET_v1::setMpx(double)
+/*! @fn void xAOD::MissingET_v1::setMpy(float value)
+ *  @copydetails xAOD::MissingET_v1::setMpx(float)
  */
 
-/*! @fn void xAOD::MissingET_v1::setSumet(double value)
- *  @copydetails xAOD::MissingET_v1::setMpx(double)
+/*! @fn void xAOD::MissingET_v1::setSumet(float value)
+ *  @copydetails xAOD::MissingET_v1::setMpx(float)
  */
 
 /*! @fn void xAOD::MissingET_v1::setName(const std::string& name)
@@ -279,10 +279,10 @@ inline void xAOD::MissingET_v1::clear()
  *        has to be explicitly done by the user.
  */
 
-/*! @fn virtual void xAOD::MissingET_v1::add(const IParticle* particle,double scale)
+/*! @fn virtual void xAOD::MissingET_v1::add(const IParticle* particle,float scale)
  *
  *  Here the particle kinematics is added to the MET object with a common scale factor. This method updates the internal data stores. If each
- *  MET component needs a different scale, xAOD::MissingET_v1::add(double,double,double) can be used.
+ *  MET component needs a different scale, xAOD::MissingET_v1::add(float,float,float) can be used.
  *
  *  @param[in] particle pointer to the particle object
  *  @param[in] scale    scale factor
@@ -300,7 +300,7 @@ inline void xAOD::MissingET_v1::clear()
  *        has to be explicitly done by the user.
  */
 
-/*! @fn virtual void xAOD::MissingET_v1::add(double px,double py)
+/*! @fn virtual void xAOD::MissingET_v1::add(float px,float py)
  *
  *  The given kinematic quantities are added to MET.
  *
@@ -319,7 +319,7 @@ inline void xAOD::MissingET_v1::clear()
 /*! @fn xAOD::MissingET_v1& xAOD::MissingET_v1::operator-=(const IParticle* part)
  *
  *  The particle kinematics is subtracted to the MET object This method updates the internal data stores. If each
- *  MET component needs a different scale, xAOD::MissingET_v1::add(double,double,double) can be used.
+ *  MET component needs a different scale, xAOD::MissingET_v1::add(float,float,float) can be used.
  *
  *  @return Reference to (updated) self.
  *
@@ -368,7 +368,7 @@ inline void xAOD::MissingET_v1::clear()
  *  @f$ (p_{x}^{{\rm miss}\prime},p_{y}^{{\rm miss}\prime},\Sigma E_{\rm T}^{\prime}) @f$ are the components of the subtracted object.
  */
 
-/*! @fn xAOD::MissingET_v1& xAOD::MissingET_v1::operator*=(double scale)
+/*! @fn xAOD::MissingET_v1& xAOD::MissingET_v1::operator*=(float scale)
  *
  *  @return Reference to self.
  *
@@ -384,7 +384,7 @@ inline void xAOD::MissingET_v1::clear()
  *  Here @f$ (p_{x}^{\rm miss},p_{y}^{\rm miss},\Sigma E_{\rm T}) @f$ are the components of this object, and @f$ f @f$ is the scale factor.
  */
 
-/*! @fn xAOD::MissingET_v1& xAOD::MissingET_v1::operator/=(double scale)
+/*! @fn xAOD::MissingET_v1& xAOD::MissingET_v1::operator/=(float scale)
  *
  *  @return Reference to self.
  *
@@ -399,7 +399,7 @@ inline void xAOD::MissingET_v1::clear()
  *
  *  Here @f$ (p_{x}^{\rm miss},p_{y}^{\rm miss},\Sigma E_{\rm T}) @f$ are the components of this object, and @f$ f @f$ is the scale factor.
  *
- *  @note If @f$ f = 0 @f$, the rule implemented in MissingETBase::Numerical::divide(double,double) is applied to the results for each
+ *  @note If @f$ f = 0 @f$, the rule implemented in MissingETBase::Numerical::divide(float,float) is applied to the results for each
  *        component.
  */
 
@@ -437,18 +437,18 @@ inline void xAOD::MissingET_v1::clear()
 // Protected Functions //
 /////////////////////////
 
-/*! @fn double& xAOD::MissingET_v1::f_mpx(()
+/*! @fn float& xAOD::MissingET_v1::f_mpx(()
  *
  *  The underlying SG::AuxElement store is accessed through references to keyed, modifiable data members.
  *
  *  @return Reference to modifiable dataword storing MET object data.
  */
 
-/*! @fn double& xAOD::MissingET_v1::f_py()
+/*! @fn float& xAOD::MissingET_v1::f_py()
  * @copydetails xAOD::MissingET_v1::f_mpx()
  */
 
-/*! @fn double& xAOD::MissingET_v1::f_sumet()
+/*! @fn float& xAOD::MissingET_v1::f_sumet()
  * @copydetails xAOD::MissingET_v1::f_mpx()
  */
 
@@ -486,10 +486,10 @@ inline void xAOD::MissingET_v1::clear()
  *  @param[in] met1 reference to non-modifiable second MET object
  */
 
-/*! @fn xAOD::MissingET_v1 operator*(const xAOD::MissingET_v1& met,double scale)
+/*! @fn xAOD::MissingET_v1 operator*(const xAOD::MissingET_v1& met,float scale)
  *
  *  The kinematic components of the referenced MET objects are scaled by (1) creating a copy of the referenced MET object and
- *  (2) use the xAOD::MissingET_v1::operator*=(double) method to apply the scale to the components of the new MET object.
+ *  (2) use the xAOD::MissingET_v1::operator*=(float) method to apply the scale to the components of the new MET object.
  *
  *  @return New MissingET_v1 object reflecting the result of the multiply operation.
  *
@@ -497,14 +497,14 @@ inline void xAOD::MissingET_v1::clear()
  *  @param[in] scale scale factor to be applied
  */
 
-/*! @fn xAOD::MissingET_v1 operator*(double scale,const xAOD::MissingET_v1& met)
- *  @copydetails operator*(const xAOD::MissingET_v1&,double)
+/*! @fn xAOD::MissingET_v1 operator*(float scale,const xAOD::MissingET_v1& met)
+ *  @copydetails operator*(const xAOD::MissingET_v1&,float)
  */
 
-/*! @fn xAOD::MissingET_v1 operator/(const xAOD::MissingET_v1& met,double scale);
+/*! @fn xAOD::MissingET_v1 operator/(const xAOD::MissingET_v1& met,float scale);
  *
  *  The kinematic components of the referenced MET objects are scaled by (1) creating a copy of the referenced MET object and
- *  (2) use the xAOD::MissingET_v1::operator/=(double) method to divide the components of the new MET object by the scale factor.
+ *  (2) use the xAOD::MissingET_v1::operator/=(float) method to divide the components of the new MET object by the scale factor.
  *
  *  @return New MissingET_v1 object reflecting the result of the divide operation.
  *
diff --git a/Event/xAOD/xAODMissingETAthenaPool/CMakeLists.txt b/Event/xAOD/xAODMissingETAthenaPool/CMakeLists.txt
index 013441b1eaa9dadf4e82fbcbd6b349cdb96fc67a..2a4cd9df0ac91904f53d83906489ad3ce14d8310 100644
--- a/Event/xAOD/xAODMissingETAthenaPool/CMakeLists.txt
+++ b/Event/xAOD/xAODMissingETAthenaPool/CMakeLists.txt
@@ -29,7 +29,7 @@ find_package( AthenaPoolUtilitiesTest )
 
 if( ATHENAPOOLUTILITIESTEST_FOUND )
   set( XAODMISSINGETATHENAPOOL_REFERENCE_TAG
-       xAODMissingETAthenaPoolReference-01-01-00 )
+       xAODMissingETAthenaPoolReference-01-02-00 )
   run_tpcnv_legacy_test( xAODMissingETAthenaPool_20.1.7.2   AOD-20.1.7.2-full
                    REQUIRED_LIBRARIES xAODMissingETAthenaPoolPoolCnv
                    REFERENCE_TAG ${XAODMISSINGETATHENAPOOL_REFERENCE_TAG} )
diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDLocReco.h b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDLocReco.h
index b12b42b015ba521bc16722c125547c2020677857..6729f8efdadebb347c5c22bb46d9c0a1f2674d63 100644
--- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDLocReco.h
+++ b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocReco/AFP_LocReco/AFP_SIDLocReco.h
@@ -12,7 +12,6 @@
 #include <vector>
 #include <fstream>
 
-//#include "GaudiKernel/Algorithm.h"
 #include "AthenaBaseComps/AthAlgorithm.h"
 #include "GaudiKernel/MsgStream.h"
 #include "GaudiKernel/ObjectVector.h"
@@ -31,12 +30,6 @@
 #include "AthenaPoolUtilities/AthenaAttributeList.h"
 #include "AthenaPoolUtilities/CondAttrListCollection.h"
 
-//#include "AFP_RawEv/AFP_RawData.h"
-//#include "AFP_RawEv/AFP_RawDataContainer.h"
-//#include "AFP_RawEv/AFP_RawDataCollection.h"
-//#include "AFP_RawEv/AFP_SIDDigitCollection.h"
-//#include "AFP_RawEv/AFP_TDDigitCollection.h"
-
 #include "AFP_Geometry/AFP_constants.h"
 #include "AFP_Geometry/AFP_Geometry.h"
 #include "AFP_Geometry/AFP_ConfigParams.h"
@@ -45,8 +38,6 @@
 #include "AFP_DigiEv/AFP_SiDigiCollection.h"
 #include "AFP_LocRecoEv/AFP_SIDLocRecoEvCollection.h"
 
-//#include "AFP_LocRecoEv/AFP_SIDLocRecoEvCollection.h"
-
 #include "AFP_LocReco/AFP_UserObjects.h"
 #include "AFP_LocReco/AFP_SIDBasicKalman.h"
 
diff --git a/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTransport.cxx b/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTransport.cxx
index d3274fe48e8870757c40cfaee9fe2969f8436013..8e8b7426c35f4267a5b195e3f443b689c3420497 100644
--- a/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTransport.cxx
+++ b/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTransport.cxx
@@ -14,13 +14,6 @@
 #include "AthenaBaseComps/AthAlgorithm.h"
 #include "GaudiKernel/ServiceHandle.h"
 
-#include "EventInfo/EventInfo.h"
-#include "EventInfo/EventID.h"
-#include "GeneratorObjects/McEventCollection.h"
-
-
-
-
 // FrameWork includes
 #include "GaudiKernel/ITHistSvc.h"
 #include "Gaudi/Property.h"
@@ -48,9 +41,6 @@ ALFA_BeamTransport::ALFA_BeamTransport(const std::string& name, ISvcLocator* pSv
   :
   AthAlgorithm(name,pSvcLocator)
 {
-  //  template for property decalration
-  //declareProperty("PropertyName", m_propertyName);
-
   declareProperty("ConfDir", m_FPConfig.ConfDir="./config");
   declareProperty("UseALFA", m_FPConfig.UseALFA=true);
   declareProperty("Debug", m_WriteDebugOutput=false);
@@ -222,14 +212,14 @@ StatusCode ALFA_BeamTransport::execute()
 ///////////////
 void ALFA_BeamTransport::MeVToGeV (HepMC::GenEvent* evt)
 {
-  for ( HepMC::GenEvent::particle_iterator p = evt->particles_begin(); p != evt->particles_end(); ++p ) {
+  for (auto p:  *evt) {
     // std::cout << " PDG, BAR " << (*p)->pdg_id() << " " << (*p)->barcode() << std::endl;
-    const HepMC::FourVector fv((*p)->momentum().px() / 1000.,
-			       (*p)->momentum().py() / 1000.,
-			       (*p)->momentum().pz() / 1000.,
-			       (*p)->momentum().e() / 1000.);
+    const HepMC::FourVector fv(p->momentum().px() / 1000.,
+			       p->momentum().py() / 1000.,
+			       p->momentum().pz() / 1000.,
+			       p->momentum().e() / 1000.);
     
-    (*p)->set_momentum( fv);
+    p->set_momentum( fv);
   }
 }
 
@@ -237,13 +227,13 @@ void ALFA_BeamTransport::MeVToGeV (HepMC::GenEvent* evt)
 ///////////////
 void ALFA_BeamTransport::GeVToMeV (HepMC::GenEvent* evt)
 {
-     for ( HepMC::GenEvent::particle_iterator p = evt->particles_begin(); p != evt->particles_end(); ++p ) {
-	  const HepMC::FourVector fv((*p)->momentum().px() * 1000.,
-				      (*p)->momentum().py() * 1000.,
-				      (*p)->momentum().pz() * 1000.,
-				      (*p)->momentum().e() * 1000.);
+     for ( auto p: *evt) {
+	  const HepMC::FourVector fv(p->momentum().px() * 1000.,
+				      p->momentum().py() * 1000.,
+				      p->momentum().pz() * 1000.,
+				      p->momentum().e() * 1000.);
 				      
-				      (*p)->set_momentum( fv);
+				      p->set_momentum( fv);
      }
 }
 
diff --git a/ForwardDetectors/ALFA/ALFA_Ntuple/ALFA_Ntuple/ALFA_Ntuple.h b/ForwardDetectors/ALFA/ALFA_Ntuple/ALFA_Ntuple/ALFA_Ntuple.h
index d6b02c64227a633516d509b53a3666eb9768697e..470cd17eff1f4d6929d8efd181fb6a9ef1160fdc 100644
--- a/ForwardDetectors/ALFA/ALFA_Ntuple/ALFA_Ntuple/ALFA_Ntuple.h
+++ b/ForwardDetectors/ALFA/ALFA_Ntuple/ALFA_Ntuple/ALFA_Ntuple.h
@@ -7,8 +7,6 @@
 
 #include "AthenaBaseComps/AthHistogramAlgorithm.h"
 
-//#include "GaudiKernel/Algorithm.h"
-//#include "GaudiKernel/MsgStream.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "StoreGate/StoreGateSvc.h"
 #include "AthenaKernel/IIOVSvc.h"
@@ -16,7 +14,6 @@
 
 #include "AthenaPoolUtilities/AthenaAttributeList.h"
 #include "AthenaPoolUtilities/CondAttrListCollection.h"
-//#include "CoralBase/Blob.h"
 
 #include <string>
 #include <iostream>
@@ -44,8 +41,6 @@
 #include "TF1.h"
 #include "TLatex.h"
 #include "TList.h"
-
-#include "TMath.h"
 #include "TMathBase.h"
 
 //for truth particles
diff --git a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/ALFA_GloRec/ALFA_GloRec.h b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/ALFA_GloRec/ALFA_GloRec.h
index a05aa65651c640a322b00d682a1c9f81b31fd0a5..f29ee72470224bf6eacff89f7396988ee9134aa9 100644
--- a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/ALFA_GloRec/ALFA_GloRec.h
+++ b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/ALFA_GloRec/ALFA_GloRec.h
@@ -15,14 +15,12 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <dirent.h>
-//#include "typeinfo.h"
 
 #include "AthenaBaseComps/AthAlgorithm.h"
 #include "GaudiKernel/Algorithm.h"
 #include "GaudiKernel/MsgStream.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/Kernel.h"
-//#include "GaudiKernel/PropertyCallbackFunctor.h"
 #include "StoreGate/StoreGateSvc.h"
 #include "EventInfo/EventInfo.h"
 #include "EventInfo/EventID.h"
@@ -61,7 +59,6 @@
 #include "TGraph.h"
 #include "TApplication.h"
 #include "TH2F.h"
-#include "TCanvas.h"
 #include "TPad.h"
 #include "TObjArray.h"
 #include "TObjString.h"
diff --git a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/share/glorecplots.C b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/share/glorecplots.C
index 46cc8e6d1e2432f2616fd109bebc6cb55441435d..16473dd08af20683f3d238bdef27c6de3b794a00 100644
--- a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/share/glorecplots.C
+++ b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_GloRec/share/glorecplots.C
@@ -17,7 +17,6 @@
 #include <cstdlib> 
 #include <stdio.h>
 #include <string>
-#include <iostream>
 #include <fstream>
 #include <ctype.h>
 
diff --git a/ForwardDetectors/FPTracker/src/Point.cxx b/ForwardDetectors/FPTracker/src/Point.cxx
index f3084da4dd868f728fe90e6553353fcb241558e5..5a277b32f2e9d950474843daedb8eefe7423500d 100644
--- a/ForwardDetectors/FPTracker/src/Point.cxx
+++ b/ForwardDetectors/FPTracker/src/Point.cxx
@@ -7,7 +7,6 @@
 #include <sstream>
 #include <cmath>
 #include <stdexcept>
-#include <sstream>
 #include <iomanip>
 namespace FPTracker{
   Point::Point():m_x(0.), m_y(0.), m_z(0.){
diff --git a/ForwardDetectors/FPTracker/src/TransversePoint.cxx b/ForwardDetectors/FPTracker/src/TransversePoint.cxx
index 64a93feb5f85da270c3734d8719f7efc4268986e..cb8cf0727837b0f93d2c4e3e37b9c2d489fd7645 100644
--- a/ForwardDetectors/FPTracker/src/TransversePoint.cxx
+++ b/ForwardDetectors/FPTracker/src/TransversePoint.cxx
@@ -7,7 +7,6 @@
 #include <cmath>
 #include <iomanip>
 #include <stdexcept>
-#include <sstream>
 namespace FPTracker{
   TransversePoint::TransversePoint():m_x(0.), m_y(0.){
   }
diff --git a/ForwardDetectors/FPTracker/src/getAlfaMagnetConfigFiles.cxx b/ForwardDetectors/FPTracker/src/getAlfaMagnetConfigFiles.cxx
index 4a8ffdb6c7a8c675ca5419cda32e63af62f9284b..f11606bfd5214535a29fa69fe9f9c478ab906e8a 100644
--- a/ForwardDetectors/FPTracker/src/getAlfaMagnetConfigFiles.cxx
+++ b/ForwardDetectors/FPTracker/src/getAlfaMagnetConfigFiles.cxx
@@ -7,7 +7,6 @@
 #include "FPTracker/SimpleLogger.h"
 #include "../src/openFile.tpl"
 #include <sstream>
-#include <sstream>
 #include <stdexcept>
 
 namespace FPTracker{
diff --git a/ForwardDetectors/FPTracker/src/getMagnetConfigFiles.cxx b/ForwardDetectors/FPTracker/src/getMagnetConfigFiles.cxx
index ea4adeb61f45039af17e9950b272be8e5f73e7f2..9d0cbafa56f68fe8022311e6330e39ca61d270b3 100644
--- a/ForwardDetectors/FPTracker/src/getMagnetConfigFiles.cxx
+++ b/ForwardDetectors/FPTracker/src/getMagnetConfigFiles.cxx
@@ -7,7 +7,6 @@
 #include "FPTracker/SimpleLogger.h"
 #include "../src/openFile.tpl"
 #include <sstream>
-#include <sstream>
 #include <iostream>
 #include <stdexcept>
 
diff --git a/ForwardDetectors/ForwardTransportFast/src/ForwardTransportFast.cxx b/ForwardDetectors/ForwardTransportFast/src/ForwardTransportFast.cxx
index ef1cc2a0d4efabe72fcc16898bc9896529e94508..1e2f28a0e63f2ef01a36ae53aa42e4995a3bd220 100644
--- a/ForwardDetectors/ForwardTransportFast/src/ForwardTransportFast.cxx
+++ b/ForwardDetectors/ForwardTransportFast/src/ForwardTransportFast.cxx
@@ -60,10 +60,8 @@ StatusCode ForwardTransportFast::execute() {
     std::vector<HepMC::FourVector> fPosVector;
     std::vector<HepMC::FourVector> fMomVector;
     
-    for (HepMC::GenEvent::particle_const_iterator p = gEvent->particles_begin(); p != gEvent->particles_end(); ++p) {
+    for (auto gParticle: *gEvent) {
   
-      HepMC::GenParticle* gParticle = (*p); 
-
       if (gParticle->status() != 1) continue; // take only stable particles
       if (gParticle->end_vertex())  continue; // skip decay vertices
       
diff --git a/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p1_test.cxx b/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p1_test.cxx
index b261ac28c549910dffe8d306890a3cc79aecd446..bfd5304046a61844d9ee58b7731863cc419bb04f 100644
--- a/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p1_test.cxx
+++ b/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p1_test.cxx
@@ -20,6 +20,7 @@
 #include "GeneratorObjectsTPCnv/initMcEventCollection.h"
 #include "AtlasHepMC/GenEvent.h"
 #include "AtlasHepMC/GenParticle.h"
+#include "AtlasHepMC/Operators.h"
 
 
 void compare (const HepMcParticleLink& p1,
diff --git a/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p2_test.cxx b/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p2_test.cxx
index c50beacf6b7e6b90adac32fea915553cb4c75202..c8f44951d69a497f2dd297de3f77d478fbc993a6 100644
--- a/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p2_test.cxx
+++ b/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p2_test.cxx
@@ -19,6 +19,7 @@
 #include "GeneratorObjectsTPCnv/initMcEventCollection.h"
 #include "AtlasHepMC/GenEvent.h"
 #include "AtlasHepMC/GenParticle.h"
+#include "AtlasHepMC/Operators.h"
 
 
 void compare (const HepMcParticleLink& p1,
diff --git a/ForwardDetectors/ZDC/ZdcAnalysis/tools/ZDCTreeAnalysis.C b/ForwardDetectors/ZDC/ZdcAnalysis/tools/ZDCTreeAnalysis.C
index 223f0137777e3f2a39828df6525fd6bf0d347efd..0153fc93c00edc4d6a9254d54fcbd0c735c9f193 100644
--- a/ForwardDetectors/ZDC/ZdcAnalysis/tools/ZDCTreeAnalysis.C
+++ b/ForwardDetectors/ZDC/ZdcAnalysis/tools/ZDCTreeAnalysis.C
@@ -8,10 +8,6 @@
 #include <algorithm>
 #include <cmath>
 
-#include <TH2.h>
-#include <TStyle.h>
-#include <TCanvas.h>
-
 #include <TH2.h>
 #include <TStyle.h>
 #include <TCanvas.h>
@@ -21,8 +17,6 @@
 #include <TLatex.h>
 #include <TPaveStats.h>
 
-#include <cmath>
-
 template <typename T> T Sqr(const T& inT) {return inT*inT;}
 
 void ZDCTreeAnalysis::InitInternal() 
diff --git a/ForwardDetectors/ZDC/ZdcCnv/ZdcByteStream/ZdcByteStream/ZdcByteStreamRawDataV2.h b/ForwardDetectors/ZDC/ZdcCnv/ZdcByteStream/ZdcByteStream/ZdcByteStreamRawDataV2.h
index b9c63fc5f0bb64727e9e7de3b6acc36d01619df2..7794d763919fd8865ba25356bf3e1fbab60c51f5 100644
--- a/ForwardDetectors/ZDC/ZdcCnv/ZdcByteStream/ZdcByteStream/ZdcByteStreamRawDataV2.h
+++ b/ForwardDetectors/ZDC/ZdcCnv/ZdcByteStream/ZdcByteStream/ZdcByteStreamRawDataV2.h
@@ -29,8 +29,6 @@ class StatusCode;
 class ZdcDigits;
 class ZdcDigitsCollection;
 
-#include "xAODTrigL1Calo/TriggerTowerContainer.h"
-
 class ZdcByteStreamRawDataV2: public AthReentrantAlgorithm
 {
 public:
diff --git a/ForwardDetectors/ZDC/ZdcRec/src/ZdcRecChannelTool.cxx b/ForwardDetectors/ZDC/ZdcRec/src/ZdcRecChannelTool.cxx
index 0b2fbe8312e492cf0d6874db899bf3d944401ac5..b2a0d03ccbf7a541b126e59e7779cff05a7e8b3a 100644
--- a/ForwardDetectors/ZDC/ZdcRec/src/ZdcRecChannelTool.cxx
+++ b/ForwardDetectors/ZDC/ZdcRec/src/ZdcRecChannelTool.cxx
@@ -22,22 +22,15 @@
 
 #include <math.h>
 
-//#include <gsl/gsl_errno.h>
-//#include <gsl/gsl_spline.h>
-
 #include "TMath.h"
-//#include "Identifier/HWIdentifier.h"
 
 #include "GaudiKernel/IInterface.h"
 #include "GaudiKernel/MsgStream.h"
 
-
-
 #include "ZdcEvent/ZdcDigits.h"
 #include "ZdcEvent/ZdcDigitsCollection.h"
 #include "ZdcRec/ZdcRecChannelTool.h"
 #include "ZdcRec/ZdcSignalSinc.h"
-//#include "ZdcIdentifier/ZdcID.h"
 #include "ZdcIdentifier/ZdcID.h"
 #include "ZdcConditions/ZdcCablingService.h"
 
diff --git a/ForwardDetectors/ZDC/ZdcRec/src/ZdcRecChannelToolV2.cxx b/ForwardDetectors/ZDC/ZdcRec/src/ZdcRecChannelToolV2.cxx
index 4ce9f9be54448d9b170731283cad7e0f2f1db93c..7feaba6ec0ef946a8ac4fcc00cae060de5dfb20b 100644
--- a/ForwardDetectors/ZDC/ZdcRec/src/ZdcRecChannelToolV2.cxx
+++ b/ForwardDetectors/ZDC/ZdcRec/src/ZdcRecChannelToolV2.cxx
@@ -32,7 +32,6 @@
 #include "ZdcByteStream/ZdcToString.h"
 
 
-//#include "ZdcIdentifier/ZdcID.h"
 #include "ZdcIdentifier/ZdcID.h"
 #include "ZdcConditions/ZdcCablingService.h"
 
diff --git a/Generators/HepMCAnalysis_i/src/GetEvents.cxx b/Generators/HepMCAnalysis_i/src/GetEvents.cxx
index 47c56f63169a6ce056f5a63c4ec0a518b3be7eeb..ac04ca15bf1fa74b69d602e7923a3e2b958add41 100644
--- a/Generators/HepMCAnalysis_i/src/GetEvents.cxx
+++ b/Generators/HepMCAnalysis_i/src/GetEvents.cxx
@@ -15,9 +15,6 @@
 #include "EventInfo/EventID.h"
 #include "GeneratorObjects/McEventCollection.h"
 
-//class HepMCAnalysisGenEvent;
-using HepMCAnalysisGenEvent=HepMC::GenEvent;
-HepMCAnalysisGenEvent* PrepareHepMCAnalysisGenEvent(const HepMC::GenEvent* cevent);
 
 StatusCode   GetRunEventNumber(AthAlgorithm* a,int& runNumber,int& evtNumber,  const std::string im)
 {
@@ -37,7 +34,7 @@ StatusCode   GetRunEventNumber(AthAlgorithm* a,int& runNumber,int& evtNumber,  c
 }
 
 
-StatusCode  GetEvents(AthAlgorithm* a,std::vector<HepMCAnalysisGenEvent*>& evts, const std::string km)
+StatusCode  GetEventsFromCollection(AthAlgorithm* a,std::vector<const HepMC::GenEvent*>& evts, const std::string km)
 {
   // load HepMC info
   const McEventCollection* mcCollptr;
@@ -48,7 +45,7 @@ StatusCode  GetEvents(AthAlgorithm* a,std::vector<HepMCAnalysisGenEvent*>& evts,
 
     // loop over all events in McEventCollection
     for ( McEventCollection::const_iterator itr = mcCollptr->begin(); itr != mcCollptr->end(); ++itr ) {
-	evts.push_back(PrepareHepMCAnalysisGenEvent(*itr));
+	evts.push_back(*itr);
 }
 }
   return StatusCode::SUCCESS;
diff --git a/Generators/HepMCAnalysis_i/src/PrepareHepMCAnalysisGenEvent.cxx b/Generators/HepMCAnalysis_i/src/PrepareHepMCAnalysisGenEvent.cxx
index f1d257a78ddc8ce274fb337ec9e37947e0cc686e..63b7806bca48ab092d20c36c7f79f6edb6569479 100644
--- a/Generators/HepMCAnalysis_i/src/PrepareHepMCAnalysisGenEvent.cxx
+++ b/Generators/HepMCAnalysis_i/src/PrepareHepMCAnalysisGenEvent.cxx
@@ -7,10 +7,12 @@
  */
 #include <vector>
 #include "HepMC/GenEvent.h"
+#include "AthenaBaseComps/AthAlgorithm.h"
 //This tricky convention is needed for usage with HepMC3.
 #ifdef HEPMC3
 #include "HepMC3/GenEvent.h"
 #include "HepMCCompatibility.h"
+StatusCode  GetEventsFromCollection(AthAlgorithm* a,std::vector<const HepMC3::GenEvent*>& evts, const std::string km);
 HepMC::GenEvent* PrepareHepMCAnalysisGenEvent(const HepMC3::GenEvent* cevent)
 {
 HepMC::GenEvent* event = ConvertHepMCGenEvent_3to2(*cevent);
@@ -21,8 +23,15 @@ HepMC::GenEvent* event = ConvertHepMCGenEvent_3to2(*cevent);
   }
   return event;
 }
+StatusCode  GetEvents(AthAlgorithm* a,std::vector<HepMC::GenEvent*>& evts, const std::string km)
+{
+std::vector<const HepMC3::GenEvent*> input;
+StatusCode ret =GetEventsFromCollection(a,input,km);
+for (auto a: input) evts.push_back(PrepareHepMCAnalysisGenEvent(a));
+return ret;
+}
 #else
-using HepMCAnalysisGenEvent=HepMC::GenEvent;
+StatusCode  GetEventsFromCollection(AthAlgorithm* a,std::vector<const HepMC::GenEvent*>& evts, const std::string km);
 HepMC::GenEvent* PrepareHepMCAnalysisGenEvent(const HepMC::GenEvent* cevent)
 {
 //Note: the deep copy solves the issue described in the previous version.
@@ -34,4 +43,11 @@ HepMC::GenEvent* event = new HepMC::GenEvent(*cevent);
   }
   return event;
 }
+StatusCode  GetEvents(AthAlgorithm* a,std::vector<HepMC::GenEvent*>& evts, const std::string km)
+{
+std::vector<const HepMC::GenEvent*> input;
+StatusCode ret =GetEventsFromCollection(a,input,km);
+for (auto a: input) evts.push_back(PrepareHepMCAnalysisGenEvent(a));
+return ret;
+}
 #endif
diff --git a/HLT/Event/ByteStreamEmonSvc/src/ByteStreamEmonInputSvc.cxx b/HLT/Event/ByteStreamEmonSvc/src/ByteStreamEmonInputSvc.cxx
index b689a76c1156b536f24a720098277750dabddcff..686ed13b4cff175aa4649b128107e77e33f06bf0 100644
--- a/HLT/Event/ByteStreamEmonSvc/src/ByteStreamEmonInputSvc.cxx
+++ b/HLT/Event/ByteStreamEmonSvc/src/ByteStreamEmonInputSvc.cxx
@@ -34,6 +34,8 @@
 #include <boost/algorithm/string.hpp>
 #include <boost/preprocessor/repetition.hpp>
 
+#include <memory>
+
 namespace {
 
     // pure madness...
@@ -155,7 +157,7 @@ bool ByteStreamEmonInputSvc::getIterator()
     delete m_provider;
     m_provider = nullptr;
 
-    std::auto_ptr<emon::SamplingAddress> address;
+    std::unique_ptr<emon::SamplingAddress> address;
 
     if(m_key_count > 0) {
         address.reset(new emon::SamplingAddress(m_key, m_key_count));
diff --git a/HLT/Trigger/TrigControl/TrigPSC/share/TrigPSCPythonSetup.py b/HLT/Trigger/TrigControl/TrigPSC/share/TrigPSCPythonSetup.py
index b3eaa2e67cd102a9a7a784bf3efb5e3669816836..efcc5441a96542d23c41e77df65fd9d0e78c3d3a 100755
--- a/HLT/Trigger/TrigControl/TrigPSC/share/TrigPSCPythonSetup.py
+++ b/HLT/Trigger/TrigControl/TrigPSC/share/TrigPSCPythonSetup.py
@@ -179,15 +179,9 @@ else:
    if PscConfig.dumpJobProperties:
       from AthenaCommon import ConfigurationShelve
       from TrigConfIO.JsonUtils import create_joboptions_json
-      ConfigurationShelve.storeJobOptionsCatalogue('HLTJobOptions.pkl')
       fname = 'HLTJobOptions'
-      with open(fname+'.pkl', "rb") as f:
-         import pickle
-         jocat = pickle.load(f)   # basic job properties
-         jocfg = pickle.load(f)   # some specialized services
-         jocat.update(jocfg)       # merge the two dictionaries
-         psclog.info('Dumping joboptions to "%s.json"', fname)
-         create_joboptions_json(jocat, fname+".json")
+      ConfigurationShelve.storeJobOptionsCatalogue(fname+".pkl")
+      create_joboptions_json(fname+".pkl",fname+".json")
 
       if PscConfig.exitAfterDump:
          theApp.exit(0)
diff --git a/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.cxx b/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.cxx
index 915a5173ba7f6dac21b79813c66edc1c36851ba7..19dbc13a7472f481ed3b458f52dcabd57d424607 100644
--- a/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.cxx
+++ b/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.cxx
@@ -6,7 +6,6 @@
 #include "HltEventLoopMgr.h"
 #include "TrigCOOLUpdateHelper.h"
 #include "TrigKernel/HltExceptions.h"
-#include "TrigSORFromPtreeHelper.h"
 #include "TrigRDBManager.h"
 #include "TrigSteeringEvent/HLTResultMT.h"
 
@@ -20,15 +19,10 @@
 
 // Gaudi includes
 #include "GaudiKernel/ConcurrencyFlags.h"
-#include "GaudiKernel/IAlgExecStateSvc.h"
 #include "GaudiKernel/IAlgManager.h"
 #include "GaudiKernel/IAlgorithm.h"
-#include "GaudiKernel/IAlgResourcePool.h"
 #include "GaudiKernel/IEvtSelector.h"
-#include "GaudiKernel/IHiveWhiteBoard.h"
 #include "GaudiKernel/IProperty.h"
-#include "GaudiKernel/IScheduler.h"
-#include "GaudiKernel/IIoComponentMgr.h"
 #include "GaudiKernel/IIoComponent.h"
 #include "GaudiKernel/ThreadLocalContext.h"
 
@@ -53,9 +47,9 @@
     if (sccopy.isFailure()) {                     \
       ATH_MSG_ERROR(errmsg);                      \
       const EventContext& ctx                     \
-        = evctx ? *evctx : EventContext();        \
+        = (evctx) ? *(evctx) : EventContext();    \
       if (failedEvent(errcode,ctx).isFailure()) { \
-        if (delctx) {delete evctx;}               \
+        if (delctx) {delete (evctx);}             \
         return retonfail;                         \
       }                                           \
       else                                        \
@@ -83,22 +77,7 @@ using namespace boost::property_tree;
 // Standard constructor
 // =============================================================================
 HltEventLoopMgr::HltEventLoopMgr(const std::string& name, ISvcLocator* svcLoc)
-: base_class(name, svcLoc),
-  m_incidentSvc("IncidentSvc", name),
-  m_jobOptionsSvc("JobOptionsSvc", name),
-  m_evtStore("StoreGateSvc", name),
-  m_detectorStore("DetectorStore", name),
-  m_inputMetaDataStore("StoreGateSvc/InputMetaDataStore", name),
-  m_ioCompMgr("IoComponentMgr", name)
-{
-}
-
-// =============================================================================
-// Standard destructor
-// =============================================================================
-HltEventLoopMgr::~HltEventLoopMgr()
-{
-}
+: base_class(name, svcLoc) {}
 
 // =============================================================================
 // Reimplementation of AthService::initalize (IStateful interface)
@@ -152,7 +131,7 @@ StatusCode HltEventLoopMgr::initialize()
   if (!threads.empty())
     ATH_MSG_INFO(" ---> NumThreads              = " << threads);
   else
-   ATH_MSG_WARNING("Failed to retrieve the job property AvalancheSchedulerSvc.ThreadPoolSize");
+    ATH_MSG_WARNING("Failed to retrieve the job property AvalancheSchedulerSvc.ThreadPoolSize");
 
   //----------------------------------------------------------------------------
   // Setup all Hive services for multithreaded event processing with the exception of SchedulerSvc,
@@ -245,7 +224,7 @@ StatusCode HltEventLoopMgr::finalize()
   ATH_MSG_INFO("Total number of EventContext objects created " << m_localEventNumber);
 
   // Release all handles
-  auto releaseAndCheck = [&](auto& handle, std::string handleType) {
+  auto releaseAndCheck = [&](auto& handle, std::string_view handleType) {
     if (handle.release().isFailure())
       ATH_MSG_WARNING("finalize(): Failed to release " << handleType << " " << handle.typeAndName());
   };
@@ -405,7 +384,7 @@ StatusCode HltEventLoopMgr::hltUpdateAfterFork(const ptree& /*pt*/)
     worker_dir /= oss.str();
     // Delete worker directory if it exists already
     if ( boost::filesystem::exists(worker_dir) ) {
-      if ( !boost::filesystem::remove_all(worker_dir) ) {
+      if ( boost::filesystem::remove_all(worker_dir) == 0 ) {
         ATH_MSG_FATAL("Cannot delete previous worker directory " << worker_dir);
         return StatusCode::FAILURE;
       }
@@ -421,7 +400,7 @@ StatusCode HltEventLoopMgr::hltUpdateAfterFork(const ptree& /*pt*/)
 
   // Start the timeout thread
   ATH_MSG_DEBUG("Starting the timeout thread");
-  m_timeoutThread.reset(new std::thread(std::bind(&HltEventLoopMgr::runEventTimer,this)));
+  m_timeoutThread = std::make_unique<std::thread>(std::bind(&HltEventLoopMgr::runEventTimer,this));
 
   // Initialise vector of time points for event timeout monitoring
   {
@@ -546,7 +525,7 @@ StatusCode HltEventLoopMgr::nextEvent(int /*maxevt*/)
       auto eventContext = SG::makeHandle(m_eventContextWHKey,*eventContextPtr);
       HLT_EVTLOOP_CHECK(eventContext.record(std::move(eventContextPtr)),
                         "Failed to record new EventContext in the event store",
-                        HLT::OnlineErrorCode::BEFORE_NEXT_EVENT, eventContextPtr.get());
+                        HLT::OnlineErrorCode::BEFORE_NEXT_EVENT, eventContext.ptr());
 
       // Reset the AlgExecStateSvc
       m_aess->reset(*eventContext);
@@ -630,7 +609,7 @@ StatusCode HltEventLoopMgr::nextEvent(int /*maxevt*/)
       ATH_MSG_DEBUG("Retrieved event info for the new event " << *eventInfo);
 
       // Set EventID for the EventContext
-      EventIDBase eid = eventIDFromxAOD(eventInfo.cptr());
+      EventID eid = eventIDFromxAOD(eventInfo.cptr());
       // Override run/LB/timestamp if needed
       if (m_forceRunNumber > 0) {
         eid.set_run_number(m_forceRunNumber);
@@ -639,8 +618,8 @@ StatusCode HltEventLoopMgr::nextEvent(int /*maxevt*/)
         eid.set_lumi_block(m_forceLumiblock);
       }
       if (m_forceSOR_ns > 0) {
-        eid.set_time_stamp(m_forceSOR_ns / 1000000000);
-        eid.set_time_stamp_ns_offset(m_forceSOR_ns % 1000000000);
+        eid.set_time_stamp(m_forceSOR_ns / std::nano::den);
+        eid.set_time_stamp_ns_offset(m_forceSOR_ns % std::nano::den);
       }
       eventContext->setEventID(eid);
 
@@ -691,7 +670,7 @@ StatusCode HltEventLoopMgr::nextEvent(int /*maxevt*/)
         ATH_MSG_WARNING("Recoverable error in draining scheduler, continuing the event loop");
         continue;
       }
-      else if (drainResult==DrainSchedulerStatusCode::SCHEDULER_EMPTY && !events_available) {
+      if (drainResult==DrainSchedulerStatusCode::SCHEDULER_EMPTY && !events_available) {
         ATH_MSG_INFO("All events processed, finalising the event loop");
         loop_ended = true;
       }
@@ -715,15 +694,12 @@ StatusCode HltEventLoopMgr::stopRun() {
 // Implementation of IEventProcessor::createEventContext
 // =============================================================================
 EventContext HltEventLoopMgr::createEventContext() {
-
   auto slot = m_whiteboard->allocateStore(m_localEventNumber); // returns npos on failure
   if (slot == std::string::npos) {
     // return an invalid EventContext
     return EventContext();
-  } else {
-    return EventContext{ m_localEventNumber, slot };
   }
-
+  return EventContext{ m_localEventNumber, slot };
 }
 
 // =============================================================================
@@ -739,7 +715,7 @@ StatusCode HltEventLoopMgr::executeEvent(EventContext &&ctx)
   // Note this is time of a scheduler slot being free, not equal to the time of a whiteboard slot being free
   const auto slotIdleTime = std::chrono::steady_clock::now() - m_freeSlotStartPoint[ctx.slot()];
   Monitored::Scalar<int64_t> monSlotIdleTime("SlotIdleTime", std::chrono::duration_cast<std::chrono::milliseconds>(slotIdleTime).count());
-  auto mon = Monitored::Group(m_monTool, monSlotIdleTime);
+  Monitored::Group(m_monTool, monSlotIdleTime);
 
   // Now add event to the scheduler
   ATH_MSG_DEBUG("Adding event " <<  ctx.evt() << ", slot " << ctx.slot() << " to the scheduler");
@@ -747,7 +723,7 @@ StatusCode HltEventLoopMgr::executeEvent(EventContext &&ctx)
 
   // If this fails, we need to wait for something to complete
   if (addEventStatus.isFailure()){
-    ATH_MSG_ERROR("Failed adding event " << ctx.evt() << ", slot " << ctx.slot() << " to the scheduler");
+    ATH_MSG_ERROR("Failed adding event to the scheduler");
     return StatusCode::FAILURE;
   }
 
@@ -844,7 +820,7 @@ StatusCode HltEventLoopMgr::updateMagField(const ptree& pt) const
       const IAlgManager* algMgr = Gaudi::svcLocator()->as<IAlgManager>();
       IAlgorithm* fieldAlg{nullptr};
       algMgr->getAlgorithm("AtlasFieldMapCondAlg", fieldAlg).ignore();
-      if ( fieldAlg ) {
+      if ( fieldAlg != nullptr ) {
         ATH_MSG_INFO("Setting field currents on AtlasFieldMapCondAlg");
         ATH_CHECK( Gaudi::Utils::setProperty(fieldAlg, "MapSoleCurrent", sol_cur) );
         ATH_CHECK( Gaudi::Utils::setProperty(fieldAlg, "MapToroCurrent", tor_cur) );
@@ -926,7 +902,7 @@ void HltEventLoopMgr::printSORAttrList(const coral::AttributeList& atr) const
   unsigned long long sorTime_ns(atr["SORTime"].data<unsigned long long>());
 
   // Human readable format of SOR time if available
-  time_t sorTime_sec = sorTime_ns/1000000000;
+  time_t sorTime_sec = sorTime_ns / std::nano::den;
   const auto sorTime_readable = OWLTime(sorTime_sec);
 
   ATH_MSG_INFO("SOR parameters:");
@@ -968,7 +944,7 @@ StatusCode HltEventLoopMgr::failedEvent(HLT::OnlineErrorCode errorCode, const Ev
                     << m_maxFrameworkErrors.value() << ", was exceeded. Exiting the event loop.");
       return StatusCode::FAILURE; // break the event loop
     }
-    else return StatusCode::SUCCESS; // continue the event loop
+    return StatusCode::SUCCESS; // continue the event loop
   };
 
   //----------------------------------------------------------------------------
@@ -981,19 +957,19 @@ StatusCode HltEventLoopMgr::failedEvent(HLT::OnlineErrorCode errorCode, const Ev
       << " all slots of this HltEventLoopMgr instance will be drained before proceeding.");
     return drainAllAndProceed();
   }
-  else if (errorCode==HLT::OnlineErrorCode::AFTER_RESULT_SENT) {
+  if (errorCode==HLT::OnlineErrorCode::AFTER_RESULT_SENT) {
     ATH_MSG_ERROR("Failure occurred with OnlineErrorCode=" << errorCode
       << " meaning there was a framework error after HLT result was already sent out."
       << " All slots of this HltEventLoopMgr instance will be drained before proceeding.");
     return drainAllAndProceed();
   }
-  else if (errorCode==HLT::OnlineErrorCode::CANNOT_ACCESS_SLOT) {
+  if (errorCode==HLT::OnlineErrorCode::CANNOT_ACCESS_SLOT) {
     ATH_MSG_ERROR("Failed to access the slot for the processed event, cannot produce output. OnlineErrorCode=" << errorCode
       << ". All slots of this HltEventLoopMgr instance will be drained before proceeding, then either the loop will"
       << " exit with a failure code or the failed event will reach a hard timeout.");
     return drainAllAndProceed();
   }
-  else if (!eventContext.valid()) {
+  if (!eventContext.valid()) {
     ATH_MSG_ERROR("Failure occurred with an invalid EventContext. Likely there was a framework error before"
       << " requesting a new event or after sending the result of a finished event. OnlineErrorCode=" << errorCode
       << ". All slots of this HltEventLoopMgr instance will be drained before proceeding.");
@@ -1084,7 +1060,7 @@ StatusCode HltEventLoopMgr::failedEvent(HLT::OnlineErrorCode errorCode, const Ev
   int64_t eventTimeMillisec = std::chrono::duration_cast<std::chrono::milliseconds>(eventTime).count();
   auto monTimeAny = Monitored::Scalar<int64_t>("TotalTime", eventTimeMillisec);
   auto monTimeAcc = Monitored::Scalar<int64_t>("TotalTimeAccepted", eventTimeMillisec);
-  auto mon = Monitored::Group(m_monTool, monTimeAny, monTimeAcc);
+  Monitored::Group(m_monTool, monTimeAny, monTimeAcc);
 
   //----------------------------------------------------------------------------
   // Try to build and send the output
@@ -1098,7 +1074,7 @@ StatusCode HltEventLoopMgr::failedEvent(HLT::OnlineErrorCode errorCode, const Ev
   }
 
   DataObject* hltResultDO = m_evtStore->accessData(hltResultWH.clid(),hltResultWH.key());
-  if (!hltResultDO) {
+  if (hltResultDO == nullptr) {
     ATH_MSG_ERROR("Failed to retrieve DataObject for the HLT result object while handling a failed event."
       << " No HLT result can be recorded for this event. OnlineErrorCode=" << errorCode
       << ", local event number " << eventContext.evt() << ", slot " << eventContext.slot()
@@ -1107,7 +1083,7 @@ StatusCode HltEventLoopMgr::failedEvent(HLT::OnlineErrorCode errorCode, const Ev
   }
 
   IOpaqueAddress* addr = nullptr;
-  if (m_outputCnvSvc->createRep(hltResultDO,addr).isFailure() || !addr) {
+  if (m_outputCnvSvc->createRep(hltResultDO,addr).isFailure() || addr == nullptr) {
     ATH_MSG_ERROR("Conversion of HLT result object to the output format failed while handling a failed event."
       << " No HLT result can be recorded for this event. OnlineErrorCode=" << errorCode
       << ", local event number " << eventContext.evt() << ", slot " << eventContext.slot()
@@ -1132,7 +1108,7 @@ StatusCode HltEventLoopMgr::failedEvent(HLT::OnlineErrorCode errorCode, const Ev
   // Clear the event data slot
   //----------------------------------------------------------------------------
   // Need to copy the event context because it's managed by the event store and clearWBSlot deletes it
-  EventContext eventContextCopy = eventContext;
+  const EventContext eventContextCopy = eventContext;
   if (clearWBSlot(eventContext.slot()).isFailure())
     return failedEvent(HLT::OnlineErrorCode::AFTER_RESULT_SENT,eventContextCopy);
 
@@ -1237,7 +1213,7 @@ HltEventLoopMgr::DrainSchedulerStatusCode HltEventLoopMgr::drainScheduler()
     // Basic checks, select slot, retrieve event info
     //--------------------------------------------------------------------------
     // Check if the EventContext object exists
-    if (!thisFinishedEvtContext) markFailed();
+    if (thisFinishedEvtContext == nullptr) markFailed();
     HLT_DRAINSCHED_CHECK(sc, "Detected nullptr EventContext while finalising a processed event",
                          HLT::OnlineErrorCode::CANNOT_ACCESS_SLOT, thisFinishedEvtContext);
 
@@ -1289,7 +1265,7 @@ HltEventLoopMgr::DrainSchedulerStatusCode HltEventLoopMgr::drainScheduler()
                          HLT::OnlineErrorCode::NO_HLT_RESULT, thisFinishedEvtContext);
 
     DataObject* hltResultDO = m_evtStore->accessData(hltResult.clid(),hltResult.key());
-    if (!hltResultDO) markFailed();
+    if (hltResultDO == nullptr) markFailed();
     HLT_DRAINSCHED_CHECK(sc, "Failed to retrieve the HLTResult DataObject",
                          HLT::OnlineErrorCode::NO_HLT_RESULT, thisFinishedEvtContext);
 
@@ -1317,7 +1293,7 @@ HltEventLoopMgr::DrainSchedulerStatusCode HltEventLoopMgr::drainScheduler()
                           HLT::OnlineErrorCode::OUTPUT_BUILD_FAILURE, thisFinishedEvtContext);
 
       DataObject* l1TriggerResultDO = m_evtStore->accessData(l1TriggerResult.clid(),l1TriggerResult.key());
-      if (!l1TriggerResultDO) markFailed();
+      if (l1TriggerResultDO == nullptr) markFailed();
       HLT_DRAINSCHED_CHECK(sc, "Failed to retrieve the L1 Trigger Result DataObject for RewriteLVL1",
                           HLT::OnlineErrorCode::OUTPUT_BUILD_FAILURE, thisFinishedEvtContext);
 
@@ -1376,7 +1352,7 @@ HltEventLoopMgr::DrainSchedulerStatusCode HltEventLoopMgr::drainScheduler()
     // Fill the time monitoring histograms
     auto monTimeAny = Monitored::Scalar<int64_t>("TotalTime", eventTimeMillisec);
     auto monTimeAcc = Monitored::Scalar<int64_t>(eventAccepted ? "TotalTimeAccepted" : "TotalTimeRejected", eventTimeMillisec);
-    auto mon = Monitored::Group(m_monTool, monTimeAny, monTimeAcc);
+    Monitored::Group(m_monTool, monTimeAny, monTimeAcc);
 
     // Set ThreadLocalContext to an invalid context as we entering a context-less environment
     Gaudi::Hive::setCurrentContext( EventContext() );
diff --git a/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.h b/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.h
index 19f8c538a8e3da6fc6fdda434483cc6f1a2b9d3a..22a0170ff789ac7014d6a564b2e021bedb012752 100644
--- a/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.h
+++ b/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.h
@@ -6,6 +6,7 @@
 #define TRIGSERVICES_HLTEVENTLOOPMGR_H
 
 // Trigger includes
+#include "TrigSORFromPtreeHelper.h"
 #include "TrigKernel/ITrigEventLoopMgr.h"
 #include "TrigOutputHandling/HLTResultMTMaker.h"
 #include "TrigSteeringEvent/OnlineErrorCode.h"
@@ -28,6 +29,11 @@
 #include "GaudiKernel/IEventProcessor.h"
 #include "GaudiKernel/IEvtSelector.h"
 #include "GaudiKernel/IConversionSvc.h"
+#include "GaudiKernel/IAlgResourcePool.h"
+#include "GaudiKernel/IAlgExecStateSvc.h"
+#include "GaudiKernel/IHiveWhiteBoard.h"
+#include "GaudiKernel/IScheduler.h"
+#include "GaudiKernel/IIoComponentMgr.h"
 #include "GaudiKernel/SmartIF.h"
 #include "Gaudi/Interfaces/IOptionsSvc.h"
 
@@ -43,16 +49,10 @@
 
 // Forward declarations
 class CondAttrListCollection;
-class IAlgExecStateSvc;
 class IAlgorithm;
-class IAlgResourcePool;
-class IHiveWhiteBoard;
 class IIncidentSvc;
-class IScheduler;
 class StoreGateSvc;
 class TrigCOOLUpdateHelper;
-class TrigSORFromPtreeHelper;
-class IIoComponentMgr;
 
 namespace coral {
   class AttributeList;
@@ -73,7 +73,7 @@ public:
   /// Standard constructor
   HltEventLoopMgr(const std::string& name, ISvcLocator* svcLoc);
   /// Standard destructor
-  virtual ~HltEventLoopMgr();
+  virtual ~HltEventLoopMgr() = default;
 
   /// @name Gaudi state transitions (overriden from AthService)
   ///@{
@@ -172,12 +172,12 @@ private:
   StatusCode drainAllSlots();
 
   // ------------------------- Handles to required services/tools --------------
-  ServiceHandle<IIncidentSvc>        m_incidentSvc;
-  ServiceHandle<Gaudi::Interfaces::IOptionsSvc>      m_jobOptionsSvc;
-  ServiceHandle<StoreGateSvc>        m_evtStore;
-  ServiceHandle<StoreGateSvc>        m_detectorStore;
-  ServiceHandle<StoreGateSvc>        m_inputMetaDataStore;
-  ServiceHandle<IIoComponentMgr>     m_ioCompMgr;
+  ServiceHandle<IIncidentSvc>        m_incidentSvc{this, "IncidentSvc", "IncidentSvc"};
+  ServiceHandle<Gaudi::Interfaces::IOptionsSvc> m_jobOptionsSvc{this, "JobOptionsSvc", "JobOptionsSvc"};
+  ServiceHandle<StoreGateSvc>        m_evtStore{this, "EventStore", "StoreGateSvc"};
+  ServiceHandle<StoreGateSvc>        m_detectorStore{this, "DetectorStore", "DetectorStore"};
+  ServiceHandle<StoreGateSvc>        m_inputMetaDataStore{this, "InputMetaDataStore", "StoreGateSvc/InputMetaDataStore"};
+  ServiceHandle<IIoComponentMgr>     m_ioCompMgr{this, "IoComponentMgr", "IoComponentMgr"};
   ServiceHandle<IEvtSelector>        m_evtSelector{this, "EvtSel", "EvtSel"};
   ServiceHandle<IConversionSvc>      m_outputCnvSvc{this, "OutputCnvSvc", "OutputCnvSvc"};
   ServiceHandle<ISchedulerMonSvc>    m_schedulerMonSvc{this, "SchedulerMonSvc", "SchedulerMonSvc"};
diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigALFAROBMonitor.py b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigALFAROBMonitor.py
index f0a0a3f06b581c626bcfaa83e4c829841f236176..1d416143e5e2477b40c3f35dc1f56b323f4cb75c 100755
--- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigALFAROBMonitor.py
+++ b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigALFAROBMonitor.py
@@ -17,167 +17,204 @@ topSequence = AlgSequence()
 topSequence += ALFAROBMonitor
 
 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
-monTool = GenericMonitoringTool('monTool')
-monTool.HistPath="ALFAROBMonitor/python"
+#monTool1 = GenericMonitoringTool('MonTool1')
+#monTool1.HistPath="ALFAROBMonitor/python_kk_background"
+#monTool = GenericMonitoringTool('MonTool')
+#monTool.HistPath="ALFAROBMonitor/python_kk"
+#ALFAROBMonitor.MonTool += [monTool, monTool1]
+
+monToolTrackingElast = GenericMonitoringTool('MonTool_trackingElast', HistPath='ALFAROBMonitor'+'/MTtracking/elast/current')
+monToolTrackingAny = GenericMonitoringTool('MonTool_trackingAny', HistPath='ALFAROBMonitor'+'/MTtracking/any/current')
+monToolTrackingElast_1LB = GenericMonitoringTool('MonTool_trackingElast_1LB', HistPath='ALFAROBMonitor'+'/MTtracking/elast/1LB')
+monToolTrackingAny_1LB = GenericMonitoringTool('MonTool_trackingAny_1LB', HistPath='ALFAROBMonitor'+'/MTtracking/any/1LB')
+monToolTrackingElast_10LB = GenericMonitoringTool('MonTool_trackingElast_10LB', HistPath='ALFAROBMonitor'+'/MTtracking/elast/10LB')
+monToolTrackingAny_10LB = GenericMonitoringTool('MonTool_trackingAny_10LB', HistPath='ALFAROBMonitor'+'/MTtracking/any/10LB')
+monToolTrackingElast_60LB = GenericMonitoringTool('MonTool_trackingElast_60LB', HistPath='ALFAROBMonitor'+'/MTtracking/elast/60LB')
+monToolTrackingAny_60LB = GenericMonitoringTool('MonTool_trackingAny_60LB', HistPath='ALFAROBMonitor'+'/MTtracking/any/60LB')
+monToolTrackingElast_SB = GenericMonitoringTool('MonTool_trackingElast_SB', HistPath='ALFAROBMonitor'+'/MTtracking/elast/SB')
+monToolTrackingAny_SB = GenericMonitoringTool('MonTool_trackingAny_SB', HistPath='ALFAROBMonitor'+'/MTtracking/any/SB')
+
+monToolCommon = GenericMonitoringTool('MonTool_common', HistPath='ALFAROBMonitor'+'/MTcommon')
+
+monToolOD_B7L1U = GenericMonitoringTool('MonTool_OD_B7L1U', HistPath='ALFAROBMonitor'+'/MTOD/B7L1U')
+monToolOD_B7L1L = GenericMonitoringTool('MonTool_OD_B7L1L', HistPath='ALFAROBMonitor'+'/MTOD/B7L1L')
+monToolOD_A7L1U = GenericMonitoringTool('MonTool_OD_A7L1U', HistPath='ALFAROBMonitor'+'/MTOD/A7L1U')
+monToolOD_A7L1L = GenericMonitoringTool('MonTool_OD_A7L1L', HistPath='ALFAROBMonitor'+'/MTOD/A7L1L')
+monToolOD_A7R1U = GenericMonitoringTool('MonTool_OD_A7R1U', HistPath='ALFAROBMonitor'+'/MTOD/A7R1U')
+monToolOD_A7R1L = GenericMonitoringTool('MonTool_OD_A7R1L', HistPath='ALFAROBMonitor'+'/MTOD/A7R1L')
+monToolOD_B7R1U = GenericMonitoringTool('MonTool_OD_B7R1U', HistPath='ALFAROBMonitor'+'/MTOD/B7R1U')
+monToolOD_B7R1L = GenericMonitoringTool('MonTool_OD_B7R1L', HistPath='ALFAROBMonitor'+'/MTOD/B7R1L')
+
+monToolDetectors = GenericMonitoringTool('MonTool_detectors', HistPath='ALFAROBMonitor'+'/MTdetectors')
+
+monToolBackgroundElast15 = GenericMonitoringTool('MonTool_backgroundElast15', HistPath='ALFAROBMonitor'+'/MTbackground/elast15/current')
+monToolBackgroundElast18 = GenericMonitoringTool('MonTool_backgroundElast18', HistPath='ALFAROBMonitor'+'/MTbackground/elast18/current')
+monToolBackgroundSyst17 = GenericMonitoringTool('MonTool_backgroundSyst17', HistPath='ALFAROBMonitor'+'/MTbackground/syst17/current')
+monToolBackgroundSyst18 = GenericMonitoringTool('MonTool_backgroundSyst18', HistPath='ALFAROBMonitor'+'/MTbackground/syst18/current')
+
+monToolBackgroundElast15_1LB = GenericMonitoringTool('MonTool_backgroundElast15_1LB', HistPath='ALFAROBMonitor'+'/MTbackground/elast15/1LB')
+monToolBackgroundElast18_1LB = GenericMonitoringTool('MonTool_backgroundElast18_1LB', HistPath='ALFAROBMonitor'+'/MTbackground/elast18/1LB')
+monToolBackgroundSyst17_1LB = GenericMonitoringTool('MonTool_backgroundSyst17_1LB', HistPath='ALFAROBMonitor'+'/MTbackground/syst17/1LB')
+monToolBackgroundSyst18_1LB = GenericMonitoringTool('MonTool_backgroundSyst18_1LB', HistPath='ALFAROBMonitor'+'/MTbackground/syst18/1LB')
+
+monToolBackgroundElast15_10LB = GenericMonitoringTool('MonTool_backgroundElast15_10LB', HistPath='ALFAROBMonitor'+'/MTbackground/elast15/10LB')
+monToolBackgroundElast18_10LB = GenericMonitoringTool('MonTool_backgroundElast18_10LB', HistPath='ALFAROBMonitor'+'/MTbackground/elast18/10LB')
+monToolBackgroundSyst17_10LB = GenericMonitoringTool('MonTool_backgroundSyst17_10LB', HistPath='ALFAROBMonitor'+'/MTbackground/syst17/10LB')
+monToolBackgroundSyst18_10LB = GenericMonitoringTool('MonTool_backgroundSyst18_10LB', HistPath='ALFAROBMonitor'+'/MTbackground/syst18/10LB')
+
+monToolBackgroundElast15_60LB = GenericMonitoringTool('MonTool_backgroundElast15_60LB', HistPath='ALFAROBMonitor'+'/MTbackground/elast15/60LB')
+monToolBackgroundElast18_60LB = GenericMonitoringTool('MonTool_backgroundElast18_60LB', HistPath='ALFAROBMonitor'+'/MTbackground/elast18/60LB')
+monToolBackgroundSyst17_60LB = GenericMonitoringTool('MonTool_backgroundSyst17_60LB', HistPath='ALFAROBMonitor'+'/MTbackground/syst17/60LB')
+monToolBackgroundSyst18_60LB = GenericMonitoringTool('MonTool_backgroundSyst18_60LB', HistPath='ALFAROBMonitor'+'/MTbackground/syst18/60LB')
+
+ALFAROBMonitor.MonTools += [monToolCommon, monToolDetectors]
+ALFAROBMonitor.MonTools += [monToolBackgroundElast15,      monToolBackgroundElast18,      monToolBackgroundSyst17,      monToolBackgroundSyst18]
+ALFAROBMonitor.MonTools += [monToolBackgroundElast15_1LB,  monToolBackgroundElast18_1LB,  monToolBackgroundSyst17_1LB,  monToolBackgroundSyst18_1LB]
+ALFAROBMonitor.MonTools += [monToolBackgroundElast15_10LB, monToolBackgroundElast18_10LB, monToolBackgroundSyst17_10LB, monToolBackgroundSyst18_10LB]
+ALFAROBMonitor.MonTools += [monToolBackgroundElast15_60LB, monToolBackgroundElast18_60LB, monToolBackgroundSyst17_60LB, monToolBackgroundSyst18_60LB]
+ALFAROBMonitor.MonTools += [monToolTrackingElast, monToolTrackingAny, monToolTrackingElast_1LB, monToolTrackingAny_1LB]
+ALFAROBMonitor.MonTools += [monToolTrackingElast_10LB, monToolTrackingAny_10LB, monToolTrackingElast_60LB, monToolTrackingAny_60LB]
+ALFAROBMonitor.MonTools += [monToolOD_B7L1U, monToolOD_B7L1L, monToolOD_A7L1U, monToolOD_A7L1L, monToolOD_A7R1U, monToolOD_A7R1L, monToolOD_B7R1U, monToolOD_B7R1L] 
 
 # common
-monTool.defineHistogram("com-LB,goodDataAssessmentLB15", type='TH2F', path='EXPERT', title='goodDataAssessmentLB15', xbins=1000, xmin=-0.5, xmax=999.5, ybins=2, ymin=0.5, ymax=2.5 )
-monTool.defineHistogram("com-LB,goodDataAssessmentLB18", type='TH2F', path='EXPERT', title='goodDataAssessmentLB18', xbins=1000, xmin=-0.5, xmax=999.5, ybins=2, ymin=0.5, ymax=2.5 )
-monTool.defineHistogram("com-goodDataAssessment",        type='TH1F', path='EXPERT', title='goodDataAssessment',     xbins=10,   xmin=-0.5, xmax=9.5 )
-
-#detector
-monTool.defineHistogram("det-B7L1U-Channel,PMF", type='TH2F', path='EXPERT', title='B7L1U activity', xbins=64, xmin=0., xmax=64., ybins=23, ymin=1.,ymax=24.)
-monTool.defineHistogram("det-B7L1L-Channel,PMF", type='TH2F', path='EXPERT', title='B7L1L activity', xbins=64, xmin=0., xmax=64., ybins=23, ymin=1.,ymax=24.)
-monTool.defineHistogram("det-A7L1U-Channel,PMF", type='TH2F', path='EXPERT', title='A7L1U activity', xbins=64, xmin=0., xmax=64., ybins=23, ymin=1.,ymax=24.)
-monTool.defineHistogram("det-A7L1L-Channel,PMF", type='TH2F', path='EXPERT', title='A7L1L activity', xbins=64, xmin=0., xmax=64., ybins=23, ymin=1.,ymax=24.)
-monTool.defineHistogram("det-A7R1U-Channel,PMF", type='TH2F', path='EXPERT', title='A7R1U activity', xbins=64, xmin=0., xmax=64., ybins=23, ymin=1.,ymax=24.)
-monTool.defineHistogram("det-A7R1L-Channel,PMF", type='TH2F', path='EXPERT', title='A7R1L activity', xbins=64, xmin=0., xmax=64., ybins=23, ymin=1.,ymax=24.)
-monTool.defineHistogram("det-B7R1U-Channel,PMF", type='TH2F', path='EXPERT', title='B7R1U activity', xbins=64, xmin=0., xmax=64., ybins=23, ymin=1.,ymax=24.)
-monTool.defineHistogram("det-B7R1L-Channel,PMF", type='TH2F', path='EXPERT', title='B7R1L activity', xbins=64, xmin=0., xmax=64., ybins=23, ymin=1.,ymax=24.)
-
-monTool.defineHistogram("trk-full-elastic-B7L1U-x,y", type='TH2F', path='EXPERT', title='B7L1U f elastic', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-elastic-B7L1L-x,y", type='TH2F', path='EXPERT', title='B7L1L f elastic', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-elastic-A7L1U-x,y", type='TH2F', path='EXPERT', title='A7L1U f elastic', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-elastic-A7L1L-x,y", type='TH2F', path='EXPERT', title='A7L1L f elastic', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-elastic-A7R1U-x,y", type='TH2F', path='EXPERT', title='A7R1U f elastic', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-elastic-A7R1L-x,y", type='TH2F', path='EXPERT', title='A7R1L f elastic', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-elastic-B7R1U-x,y", type='TH2F', path='EXPERT', title='B7R1U f elastic', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-elastic-B7R1L-x,y", type='TH2F', path='EXPERT', title='B7R1L f elastic', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-
-monTool.defineHistogram("trk-full-elastic_ALFA_BG-B7L1U-x,y", type='TH2F', path='EXPERT', title='B7L1U f elastic ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-elastic_ALFA_BG-B7L1L-x,y", type='TH2F', path='EXPERT', title='B7L1L f elastic ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-elastic_ALFA_BG-A7L1U-x,y", type='TH2F', path='EXPERT', title='A7L1U f elastic ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-elastic_ALFA_BG-A7L1L-x,y", type='TH2F', path='EXPERT', title='A7L1L f elastic ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-elastic_ALFA_BG-A7R1U-x,y", type='TH2F', path='EXPERT', title='A7R1U f elastic ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-elastic_ALFA_BG-A7R1L-x,y", type='TH2F', path='EXPERT', title='A7R1L f elastic ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-elastic_ALFA_BG-B7R1U-x,y", type='TH2F', path='EXPERT', title='B7R1U f elastic ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-elastic_ALFA_BG-B7R1L-x,y", type='TH2F', path='EXPERT', title='B7R1L f elastic ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-
-monTool.defineHistogram("trk-full-singleDiffr-B7L1U-x,y", type='TH2F', path='EXPERT', title='B7L1U f singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-singleDiffr-B7L1L-x,y", type='TH2F', path='EXPERT', title='B7L1L f singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-singleDiffr-A7L1U-x,y", type='TH2F', path='EXPERT', title='A7L1U f singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-singleDiffr-A7L1L-x,y", type='TH2F', path='EXPERT', title='A7L1L f singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-singleDiffr-A7R1U-x,y", type='TH2F', path='EXPERT', title='A7R1U f singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-singleDiffr-A7R1L-x,y", type='TH2F', path='EXPERT', title='A7R1L f singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-singleDiffr-B7R1U-x,y", type='TH2F', path='EXPERT', title='B7R1U f singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-singleDiffr-B7R1L-x,y", type='TH2F', path='EXPERT', title='B7R1L f singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-
-monTool.defineHistogram("trk-full-ALFA_MBTS_singleDiffr-B7L1U-x,y", type='TH2F', path='EXPERT', title='B7L1U f ALFA_MBTS_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_MBTS_singleDiffr-B7L1L-x,y", type='TH2F', path='EXPERT', title='B7L1L f ALFA_MBTS_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_MBTS_singleDiffr-A7L1U-x,y", type='TH2F', path='EXPERT', title='A7L1U f ALFA_MBTS_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_MBTS_singleDiffr-A7L1L-x,y", type='TH2F', path='EXPERT', title='A7L1L f ALFA_MBTS_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_MBTS_singleDiffr-A7R1U-x,y", type='TH2F', path='EXPERT', title='A7R1U f ALFA_MBTS_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_MBTS_singleDiffr-A7R1L-x,y", type='TH2F', path='EXPERT', title='A7R1L f ALFA_MBTS_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_MBTS_singleDiffr-B7R1U-x,y", type='TH2F', path='EXPERT', title='B7R1U f ALFA_MBTS_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_MBTS_singleDiffr-B7R1L-x,y", type='TH2F', path='EXPERT', title='B7R1L f ALFA_MBTS_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-
-monTool.defineHistogram("trk-full-ALFA_LUCID_singleDiffr-B7L1U-x,y", type='TH2F', path='EXPERT', title='B7L1U f ALFA_LUCID_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_LUCID_singleDiffr-B7L1L-x,y", type='TH2F', path='EXPERT', title='B7L1L f ALFA_LUCID_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_LUCID_singleDiffr-A7L1U-x,y", type='TH2F', path='EXPERT', title='A7L1U f ALFA_LUCID_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_LUCID_singleDiffr-A7L1L-x,y", type='TH2F', path='EXPERT', title='A7L1L f ALFA_LUCID_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_LUCID_singleDiffr-A7R1U-x,y", type='TH2F', path='EXPERT', title='A7R1U f ALFA_LUCID_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_LUCID_singleDiffr-A7R1L-x,y", type='TH2F', path='EXPERT', title='A7R1L f ALFA_LUCID_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_LUCID_singleDiffr-B7R1U-x,y", type='TH2F', path='EXPERT', title='B7R1U f ALFA_LUCID_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_LUCID_singleDiffr-B7R1L-x,y", type='TH2F', path='EXPERT', title='B7R1L f ALFA_LUCID_singleDiffr', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-
-monTool.defineHistogram("trk-full-ALFA_EM3-B7L1U-x,y", type='TH2F', path='EXPERT', title='B7L1U f ALFA_EM3', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_EM3-B7L1L-x,y", type='TH2F', path='EXPERT', title='B7L1L f ALFA_EM3', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_EM3-A7L1U-x,y", type='TH2F', path='EXPERT', title='A7L1U f ALFA_EM3', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_EM3-A7L1L-x,y", type='TH2F', path='EXPERT', title='A7L1L f ALFA_EM3', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_EM3-A7R1U-x,y", type='TH2F', path='EXPERT', title='A7R1U f ALFA_EM3', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_EM3-A7R1L-x,y", type='TH2F', path='EXPERT', title='A7R1L f ALFA_EM3', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_EM3-B7R1U-x,y", type='TH2F', path='EXPERT', title='B7R1U f ALFA_EM3', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_EM3-B7R1L-x,y", type='TH2F', path='EXPERT', title='B7R1L f ALFA_EM3', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-
-monTool.defineHistogram("trk-full-ALFA_J12-B7L1U-x,y", type='TH2F', path='EXPERT', title='B7L1U f ALFA_J12', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_J12-B7L1L-x,y", type='TH2F', path='EXPERT', title='B7L1L f ALFA_J12', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_J12-A7L1U-x,y", type='TH2F', path='EXPERT', title='A7L1U f ALFA_J12', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_J12-A7L1L-x,y", type='TH2F', path='EXPERT', title='A7L1L f ALFA_J12', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_J12-A7R1U-x,y", type='TH2F', path='EXPERT', title='A7R1U f ALFA_J12', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_J12-A7R1L-x,y", type='TH2F', path='EXPERT', title='A7R1L f ALFA_J12', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_J12-B7R1U-x,y", type='TH2F', path='EXPERT', title='B7R1U f ALFA_J12', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_J12-B7R1L-x,y", type='TH2F', path='EXPERT', title='B7R1L f ALFA_J12', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-
-monTool.defineHistogram("trk-full-ALFA_TRT-B7L1U-x,y", type='TH2F', path='EXPERT', title='B7L1U f ALFA_TRT', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_TRT-B7L1L-x,y", type='TH2F', path='EXPERT', title='B7L1L f ALFA_TRT', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_TRT-A7L1U-x,y", type='TH2F', path='EXPERT', title='A7L1U f ALFA_TRT', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_TRT-A7L1L-x,y", type='TH2F', path='EXPERT', title='A7L1L f ALFA_TRT', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_TRT-A7R1U-x,y", type='TH2F', path='EXPERT', title='A7R1U f ALFA_TRT', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_TRT-A7R1L-x,y", type='TH2F', path='EXPERT', title='A7R1L f ALFA_TRT', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_TRT-B7R1U-x,y", type='TH2F', path='EXPERT', title='B7R1U f ALFA_TRT', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_TRT-B7R1L-x,y", type='TH2F', path='EXPERT', title='B7R1L f ALFA_TRT', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-
-monTool.defineHistogram("trk-full-ANY-B7L1U-x,y", type='TH2F', path='EXPERT', title='B7L1U f ANY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ANY-B7L1L-x,y", type='TH2F', path='EXPERT', title='B7L1L f ANY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ANY-A7L1U-x,y", type='TH2F', path='EXPERT', title='A7L1U f ANY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ANY-A7L1L-x,y", type='TH2F', path='EXPERT', title='A7L1L f ANY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ANY-A7R1U-x,y", type='TH2F', path='EXPERT', title='A7R1U f ANY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ANY-A7R1L-x,y", type='TH2F', path='EXPERT', title='A7R1L f ANY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ANY-B7R1U-x,y", type='TH2F', path='EXPERT', title='B7R1U f ANY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ANY-B7R1L-x,y", type='TH2F', path='EXPERT', title='B7R1L f ANY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-
-monTool.defineHistogram("trk-full-ANY_UNPAIRED_ISO-B7L1U-x,y", type='TH2F', path='EXPERT', title='B7L1U f ANY_UNPAIRED_ISO', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ANY_UNPAIRED_ISO-B7L1L-x,y", type='TH2F', path='EXPERT', title='B7L1L f ANY_UNPAIRED_ISO', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ANY_UNPAIRED_ISO-A7L1U-x,y", type='TH2F', path='EXPERT', title='A7L1U f ANY_UNPAIRED_ISO', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ANY_UNPAIRED_ISO-A7L1L-x,y", type='TH2F', path='EXPERT', title='A7L1L f ANY_UNPAIRED_ISO', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ANY_UNPAIRED_ISO-A7R1U-x,y", type='TH2F', path='EXPERT', title='A7R1U f ANY_UNPAIRED_ISO', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ANY_UNPAIRED_ISO-A7R1L-x,y", type='TH2F', path='EXPERT', title='A7R1L f ANY_UNPAIRED_ISO', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ANY_UNPAIRED_ISO-B7R1U-x,y", type='TH2F', path='EXPERT', title='B7R1U f ANY_UNPAIRED_ISO', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ANY_UNPAIRED_ISO-B7R1L-x,y", type='TH2F', path='EXPERT', title='B7R1L f ANY_UNPAIRED_ISO', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-
-monTool.defineHistogram("trk-full-ANY_ALFA_BG-B7L1U-x,y", type='TH2F', path='EXPERT', title='B7L1U f ANY_ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ANY_ALFA_BG-B7L1L-x,y", type='TH2F', path='EXPERT', title='B7L1L f ANY_ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ANY_ALFA_BG-A7L1U-x,y", type='TH2F', path='EXPERT', title='A7L1U f ANY_ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ANY_ALFA_BG-A7L1L-x,y", type='TH2F', path='EXPERT', title='A7L1L f ANY_ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ANY_ALFA_BG-A7R1U-x,y", type='TH2F', path='EXPERT', title='A7R1U f ANY_ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ANY_ALFA_BG-A7R1L-x,y", type='TH2F', path='EXPERT', title='A7R1L f ANY_ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ANY_ALFA_BG-B7R1U-x,y", type='TH2F', path='EXPERT', title='B7R1U f ANY_ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ANY_ALFA_BG-B7R1L-x,y", type='TH2F', path='EXPERT', title='B7R1L f ANY_ALFA_BG', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-
-monTool.defineHistogram("trk-full-ALFA_EMPTY-B7L1U-x,y", type='TH2F', path='EXPERT', title='B7L1U f ALFA_EMPTY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_EMPTY-B7L1L-x,y", type='TH2F', path='EXPERT', title='B7L1L f ALFA_EMPTY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_EMPTY-A7L1U-x,y", type='TH2F', path='EXPERT', title='A7L1U f ALFA_EMPTY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_EMPTY-A7L1L-x,y", type='TH2F', path='EXPERT', title='A7L1L f ALFA_EMPTY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_EMPTY-A7R1U-x,y", type='TH2F', path='EXPERT', title='A7R1U f ALFA_EMPTY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_EMPTY-A7R1L-x,y", type='TH2F', path='EXPERT', title='A7R1L f ALFA_EMPTY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-monTool.defineHistogram("trk-full-ALFA_EMPTY-B7R1U-x,y", type='TH2F', path='EXPERT', title='B7R1U f ALFA_EMPTY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
-monTool.defineHistogram("trk-full-ALFA_EMPTY-B7R1L-x,y", type='TH2F', path='EXPERT', title='B7R1L f ALFA_EMPTY', xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
-
-monTool.defineHistogram("od-B7L1U-RP_1_0 position", type='TH1F', path='EXPERT', title='B7L1U RP_1_0 position', xbins=200, xmin=-145., xmax=-125.)
-monTool.defineHistogram("od-B7L1U-RP_1_1 position", type='TH1F', path='EXPERT', title='B7L1U RP_1_1 position', xbins=200, xmin=-145., xmax=-125.)
-monTool.defineHistogram("od-B7L1U-distance_1_2_side_0", type='TH1F', path='EXPERT', title='B7L1U distance_1_2_side_0', xbins=401, xmin=-20.05, xmax=20.05)
-monTool.defineHistogram("od-B7L1U-distance_1_2_side_1", type='TH1F', path='EXPERT', title='B7L1U distance_1_2_side_1', xbins=401, xmin=-20.05, xmax=20.05)
-
-monTool.defineHistogram("od-B7L1L-RP_2_0 position", type='TH1F', path='EXPERT', title='B7L1L RP_2_0 position', xbins=200, xmin=-145., xmax=-125.)
-monTool.defineHistogram("od-B7L1L-RP_2_1 position", type='TH1F', path='EXPERT', title='B7L1L RP_2_1 position', xbins=200, xmin=-145., xmax=-125.)
-
-monTool.defineHistogram("od-A7L1U-RP_3_0 position", type='TH1F', path='EXPERT', title='A7L1U RP_3_0 position', xbins=200, xmin=-145., xmax=-125.)
-monTool.defineHistogram("od-A7L1U-RP_3_1 position", type='TH1F', path='EXPERT', title='A7L1U RP_3_1 position', xbins=200, xmin=-145., xmax=-125.)
-monTool.defineHistogram("od-A7L1U-distance_3_4_side_0", type='TH1F', path='EXPERT', title='A7L1U distance_3_4_side_0', xbins=401, xmin=-20.05, xmax=20.05)
-monTool.defineHistogram("od-A7L1U-distance_3_4_side_1", type='TH1F', path='EXPERT', title='A7L1U distance_3_4_side_1', xbins=401, xmin=-20.05, xmax=20.05)
-
-monTool.defineHistogram("od-A7L1L-RP_4_0 position", type='TH1F', path='EXPERT', title='A7L1L RP_4_0 position', xbins=200, xmin=-145., xmax=-125.)
-monTool.defineHistogram("od-A7L1L-RP_4_1 position", type='TH1F', path='EXPERT', title='A7L1L RP_4_1 position', xbins=200, xmin=-145., xmax=-125.)
-
-monTool.defineHistogram("od-A7R1U-RP_5_0 position", type='TH1F', path='EXPERT', title='A7R1U RP_5_0 position', xbins=200, xmin=-145., xmax=-125.)
-monTool.defineHistogram("od-A7R1U-RP_5_1 position", type='TH1F', path='EXPERT', title='A7R1U RP_5_1 position', xbins=200, xmin=-145., xmax=-125.)
-monTool.defineHistogram("od-A7R1U-distance_5_6_side_0", type='TH1F', path='EXPERT', title='A7R1U distance_5_6_side_0', xbins=401, xmin=-20.05, xmax=20.05)
-monTool.defineHistogram("od-A7R1U-distance_5_6_side_1", type='TH1F', path='EXPERT', title='A7R1U distance_5_6_side_1', xbins=401, xmin=-20.05, xmax=20.05)
-
-monTool.defineHistogram("od-A7R1L-RP_6_0 position", type='TH1F', path='EXPERT', title='A7R1L RP_6_0 position', xbins=200, xmin=-145., xmax=-125.)
-monTool.defineHistogram("od-A7R1L-RP_6_1 position", type='TH1F', path='EXPERT', title='A7R1L RP_6_1 position', xbins=200, xmin=-145., xmax=-125.)
-
-monTool.defineHistogram("od-B7R1U-RP_7_0 position", type='TH1F', path='EXPERT', title='B7R1U RP_7_0 position', xbins=200, xmin=-145., xmax=-125.)
-monTool.defineHistogram("od-B7R1U-RP_7_1 position", type='TH1F', path='EXPERT', title='B7R1U RP_7_1 position', xbins=200, xmin=-145., xmax=-125.)
-monTool.defineHistogram("od-B7R1U-distance_7_8_side_0", type='TH1F', path='EXPERT', title='B7R1U distance_7_8_side_0', xbins=401, xmin=-20.05, xmax=20.05)
-monTool.defineHistogram("od-B7R1U-distance_7_8_side_1", type='TH1F', path='EXPERT', title='B7R1U distance_7_8_side_1', xbins=401, xmin=-20.05, xmax=20.05)
-
-monTool.defineHistogram("od-B7R1L-RP_8_0 position", type='TH1F', path='EXPERT', title='B7R1L RP_8_0 position', xbins=200, xmin=-145., xmax=-125.)
-monTool.defineHistogram("od-B7R1L-RP_8_1 position", type='TH1F', path='EXPERT', title='B7R1L RP_8_1 position', xbins=200, xmin=-145., xmax=-125.)
+monToolCommon.defineHistogram("com_LB,goodDataAssessmentLB15", type='TH2F', path='EXPERT', title='goodDataAssessmentLB15', xbins=1000, xmin=-0.5, xmax=999.5, ybins=2, ymin=0.5, ymax=2.5 )
+monToolCommon.defineHistogram("com_LB,goodDataAssessmentLB18", type='TH2F', path='EXPERT', title='goodDataAssessmentLB18', xbins=1000, xmin=-0.5, xmax=999.5, ybins=2, ymin=0.5, ymax=2.5 )
+monToolCommon.defineHistogram("com_goodDataAssessment",        type='TH1F', path='EXPERT', title='goodDataAssessment',     xbins=10,   xmin=-0.5, xmax=9.5 )
+
+stations = ['B7L1U', 'B7L1L', 'A7L1U', 'A7L1L', 'A7R1U', 'A7R1L', 'B7R1U', 'B7R1L']
+for station in stations:
+	#detector
+   monToolDetectors.defineHistogram(station + "_,PMF", type='TH2F', path='EXPERT', title=station + " activity;channels;PMF", xbins=64, xmin=0., xmax=64., ybins=23, ymin=1.,ymax=24.)
+
+   if station.find("U") is not -1:
+      monToolTrackingElast.defineHistogram("elastic_" + station + ",y", type='TH2F', path='EXPERT', title=station + " f elastic;x;y",              xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
+      monToolTrackingAny.defineHistogram("ANY_" + station + ",y", type='TH2F', path='EXPERT', title=station + " f ANY;x;y",                        xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
+      monToolTrackingElast_SB.defineHistogram("elastic_" + station + "_SB,y", type='TH2F', path='EXPERT', title=station + " SB elastic ;x;y",      xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
+      monToolTrackingAny_SB.defineHistogram("ANY_" + station + "_SB,y", type='TH2F', path='EXPERT', title=station + " SB ANY;x;y",                 xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.)
+      monToolTrackingElast_1LB.defineHistogram("elastic_" + station + "_1LB,y", type='TH2F', path='EXPERT', title=station + " 1LB elastic ;x;y",   xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.,opt='kLBNHistoryDepth=1')
+      monToolTrackingAny_1LB.defineHistogram("ANY_" + station + "_1LB,y", type='TH2F', path='EXPERT', title=station + " 1LB ANY;x;y",              xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.,opt='kLBNHistoryDepth=1')
+      monToolTrackingElast_10LB.defineHistogram("elastic_" + station + "_10LB,y", type='TH2F', path='EXPERT', title=station + " 10LB elastic;x;y", xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.,opt='kLBNHistoryDepth=10')
+      monToolTrackingAny_10LB.defineHistogram("ANY_" + station + "_10LB,y", type='TH2F', path='EXPERT', title=station + " 10LB ANY;x;y",           xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.,opt='kLBNHistoryDepth=10')
+      monToolTrackingElast_60LB.defineHistogram("elastic_" + station + "_60LB,y", type='TH2F', path='EXPERT', title=station + " 60LB elastic;x;y", xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.,opt='kLBNHistoryDepth=60')
+      monToolTrackingAny_60LB.defineHistogram("ANY_" + station + "_60LB,y", type='TH2F', path='EXPERT', title=station + " 60LB ANY;x;y",           xbins=260, xmin=-23., xmax=23., ybins=175, ymin=0.,ymax=35.,opt='kLBNHistoryDepth=60')
+   else:
+      monToolTrackingElast.defineHistogram     ("elastic_" + station + ",y", type='TH2F', path='EXPERT', title=station + " f elastic;x;y",         xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
+      monToolTrackingAny.defineHistogram       ("ANY_" + station + ",y", type='TH2F', path='EXPERT', title=station + " f ANY;x;y",                 xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
+      monToolTrackingElast_SB.defineHistogram  ("elastic_" + station + "_SB,y", type='TH2F', path='EXPERT', title=station + " SB elastic ;x;y",    xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
+      monToolTrackingAny_SB.defineHistogram    ("ANY_" + station + "_SB,y", type='TH2F', path='EXPERT', title=station + " SB ANY;x;y",             xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.)
+      monToolTrackingElast_1LB.defineHistogram ("elastic_" + station + "_1LB,y", type='TH2F', path='EXPERT', title=station + " 1LB elastic ;x;y",  xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.,opt='kLBNHistoryDepth=1')
+      monToolTrackingAny_1LB.defineHistogram   ("ANY_" + station + "_1LB,y", type='TH2F', path='EXPERT', title=station + " 1LB ANY;x;y",           xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.,opt='kLBNHistoryDepth=1')
+      monToolTrackingElast_10LB.defineHistogram("elastic_" + station + "_10LB,y", type='TH2F', path='EXPERT', title=station + " 10LB elastic;x;y", xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.,opt='kLBNHistoryDepth=10')
+      monToolTrackingAny_10LB.defineHistogram  ("ANY_" + station + "_10LB,y", type='TH2F', path='EXPERT', title=station + " 10LB ANY;x;y",         xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.,opt='kLBNHistoryDepth=10')
+      monToolTrackingElast_60LB.defineHistogram("elastic_" + station + "_60LB,y", type='TH2F', path='EXPERT', title=station + " 60LB elastic;x;y", xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.,opt='kLBNHistoryDepth=60')
+      monToolTrackingAny_60LB.defineHistogram  ("ANY_" + station + "_60LB,y", type='TH2F', path='EXPERT', title=station + " 60LB ANY;x;y",         xbins=260, xmin=-23., xmax=23., ybins=175, ymin=-35.,ymax=0.,opt='kLBNHistoryDepth=60')
+
+monToolOD_B7L1U.defineHistogram("od_B7L1U_RP_1_0 position", type='TH1F', path='EXPERT', title='B7L1U RP_1_0 position', xbins=200, xmin=-145., xmax=-125.)
+monToolOD_B7L1U.defineHistogram("od_B7L1U_RP_1_1 position", type='TH1F', path='EXPERT', title='B7L1U RP_1_1 position', xbins=200, xmin=-145., xmax=-125.)
+monToolOD_B7L1U.defineHistogram("od_B7L1U_distance_1_2_side_0", type='TH1F', path='EXPERT', title='B7L1U distance_1_2_side_0', xbins=401, xmin=-20.05, xmax=20.05)
+monToolOD_B7L1U.defineHistogram("od_B7L1U_distance_1_2_side_1", type='TH1F', path='EXPERT', title='B7L1U distance_1_2_side_1', xbins=401, xmin=-20.05, xmax=20.05)
+
+monToolOD_B7L1L.defineHistogram("od_B7L1L_RP_2_0 position", type='TH1F', path='EXPERT', title='B7L1L RP_2_0 position', xbins=200, xmin=-145., xmax=-125.)
+monToolOD_B7L1L.defineHistogram("od_B7L1L_RP_2_1 position", type='TH1F', path='EXPERT', title='B7L1L RP_2_1 position', xbins=200, xmin=-145., xmax=-125.)
+
+monToolOD_B7L1U.defineHistogram("od_B7L1U_RP_1_0 position", type='TH1F', path='EXPERT', title='B7L1U RP_1_0 position', xbins=200, xmin=-145., xmax=-125.)
+monToolOD_B7L1U.defineHistogram("od_B7L1U_RP_1_1 position", type='TH1F', path='EXPERT', title='B7L1U RP_1_1 position', xbins=200, xmin=-145., xmax=-125.)
+monToolOD_B7L1U.defineHistogram("od_B7L1U_distance_1_2_side_0", type='TH1F', path='EXPERT', title='B7L1U distance_1_2_side_0', xbins=401, xmin=-20.05, xmax=20.05)
+monToolOD_B7L1U.defineHistogram("od_B7L1U_distance_1_2_side_1", type='TH1F', path='EXPERT', title='B7L1U distance_1_2_side_1', xbins=401, xmin=-20.05, xmax=20.05)
+
+monToolOD_B7L1L.defineHistogram("od_B7L1L_RP_2_0 position", type='TH1F', path='EXPERT', title='B7L1L RP_2_0 position', xbins=200, xmin=-145., xmax=-125.)
+monToolOD_B7L1L.defineHistogram("od_B7L1L_RP_2_1 position", type='TH1F', path='EXPERT', title='B7L1L RP_2_1 position', xbins=200, xmin=-145., xmax=-125.)
+
+monToolOD_A7L1U.defineHistogram("od_A7L1U_RP_3_0 position", type='TH1F', path='EXPERT', title='A7L1U RP_3_0 position', xbins=200, xmin=-145., xmax=-125.)
+monToolOD_A7L1U.defineHistogram("od_A7L1U_RP_3_1 position", type='TH1F', path='EXPERT', title='A7L1U RP_3_1 position', xbins=200, xmin=-145., xmax=-125.)
+monToolOD_A7L1U.defineHistogram("od_A7L1U_distance_3_4_side_0", type='TH1F', path='EXPERT', title='A7L1U distance_3_4_side_0', xbins=401, xmin=-20.05, xmax=20.05)
+monToolOD_A7L1U.defineHistogram("od_A7L1U_distance_3_4_side_1", type='TH1F', path='EXPERT', title='A7L1U distance_3_4_side_1', xbins=401, xmin=-20.05, xmax=20.05)
+
+monToolOD_A7L1L.defineHistogram("od_A7L1L_RP_4_0 position", type='TH1F', path='EXPERT', title='A7L1L RP_4_0 position', xbins=200, xmin=-145., xmax=-125.)
+monToolOD_A7L1L.defineHistogram("od_A7L1L_RP_4_1 position", type='TH1F', path='EXPERT', title='A7L1L RP_4_1 position', xbins=200, xmin=-145., xmax=-125.)
+
+monToolOD_A7R1U.defineHistogram("od_A7R1U_RP_5_0 position", type='TH1F', path='EXPERT', title='A7R1U RP_5_0 position', xbins=200, xmin=-145., xmax=-125.)
+monToolOD_A7R1U.defineHistogram("od_A7R1U_RP_5_1 position", type='TH1F', path='EXPERT', title='A7R1U RP_5_1 position', xbins=200, xmin=-145., xmax=-125.)
+monToolOD_A7R1U.defineHistogram("od_A7R1U_distance_5_6_side_0", type='TH1F', path='EXPERT', title='A7R1U distance_5_6_side_0', xbins=401, xmin=-20.05, xmax=20.05)
+monToolOD_A7R1U.defineHistogram("od_A7R1U_distance_5_6_side_1", type='TH1F', path='EXPERT', title='A7R1U distance_5_6_side_1', xbins=401, xmin=-20.05, xmax=20.05)
+
+monToolOD_A7R1L.defineHistogram("od_A7R1L_RP_6_0 position", type='TH1F', path='EXPERT', title='A7R1L RP_6_0 position', xbins=200, xmin=-145., xmax=-125.)
+monToolOD_A7R1L.defineHistogram("od_A7R1L_RP_6_1 position", type='TH1F', path='EXPERT', title='A7R1L RP_6_1 position', xbins=200, xmin=-145., xmax=-125.)
+
+monToolOD_B7R1U.defineHistogram("od_B7R1U_RP_7_0 position", type='TH1F', path='EXPERT', title='B7R1U RP_7_0 position', xbins=200, xmin=-145., xmax=-125.)
+monToolOD_B7R1U.defineHistogram("od_B7R1U_RP_7_1 position", type='TH1F', path='EXPERT', title='B7R1U RP_7_1 position', xbins=200, xmin=-145., xmax=-125.)
+monToolOD_B7R1U.defineHistogram("od_B7R1U_distance_7_8_side_0", type='TH1F', path='EXPERT', title='B7R1U distance_7_8_side_0', xbins=401, xmin=-20.05, xmax=20.05)
+monToolOD_B7R1U.defineHistogram("od_B7R1U_distance_7_8_side_1", type='TH1F', path='EXPERT', title='B7R1U distance_7_8_side_1', xbins=401, xmin=-20.05, xmax=20.05)
+
+monToolOD_B7R1L.defineHistogram("od_B7R1L_RP_8_0 position", type='TH1F', path='EXPERT', title='B7R1L RP_8_0 position', xbins=200, xmin=-145., xmax=-125.)
+monToolOD_B7R1L.defineHistogram("od_B7R1L_RP_8_1 position", type='TH1F', path='EXPERT', title='B7R1L RP_8_1 position', xbins=200, xmin=-145., xmax=-125.)
+
+# background monitoring hstograms
+bckg_armSets = ['L1U', 'L1D', 'R1U','R1D']
+bckg_triggers = ['elast15', 'elast18', 'syst17', 'syst18']
+xcxAxis = ["x_{3} [mm]", "x_{4} [mm]", "x_{6} [mm]", "x_{5} [mm]"]
+ycxAxis = ["x_{1} [mm]", "x_{2} [mm]", "x_{8} [mm]", "x_{7} [mm]"]
+xcyAxis = ["y_{3} [mm]", "y_{4} [mm]", "y_{6} [mm]", "y_{5} [mm]"]
+ycyAxis = ["y_{1} [mm]", "y_{2} [mm]", "y_{8} [mm]", "y_{7} [mm]"]
+xaxAxis = ["x_{3} [mm]", "x_{4} [mm]", "x_{5} [mm]", "x_{6} [mm]"]
+yaxAxis = ["#theta_{x} [#murad]", "#theta_{x} [#murad]", "#theta_{x} [#murad]", "#theta_{x} [#murad]"]
+xayAxis = ["y_{3} [mm]", "y_{4} [mm]", "y_{5} [mm]", "y_{6} [mm]"]
+yayAxis = ["#theta_{y} [#murad]", "#theta_{y} [#murad]", "#theta_{y} [#murad]", "#theta_{y} [#murad]"]
+
+for trigger in bckg_triggers:
+   for station in bckg_armSets:
+      if (trigger.find('elast15') != -1) and ((station.find('L1D') != -1) or (station.find('R1U') != -1)):  # golden 1: exclude bottom left top righ
+         continue
+      if (trigger.find('elast18') != -1) and ((station.find('L1U') != -1) or (station.find('R1D') != -1)):  # golden 2: exclude top left bottom right
+         continue
+      if (trigger.find('syst17') != -1) and ((station.find('L1D') != -1) or (station.find('R1D') != -1)):   # antigolden 1: exclude both lowe
+         continue
+      if (trigger.find('syst18') != -1) and ((station.find('L1U') != -1) or (station.find('R1U') != -1)):   # antigolden 2: exclude both upper
+         continue
+
+      if (trigger.find('elast15') != -1):
+         monToolBckg_1LB = monToolBackgroundElast15_1LB
+         monToolBckg_10LB = monToolBackgroundElast15_10LB
+         monToolBckg_60LB = monToolBackgroundElast15_60LB
+         monToolBckg = monToolBackgroundElast15
+      if (trigger.find('elast18') != -1):
+         monToolBckg_10LB = monToolBackgroundElast18_10LB
+         monToolBckg_60LB = monToolBackgroundElast18_60LB
+         monToolBckg = monToolBackgroundElast18
+         monToolBckg_1LB = monToolBackgroundElast18_1LB
+      if (trigger.find('syst17') != -1):
+         monToolBckg_60LB = monToolBackgroundSyst17_60LB
+         monToolBckg = monToolBackgroundSyst17
+         monToolBckg_1LB = monToolBackgroundSyst17_1LB
+         monToolBckg_10LB = monToolBackgroundSyst17_10LB
+      if (trigger.find('syst18') != -1):
+         monToolBckg_1LB = monToolBackgroundSyst18_1LB
+         monToolBckg_10LB = monToolBackgroundSyst18_10LB
+         monToolBckg_60LB = monToolBackgroundSyst18_60LB
+         monToolBckg = monToolBackgroundSyst18
+
+      monToolBckg.defineHistogram(trigger+'_x_'+station+',y', type='TH2F', path='EXPERT', title=trigger+'_x_'+station+';'+xcxAxis[bckg_armSets.index(station)]+';'+ycxAxis[bckg_armSets.index(station)], xbins=200, xmin=-12., xmax=12., ybins=200, ymin=-12., ymax=12.)
+      monToolBckg.defineHistogram(trigger+'_y_'+station+',y', type='TH2F', path='EXPERT', title=trigger+'_y_'+station+';'+xcyAxis[bckg_armSets.index(station)]+';'+ycyAxis[bckg_armSets.index(station)], xbins=200, xmin=-25., xmax=25., ybins=200, ymin=-25., ymax=25.)
+      monToolBckg.defineHistogram(trigger+'_ax_'+station+',y', type='TH2F', path='EXPERT', title=trigger+'_ax_'+station+';'+xaxAxis[bckg_armSets.index(station)]+';'+yaxAxis[bckg_armSets.index(station)], xbins=200, xmin=-12., xmax=12., ybins=200, ymin=-1500., ymax=1500.)
+      monToolBckg.defineHistogram(trigger+'_ay_'+station+',y', type='TH2F', path='EXPERT', title=trigger+'_ay_'+station+';'+xcyAxis[bckg_armSets.index(station)]+';'+yayAxis[bckg_armSets.index(station)], xbins=200, xmin=-25., xmax=25., ybins=200, ymin=-2000., ymax=2000.)
+
+      monToolBckg_1LB.defineHistogram(trigger+'_x_'+station+'_1LB,y', type='TH2F', path='EXPERT', title=trigger+'_x_'+station+'_1LB;'+xcxAxis[bckg_armSets.index(station)]+';'+ycxAxis[bckg_armSets.index(station)], xbins=200, xmin=-12., xmax=12., ybins=200, ymin=-12., ymax=12. ,opt='kLBNHistoryDepth=1')
+      monToolBckg_1LB.defineHistogram(trigger+'_y_'+station+'_1LB,y', type='TH2F', path='EXPERT', title=trigger+'_y_'+station+'_1LB;'+xcyAxis[bckg_armSets.index(station)]+';'+ycyAxis[bckg_armSets.index(station)], xbins=200, xmin=-25., xmax=25., ybins=200, ymin=-25., ymax=25. ,opt='kLBNHistoryDepth=1')
+      monToolBckg_1LB.defineHistogram(trigger+'_ax_'+station+'_1LB,y', type='TH2F', path='EXPERT', title=trigger+'_ax_'+station+'_1LB;'+xaxAxis[bckg_armSets.index(station)]+';'+yaxAxis[bckg_armSets.index(station)], xbins=200, xmin=-12., xmax=12., ybins=200, ymin=-1500., ymax=1500. ,opt='kLBNHistoryDepth=1')
+      monToolBckg_1LB.defineHistogram(trigger+'_ay_'+station+'_1LB,y', type='TH2F', path='EXPERT', title=trigger+'_ay_'+station+'_1LB;'+xcyAxis[bckg_armSets.index(station)]+';'+yayAxis[bckg_armSets.index(station)], xbins=200, xmin=-25., xmax=25., ybins=200, ymin=-2000., ymax=2000. ,opt='kLBNHistoryDepth=1')
+
+      monToolBckg_10LB.defineHistogram(trigger+'_x_'+station+'_10LB,y', type='TH2F', path='EXPERT', title=trigger+'_x_'+station+'_10LB;'+xcxAxis[bckg_armSets.index(station)]+';'+ycxAxis[bckg_armSets.index(station)], xbins=200, xmin=-12., xmax=12., ybins=200, ymin=-12., ymax=12. ,opt='kLBNHistoryDepth=10') 
+      monToolBckg_10LB.defineHistogram(trigger+'_y_'+station+'_10LB,y', type='TH2F', path='EXPERT', title=trigger+'_y_'+station+'_10LB;'+xcyAxis[bckg_armSets.index(station)]+';'+ycyAxis[bckg_armSets.index(station)], xbins=200, xmin=-25., xmax=25., ybins=200, ymin=-25., ymax=25. ,opt='kLBNHistoryDepth=10') 
+      monToolBckg_10LB.defineHistogram(trigger+'_ax_'+station+'_10LB,y', type='TH2F', path='EXPERT', title=trigger+'_ax_'+station+'_10LB;'+xaxAxis[bckg_armSets.index(station)]+';'+yaxAxis[bckg_armSets.index(station)], xbins=200, xmin=-12., xmax=12., ybins=200, ymin=-1500., ymax=1500. ,opt='kLBNHistoryDepth=10')
+      monToolBckg_10LB.defineHistogram(trigger+'_ay_'+station+'_10LB,y', type='TH2F', path='EXPERT', title=trigger+'_ay_'+station+'_10LB;'+xcyAxis[bckg_armSets.index(station)]+';'+yayAxis[bckg_armSets.index(station)], xbins=200, xmin=-25., xmax=25., ybins=200, ymin=-2000., ymax=2000. ,opt='kLBNHistoryDepth=10')
 
+      monToolBckg_60LB.defineHistogram(trigger+'_x_'+station+'_60LB,y', type='TH2F', path='EXPERT', title=trigger+'_x_'+station+'_60LB;'+xcxAxis[bckg_armSets.index(station)]+';'+ycxAxis[bckg_armSets.index(station)], xbins=200, xmin=-12., xmax=12., ybins=200, ymin=-12., ymax=12. ,opt='kLBNHistoryDepth=60')
+      monToolBckg_60LB.defineHistogram(trigger+'_y_'+station+'_60LB,y', type='TH2F', path='EXPERT', title=trigger+'_y_'+station+'_60LB;'+xcyAxis[bckg_armSets.index(station)]+';'+ycyAxis[bckg_armSets.index(station)], xbins=200, xmin=-25., xmax=25., ybins=200, ymin=-25., ymax=25. ,opt='kLBNHistoryDepth=60')
+      monToolBckg_60LB.defineHistogram(trigger+'_ax_'+station+'_60LB,y', type='TH2F', path='EXPERT', title=trigger+'_ax_'+station+'_60LB;'+xaxAxis[bckg_armSets.index(station)]+';'+yaxAxis[bckg_armSets.index(station)], xbins=200, xmin=-12., xmax=12., ybins=200, ymin=-1500., ymax=1500. ,opt='kLBNHistoryDepth=60')
+      monToolBckg_60LB.defineHistogram(trigger+'_ay_'+station+'_60LB,y', type='TH2F', path='EXPERT', title=trigger+'_ay_'+station+'_60LB;'+xcyAxis[bckg_armSets.index(station)]+';'+yayAxis[bckg_armSets.index(station)], xbins=200, xmin=-25., xmax=25., ybins=200, ymin=-2000., ymax=2000. ,opt='kLBNHistoryDepth=60')
 #ALFAROBMonitor.MonTool = monTool
 
-topSequence.ALFAROBMonitor.MonTool = monTool
+#topSequence.ALFAROBMonitor.MonTool = [monTool, monTool1]
 #--------------------------------------------------------------
 # Private Application Configuration options
 #--------------------------------------------------------------
diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigL1TopoWriteValData.py b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigL1TopoWriteValData.py
index cbf3c84a238709c06a32a00ba13d263bc5f6d53a..8388b47ca14b9274ba2bdbc3b650abc648faa0a0 100755
--- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigL1TopoWriteValData.py
+++ b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigL1TopoWriteValData.py
@@ -55,10 +55,10 @@ else:
 
 
 # Add an instance of TrigL1TopoWriteValData to the sequence
-from AthenaCommon import CfgMgr
-l1topoWriteValData = CfgMgr.TrigL1TopoWriteValData("l1topoWriteValData")
-topSequence += l1topoWriteValData
-log.debug("added l1topoWriteValData to topSequence")
+#from AthenaCommon import CfgMgr
+#l1topoWriteValData = CfgMgr.TrigL1TopoWriteValData("l1topoWriteValData")
+#topSequence += l1topoWriteValData
+#log.debug("added l1topoWriteValData to topSequence")
 #l1topoWriteValData.OutputLevel=1
 
 #--------------------------------------------------------------
diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.cxx b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.cxx
index 0397881a3b869688482b76551b48d4e6161cb423..5e2bd01d2c1145722d07c8b00a654c3cd5569dcf 100755
--- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.cxx
+++ b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.cxx
@@ -37,7 +37,8 @@
 #include <TH1F.h>
 #include <TH2F.h>
 #include <TProfile2D.h>
- 
+
+
 ////////////////////////////////////////////////////////////////////////////
 
 TrigALFAROBMonitor::TrigALFAROBMonitor(const std::string& name, ISvcLocator* pSvcLocator) :
@@ -104,34 +105,8 @@ TrigALFAROBMonitor::TrigALFAROBMonitor(const std::string& name, ISvcLocator* pSv
  m_map_TrgNamesToHistGroups["L1_ALFA_ELAST15"] = 0;
  m_map_TrgNamesToHistGroups["L1_ALFA_ELAST18"] = 0;
 
- m_map_TrgNamesToHistGroups["L1_ALFA_ELAST15_Calib"] = 1;
- m_map_TrgNamesToHistGroups["L1_ALFA_ELAST18_Calib"] = 1;
-
- m_map_TrgNamesToHistGroups["L1_ALFA_SDIFF5"] = 2;
- m_map_TrgNamesToHistGroups["L1_ALFA_SDIFF6"] = 2;
- m_map_TrgNamesToHistGroups["L1_ALFA_SDIFF7"] = 2;
- m_map_TrgNamesToHistGroups["L1_ALFA_SDIFF8"] = 2;
-
- m_map_TrgNamesToHistGroups["L1_MBTS_1_A_ALFA_C"] = 3;
- m_map_TrgNamesToHistGroups["L1_MBTS_1_C_ALFA_A"] = 3;
-
- m_map_TrgNamesToHistGroups["L1_LUCID_A_ALFA_C"] = 4;
- m_map_TrgNamesToHistGroups["L1_LUCID_C_ALFA_A"] = 4;
-
- m_map_TrgNamesToHistGroups["L1_EM3_ALFA_ANY"] = 5;
-
- m_map_TrgNamesToHistGroups["L1_J12_ALFA_ANY"] = 6;
-
- m_map_TrgNamesToHistGroups["L1_TRT_ALFA_ANY"] = 7;
+ m_map_TrgNamesToHistGroups["L1_ALFA_ANY"] = 1;
 
- m_map_TrgNamesToHistGroups["L1_ALFA_ANY"] = 8;
-
- m_map_TrgNamesToHistGroups["L1_ALFA_ANY_UNPAIRED_ISO"] = 9;
-
- m_map_TrgNamesToHistGroups["L1_ALFA_ANY_CALIB"] = 10;
-
- m_map_TrgNamesToHistGroups["L1_ALFA_ANY_A_EMPTY"] = 11;
- m_map_TrgNamesToHistGroups["L1_ALFA_ANY_C_EMPTY"] = 11;
 }
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
@@ -186,7 +161,7 @@ StatusCode TrigALFAROBMonitor::initialize(){
 
   ATH_CHECK( m_L1MenuKey.initialize() );
 
-  if (!m_monTool.empty()) CHECK(m_monTool.retrieve());
+  ATH_CHECK( m_monTools.retrieve() );
 
   ATH_MSG_INFO("Initialize completed");
   return StatusCode::SUCCESS;
@@ -198,8 +173,6 @@ StatusCode TrigALFAROBMonitor::execute (const EventContext& ctx) const {
 
   uint32_t  LB; // luminosity block number
   uint32_t previousEventLB(99999); // luminosity block number of the previous events
-  uint32_t prevLB10reset = 0;   // LB at which previous reset of 10LB histograms happened
-  uint32_t prevLB60reset = 0;   // LB  -- 60LB histograms were reset
   uint32_t prescKey(-999); // current hlt prescale key
   bool SBflag(false);
 
@@ -218,56 +191,20 @@ StatusCode TrigALFAROBMonitor::execute (const EventContext& ctx) const {
     return StatusCode::SUCCESS;
   }
 
-  // get EventInfo - in new athena MT EventContext shoudl be used.
- /*
-  const EventInfo* p_EventInfo(0);
-  StatusCode sc = evtStore()->retrieve(p_EventInfo);
-  if(sc.isFailure()){
-      ATH_MSG_ERROR("Can't get EventIinfo object");
-      return StatusCode::SUCCESS;
-  }
-  */
-    
-  //--------------------------------------------------------------------------
-  // take only events with alfaCalibrationStream tag  
-  //--------------------------------------------------------------------------
-  // if this algo will be used in regular HLT chain - then the chain selection will provide only events triggered by ALFA and with tag of ALFA_calib stream
- /*
-  bool eventInCalibStream = false;
-  typedef std::vector< TriggerInfo::StreamTag > StreamTagVector_t;
-  StreamTagVector_t vecStreamTags = p_EventInfo->trigger_info()->streamTags();
-  for (std::vector<TriggerInfo::StreamTag>::iterator iter = vecStreamTags.begin(); iter!=vecStreamTags.end(); iter++) {
-         if ((*iter).name().compare(m_calibrationStreamName.value()) == 0 ){
-             eventInCalibStream = true;
-             break;
-         }
-  }
-  if (!eventInCalibStream) {
-       //ATH_MSG_INFO ("event not tagged for calibration stream - return without ROS data request ");
-    return StatusCode::SUCCESS;
-  }
-*/
-
-
   bool event_with_checksum_failure(false);
   
   //ATH_MSG_INFO ("new event");
   // get EventID
-
   //const EventID* p_EventID = p_EventInfo->event_ID();
+
   const EventIDBase p_EventIDBase = ctx.eventID();
   LB = p_EventIDBase.lumi_block();
-  ATH_MSG_INFO(" Decoded lumi block nb: " <<LB);
+  ATH_MSG_DEBUG(" Decoded lumi block nb: " <<LB);
 
   if (previousEventLB >= 99999) {
     previousEventLB = LB;  // first event
-    prevLB10reset = LB;
-    prevLB60reset = LB;
   } else {
      if (LB > previousEventLB){ // new LB
-        reset1LBhistos();
-        if ((LB - prevLB10reset) > 10 ) {reset10LBhistos(); prevLB10reset = LB;};
-        if ((LB - prevLB60reset) > 60 ) {reset60LBhistos(); prevLB60reset = LB;};
         uint32_t newPrescKey = m_configSvc->hltPrescaleKey();
         if (newPrescKey != prescKey) {
              ATH_MSG_INFO ("HLT prescale key changed to "<<newPrescKey );
@@ -300,14 +237,14 @@ StatusCode TrigALFAROBMonitor::execute (const EventContext& ctx) const {
 
   // Now try to extract L1 decisons from ROIB fragment
   if(!evtStore()->contains<ROIB::RoIBResult>(m_keyRBResult)) {
-       ATH_MSG_DEBUG("RoIBResult does not exist with key: " << m_keyRBResult);
+       ATH_MSG_INFO("RoIBResult does not exist with key: " << m_keyRBResult);
   }
 
   const ROIB::RoIBResult* roIBResult=0;
   StatusCode sc = evtStore()->retrieve(roIBResult,m_keyRBResult);
 
   if(sc.isFailure()){
-    ATH_MSG_DEBUG(" Unable to retrieve RoIBResult from storeGate!");
+    ATH_MSG_INFO(" Unable to retrieve RoIBResult from storeGate!");
                return StatusCode::SUCCESS; //HLT::NO_LVL1_RESULT;
   } else {
     const std::vector<ROIB::CTPRoI> ctpRoIVecAV = roIBResult->cTPResult().TAV();
@@ -364,7 +301,6 @@ StatusCode TrigALFAROBMonitor::execute (const EventContext& ctx) const {
     if (p_EventInfo) {
       StreamTagVector_t vecStreamTags = p_EventInfo->trigger_info()->streamTags();
       vecStreamTags.push_back( TriggerInfo::StreamTag(m_debugStreamName,"debug",false) );
-      // FIXME: const_cast
       const_cast<TriggerInfo*>(p_EventInfo->trigger_info())->setStreamTags(vecStreamTags);
     }
   }
@@ -397,7 +333,10 @@ StatusCode TrigALFAROBMonitor::start() {
         m_map_TrgItemNumbersToHistGroups[item.ctpId()] = it->second;
         // locate golden alfa triggers for data quality assesment base on the ratio of tracks in elastic triggered events
         if (item.name().compare("L1_ALFA_ELAST15") == 0) { m_elast15 = item.ctpId(); continue; }
-        if (item.name().compare("L1_ALFA_ELAST18") == 0) m_elast18 = item.ctpId();
+        if (item.name().compare("L1_ALFA_ELAST18") == 0) { m_elast18 = item.ctpId(); continue; }
+        if (item.name().compare("L1_ALFA_SYST17")  == 0) { m_syst17  = item.ctpId(); continue; }
+        if (item.name().compare("L1_ALFA_SYST18")  == 0)   m_syst18  = item.ctpId();
+
       }
     }
   }
@@ -412,8 +351,6 @@ StatusCode TrigALFAROBMonitor::start() {
   // Define histograms only when checks are requested
   if ((not m_doROBChecksum.value()) && (not m_doROBStatus.value())) return StatusCode::SUCCESS;
 
-  ATH_MSG_DEBUG("TrigALFAROBMonitor::start() 3");
-
   // *-- booking path
   m_pathHisto = std::string("/EXPERT/") + name() + "/";
 
@@ -422,194 +359,6 @@ StatusCode TrigALFAROBMonitor::start() {
   //eformat::helper::SourceIdentifier srcID_CTP( eformat::TDAQ_CTP ,0);
   //eformat::helper::SourceIdentifier srcID_HLT( eformat::TDAQ_HLT, 0);
 
-  if ( m_doROBChecksum.value() ) {
-    // *-- ROBs with failed checksum
-    m_hist_failedChecksumForALFAROB = new TH1F (m_histProp_failedChecksumForALFAROB.value().title().c_str(),
-					       (m_histProp_failedChecksumForALFAROB.value().title()+";ALFA ROB id").c_str(),
-					        m_histProp_failedChecksumForALFAROB.value().bins(),
-					        m_histProp_failedChecksumForALFAROB.value().lowEdge(),
-					        m_histProp_failedChecksumForALFAROB.value().highEdge());
-    if (m_hist_failedChecksumForALFAROB) {
-      m_hist_failedChecksumForALFAROB->SetCanExtend(TH1::kAllAxes);
-      if( m_rootHistSvc->regHist(m_pathHisto + "common/" + m_hist_failedChecksumForALFAROB->GetName(), m_hist_failedChecksumForALFAROB).isFailure() ) {
-	ATH_MSG_WARNING("Can not register ALFA ROB checksum monitoring histogram: " << m_hist_failedChecksumForALFAROB->GetName());
-      }
-    }
-  }
-
-  if ( m_doDataGoodMonitoring.value() ) {
-    // *-- book histo to assess fraction of elastic triggered events with elastic tracks candidates
-    std::string histTitle = "goodDataAssessment";
-    m_hist_goodData = new TH1F (histTitle.c_str(), (histTitle + " elastics").c_str(), 10, -0.5, 9.5);
-    if (m_hist_goodData) {
-      m_hist_goodData->SetCanExtend(TH1::kAllAxes);
-      if( m_rootHistSvc->regHist(m_pathHisto + "common/" + m_hist_goodData->GetName(), m_hist_goodData).isFailure() ) {
-	ATH_MSG_WARNING("Can not register ALFA ROB good data elastic monitoring histogram: " << m_hist_goodData->GetName());
-      }
-    }
-    histTitle = "goodDataAssessmentLB15";
-    m_hist_goodDataLB15 = new TH2F (histTitle.c_str(), (histTitle + " elasticsLB").c_str(), 1000, -0.5, 999.5, 2, 0.5, 2.5);
-    if( m_rootHistSvc->regHist(m_pathHisto + "common/" + m_hist_goodDataLB15->GetName(), m_hist_goodDataLB15).isFailure() ) {
-	ATH_MSG_WARNING("Can not register ALFA ROB good data elastic LB 15 monitoring histogram: " << m_hist_goodDataLB15->GetName());
-    }
-    histTitle = "goodDataAssessmentLB18";
-    m_hist_goodDataLB18 = new TH2F (histTitle.c_str(), (histTitle + " elasticsLB").c_str(), 1000, -0.5, 999.5, 2, 0.5, 2.5);
-    if( m_rootHistSvc->regHist(m_pathHisto + "common/" + m_hist_goodDataLB18->GetName(), m_hist_goodDataLB18).isFailure() ) {
-	ATH_MSG_WARNING("Can not register ALFA ROB good data elastic LB 18 monitoring histogram: " << m_hist_goodDataLB18->GetName());
-    }
-    histTitle = "corruptedROD";
-    m_hist_corruptedROD_LB = new TH2F (histTitle.c_str(), (histTitle + " perLB").c_str(), 1000, -0.5, 999.5, 2, -0.5, 1.5);
-    if( m_rootHistSvc->regHist(m_pathHisto + "common/" + m_hist_corruptedROD_LB->GetName(), m_hist_corruptedROD_LB).isFailure() ) {
-	ATH_MSG_WARNING("Can not register ALFA ROB good data elastic LB 18 monitoring histogram: " << m_hist_corruptedROD_LB->GetName());
-    }
-  }
-
-
-  if ( m_doALFATracking.value() ) {
-     std::string histTitle;
-
-     for (uint32_t trgCond = 0; trgCond < 12; trgCond++) {
-         for (uint32_t station = 0; station < 8; station++) {
-              histTitle = m_stationNames[station] + "_f_" + m_trigConditions[trgCond];
-              m_hist_ALFA_trig_validated_tracks[trgCond][station] = new TH2F (histTitle.c_str(), (histTitle).c_str(),
-                                                                                    260,-23,23,175,m_y_min[station%2],m_y_max[station%2]); 
-              if (m_hist_ALFA_trig_validated_tracks[trgCond][station]) {
-                 if( m_rootHistSvc->regHist(m_pathHisto + "tracking/full/" + m_trigConditions[trgCond] + "/" + m_stationNames[station] , 
-                        m_hist_ALFA_trig_validated_tracks[trgCond][station]).isFailure() ) {
-                       ATH_MSG_WARNING("Can not register ALFA tracking histogram: " 
-                                   << (m_hist_ALFA_trig_validated_tracks[trgCond][station])->GetName());
-                 }
-              }
-         }
-     }
-
-     for (uint32_t trgCond = 0; trgCond < 12; trgCond++) {
-         for (uint32_t station = 0; station < 8; station++) {
-              histTitle = m_stationNames[station] + "_f_SB_" + m_trigConditions[trgCond];
-              m_hist_ALFA_trig_validated_tracks_SB[trgCond][station] = new TH2F (histTitle.c_str(), (histTitle).c_str(),
-                                                                                    260,-23,23,175,m_y_min[station%2],m_y_max[station%2]); 
-              if (m_hist_ALFA_trig_validated_tracks_SB[trgCond][station]) {
-                 if( m_rootHistSvc->regHist(m_pathHisto + "tracking/full_SB/" + m_trigConditions[trgCond] + "/" + m_stationNames[station] , 
-                        m_hist_ALFA_trig_validated_tracks_SB[trgCond][station]).isFailure() ) {
-                       ATH_MSG_WARNING("Can not register ALFA tracking histogram: " 
-                                   << (m_hist_ALFA_trig_validated_tracks_SB[trgCond][station])->GetName());
-                 }
-              }
-         }
-     }
-
-     for (uint32_t trgCond = 0; trgCond < 12; trgCond++) {
-         for (uint32_t station = 0; station < 8; station++) {
-              histTitle = m_stationNames[station] + "_current_" + m_trigConditions[trgCond];
-              m_hist_ALFA_trig_validated_tracks_1LB_current[trgCond][station] = new TH2F (histTitle.c_str(), (histTitle).c_str(),
-                                                                                    260,-23,23,175,m_y_min[station%2],m_y_max[station%2]); 
-              if (m_hist_ALFA_trig_validated_tracks_1LB_current[trgCond][station]) {
-                 if( m_rootHistSvc->regHist(m_pathHisto + "tracking/current/" + m_trigConditions[trgCond] + "/" + m_stationNames[station] , 
-                        m_hist_ALFA_trig_validated_tracks_1LB_current[trgCond][station]).isFailure() ) {
-                       ATH_MSG_WARNING("Can not register ALFA tracking histogram: " 
-                                   << (m_hist_ALFA_trig_validated_tracks_1LB_current[trgCond][station])->GetName());
-                 } 
-              }
-         }
-     }
-
-     for (uint32_t trgCond = 0; trgCond < 12; trgCond++) {
-         for (uint32_t station = 0; station < 8; station++) {
-              histTitle = m_stationNames[station] + "_1_" + m_trigConditions[trgCond];
-              m_hist_ALFA_trig_validated_tracks_1LB[trgCond][station] = new TH2F (histTitle.c_str(), (histTitle).c_str(),
-                                                                                    260,-23,23,175,m_y_min[station%2],m_y_max[station%2]); 
-              if (m_hist_ALFA_trig_validated_tracks_1LB[trgCond][station]) {
-                 if( m_rootHistSvc->regHist(m_pathHisto + "tracking/reset1LB/" + m_trigConditions[trgCond] + "/" + m_stationNames[station] , 
-                        m_hist_ALFA_trig_validated_tracks_1LB[trgCond][station]).isFailure() ) {
-                       ATH_MSG_WARNING("Can not register ALFA tracking histogram: " 
-                                   << (m_hist_ALFA_trig_validated_tracks_1LB[trgCond][station])->GetName());
-                 } 
-              }
-         }
-     }
-
-     for (uint32_t trgCond = 0; trgCond < 12; trgCond++) {
-         for (uint32_t station = 0; station < 8; station++) {
-              histTitle = m_stationNames[station] + "_10_" + m_trigConditions[trgCond];
-              m_hist_ALFA_trig_validated_tracks_10LB[trgCond][station] = new TH2F (histTitle.c_str(), (histTitle).c_str(),
-                                                                                    260,-23,23,175,m_y_min[station%2],m_y_max[station%2]); 
-              if (m_hist_ALFA_trig_validated_tracks_10LB[trgCond][station]) {
-                 if( m_rootHistSvc->regHist(m_pathHisto + "tracking/reset10LB/" + m_trigConditions[trgCond] + "/" + m_stationNames[station] , 
-                        m_hist_ALFA_trig_validated_tracks_10LB[trgCond][station]).isFailure() ) {
-                       ATH_MSG_WARNING("Can not register ALFA tracking histogram: " 
-                                   << (m_hist_ALFA_trig_validated_tracks_10LB[trgCond][station])->GetName());
-                 }
-              }
-         }
-     }
-
-     for (uint32_t trgCond = 0; trgCond < 12; trgCond++) {
-         for (uint32_t station = 0; station < 8; station++) {
-              histTitle = m_stationNames[station] + "_60_" + m_trigConditions[trgCond];
-              m_hist_ALFA_trig_validated_tracks_60LB[trgCond][station] = new TH2F (histTitle.c_str(), (histTitle).c_str(),
-                                                                                    260,-23,23,175,m_y_min[station%2],m_y_max[station%2]); 
-              if (m_hist_ALFA_trig_validated_tracks_60LB[trgCond][station]) {
-                 if( m_rootHistSvc->regHist(m_pathHisto + "tracking/reset60LB/" + m_trigConditions[trgCond] + "/" + m_stationNames[station] , 
-                        m_hist_ALFA_trig_validated_tracks_60LB[trgCond][station]).isFailure() ) {
-                       ATH_MSG_WARNING("Can not register ALFA tracking histogram: " 
-                                   << (m_hist_ALFA_trig_validated_tracks_60LB[trgCond][station])->GetName());
-                 }
-              }
-         }
-     }
-  }
-
-  if ( m_doPMFMonitoring.value() ) {
-
-     std::string histTitle;
-
-     for (uint32_t station = 0; station < 8; station++) {
-         histTitle = "RP_" + std::to_string(station+1) + " PMT_activity";
-         m_hist_pmfMonitoring[station] = new TH2F (histTitle.c_str(), (histTitle + " all PMTs").c_str(), 64,0.,64.,23.,1.,24.);
-              if (m_hist_pmfMonitoring[station]) {
-                 if( m_rootHistSvc->regHist(m_pathHisto + "detectors/"+ m_stationNames[station] + "/" + (m_hist_pmfMonitoring[station])->GetName(), 
-                       m_hist_pmfMonitoring[station]).isFailure() ) {
-                       ATH_MSG_WARNING("Can not register ALFA PMT monitoring histogram: " 
-                                   << (m_hist_pmfMonitoring[station])->GetName());
-                 }
-              }
-     }
-  }
-
-
-  if ( m_doODDistance.value() ) {
-
-     std::string histTitle;
-
-     for (uint32_t iDet = 0; iDet < 8; iDet++) {
-      for (uint32_t iSide=0; iSide<2; iSide++) {
-         histTitle = "RP_" + std::to_string(iDet+1) + "_" + std::to_string(iSide) + " position";
-         m_hist_PosDetector[iDet][iSide] = new TH1F (histTitle.c_str(), (histTitle).c_str(), 200.,-145.0,-125.0);
-         if (m_hist_PosDetector[iDet][iSide]) {
-             if( m_rootHistSvc->regHist(m_pathHisto + "OD/"+ m_stationNames[iDet] + "/" + (m_hist_PosDetector[iDet][iSide])->GetName(), 
-                     m_hist_PosDetector[iDet][iSide]).isFailure() ) {
-                     ATH_MSG_WARNING("Can not register ALFA PMT monitoring histogram: " 
-                                 << (m_hist_PosDetector[iDet][iSide])->GetName());
-             }
-         }
-       }
-     }
-     for (uint32_t iStation = 0; iStation < 4; iStation++) {
-       for (uint32_t iSide=0; iSide<2; iSide++) {
-         histTitle = "Distance_" + std::to_string(2*iStation+1) + "_" + std::to_string(2*iStation+2) + "_side_" + std::to_string(iSide);
-         m_hist_DistStation[2*iStation][iSide] = new TH1F (histTitle.c_str(), (histTitle).c_str(), 401.,-20.05,20.05);
-         if (m_hist_DistStation[2*iStation][iSide]) {
-             if( m_rootHistSvc->regHist(m_pathHisto + "OD/"+ m_stationNames[2*iStation] + "/" + (m_hist_DistStation[2*iStation][iSide])->GetName(),                   
-                     m_hist_DistStation[2*iStation][iSide]).isFailure() ) {
-                     ATH_MSG_WARNING("Can not register ALFA PMT monitoring histogram: "  
-                                 << (m_hist_DistStation[2*iStation][iSide])->GetName());
-             }
-         }
-  
-       }
-     }
-  }
-
   // release histogramming service
   // when we plan to book now histograms at the LB boundaries we should not release the histogramming service ...m_rootHistSvc.release().ignore();
 
@@ -621,8 +370,6 @@ StatusCode TrigALFAROBMonitor::start() {
 StatusCode TrigALFAROBMonitor::stop() {
 
   // find LB number some other way that from EventInfo
-  reset1LBhistos();
-
   return StatusCode::SUCCESS;
 }
 
@@ -780,12 +527,10 @@ uint32_t TrigALFAROBMonitor::decodeALFA(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFr
         // check consistency of the ROD data - if data from LWC point to TWC
         if ((*lwcPtr & 0xff000000) != 0x81000000) {
     	    ATH_MSG_DEBUG("ROD "<< MSG::hex<<rodId<<" skipped - LWC(-1): "<< *(lwcPtr-1) <<" LWC: "<<*lwcPtr << " LWC+1: "<< *(lwcPtr+1) );
-    	    ATH_MSG_INFO("ROD "<< MSG::hex<<rodId<<"skipped - LWC(-1): "<< *(lwcPtr-1) <<" LWC: "<<*lwcPtr << " LWC+1: "<< *(lwcPtr+1) );
             return (1); //continue;
         }
         if ((*twcPtr & 0xff000000) != 0x8a000000) {
-    	    ATH_MSG_DEBUG( "ROD "<< MSG::hex<<rodId<<" skipped - TWC: "<< *twcPtr );
-    	    ATH_MSG_INFO( "ROD "<< MSG::hex<<rodId<<" skipped - TWC(-1): "<< *(twcPtr-1)<< " TWC: "<< *twcPtr <<" TWC+1: " << *(twcPtr+1) 
+    	    ATH_MSG_DEBUG( "ROD "<< MSG::hex<<rodId<<" skipped - TWC(-1): "<< *(twcPtr-1)<< " TWC: "<< *twcPtr <<" TWC+1: " << *(twcPtr+1) 
                            <<" LWC: " << *lwcPtr << " mbNb: "<< mbNb);
             return (1); //continue;
         }
@@ -886,12 +631,11 @@ void TrigALFAROBMonitor::decodeRealPMT (uint32_t dataWord, uint32_t quarter, uin
        if (dataWord & mask) {
            int channel = offset + quarter*16;
 
-           m_hist_pmfMonitoring[mbNb]->Fill(double(channel),double(pmf)); 
            {
-               std::string stationName = "det-" + m_stationNames[mbNb] + "-Channel";
+               std::string stationName =  m_stationNames[mbNb] + "_"; 
                auto channelNb = Monitored::Scalar<double>(stationName, channel);
                auto pmfNb     = Monitored::Scalar<double>("PMF", pmf);
-               auto monGroup = Monitored::Group ( m_monTool, channelNb, pmfNb );
+               auto monGroup = Monitored::Group ( *m_monTools["MonTool_detectors"], channelNb, pmfNb );
            }
 
            if (layerNb >= 0) {
@@ -1023,42 +767,6 @@ bool TrigALFAROBMonitor::getHLTResult(HLT::HLTResult &resultHLT) const {
     }
 }
 
-void TrigALFAROBMonitor::reset1LBhistos() const {
-
-     ATH_MSG_INFO ("reset 1LB histos" );
-     for (uint32_t trgCond = 0; trgCond < 12; trgCond++) {
-         for (uint32_t station = 0; station < 8; station++) {
-              (m_hist_ALFA_trig_validated_tracks_1LB[trgCond][station])->Reset();
-              (m_hist_ALFA_trig_validated_tracks_1LB[trgCond][station])->Add(m_hist_ALFA_trig_validated_tracks_1LB_current[trgCond][station]);
-              (m_hist_ALFA_trig_validated_tracks_1LB_current[trgCond][station])->Reset();
-         }
-     }
-}
-
-
-void TrigALFAROBMonitor::reset10LBhistos() const {
-
-     ATH_MSG_INFO ("reset 10LB histos");
-     for (uint32_t trgCond = 0; trgCond < 12; trgCond++) {
-         for (uint32_t station = 0; station < 8; station++) {
-             (m_hist_ALFA_trig_validated_tracks_10LB[trgCond][station])->Reset();
-         }
-     }
-}
-
-
-void TrigALFAROBMonitor::reset60LBhistos() const {
-
-     ATH_MSG_INFO ("reset 60LB histos");
-     for (uint32_t trgCond = 0; trgCond < 12; trgCond++) {
-         for (uint32_t station = 0; station < 8; station++) {
-            (m_hist_ALFA_trig_validated_tracks_60LB[trgCond][station])->Reset();
-         }
-     }
-}
-
-
-
 void TrigALFAROBMonitor::findALFATracks( const ROIB::RoIBResult* roIBResult, 
                                          const int lumiBlockNb, 
                                          const bool SBflag, 
@@ -1212,19 +920,30 @@ void TrigALFAROBMonitor::findALFATracks( const ROIB::RoIBResult* roIBResult,
                                           ATH_MSG_DEBUG( "findALFATracks access TBP at: " <<word<<" with offset: "<<offset );
                                           if ((ctpRoIVecBP.at(word)).roIWord() & 1<<offset) {
                                                 ATH_MSG_DEBUG( "filling findALFATracks histos " );
-                                                m_hist_ALFA_trig_validated_tracks[it->second][iDet]->Fill(x_Rec[iDet],y_Rec[iDet]);
            					{
-               						std::string stationName = "trk-full-" + m_trigConditions[it->second]+ "-" + m_stationNames[iDet] + "-x";
+               						std::string stationName =  m_trigConditions[it->second]+ "_" + m_stationNames[iDet];
                						auto x_coord = Monitored::Scalar<double>(stationName, x_Rec[iDet]);
                						auto y_coord = Monitored::Scalar<double>("y", y_Rec[iDet]);
-               						auto monGroup = Monitored::Group ( m_monTool, x_coord, y_coord );
+                                                        std::string current, trk1, trk10, trk60;
+                                                        if (it->second == 0) {
+                                                            current = "trackingElast";
+                                                            trk1 =    "trackingElast_1LB";
+                                                            trk10 =   "trackingElast_10LB";
+                                                            trk60 =   "trackingElast_60LB";
+                                                        } else {
+                                                            current = "trackingAny";
+                                                            trk1 =    "trackingAny_1LB";
+                                                            trk10 =   "trackingAny_10LB";
+                                                            trk60 =   "trackingAny_60LB";
+                                                        }
+               						    auto monGroup =   Monitored::Group (  *m_monTools["MonTool_" + current], x_coord, y_coord );
+               						    auto monGroup1 =  Monitored::Group (  *m_monTools["MonTool_" + trk1],    x_coord, y_coord );
+               						    auto monGroup10 = Monitored::Group (  *m_monTools["MonTool_" + trk10],   x_coord, y_coord );
+               						    auto monGroup60 = Monitored::Group (  *m_monTools["MonTool_" + trk60],   x_coord, y_coord );
            					}
 
-                                                m_hist_ALFA_trig_validated_tracks_1LB_current[it->second][iDet]->Fill(x_Rec[iDet],y_Rec[iDet]);
-                                                m_hist_ALFA_trig_validated_tracks_10LB[it->second][iDet]->Fill(x_Rec[iDet],y_Rec[iDet]);
-                                                m_hist_ALFA_trig_validated_tracks_60LB[it->second][iDet]->Fill(x_Rec[iDet],y_Rec[iDet]);
                                                 if (SBflag) {
-                                                   m_hist_ALFA_trig_validated_tracks_SB[it->second][iDet]->Fill(x_Rec[iDet],y_Rec[iDet]);
+                                                   //m_hist_ALFA_trig_validated_tracks_SB[it->second][iDet]->Fill(x_Rec[iDet],y_Rec[iDet]);
                                                 }
                                                 //ATH_MSG_INFO ("found track in det: "<<iDet<<" item: "<<it->first<<" in word: "<<word<<" offset: "<<offset);
                     			   }
@@ -1251,51 +970,43 @@ void TrigALFAROBMonitor::findALFATracks( const ROIB::RoIBResult* roIBResult,
            if ((ctpRoIVecBP.at(m_elast15>>5)).roIWord() & (1 <<(m_elast15%32))) {
               {
                   std::string stationName  = "goodDataAssessmentLB15";
-                  std::string stationName1 = "com-goodDataAssessment";
+                  std::string stationName1 = "com_goodDataAssessment";
                   auto one      = Monitored::Scalar<double>(stationName, 1.);
                   auto anotherOne = Monitored::Scalar<double>(stationName1, 1.);
-                  auto lbNb     = Monitored::Scalar<double>("com-LB", lumiBlockNb);
-                  auto monGroup = Monitored::Group ( m_monTool, one, anotherOne, lbNb );
+                  auto lbNb     = Monitored::Scalar<double>("com_LB", lumiBlockNb);
+                  auto monGroup = Monitored::Group (  *m_monTools["MonTool_common"], one, anotherOne, lbNb );
               }
-              m_hist_goodData->Fill(1.);
-              m_hist_goodDataLB15->Fill(lumiBlockNb, 1.);
               if ((nbOfTracksInDetectors[0] <=2) && (nbOfTracksInDetectors[2] <=2) && (nbOfTracksInDetectors[5]<=2) && (nbOfTracksInDetectors[7] <= 2) &&
                     (nbOfTracksInDetectors[0]>0) && (nbOfTracksInDetectors[2] >0) && (nbOfTracksInDetectors[5]>0) && (nbOfTracksInDetectors[7] > 0) ) {
                  {
                      std::string stationName  = "goodDataAssessmentLB15";
-                     std::string stationName1 = "com-goodDataAssessment";
+                     std::string stationName1 = "com_goodDataAssessment";
                      auto two      = Monitored::Scalar<double>(stationName, 2.);
                      auto anotherTwo = Monitored::Scalar<double>(stationName1, 2.);
-                     auto lbNb     = Monitored::Scalar<double>("com-LB", lumiBlockNb);
-                     auto monGroup = Monitored::Group ( m_monTool, two, anotherTwo, lbNb );
+                     auto lbNb     = Monitored::Scalar<double>("com_LB", lumiBlockNb);
+                     auto monGroup = Monitored::Group (  *m_monTools["MonTool_common"], two, anotherTwo, lbNb );
                  }
-                 m_hist_goodData->Fill(2.);
-                 m_hist_goodDataLB15->Fill(lumiBlockNb, 2.);
               }
            }
            if ((ctpRoIVecBP.at(m_elast18>>5)).roIWord() & (1 <<(m_elast18%32))) {
                  {
                      std::string stationName  = "goodDataAssessmentLB18";
-                     std::string stationName1 = "com-goodDataAssessment";
+                     std::string stationName1 = "com_goodDataAssessment";
                      auto one      = Monitored::Scalar<double>(stationName, 1.);
                      auto four = Monitored::Scalar<double>(stationName1, 4.);
-                     auto lbNb     = Monitored::Scalar<double>("com-LB", lumiBlockNb);
-                     auto monGroup = Monitored::Group ( m_monTool, one, four, lbNb );
+                     auto lbNb     = Monitored::Scalar<double>("com_LB", lumiBlockNb);
+                     auto monGroup = Monitored::Group (  *m_monTools["MonTool_common"], one, four, lbNb );
                  }
-              m_hist_goodData->Fill(4.);
-              m_hist_goodDataLB18->Fill(lumiBlockNb, 1.);
               if ((nbOfTracksInDetectors[1] <=2) && (nbOfTracksInDetectors[3] <=2) && (nbOfTracksInDetectors[4]<=2) && (nbOfTracksInDetectors[6] <= 2) &&
                     (nbOfTracksInDetectors[1]>0) && (nbOfTracksInDetectors[3] >0) && (nbOfTracksInDetectors[4]>0) && (nbOfTracksInDetectors[6] > 0) ) {
                  {
                      std::string stationName  = "goodDataAssessmentLB18";
-                     std::string stationName1 = "com-goodDataAssessment";
+                     std::string stationName1 = "com_goodDataAssessment";
                      auto two      = Monitored::Scalar<double>(stationName, 2.);
                      auto five = Monitored::Scalar<double>(stationName1, 5.);
                      auto lbNb     = Monitored::Scalar<double>("com-LB", lumiBlockNb);
-                     auto monGroup = Monitored::Group ( m_monTool, two, five, lbNb );
+                     auto monGroup = Monitored::Group (  *m_monTools["MonTool_common"], two, five, lbNb );
                  }
-                 m_hist_goodData->Fill(5.);
-                 m_hist_goodDataLB18->Fill(lumiBlockNb, 2.);
               }
            }
         }
@@ -1304,6 +1015,276 @@ void TrigALFAROBMonitor::findALFATracks( const ROIB::RoIBResult* roIBResult,
            ATH_MSG_DEBUG( "det: "<<i<<" - "<<nbOfTracksInDetectors[i]<<"; ");
         }
 
+        const float dist = 8264.;
+        const std::vector <std::string> triggers={"elast15", "elast18", "syst17", "syst18"};
+        const std::vector <std::string> armSets={"L1U", "L1D", "R1U","R1D"};
+        if ((ctpRoIVecBP.at(m_elast15>>5)).roIWord() & (1 <<(m_elast15%32))) {
+           if ( (nbOfTracksInDetectors[0] == 1) && (nbOfTracksInDetectors[2] == 1) && (nbOfTracksInDetectors[5] == 1) && (nbOfTracksInDetectors[7] == 1) &&
+                 (nbOfTracksInDetectors[1] == 0) && (nbOfTracksInDetectors[3] == 0) && (nbOfTracksInDetectors[4] == 0) && (nbOfTracksInDetectors[6] == 0) ) {
+               if ( (x_Rec[0] > -9000.) && (x_Rec[2] > -9000.) && (x_Rec[7] > -9000.) ) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[0] + "_x_" + armSets[0];
+                         std::string name1 = triggers[0] + "_ax_" + armSets[0]; 
+                         auto pcx_x = Monitored::Scalar<float>(name,-x_Rec[0]);
+                         auto pcx_y = Monitored::Scalar<float>("y", -x_Rec[7]);
+                         auto pax_x = Monitored::Scalar<float>(name1,-x_Rec[2]);
+                         auto pax_y = Monitored::Scalar<float>("y", (1000000.*(x_Rec[2] - x_Rec[0]))/dist);
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundElast15"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast15_1LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast15_10LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast15_60LB"], pcx_x, pcx_y, pax_x, pax_y);
+                       }
+               
+               if ( (y_Rec[0] > -9000.) && (y_Rec[2] > -9000.) && (y_Rec[7] > -9000.) ) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[0] + "_y_" + armSets[0];
+                         std::string name1 = triggers[0] + "_ay_" + armSets[0]; 
+                         auto pcy_x = Monitored::Scalar<float>(name,y_Rec[0]);
+                         auto pcy_y = Monitored::Scalar<float>("y", y_Rec[7]);
+                         auto pay_x = Monitored::Scalar<float>(name1,y_Rec[2]);
+                         auto pay_y = Monitored::Scalar<float>("y", (1000000.*(y_Rec[0] - y_Rec[2]))/dist );
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundElast15"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast15_1LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast15_10LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast15_60LB"], pcy_x, pcy_y, pay_x, pay_y);
+                       }
+               }
+               if ( (x_Rec[5] > -9000.) && (x_Rec[7] > -9000.) && (x_Rec[2] > -9000.) ) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[0] + "_x_" + armSets[3];
+                         std::string name1 = triggers[0] + "_ax_" + armSets[3]; 
+                         auto pcx_x = Monitored::Scalar<float>(name,-x_Rec[2]);
+                         auto pcx_y = Monitored::Scalar<float>("y", -x_Rec[5]);
+                         auto pax_x = Monitored::Scalar<float>(name1,-x_Rec[5]);
+                         auto pax_y = Monitored::Scalar<float>("y", (1000000.*(x_Rec[5] - x_Rec[7]))/dist );
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundElast15"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast15_1LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast15_10LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast15_60LB"], pcx_x, pcx_y, pax_x, pax_y);
+                       }
+               }
+               if ( (y_Rec[5] > -9000.) && (y_Rec[7] > -9000.) && (y_Rec[2] > -9000.) ) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[0] + "_y_" + armSets[3];
+                         std::string name1 = triggers[0] + "_ay_" + armSets[3]; 
+                         auto pcy_x = Monitored::Scalar<float>(name,y_Rec[2]);
+                         auto pcy_y = Monitored::Scalar<float>("y", y_Rec[5]);
+                         auto pay_x = Monitored::Scalar<float>(name1,y_Rec[5]);
+                         auto pay_y = Monitored::Scalar<float>("y",  (1000000.*(y_Rec[7] - y_Rec[5]))/dist );
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundElast15"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast15_1LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast15_10LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast15_60LB"], pcy_x, pcy_y, pay_x, pay_y);
+                       }
+               }
+           }
+         }
+        }
+
+        if ((ctpRoIVecBP.at(m_elast18>>5)).roIWord() & (1 <<(m_elast18%32))) {
+           if ( (nbOfTracksInDetectors[1] == 1) && (nbOfTracksInDetectors[3] == 1) && (nbOfTracksInDetectors[4] == 1) && (nbOfTracksInDetectors[6] == 1) &&
+                 (nbOfTracksInDetectors[0] == 0) && (nbOfTracksInDetectors[2] == 0) && (nbOfTracksInDetectors[5] == 0) && (nbOfTracksInDetectors[7] == 0) ) {
+               if ( (x_Rec[1] > -9000.) && (x_Rec[3] > -9000.) && (x_Rec[6] > -9000.) ) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[1] + "_x_" + armSets[1];
+                         std::string name1 = triggers[1] + "_ax_" + armSets[1]; 
+                         auto pcx_x = Monitored::Scalar<float>(name,-x_Rec[1]);
+                         auto pcx_y = Monitored::Scalar<float>("y", -x_Rec[6]);
+                         auto pax_x = Monitored::Scalar<float>(name1,-x_Rec[3]);
+                         auto pax_y = Monitored::Scalar<float>("y",  (1000000.*(x_Rec[3] - x_Rec[1]))/dist );
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundElast18"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast18_1LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast18_10LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast18_60LB"], pcx_x, pcx_y, pax_x, pax_y);
+                       }
+               }
+               if ( (y_Rec[1] > -9000.) && (y_Rec[3] > -9000.) && (y_Rec[6] > -9000.) ) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[1] + "_y_" + armSets[1];
+                         std::string name1 = triggers[1] + "_ay_" + armSets[1]; 
+                         auto pcy_x = Monitored::Scalar<float>(name,y_Rec[1]);
+                         auto pcy_y = Monitored::Scalar<float>("y", y_Rec[6]);
+                         auto pay_x = Monitored::Scalar<float>(name1,y_Rec[3]);
+                         auto pay_y = Monitored::Scalar<float>("y",  (1000000.*(y_Rec[1] - y_Rec[3]))/dist );
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundElast18"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast18_1LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast18_10LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast18_60LB"], pcy_x, pcy_y, pay_x, pay_y);
+                       }
+               }
+               if ( (x_Rec[4] > -9000.) && (x_Rec[6] > -9000.) && (x_Rec[3] > -9000.) ) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[1] + "_x_" + armSets[2];
+                         std::string name1 = triggers[1] + "_ax_" + armSets[2]; 
+                         auto pcx_x = Monitored::Scalar<float>(name,-x_Rec[3]);
+                         auto pcx_y = Monitored::Scalar<float>("y", -x_Rec[4]);
+                         auto pax_x = Monitored::Scalar<float>(name1,-x_Rec[4]);
+                         auto pax_y = Monitored::Scalar<float>("y", (1000000.*(x_Rec[4] - x_Rec[6]))/dist );
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundElast18"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast18_1LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast18_10LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast18_60LB"], pcx_x, pcx_y, pax_x, pax_y);
+                       }
+               }
+               if ( (y_Rec[4] > -9000.) && (y_Rec[6] > -9000.) && (y_Rec[3] > -9000.)  ) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[1] + "_y_" + armSets[2];
+                         std::string name1 = triggers[1] + "_ay_" + armSets[2]; 
+                         auto pcy_x = Monitored::Scalar<float>(name,y_Rec[3]);
+                         auto pcy_y = Monitored::Scalar<float>("y", y_Rec[4]);
+                         auto pay_x = Monitored::Scalar<float>(name1,y_Rec[4]);
+                         auto pay_y = Monitored::Scalar<float>("y",  (1000000.*(y_Rec[6] - y_Rec[4]))/dist );
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundElast18"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast18_1LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast18_10LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundElast18_60LB"], pcy_x, pcy_y, pay_x, pay_y);
+                       }
+               }
+           }
+         }
+
+        if ((ctpRoIVecBP.at(m_syst17>>5)).roIWord() & (1 <<(m_syst17%32))) {
+           //if ( (m_nbOfTracksInDetectors[0] >= 1) && (m_nbOfTracksInDetectors[2] >= 1) && (m_nbOfTracksInDetectors[4] >= 1) && (m_nbOfTracksInDetectors[6] >= 1) &&
+             if (1) {  // (m_nbOfTracksInDetectors[1] == 0) && (m_nbOfTracksInDetectors[3] == 0) && (m_nbOfTracksInDetectors[5] == 0) && (m_nbOfTracksInDetectors[7] == 0) ) {
+               //ATH_MSG_INFO(" m_syst17 fired: xrec0: "<<x_Rec[0]<<" xrec2: "<<x_Rec[2]<<" xrec4: "<<x_Rec[4]<<" xrec6: "<<x_Rec[6] );
+               if ( (x_Rec[0] > -9000.) && (x_Rec[2] > -9000.) ) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[2] + "_x_" + armSets[0];
+                         std::string name1 = triggers[2] + "_ax_" + armSets[0]; 
+                         auto pcx_x = Monitored::Scalar<float>(name,-x_Rec[0]);
+                         auto pcx_y = Monitored::Scalar<float>("y", -x_Rec[2]);
+                         auto pax_x = Monitored::Scalar<float>(name1,-x_Rec[2]);
+                         auto pax_y = Monitored::Scalar<float>("y", (1000000.*(x_Rec[2] - x_Rec[0]))/dist );
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17_1LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17_10LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17_60LB"], pcx_x, pcx_y, pax_x, pax_y);
+                       }
+               }
+               if ( (y_Rec[0] > -9000.) && (y_Rec[2] > -9000.) ) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[2] + "_y_" + armSets[0];
+                         std::string name1 = triggers[2] + "_ay_" + armSets[0]; 
+                         auto pcy_x = Monitored::Scalar<float>(name,y_Rec[0]);
+                         auto pcy_y = Monitored::Scalar<float>("y", y_Rec[2]);
+                         auto pay_x = Monitored::Scalar<float>(name1, y_Rec[2]);
+                         auto pay_y = Monitored::Scalar<float>("y",  (1000000.*(y_Rec[0] - y_Rec[2]))/dist );
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17_1LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17_10LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17_60LB"], pcy_x, pcy_y, pay_x, pay_y);
+                       }
+               }
+               if ( (x_Rec[4] > -9000.) && (x_Rec[6] > -9000.) ) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[2] + "_x_" + armSets[2];
+                         std::string name1 = triggers[2] + "_ax_" + armSets[2]; 
+                         auto pcx_x = Monitored::Scalar<float>(name,-x_Rec[6]);
+                         auto pcx_y = Monitored::Scalar<float>("y", -x_Rec[4]);
+                         auto pax_x = Monitored::Scalar<float>(name1, -x_Rec[4]);
+                         auto pax_y = Monitored::Scalar<float>("y", (1000000.*(x_Rec[4] - x_Rec[6]))/dist );
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17_1LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17_10LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17_60LB"], pcx_x, pcx_y, pax_x, pax_y);
+                       }
+               }
+               if ( (y_Rec[4] > -9000.) && (y_Rec[6] > -9000.)) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[2] + "_y_" + armSets[2];
+                         std::string name1 = triggers[2] + "_ay_" + armSets[2]; 
+                         auto pcy_x = Monitored::Scalar<float>(name,y_Rec[6]);
+                         auto pcy_y = Monitored::Scalar<float>("y", y_Rec[4]);
+                         auto pay_x = Monitored::Scalar<float>(name1, y_Rec[4]);
+                         auto pay_y = Monitored::Scalar<float>("y",  (1000000.*(y_Rec[6] - y_Rec[4]))/dist );
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17_1LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17_10LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst17_60LB"], pcy_x, pcy_y, pay_x, pay_y);
+                       }
+               }
+           }
+         }
+
+        if ((ctpRoIVecBP.at(m_syst18>>5)).roIWord() & (1 <<(m_syst18%32))) {
+            //if ( (m_nbOfTracksInDetectors[1] >= 1) && (m_nbOfTracksInDetectors[3] >= 1) && (m_nbOfTracksInDetectors[5] >= 1) && (m_nbOfTracksInDetectors[7] >= 1) &&
+              if (1) { //((m_nbOfTracksInDetectors[0] == 0) && (m_nbOfTracksInDetectors[2] == 0) && (m_nbOfTracksInDetectors[4] == 0) && (m_nbOfTracksInDetectors[6] == 0) ) {
+               //ATH_MSG_INFO(" m_syst18 fired: xrec1: "<<x_Rec[1]<<" xrec3: "<<x_Rec[3]<<" xrec5: "<<x_Rec[5]<<" xrec7: "<<x_Rec[7] );
+               if ( (x_Rec[1] > -9000.) && (x_Rec[3] > -9000.) ) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[3] + "_x_" + armSets[1];
+                         std::string name1 = triggers[3] + "_ax_" + armSets[1]; 
+                         auto pcx_x = Monitored::Scalar<float>(name,-x_Rec[1]);
+                         auto pcx_y = Monitored::Scalar<float>("y", -x_Rec[3]);
+                         auto pax_x = Monitored::Scalar<float>(name1, -x_Rec[3]);
+                         auto pax_y = Monitored::Scalar<float>("y", (1000000.*(x_Rec[3] - x_Rec[1]))/dist );
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18_1LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18_10LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18_60LB"], pcx_x, pcx_y, pax_x, pax_y);
+                       }
+               }
+               if ( (y_Rec[1] > -9000.) && (y_Rec[3] > -9000.) ) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[3] + "_y_" + armSets[1];
+                         std::string name1 = triggers[3] + "_ay_" + armSets[1]; 
+                         auto pcy_x = Monitored::Scalar<float>(name,y_Rec[1]);
+                         auto pcy_y = Monitored::Scalar<float>("y", y_Rec[3]);
+                         auto pay_x = Monitored::Scalar<float>(name1, y_Rec[3]);
+                         auto pay_y = Monitored::Scalar<float>("y",  (1000000.*(y_Rec[1] - y_Rec[3]))/dist );
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18_1LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18_10LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18_60LB"], pcy_x, pcy_y, pay_x, pay_y);
+                       }
+               }
+               if ( (x_Rec[5] > -9000.) && (x_Rec[7] > -9000.) ) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[3] + "_x_" + armSets[3];
+                         std::string name1 = triggers[3] + "_ax_" + armSets[3]; 
+                         auto pcx_x = Monitored::Scalar<float>(name,-x_Rec[7]);
+                         auto pcx_y = Monitored::Scalar<float>("y", -x_Rec[5]);
+                         auto pax_x = Monitored::Scalar<float>(name1, -x_Rec[5]);
+                         auto pax_y = Monitored::Scalar<float>("y", (1000000.*(x_Rec[5] - x_Rec[7]))/dist );
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18_1LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18_10LB"], pcx_x, pcx_y, pax_x, pax_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18_60LB"], pcx_x, pcx_y, pax_x, pax_y);
+                       }
+               }
+               if ( (y_Rec[5] > -9000.)&& (y_Rec[7] > -9000.) ) {
+                       {
+                         ATH_MSG_DEBUG( "filling bckg histos " );
+                         std::string name = triggers[3] + "_y_" + armSets[3];
+                         std::string name1 = triggers[3] + "_ay_" + armSets[3]; 
+                         auto pcy_x = Monitored::Scalar<float>(name,y_Rec[7]);
+                         auto pcy_y = Monitored::Scalar<float>("y", y_Rec[5]);
+                         auto pay_x = Monitored::Scalar<float>(name1, y_Rec[5]);
+                         auto pay_y = Monitored::Scalar<float>("y", (1000000.*(y_Rec[7] - y_Rec[5]))/dist );
+                         auto monGroup = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_1LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18_1LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_10LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18_10LB"], pcy_x, pcy_y, pay_x, pay_y);
+                         auto monGroup_60LB = Monitored::Group ( *m_monTools["MonTool_backgroundSyst18_60LB"], pcy_x, pcy_y, pay_x, pay_y);
+                       }
+               }
+           }
+         }
+
    return;
 }  
 
@@ -1403,10 +1384,6 @@ void TrigALFAROBMonitor::findODTracks( bool FiberHitsODNeg[][3][30], bool FiberH
                             if (FoundTrack[iUL]) break;
                         }
                     }//end of iLay-loop
-                    // hMinMultipl[iStation*2+iUL][iSide]->Fill(MinMultipl);
-                    // hMultipl2D[iStation*2+iUL][iSide][0]->Fill(Multiplicity[0],Multiplicity[1]);
-                    // hMultipl2D[iStation*2+iUL][iSide][1]->Fill(Multiplicity[0],Multiplicity[2]);
-                    // hMultipl2D[iStation*2+iUL][iSide][2]->Fill(Multiplicity[1],Multiplicity[2]);
                 }//end of iUL-loop
 
             } else {//The same just for the negative side
@@ -1481,45 +1458,38 @@ void TrigALFAROBMonitor::findODTracks( bool FiberHitsODNeg[][3][30], bool FiberH
                         }
                         if (FoundTrack[iUL]) break;
                     }//end of iLay-loop
-                    // hMinMultipl[iStation*2+iUL][iSide]->Fill(MinMultipl);
-                    // hMultipl2D[iStation*2+iUL][iSide][0]->Fill(Multiplicity[0],Multiplicity[1]);
-                    // hMultipl2D[iStation*2+iUL][iSide][1]->Fill(Multiplicity[0],Multiplicity[2]);
-                    // hMultipl2D[iStation*2+iUL][iSide][2]->Fill(Multiplicity[1],Multiplicity[2]);
                 }//end of iUL-loop
             }
 
             //If we have a track in both upper and lower detector, we fill the histograms
             if (FoundTrack[0]) { 
                  {
-                     std::string stationName  = "od-" + m_stationNames[iStation*2] + "-RP_" + std::to_string(iStation*2+1) + "_" + std::to_string(iSide) + " position";
-                     ATH_MSG_INFO(stationName);
+                     std::string stationName  = "od_" + m_stationNames[iStation*2] + "_RP_" + std::to_string(iStation*2+1) + "_" + std::to_string(iSide) + " position";
                      auto pos    = Monitored::Scalar<double>(stationName, Pos[0]);
-                     auto monGroup = Monitored::Group ( m_monTool, pos );
+                     auto monGroup = Monitored::Group (  *m_monTools["MonTool_OD_" + m_stationNames[iStation*2]], pos );
                  }
 
-                 m_hist_PosDetector[iStation*2][iSide]->Fill(Pos[0]);
+                 //m_hist_PosDetector[iStation*2][iSide]->Fill(Pos[0]);
                  ODtracks[iStation*2][iSide] = Pos[0];
             }
             if (FoundTrack[1]) {
                  {
-                     std::string stationName  = "od-" + m_stationNames[iStation*2+1] + "-RP_" + std::to_string(iStation*2+2) + "_" + std::to_string(iSide) + " position";
-                     ATH_MSG_INFO(stationName);
+                     std::string stationName  = "od_" + m_stationNames[iStation*2+1] + "_RP_" + std::to_string(iStation*2+2) + "_" + std::to_string(iSide) + " position";
                      auto pos    = Monitored::Scalar<double>(stationName, Pos[1]);
-                     auto monGroup = Monitored::Group ( m_monTool, pos );
+                     auto monGroup = Monitored::Group (  *m_monTools["MonTool_OD_" + m_stationNames[iStation*2+1]], pos );
                  }
-                 m_hist_PosDetector[iStation*2+1][iSide]->Fill(Pos[1]);
+                 //m_hist_PosDetector[iStation*2+1][iSide]->Fill(Pos[1]);
                  ODtracks[iStation*2+1][iSide] = Pos[1];
             }
             //if (FoundTrack[0] && FoundTrack[1]){
             if( (ODtracks[iStation*2][iSide] < 0) && (ODtracks[iStation*2+1][iSide] < 0) ) {
               {
-                  std::string stationName  = "od-" + m_stationNames[iStation*2] + "-distance_" + std::to_string(iStation*2+1) + "_" + std::to_string(iStation*2+2)+ "_side_" + std::to_string(iSide);
-                  ATH_MSG_INFO(stationName);
+                  std::string stationName  = "od_" + m_stationNames[iStation*2] + "_distance_" + std::to_string(iStation*2+1) + "_" + std::to_string(iStation*2+2)+ "_side_" + std::to_string(iSide);
                   auto pos    = Monitored::Scalar<double>(stationName, -ODtracks[iStation*2][iSide] - ODtracks[iStation*2+1][iSide] + m_alfa_edge[iStation*2] + m_alfa_edge[iStation*2+1]);
-                  auto monGroup = Monitored::Group ( m_monTool, pos );
+                  auto monGroup = Monitored::Group (  *m_monTools["MonTool_OD_" +  m_stationNames[iStation*2]], pos );
               }
 
-              m_hist_DistStation[2*iStation][iSide]->Fill(-ODtracks[iStation*2][iSide] - ODtracks[iStation*2+1][iSide] + m_alfa_edge[iStation*2] + m_alfa_edge[iStation*2+1]);
+              //m_hist_DistStation[2*iStation][iSide]->Fill(-ODtracks[iStation*2][iSide] - ODtracks[iStation*2+1][iSide] + m_alfa_edge[iStation*2] + m_alfa_edge[iStation*2+1]);
             }
 
         }//end of iSide-loop
diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.h b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.h
index 840564901a3c2ee9195d65eb4884336fffc5e9c3..60370d8dc2a10b064fb59dceff3cf411b774a0f1 100755
--- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.h
+++ b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "AthenaBaseComps/AthReentrantAlgorithm.h"
@@ -26,6 +26,8 @@
 
 #include "AthenaMonitoringKernel/Monitored.h"
 
+#include <initializer_list>
+
 
 
 /////////////////////////////////////////////////////////////////////////////
@@ -36,6 +38,7 @@ namespace ROIB {
 
 class MuCTPI_RDO;
 class IROBDataProviderSvc;
+class ITrigROBDataProviderSvc;
 
 class TH1F;       /// for monitoring purposes
 class TH2F;       /// for monitoring purposes
@@ -90,10 +93,6 @@ private:
   BooleanProperty                  m_doROBChecksum;
   TH1F*                            m_hist_failedChecksumForALFAROB;
   Histo1DProperty                  m_histProp_failedChecksumForALFAROB;
-  //TH1F*                            m_hist_failedChecksumForROB;
-  //Histo1DProperty                  m_histProp_failedChecksumForROB;
-  //TH1F*                            m_hist_failedChecksumForSD;
-  //Histo1DProperty                  m_histProp_failedChecksumForSD;
 
   /// Switch for ALFA fast online tracking
   BooleanProperty                  m_doALFATracking;
@@ -121,42 +120,29 @@ private:
   std::map<eformat::GenericStatus, std::string> m_map_GenericStatus;
   std::vector<std::string>                      m_vec_SpecificStatus;
 
+  TH2F*                            m_hist_bckg_pcx[4][4];
+  TH2F*                            m_hist_bckg_pcy[4][4];
+  TH2F*                            m_hist_bckg_pax[4][4];
+  TH2F*                            m_hist_bckg_pay[4][4];
+
   /// pointers to the CTP and muCTPi result objects
   ROIB::MuCTPIResult*              m_lvl1muCTPIResult;  // RoIB muCTPi Result
 
-  ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool","","Monitoring tool"};
+  ToolHandleArray<GenericMonitoringTool> m_monTools{this, "MonTools", {}, "Monitoring tools"};
 
   /// vectors with CTP and muCTPi ROB Ids
-  //std::vector<uint32_t> m_ctpRobIds;
-  //std::vector<uint32_t> m_muCTPiRobIds;
   std::vector<uint32_t> m_ALFARobIds;
 
-  /// trigger muCTPi RoIs from L1 and DAQ ROB
-  //std::vector<ROIB::MuCTPIRoI>     m_lvl1muCTPIRoIs;    // RoIs from RoIB muCTPi ROB
-  //std::vector<ROIB::MuCTPIRoI>     m_daqmuCTPIRoIs;     // RoIs from DAQ muCTPi ROB
-
-  //std::vector<uint32_t>            m_lvl1muCTPIHash_Endcap;  // Hash for RoIs from RoIB 
-  //std::vector<uint32_t>            m_lvl1muCTPIHash_Forward; // Hash for RoIs from RoIB 
-  //std::vector<uint32_t>            m_lvl1muCTPIHash_Barrel;  // Hash for RoIs from RoIB 
-
-  //std::vector<uint32_t>            m_daqmuCTPIHash_Endcap;   // Hash for RoIs from DAQ ROB 
-  //std::vector<uint32_t>            m_daqmuCTPIHash_Forward;  // Hash for RoIs from DAQ ROB 
-  //std::vector<uint32_t>            m_daqmuCTPIHash_Barrel;   // Hash for RoIs from DAQ ROB 
-
   Histo1DProperty                  m_histProp_NumberOfRoIs;
 
   std::map<std::string, int> m_map_TrgNamesToHistGroups;
   std::map<int, int>         m_map_TrgItemNumbersToHistGroups;
 
-  //mutable std::map<int, int>  m_triggerHitPatternReady;
-  //mutable std::map<int, int>  m_triggerHitPattern;
 
   std::string m_pathHisto;
 
-  //TrigConf::HLTChain* m_HLTcostMon_chain;
 
-  int m_elast15 {0}, m_elast18 {0};     // ctp-items id numbers to select golden alfa trigger for data quality assesment
-  //mutable int m_nbOfTracksInDetectors[8]; // counters for track candidates - needed in data quality assesment
+  int m_elast15 {0}, m_elast18 {0},  m_syst17 {0}, m_syst18 {0};     // ctp-items id numbers to select golden alfa trigger for data quality assesment
 
 // ALFA extensions
 // geometry data
@@ -167,16 +153,13 @@ private:
 
 #include "../src/TrigALFAROBMon_geomTable.icc"
 
-  //mutable std::vector <float> m_pU[8][10];
-  //mutable std::vector <float> m_pV[8][10];
-
   const float m_y_min[2] = {0.,-35.};
   const float m_y_max[2] = {35.,0.};
 
-  //mutable bool m_sFiberHitsODPos[8][3][30],  m_sFiberHitsODNeg[8][3][30];
 
   const std::vector<std::string> m_stationNames {"B7L1U", "B7L1L", "A7L1U", "A7L1L", "A7R1U", "A7R1L", "B7R1U", "B7R1L"};
-  const std::vector<std::string> m_trigConditions{"elastic", "elastic_ALFA_BG", "singleDiffr", "ALFA_MBTS_singleDiffr", "ALFA_LUCID_singleDiffr", "ALFA_EM3", "ALFA_J12", "ALFA_TRT", "ANY", "ANY_UNPAIRED_ISO", "ANY_ALFA_BG", "ALFA_EMPTY"};
+  //const std::vector<std::string> m_trigConditions{"elastic", "elastic_ALFA_BG", "singleDiffr", "ALFA_MBTS_singleDiffr", "ALFA_LUCID_singleDiffr", "ALFA_EM3", "ALFA_J12", "ALFA_TRT", "ANY", "ANY_UNPAIRED_ISO", "ANY_ALFA_BG", "ALFA_EMPTY"};
+  const std::vector<std::string> m_trigConditions{"elastic",  "ANY"};
 
 
   /// Helper for checksum test
@@ -214,9 +197,4 @@ private:
 
   /// Helper to print contents of a muCTPi RoIB data word 
   void dumpRoIBDataWord(uint32_t data_word ) const;
-
-  // routines to reset selected set of histograms
-  void reset1LBhistos() const;
-  void reset10LBhistos() const;
-  void reset60LBhistos() const;
 };
diff --git a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx
index f2946b9a5bffc4434501cc5d43d9ca0cbd919993..af237112034a97477bfc93f19f050af7dee3c930 100644
--- a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx
+++ b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx
@@ -317,7 +317,7 @@ StatusCode InDetAlignFillTrack::FillTrack() {
                               << endmsg;
             }
 
-            float genPt = sqrt((genParticle->momentum().x()) * (genParticle->momentum().x())
+            float genPt = std::sqrt((genParticle->momentum().x()) * (genParticle->momentum().x())
                                + (genParticle->momentum().y()) * (genParticle->momentum().y()));
 
             ATH_MSG_DEBUG("   * pt " << genPt / CLHEP::GeV << " CLHEP::GeV/c"
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibEvtInfo.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibEvtInfo.h
index da45a0d3f82e37e40f9ed61253f125c4ec46e227..16e953064881674ff3951cef141cde57f6a887f7 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibEvtInfo.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibEvtInfo.h
@@ -50,7 +50,9 @@ class ISCT_CalibEvtInfo: virtual public IAlgTool {
       virtual int numLumiBlocks() const =0;
 
       virtual void setRunNumber(const int rn)=0;
+      virtual void setEventNumber(const int en)=0;
       virtual int runNumber() const =0;
+      virtual int eventNumber() const =0;
 
       virtual void setCounter(const int counterVal)=0;
       virtual void incrementCounter()=0;
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalib.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalib.h
index 35683d6af390e796ea903ef370c800ab950ca9b0..b8723c9f485884956cd142a1871e79124ef45ff7 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalib.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalib.h
@@ -127,6 +127,7 @@ class SCTCalib : public AthAlgorithm {
 
       // Properties configurable from jobO
       IntegerProperty m_runNumber{this, "RunNumber", -1};
+      IntegerProperty m_eventNumber{this, "EventNumber", -1};
 
       StringProperty m_runStartTime{this, "RunStartTime", "", "from runInfo.txt"};
       StringProperty m_runEndTime{this, "RunEndTime", "", "from runInfo.txt"};
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteTool.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteTool.h
index 1b7445ee53babd03cb3e3183051dcddbd022d5ba..8d0fb3f4cf2d2426e1f62a765d401df2afca3469 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteTool.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteTool.h
@@ -16,13 +16,18 @@
 #define SCTCalibWriteTool_H
 
 // Athena includes
+//#include "AthenaBaseComps/AthService.h"
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "AthenaKernel/IOVTime.h"
+#include "AthenaKernel/IIOVDbSvc.h"
+#include "AthenaKernel/IAthenaOutputStreamTool.h" 
 #include "AthenaPoolUtilities/CondAttrListCollection.h"
 #include "EventInfo/EventInfo.h"
 #include "Identifier/Identifier.h"
 #include "InDetConditionsSummaryService/InDetHierarchy.h"
 #include "StoreGate/ReadHandleKey.h"
+//#include "StoreGate/WriteCondHandleKey.h"
+#include "StoreGate/WriteCondHandle.h"
 
 #include "CoralBase/AttributeListSpecification.h"
 
@@ -30,6 +35,7 @@
 #include "GaudiKernel/IInterface.h"
 #include "GaudiKernel/IAlgTool.h"
 #include "GaudiKernel/ToolHandle.h"
+#include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/StatusCode.h"
 #include "GaudiKernel/ClassID.h"
 
@@ -56,7 +62,7 @@ class SCTCalibWriteTool : public AthAlgTool {
       // Constructor
       SCTCalibWriteTool(const std::string& type, const std::string& name, const IInterface* parent);
       // Destructor
-      virtual ~SCTCalibWriteTool() = default;
+      virtual ~SCTCalibWriteTool();
 
       // overloading functions
       virtual StatusCode initialize();
@@ -73,7 +79,7 @@ class SCTCalibWriteTool : public AthAlgTool {
       std::string
       createDefectString(const int defectBeginChannel,const int defectEndChannel) const;
 
-     StatusCode createCondObjects ATLAS_NOT_THREAD_SAFE // Thread unsafe CondAttrListCollection::add is used.
+      StatusCode createCondObjects ATLAS_NOT_THREAD_SAFE // Thread unsafe CondAttrListCollection::add is used.
                                  (const Identifier& wafer_id,
                                   const SCT_ID* m_sctId,
                                   const int samplesize,
@@ -198,7 +204,7 @@ class SCTCalibWriteTool : public AthAlgTool {
       IntegerProperty              m_version{this, "Version", 0};
       IntegerProperty              m_beginRun{this, "BeginRun", IOVTime::MINRUN};
       IntegerProperty              m_endRun{this, "EndRun", IOVTime::MAXRUN};
-      StringProperty               m_streamName{this, "StreamName", "CondStreamTest"};
+      StringProperty               m_streamName{this, "StreamName", "SCTCalibStream"};
       StringProperty               m_tagID4NoisyStrips{this, "TagID4NoisyStrips", ""};
       StringProperty               m_tagID4DeadStrips{this, "TagID4DeadStrips", ""};
       StringProperty               m_tagID4DeadChips{this, "TagID4DeadChips", ""};
@@ -208,8 +214,9 @@ class SCTCalibWriteTool : public AthAlgTool {
       StringProperty               m_tagID4BSErrors{this, "TagID4BSErrors", ""};
       StringProperty               m_tagID4LorentzAngle{this, "TagID4LorentzAngle", ""};
 
-      IIOVRegistrationSvc*         m_regSvc{nullptr};
-      IAthenaOutputStreamTool*     m_streamer{nullptr};
+      IIOVRegistrationSvc*                m_regSvc{nullptr};
+      ToolHandle<IAthenaOutputStreamTool> m_streamer{nullptr};
+      ServiceHandle<IIOVDbSvc>            m_IOVDbSvc;
 
       bool                         m_defectRecorded{false};
       bool                         m_deadStripRecorded{false};
@@ -220,6 +227,7 @@ class SCTCalibWriteTool : public AthAlgTool {
       bool                         m_BSErrRecorded{false};
       bool                         m_LARecorded{false};
       const SCT_ID*                m_pHelper{nullptr};
+
 };
 
 inline const InterfaceID& SCTCalibWriteTool::interfaceID() {
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/scripts/runInfo.py b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/scripts/runInfo.py
index e81dc356e21d9da3c6c0173df223c6da9b79244c..387c2137d80f91f1c4b8a0b8cb34c602162a9e4f 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/scripts/runInfo.py
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/scripts/runInfo.py
@@ -54,12 +54,12 @@ def main( runNum=None ):
   print 'runInfo from scripts folder'
   #e.g. : http://coolcherrypy.cern.ch:8080/cooldb/ATLAS_COOLPROD/ATLAS_COOLONL_TDAQ/COMP200/TDAQ/RunCtrl/EOR_Params/timespan/732227499458560-732231794425855/channels/0
   
-  xmlString=channelValueQuery(url)
-  RunNumber    = extractValue(xmlString,'RunNumber')
-  iovstart,iovend     = extractChannelIov(xmlString)
-  nLB          = iovend - ( iovstart + 1 )
-  ProjectTag   = extractValue(xmlString,'FilenameTag' )
-  DetectorMask =  extractValue(xmlString,'DetectorMask' )
+  xmlString       = channelValueQuery(url)
+  RunNumber       = extractValue(xmlString,'RunNumber')
+  iovstart,iovend = extractChannelIov(xmlString)
+  nLB             = iovend - ( iovstart + 1 )
+  ProjectTag      = extractValue(xmlString,'FilenameTag' )
+  DetectorMask    = extractValue(xmlString,'DetectorMask' )
   
   ts1 = long(extractValue(xmlString,"SORTime"))/1000000000L
   ts2 = long(extractValue(xmlString,"EORTime"))/1000000000L
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/scripts/sct_calib_tf.py b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/scripts/sct_calib_tf.py
index 95b8a2df21fb9b8a3450859c32f269551fc0bb4c..1ae78f731d1e749d945b8152a095a5dbb9bb9918 100755
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/scripts/sct_calib_tf.py
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/scripts/sct_calib_tf.py
@@ -31,6 +31,7 @@ from PyJobTransformsCore.trfutil import *
 
 dsDict={'input': [] , 'output' : []}
 RunNumber=-1
+EventNumber=-1
 SvcClass=''
 Stream=''
 NumberOfEvents=0
@@ -295,6 +296,8 @@ class SCTCalibExecutor( athenaExecutor ):
         fileName=namelist[0].split('/')[nName]
         projectName=str(fileName.split('.')[0])
 
+        #### Try to avoid validation of output files
+        #self.skipOutputFileValidation=True
 
         if not 'doRunInfo' in runArgs:
             self.conf.addToArgdict('doRunInfo', trfArgClasses.argBool(False))
@@ -302,7 +305,7 @@ class SCTCalibExecutor( athenaExecutor ):
             if runArgs['doRunInfo']._value:
                 import SCT_CalibAlgs.runInfo as runInfo
 
-                print "RunNumber for the runInfo = " + str(RunNumber) + " " + Stream
+                print ("RunNumber for the runInfo = ", str(RunNumber), " ", Stream)
                 runInfo.main(RunNumber, projectName)
 
         if not 'splitNoisyStrip' in runArgs:
@@ -310,13 +313,17 @@ class SCTCalibExecutor( athenaExecutor ):
         if not 'doRunSelector' in runArgs:
             self.conf.addToArgdict('doRunSelector', trfArgClasses.argBool(False))
 
+        #### This is a try to set event number manually if run over HIST files
+        if not 'EventNumber' in runArgs:
+            self.conf.addToArgdict('EventNumber', trfArgClasses.argInt(0))
+
         # Set STAGE_SVCCLASS
         if not SvcClass is '' and not SvcClass is None:
             os.environ['STAGE_SVCCLASS']=SvcClass
 
         # Check input type
         inputtype=dsDict['input'][0]['dataset'].split('.')[4]
-        print "Input type = " + inputtype
+        print ("Input type = ", inputtype)
         self.conf.addToArgdict('InputType', trfArgClasses.argString(inputtype))
 
         # check which parts to be run
@@ -413,7 +420,7 @@ class SCTCalibExecutor( athenaExecutor ):
             checkRun=runSelector.main(RunNumber,part,skipQueue,Stream)
             if not checkRun:
 
-                print "Run %s didn't pass run selection criteria. It will not be processed and no output will be generated. Finish execution and exit gracefully" %(RunNumber)
+                print ("Run ", RunNumber, " didn't pass run selection criteria. It will not be processed and no output will be generated. Finish execution and exit gracefully")
                 emptyDic = {}
                 self._trf._dataDictionary = emptyDic
                     
@@ -450,12 +457,12 @@ class SCTCalibExecutor( athenaExecutor ):
                 cmd += "\n"
 #                cmd += " >> /dev/null 2>&1 \n"
             
-                print cmd
+                print (cmd)
                 self._echologger.info('Merging Hitmap and LB files!')
                 retcode=1
                 try:
                     retcode = os.system(cmd)
-                except OSError, e:
+                except (OSError, e):
                     retcode = 1
                 if retcode == 0:
                     self._echologger.info('Root merge successful')
@@ -485,13 +492,13 @@ class SCTCalibExecutor( athenaExecutor ):
         if 'doNoisyStrip' in runArgs['part']._value and runArgs['splitNoisyStrip']._value == 1:
             outInstance0 = self.conf.dataDictionary[list(self._output)[0]]
             outTFile0 = TFile(outInstance0._value[0])
-            print outTFile0.GetName()
+            print (outTFile0.GetName())
             outNentries0 = int(outTFile0.Get('GENERAL/events').GetEntries())
             outInstance0._setMetadata(outInstance0._value,{'nentries': outNentries0})
             
             outInstance1 = self.conf.dataDictionary[list(self._output)[1]]
             outTFile1 = TFile(outInstance1._value[0])
-            print outTFile1.GetName()
+            print (outTFile1.GetName())
             outNentries1 = int(outTFile1.Get('GENERAL/events').GetEntries())
             outInstance1._setMetadata(outInstance1._value,{'nentries': outNentries1})
 
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/ReadCoolUPD4.py b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/ReadCoolUPD4.py
index c4760ef25bab955fb59d337373f1d2dfb06c806c..96c2953b330becd67a30e81abbe2c0d2358b12e3 100755
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/ReadCoolUPD4.py
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/ReadCoolUPD4.py
@@ -30,10 +30,13 @@ def openDatabase(dbstring):
   
 #def formIov(runNumber):
 #  s,u=(runNumber << 32), ((runNumber + 1) << 32) - 1
+#  print ("formIOV: ", s, u)
 #  return s,u
   
+#CS: this version is needed if previous runs are processed (make sure runNumberSave is small enough)
 def formIov(runNumber):
-  runNumberSave = 362345
+  #runNumberSave = 364160
+  runNumberSave = 364076
   s,u=(runNumberSave << 32), ((runNumber + 1) << 32) - 1
   return s,u
 
@@ -63,13 +66,13 @@ def GetRunList(dbstring, folder, tag, runNumber, k):
     db.closeDatabase()
     
     Temp=sorted(temp)
-    # print('array is', Temp)
+    #print('GetRunList: array is', Temp)
     ls=[]
     for i in range(len(Temp)-1):
         if (Temp[i] != Temp[i+1]):
              ls.append(Temp[i])
    
-#    ls.append(Temp[len(Temp)-1])
+    #ls.append(Temp[len(Temp)-1])
     print(ls)
 
     list=[]
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/SCTCalibConfig.py b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/SCTCalibConfig.py
index c5cebd51d71980a69a42a60fbe54a19c65046f46..5e9f737601b82795d07aba48e2abb705400749a1 100755
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/SCTCalibConfig.py
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/SCTCalibConfig.py
@@ -7,7 +7,8 @@
 #--------------------------------------------------------------
 # RunNumber and number of events
 #--------------------------------------------------------------
-RunNumber = 364214
+#RunNumber = 364214
+RunNumber = 370059
 EvtMax    = -1  
 
 #--------------------------------------------------------------
@@ -151,5 +152,5 @@ ConditionsTagNF  = 'CONDBR2-ES1PA-2016-03'    # Solenoid=OFF, BarrelToroid=OFF
 
 #-------------------------------------------------------------- 
 # Read /SCT/Derived/Monotoring in COOL 
-NoisyReadNumRuns = 5   # Used in a criteria for upload of NoisyStrips 
+NoisyReadNumRuns = 3   # Used in a criteria for upload of NoisyStrips 
 TagID4NoisyUploadTest = 'SctDerivedMonitoring-RUN2-UPD4-005'
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/skeleton.sct_calib.py b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/skeleton.sct_calib.py
index 90a4d122bb953fc6d0dd2015fb357b32a341dfef..c3775027e118f1a04616f6cc3a550a8e5e6970e2 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/skeleton.sct_calib.py
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/skeleton.sct_calib.py
@@ -41,6 +41,16 @@ theAuditorSvc.Auditors  += [ "MemStatAuditor" ]
 theApp.AuditAlgorithms = True
 theApp.AuditServices   = True
 
+#--------------------------------------------------------------
+# Switching off multi-threading (not working?!)
+#--------------------------------------------------------------
+#from GaudiHive.GaudiHiveConf import ForwardSchedulerSvc
+##svcMgr.ForwardSchedulerSvc.ThreadPoolSize    = numThreads
+##svcMgr.ForwardSchedulerSvc.MaxEventsInFlight = numEvents
+#svcMgr.ForwardSchedulerSvc.ThreadPoolSize    = 1
+#svcMgr.ForwardSchedulerSvc.MaxEventsInFlight = 1
+#--------------------------------------------------------------
+
 #--------------------------------------------------------------
 # User setup to run each algorithm
 # - SCTCalibConfig.py is used as input to the following
@@ -56,6 +66,10 @@ else :
 if hasattr( runArgs, 'RunNumber' ) :
     RunNumber = runArgs.RunNumber
 
+#--- Reading EventNumber from FileName
+if hasattr( runArgs, 'EventNumber' ) :
+    EventNumber = runArgs.EventNumber
+
 #--- Setting MaxEvents from runArguments
 if hasattr( runArgs, 'maxEvents' ) :
     EvtMax = runArgs.maxEvents
@@ -159,7 +173,9 @@ else :
 #--------------------------------------------------------------
 if runArgs.InputType is not 'RAW':
     ServiceMgr.EventSelector.RunNumber         = runArgs.RunNumber
-    ServiceMgr.EventSelector.InitialTimeStamp  = int(SORTime)
+    ServiceMgr.EventSelector.FirstEvent        = runArgs.EventNumber
+    ServiceMgr.EventSelector.FirstLB           = 0
+    ServiceMgr.EventSelector.InitialTimeStamp  = int(SORTime.split(".")[0])
 
 
 #--------------------------------------------------------------
@@ -368,8 +384,9 @@ conddb.dbdata = 'CONDBR2'
 
 from SCT_ConditionsTools.SCT_MonitorConditionsToolSetup import SCT_MonitorConditionsToolSetup
 sct_MonitorConditionsToolSetup = SCT_MonitorConditionsToolSetup()
-#sct_MonitorConditionsToolSetup.setFolderDb("<db>COOLOFL_SCT/CONDBR2</db> /SCT/Derived/Monitoring<tag>SctDerivedMonitoring-RUN2-UPD4-005</tag>")
-sct_MonitorConditionsToolSetup.setFolderDb("<db>COOLOFL_SCT/CONDBR2</db> /SCT/Derived/Monitoring<tag>SctDerivedMonitoring-RUN2-UPD4-005</tag><forceRunNumber>364160</forceRunNumber>")
+sct_MonitorConditionsToolSetup.setFolderDb("<db>COOLOFL_SCT/CONDBR2</db> /SCT/Derived/Monitoring<tag>SctDerivedMonitoring-RUN2-UPD4-005</tag>")
+#sct_MonitorConditionsToolSetup.setFolderDb("<db>COOLOFL_SCT/CONDBR2</db> /SCT/Derived/Monitoring<tag>SctDerivedMonitoring-RUN2-UPD4-005</tag><forceRunNumber>364160</forceRunNumber>")
+#sct_MonitorConditionsToolSetup.setFolderDb("<db>COOLOFL_SCT/CONDBR2</db> /SCT/Derived/Monitoring<tag>SctDerivedMonitoring-RUN2-UPD4-005</tag><forceRunNumber>364214</forceRunNumber>")
 sct_MonitorConditionsToolSetup.setup()
 
 # GeoModel & MagneticFieldSvc
@@ -453,7 +470,7 @@ SCTCalibWriteTool.TagID4Efficiency     = TagID4Efficiency
 SCTCalibWriteTool.TagID4BSErrors       = TagID4BSErrors
 SCTCalibWriteTool.TagID4LorentzAngle   = TagID4LorentzAngle
 
-SCTCalibWriteTool.OutputLevel = INFO
+SCTCalibWriteTool.OutputLevel = DEBUG
 
 print(SCTCalibWriteTool)
 
@@ -475,6 +492,7 @@ SCTCalib = topSequence.SCTCalib
 
 #--- Run number
 SCTCalib.RunNumber = RunNumber
+SCTCalib.EventNumber = EventNumber
 #--- Run stat/end time read from runInfo.txt
 SCTCalib.RunStartTime = SORTime
 SCTCalib.RunEndTime   = EORTime
@@ -523,6 +541,9 @@ SCTCalib.DoLorentzAngle   = DoLorentzAngle    # False in default
 SCTCalib.WriteToCool = WriteToCool # True in default
 
 #--- Properties for noisy strips
+SCTCalib.LbsPerWindow           = LbsPerWindow
+SCTCalib.NoisyUpdate            = NoisyUpdate
+SCTCalib.NoisyWriteAllModules   = NoisyWriteAllModules
 SCTCalib.NoisyMinStat           = NoisyMinStat
 SCTCalib.NoisyStripAll          = NoisyStripAll
 SCTCalib.NoisyStripThrDef       = NoisyStripThrDef
@@ -603,4 +624,5 @@ theApp.EvtMax                      = EvtMax
 # Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
 #--------------------------------------------------------------
 ServiceMgr.MessageSvc.OutputLevel = DEBUG
+ServiceMgr.MessageSvc.debugLimit  = 1000
 ServiceMgr.MessageSvc.infoLimit   = 2000000
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx
index dd0f7a3c5eff2720767ac223f1e379439b92dc93..f55080d716232936ccd7e25801116ac176b693f9 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx
@@ -184,6 +184,7 @@ StatusCode SCTCalib::initialize() {
    if (not retrievedService(m_calibLbTool)) return StatusCode::FAILURE;
 
    ATH_CHECK(m_CablingTool.retrieve());
+   ATH_CHECK(m_SCTDetEleCollKey.initialize());
 
    //--- LB range
    try {
@@ -261,6 +262,7 @@ StatusCode SCTCalib::initialize() {
       m_calibEvtInfoTool->setSource("HIST");
       m_calibEvtInfoTool->setTimeStamp(m_runStartTime, m_runEndTime);
       m_calibEvtInfoTool->setRunNumber(m_runNumber);
+      m_calibEvtInfoTool->setEventNumber(m_eventNumber);
    }
 
    //--- Booking histograms for hitmaps
@@ -273,6 +275,7 @@ StatusCode SCTCalib::initialize() {
       m_numberOfEventsHist = m_calibHitmapTool->size();
       m_calibEvtInfoTool->setTimeStamp(m_runStartTime, m_runEndTime);
       m_calibEvtInfoTool->setRunNumber(m_runNumber);
+      m_calibEvtInfoTool->setEventNumber(m_eventNumber);
       //m_calibEvtInfoTool->setLumiBlock(0);
       //m_calibEvtInfoTool->setBunchCrossing(0);
       m_calibLbTool->read("./SCTLB.root");
@@ -351,7 +354,7 @@ StatusCode SCTCalib::execute() {
    m_calibEvtInfoTool->incrementCounter();
 
    ATH_MSG_DEBUG("----- end of execute() ----- ");
-   
+
    return StatusCode::SUCCESS;
 }
 
@@ -463,6 +466,7 @@ StatusCode SCTCalib::stop ATLAS_NOT_THREAD_SAFE () { // Thread unsafe getNoisySt
 
    //--- Close HIST
    if (m_readHIST) m_inputHist->Close();
+
    return StatusCode::SUCCESS;
 }
 
@@ -473,6 +477,13 @@ StatusCode SCTCalib::stop ATLAS_NOT_THREAD_SAFE () { // Thread unsafe getNoisySt
 StatusCode SCTCalib::finalize() {
    ATH_MSG_INFO("----- in finalize() ----- ");
 
+   if (m_writeToCool) {
+      if (!m_pCalibWriteTool.release().isSuccess()) {
+         ATH_MSG_ERROR("Failed to release m_pCalibWriteTool");
+         return StatusCode::FAILURE;
+      }
+   }
+
    ATH_MSG_INFO("Thank-you for using SCT_CalibAlgs, version " << PACKAGE_VERSION);
    return StatusCode::SUCCESS;
 }
@@ -531,7 +542,7 @@ StatusCode SCTCalib::getNoisyStrip ATLAS_NOT_THREAD_SAFE () { // Thread unsafe w
    // }
 
    ATH_MSG_INFO("----- in getNoisyStrip() ----- ");
-   
+
    //--- Number of LBs processed
    m_numOfLBsProcessed = 0;
    for (int iLB{0}; iLB != m_LBRange; ++iLB) {
@@ -2633,7 +2644,7 @@ SCTCalib::getNumNoisyStrips(const Identifier& waferId) const {
    bool isNoisyWafer{false};
    float noisyStripThr{m_noisyStripThrDef ? (m_noisyStripThrOffline) : (m_noisyStripThrOnline)};
    for (int iStrip{0}; iStrip != nbins; ++iStrip) {
-      if (m_calibHitmapTool->getBinForHistogramIndex(iStrip + 1, waferHash.value()) / m_numberOfEvents > noisyStripThr) ++numNoisyStripsInTheWafer;
+      if ( (float) m_calibHitmapTool->getBinForHistogramIndex(iStrip + 1, waferHash.value()) / m_numberOfEvents > noisyStripThr) ++numNoisyStripsInTheWafer;
    }
    //--- Define/counts noisy wafers using wafer occupancy and number of noisy strips
    double averageOccupancy{m_calibHitmapTool->size(waferHash.value())/static_cast<double>(nbins)/static_cast<double>(m_numberOfEvents)};
@@ -2661,7 +2672,7 @@ SCTCalib::addStripsToList(Identifier& waferId, std::set<Identifier>& stripIdList
       if (!isNoisy) { //--- Add all strips
          stripIdList.insert(stripId);
       } else {
-         const float stripOccupancy{static_cast<float>(m_calibHitmapTool->getBinForHistogramIndex(iStrip + 1, waferHash.value()) / m_numberOfEvents)};
+         const float stripOccupancy{ (float) m_calibHitmapTool->getBinForHistogramIndex(iStrip + 1, waferHash.value()) / m_numberOfEvents};
          if (stripOccupancy > noisyStripThr) {
             if (!isNew) { //--- All noisy strips
                stripIdList.insert(stripId);
@@ -2682,10 +2693,10 @@ SCTCalib::addStripsToList(Identifier& waferId, std::set<Identifier>& stripIdList
 
 
 StatusCode
-SCTCalib::writeModuleListToCool ATLAS_NOT_THREAD_SAFE // Thread unsafe SCTCalibWriteTool::createCondObjects method is used.
-                               (const std::map<Identifier, std::set<Identifier>>& moduleListAll,
-                                const std::map<Identifier, std::set<Identifier>>& moduleListNew,
-                                const std::map<Identifier, std::set<Identifier>>& moduleListRef) {
+SCTCalib::writeModuleListToCool ATLAS_NOT_THREAD_SAFE // Thread unsafe SCTCalibWriteTool::createListStrip method is used.
+(const std::map<Identifier, std::set<Identifier>>& moduleListAll,
+ const std::map<Identifier, std::set<Identifier>>& moduleListNew,
+ const std::map<Identifier, std::set<Identifier>>& moduleListRef) {
    //--- Write out strips
    float noisyStripThr{m_noisyStripThrDef?(m_noisyStripThrOffline):(m_noisyStripThrOnline)};
    int nDefects{0};
@@ -2706,33 +2717,35 @@ SCTCalib::writeModuleListToCool ATLAS_NOT_THREAD_SAFE // Thread unsafe SCTCalibW
                   ATH_MSG_ERROR("Could not create defect strip entry in the CalibWriteTool.");
                }
                nDefects++;
-            } else ATH_MSG_DEBUG("Module " << moduleId  << " is identical to the reference output");
+            }; // else ATH_MSG_DEBUG("Module " << moduleId  << " is identical to the reference output");
          } else {
             if (m_noisyStripAll) { //--- ALL noisy strips
                if (!defectStripsAll.empty() || m_noisyWriteAllModules) {
-                 if (m_pCalibWriteTool->createCondObjects(moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsAll).isFailure()) {
-                   ATH_MSG_ERROR("Could not create defect strip entry in the CalibWriteTool.");
-                 }
-              }
+                  if (m_pCalibWriteTool->createCondObjects(moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsAll).isFailure()) {
+                     ATH_MSG_ERROR("Could not create defect strip entry in the CalibWriteTool.");
+                  }
+               }
             } else { //--- Only NEW noisy strips
                if (!defectStripsNew.empty()) {
-                 if (m_pCalibWriteTool->createCondObjects(moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsNew).isFailure()) {
-                   ATH_MSG_ERROR("Could not create defect strip entry in the CalibWriteTool.");
-                 }
+                  if (m_pCalibWriteTool->createCondObjects(moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsNew).isFailure()) {
+                     ATH_MSG_ERROR("Could not create defect strip entry in the CalibWriteTool.");
+                  }
                }
             }
          }
       }
    }
-   //ATH_MSG_INFO("Number of modules for which conditions were created: " << nDefects << "  !!!!" << endmsg;
-   if (moduleListAll.empty() or nDefects==0) {
+   ATH_MSG_DEBUG("Number of modules for which conditions were created: " << nDefects << "  !!!!");
+   if (moduleListAll.empty() or ( nDefects==0 && m_noisyUpdate )) {
       ATH_MSG_INFO("Number of noisy strips was zero or the same list of noisy strips. No local DB was created.");
    } else {
+      ATH_MSG_DEBUG("directly before call of wrapUpNoisyChannel");
       if (m_pCalibWriteTool->wrapUpNoisyChannel().isFailure()) {
          ATH_MSG_ERROR("Could not get NoisyStrips info");
          return StatusCode::FAILURE;
       }
    }
+   ATH_MSG_DEBUG("before return");
    return StatusCode::SUCCESS;
 }
 
@@ -2854,6 +2867,9 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set
       //const std::map<Identifier, std::set<Identifier>>& moduleListNew,
       const std::map<Identifier, std::set<Identifier>>& moduleListRef,
       const std::string& badStripsFile) const {
+
+   ATH_MSG_DEBUG("noisyStripsToSummaryXml: start");
+
    //--- Open
    const char* outputFileName{badStripsFile.c_str()};
    std::ofstream outFile{outputFileName, std::ios::out};
@@ -2875,6 +2891,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set
    //--- Create module list
    SCT_ID::const_id_iterator waferItr{m_pSCTHelper->wafer_begin()};
    SCT_ID::const_id_iterator waferItrE{m_pSCTHelper->wafer_end()};
+   ATH_MSG_DEBUG("noisyStripsToSummaryXml: before wafer loop");
    for (; waferItr != waferItrE; ++waferItr) {
       //--- Identifier
       Identifier waferId{*waferItr};
@@ -2901,6 +2918,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set
 
       //--- Execute once in this module
       if (m_pSCTHelper->side(waferId) == 1) {
+         ATH_MSG_DEBUG("noisyStripsToSummaryXml: ALL");
          //--- Noisy strips : All
          std::map< Identifier, std::set<Identifier> >::const_iterator moduleAllItr{moduleListAll.find(moduleId)};
          if (moduleAllItr != moduleListAll.end()) {
@@ -2909,6 +2927,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set
             numStripsAll += (*moduleAllItr).second.size();
          }
 
+         ATH_MSG_DEBUG("noisyStripsToSummaryXml: REF");
          //--- Noisy strips : Ref
          std::map< Identifier, std::set<Identifier> >::const_iterator moduleRefItr{moduleListRef.find(moduleId)};
          if (moduleRefItr != moduleListRef.end()) {
@@ -2917,6 +2936,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set
             numStripsRef += moduleRefItr->second.size();
          }
 
+         ATH_MSG_DEBUG("noisyStripsToSummaryXml: NEW");
          //--- Noisy strips : New
          if ( moduleAllItr != moduleListAll.end() ) {
             if ( moduleRefItr != moduleListRef.end() ) {
@@ -2929,6 +2949,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set
             }
          }
 
+         ATH_MSG_DEBUG("noisyStripsToSummaryXml: stripIdList -> chipIdList");
          //--- Noisy chips : stripIdList -> chipIdList
          if (moduleAllItr != moduleListAll.end()) {
             std::set<int> chipIdList{getNoisyChips(moduleAllItr->second)};
@@ -2956,6 +2977,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set
                }
             }
          }
+         ATH_MSG_DEBUG("noisyStripsToSummaryXml: Difference between All & Ref");
          //--- Difference between All & Ref
          if (defectStripsAll != defectStripsRef) ++numModulesDiff;
          //--- Module list written to XML
@@ -2973,9 +2995,12 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set
                          << "      <value name=\"StripOfflineRef\">" << normalizeList(defectStripsRef)    << "</value>" << linefeed
                          << "    </module>"                                                                             << std::endl;
          }
+         ATH_MSG_DEBUG("noisyStripsToSummaryXml: After Difference between All & Ref");
       }
    }//--- end loop : waferItr
 
+   ATH_MSG_DEBUG("noisyStripsToSummaryXml: after waferItr");
+
    //--- Upload flag
    std::string strUploadFlag{"U"};
 
@@ -3000,6 +3025,8 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set
       }
    }
 
+   ATH_MSG_DEBUG("noisyStripsToSummaryXml: after FlagChecking");
+
    //--- Upload test result to XML
    std::ostringstream osNoisyMinStat, osNoisyModuleList, osNoisyModuleDiff, osNoisyStripDiff;
    osNoisyMinStat    << "#events more than "                                                                      << m_noisyMinStat.value();
@@ -3053,6 +3080,8 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set
            << "  </modules>"                                                                           << linefeed
            << "</run>"                                                                                 << std::endl;
 
+   ATH_MSG_DEBUG("noisyStripsToSummaryXml: before return");
+
    return StatusCode::SUCCESS;
 }
 
@@ -3131,7 +3160,7 @@ SCTCalib::getNoisyLB(const Identifier& moduleId, int& chipId) const {
    for (int iLB{0}; iLB != m_LBRange; ++iLB) {
       double numEventsInLB{static_cast<double>(m_calibLbTool->getNumberOfEventsInBin(iLB + 1))};
       if (numEventsInLB == 0) continue;
-      double chipOccupancy{m_calibLbTool->getBinForHistogramIndex(iLB + 1, histIndex)/numEventsInLB};
+      double chipOccupancy{(float) m_calibLbTool->getBinForHistogramIndex(iLB + 1, histIndex) / numEventsInLB};
       if (chipOccupancy > chipOccupancyThr) LBList.insert(iLB);
    }
    //--- Transform LBList to string and calculate a fraction of noisy LBs
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteTool.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteTool.cxx
index e714da798401338c14ab479eaa66fd514ef1b4ba..0379ed1b56d49bbb1d99f8dc4b8528924dafb5d9 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteTool.cxx
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteTool.cxx
@@ -54,7 +54,15 @@ const bool becCapsFormat{true};
 const bool becUnderscoreFormat{false};
 
 SCTCalibWriteTool::SCTCalibWriteTool(const std::string& type, const std::string& name, const IInterface* parent) :
-   AthAlgTool(type, name, parent)
+   AthAlgTool(type, name, parent),
+   m_streamer(((m_version == 0) ? "AthenaOutputStreamTool" : "AthenaPoolOutputStreamTool"), this),
+   m_IOVDbSvc("IOVDbSvc", "SCTCalibWriteTool")
+{
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+
+SCTCalibWriteTool::~SCTCalibWriteTool()
 {
 }
 
@@ -74,7 +82,11 @@ SCTCalibWriteTool::queryInterface(const InterfaceID& riid, void** ppvIF)
 ///////////////////////////////////////////////////////////////////////////////////////////
 
 StatusCode
-SCTCalibWriteTool::initialize() {
+SCTCalibWriteTool::initialize()
+{
+
+   ATH_MSG_DEBUG("in SCTCalibWriteTool::initialize start");
+
    if (detStore()->retrieve(m_pHelper,"SCT_ID").isFailure()) {
       ATH_MSG_ERROR("SCT mgr failed to retrieve");
       return StatusCode::FAILURE;
@@ -98,12 +110,17 @@ SCTCalibWriteTool::initialize() {
 
    // Get the IOVRegistrationSvc when needed
    if (m_regIOV) {
+
       if (service("IOVRegistrationSvc", m_regSvc).isFailure()) {
          ATH_MSG_ERROR("Unable to find IOVRegistrationSvc ");
          return StatusCode::FAILURE;
       }
    }
-   
+
+   // Retrieve IOVDb service
+   if (m_IOVDbSvc.retrieve().isFailure())
+      return msg(MSG:: ERROR)<< "Failed to retrieve IOVDbSvc " << endmsg, StatusCode::FAILURE;
+
    return StatusCode::SUCCESS;
 }
 
@@ -111,6 +128,17 @@ SCTCalibWriteTool::initialize() {
 
 StatusCode
 SCTCalibWriteTool::finalize() {
+   ATH_MSG_DEBUG("SCTCalibWriteTool::finalize");
+   if (!m_attrListColl.release()) {
+      return StatusCode::FAILURE;
+   }
+   if (!m_streamer.release().isSuccess()) {
+      return StatusCode::FAILURE;
+   }
+   if (!m_IOVDbSvc.release().isSuccess()) {
+      return StatusCode::FAILURE;
+   }
+   ATH_MSG_DEBUG("Thank you for using the SCTCalibWriteTool");
    return StatusCode::SUCCESS;
 }
 
@@ -207,12 +235,12 @@ SCTCalibWriteTool::createCondObjects ATLAS_NOT_THREAD_SAFE // Thread unsafe Cond
 
 StatusCode
 SCTCalibWriteTool::createListStrip ATLAS_NOT_THREAD_SAFE // Thread unsafe CondAttrListCollection::add is used.
-                                  (const Identifier& wafer_id,
-                                   const SCT_ID* sctId,
-                                   const int samplesize,
-                                   const std::string& defectType,
-                                   const float threshold,
-                                   const std::string& defectList) const
+(const Identifier& wafer_id,
+ const SCT_ID* sctId,
+ const int samplesize,
+ const std::string& defectType,
+ const float threshold,
+ const std::string& defectList) const
 {
    if (!m_writeCondObjs) {
       return StatusCode::SUCCESS;
@@ -236,7 +264,7 @@ SCTCalibWriteTool::createListStrip ATLAS_NOT_THREAD_SAFE // Thread unsafe CondAt
    std::ostringstream attrStr2;
    attrList0.toOutputStream(attrStr2);
    m_attrListColl_deadStrip->add(wafer_id.get_identifier32().get_compact(), attrList0);
-   ATH_MSG_INFO("createListStrip: return StatusCode::SUCCESS");
+   //ATH_MSG_INFO("createListStrip: return StatusCode::SUCCESS");
    return StatusCode::SUCCESS;
 }
 
@@ -480,8 +508,11 @@ SCTCalibWriteTool::stringToInt(const std::string& s) const {
 
 StatusCode
 SCTCalibWriteTool::wrapUpNoisyChannel() {
+   ATH_MSG_DEBUG("wrapUpNoisyChannel: start");
    if (recordAndStream(m_attrListColl.get(), s_defectFolderName, m_defectRecorded).isFailure()) return StatusCode::FAILURE;
+   ATH_MSG_DEBUG("wrapUpNoisyChannel: middle");
    if (registerCondObjectsWithErrMsg(s_defectFolderName, m_tagID4NoisyStrips).isFailure()) return StatusCode::FAILURE;
+   ATH_MSG_DEBUG("wrapUpNoisyChannel: end");
    return StatusCode::SUCCESS;
 }
 
@@ -552,26 +583,31 @@ SCTCalibWriteTool::wrapUpLorentzAngle() {
 
 StatusCode
 SCTCalibWriteTool::streamOutCondObjects(const std::string& foldername) {
+   ATH_MSG_DEBUG("streamOutCondObjects: before connectOutput" << m_streamName);
    if (m_streamer->connectOutput(m_streamName).isFailure()) {
       ATH_MSG_ERROR("Could not connect stream to output");
       return( StatusCode::FAILURE);
    }
    IAthenaOutputStreamTool::TypeKeyPairs typeKeys{1};
+   ATH_MSG_DEBUG("streamOutCondObjects: before m_readWriteCool");
    if (m_readWriteCool) {
-      IAthenaOutputStreamTool::TypeKeyPair
-      attrCollPair{"CondAttrListCollection", foldername};
+      //ATH_MSG_DEBUG("before CondAttrListCollection " << foldername);
+      IAthenaOutputStreamTool::TypeKeyPair attrCollPair{"CondAttrListCollection", foldername};
       typeKeys[0] = attrCollPair;
    }
 
+   ATH_MSG_DEBUG("streamOutCondObjects: before streamObjects");
    if (m_streamer->streamObjects(typeKeys).isFailure()) {
       ATH_MSG_ERROR("Could not stream out AttributeLists");
       return StatusCode::FAILURE;
    }
 
+   ATH_MSG_DEBUG("streamOutCondObjects: before commitOutput");
    if (m_streamer->commitOutput().isFailure()) {
       ATH_MSG_ERROR("Could not commit output stream");
       return StatusCode::FAILURE;
    }
+   ATH_MSG_DEBUG("streamOutCondObjects: before return");
    return StatusCode::SUCCESS;
 }
 
@@ -579,8 +615,9 @@ SCTCalibWriteTool::streamOutCondObjects(const std::string& foldername) {
 
 StatusCode
 SCTCalibWriteTool::streamOutCondObjectsWithErrMsg(const std::string& foldername) {
+   ATH_MSG_DEBUG("streamOutCondObjectsWithErrMsg: foldername " << foldername);
    if (streamOutCondObjects(foldername).isFailure()) {
-      ATH_MSG_ERROR("Could create conditions object  " << foldername);
+      ATH_MSG_ERROR("Could not create conditions object  " << foldername);
       return StatusCode::FAILURE;
    }
    return StatusCode::SUCCESS;
@@ -591,6 +628,7 @@ SCTCalibWriteTool::streamOutCondObjectsWithErrMsg(const std::string& foldername)
 StatusCode
 SCTCalibWriteTool::registerCondObjects(const std::string& foldername,const std::string& tagname) const {
    // Register the IOV DB with the conditions data written out
+   ATH_MSG_DEBUG("registerCondObjects start");
    if (m_readWriteCool) {
       // Can only write out AttrList's if this is NOT write and reg in two steps
       if (!m_twoStepWriteReg) {
@@ -602,8 +640,9 @@ SCTCalibWriteTool::registerCondObjects(const std::string& foldername,const std::
          if (!m_manualiov) {
 
             SG::ReadHandle<EventInfo> evt{m_eventInfoKey};
+            ATH_MSG_DEBUG("registerCondObjects: before get EventInfo");
             if (not evt.isValid()) {
-               ATH_MSG_ERROR("Unable to get the EventInfo");
+               ATH_MSG_ERROR("registerCondObjects: Unable to get the EventInfo");
                return StatusCode::FAILURE;
             }
 
@@ -619,17 +658,28 @@ SCTCalibWriteTool::registerCondObjects(const std::string& foldername,const std::
          unsigned int beginLB{IOVTime::MINEVENT};
          unsigned int endLB{IOVTime::MAXEVENT};
 
+         ATH_MSG_DEBUG("registerCondObjects: registerCondObjects middle");
+
          if (not tagname.empty()) {
+            ATH_MSG_DEBUG("registerCondObjects: registerCondObjects before registerIOV 1");
+            ATH_MSG_DEBUG("registerCondObjects: foldername, tagname, beginRun, endRun, beginLB, endLB: " << foldername << ", " << tagname << ", " << beginRun << ", " << endRun << ", " << beginLB << ", " << endLB);
             sc = m_regSvc->registerIOV("CondAttrListCollection", foldername, tagname, beginRun, endRun, beginLB, endLB);
+            ATH_MSG_DEBUG("registerCondObjects after registerIOV 1");
          } else {
+            ATH_MSG_DEBUG("registerCondObjects before registerIOV 2");
+            ATH_MSG_DEBUG("registerCondObjects: foldername, beginRun, endRun, beginLB, endLB: " << foldername << ", " << beginRun << ", " << endRun << ", " << beginLB << ", " << endLB);
             sc = m_regSvc->registerIOV("CondAttrListCollection", foldername, "", beginRun, endRun, beginLB, endLB);
+            ATH_MSG_DEBUG("registerCondObjects after registerIOV 2");
          }
          if (sc.isFailure()) {
-            ATH_MSG_ERROR("Could not register in IOV DB for CondAttrListCollection");
+            ATH_MSG_ERROR("registerCondObjects: Could not register in IOV DB for CondAttrListCollection");
             return StatusCode::FAILURE;
          }
       }
    }
+
+   ATH_MSG_DEBUG("registerCondObjects end");
+
    return StatusCode::SUCCESS;
 }
 
@@ -639,7 +689,7 @@ StatusCode
 SCTCalibWriteTool::registerCondObjectsWithErrMsg(const std::string& foldername,const std::string& tagname) const {
    if (m_regIOV) {
       if (registerCondObjects(foldername,tagname).isFailure()) {
-         ATH_MSG_ERROR("Could not register " << foldername);
+         ATH_MSG_ERROR("registerCondObjectsWithErrMsg: Could not register " << foldername);
          return StatusCode::FAILURE;
       }
    }
@@ -650,14 +700,18 @@ SCTCalibWriteTool::registerCondObjectsWithErrMsg(const std::string& foldername,c
 
 StatusCode
 SCTCalibWriteTool::recordAndStream(const CondAttrListCollection* pCollection,const std::string& foldername, bool& flag) {
+   ATH_MSG_DEBUG("recordAndStream start " << foldername);
    if (m_writeCondObjs) {
+      ATH_MSG_DEBUG("recordAndStream middle ");
       if (detStore()->record(pCollection, foldername).isFailure()) {
          ATH_MSG_ERROR("Could not record "<<foldername);
          return StatusCode::FAILURE;
       }
       flag=true;
+      ATH_MSG_DEBUG("recordAndStream middle 2");
       if (streamOutCondObjectsWithErrMsg(s_defectFolderName).isFailure()) return StatusCode::FAILURE;
    }
+   ATH_MSG_DEBUG("recordAndStream end ");
    return StatusCode::SUCCESS;
 }
 
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx
index 3336efc690b59cd100b436ffaef5952666219a9f..775f5f10382bb4b5bdbf1d9a9ad35a82bac57db1 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx
@@ -115,11 +115,21 @@ SCT_CalibEventInfo::setRunNumber(const int rn) {
    m_runNumber = rn;
 }
 
+void
+SCT_CalibEventInfo::setEventNumber(const int en) {
+   m_eventNumber = en;
+}
+
 int
 SCT_CalibEventInfo::runNumber() const {
    return m_runNumber;
 }
 
+int
+SCT_CalibEventInfo::eventNumber() const {
+   return m_eventNumber;
+}
+
 void
 SCT_CalibEventInfo::setCounter(const int counterVal) {
    m_counter = counterVal;
diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.h
index 90a41d23c9c26cfb66320ea775235e8e2a76db49..32c6508f9f6d53ef097f6480a6db17e1dee7ab5e 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.h
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.h
@@ -53,7 +53,9 @@ class SCT_CalibEventInfo: public extends<AthAlgTool, ISCT_CalibEvtInfo>
       virtual int numLumiBlocks() const;
 
       virtual void setRunNumber(const int rn);
+      virtual void setEventNumber(const int en);
       virtual int runNumber() const;
+      virtual int eventNumber() const;
 
       virtual void setCounter(const int counterVal);
       virtual void incrementCounter();
@@ -76,6 +78,7 @@ class SCT_CalibEventInfo: public extends<AthAlgTool, ISCT_CalibEvtInfo>
 
       //
       int  m_runNumber{0};
+      int  m_eventNumber{0};
       int  m_lumiBlock{0};
       int  m_timeStamp{0};
       int  m_bunchCrossing{0};
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/python/SCT_ByteStreamErrorsTestAlgConfig.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/python/SCT_ByteStreamErrorsTestAlgConfig.py
index 931ba6945007d2605bcdd3b697931e92fc108440..fe9cc8eea3ed7beab56d935fde5fed41cc43e2a2 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/python/SCT_ByteStreamErrorsTestAlgConfig.py
+++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/python/SCT_ByteStreamErrorsTestAlgConfig.py
@@ -41,4 +41,4 @@ if __name__=="__main__":
     algkwargs["OutputLevel"] = INFO
     cfg.merge(SCT_ByteStreamErrorsTestAlgCfg(ConfigFlags, **algkwargs))
 
-    cfg.run(maxEvents=20)
+    cfg.run(maxEvents=25)
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/python/SCT_FlaggedConditionTestAlgConfig.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/python/SCT_FlaggedConditionTestAlgConfig.py
new file mode 100644
index 0000000000000000000000000000000000000000..8b970993103d19bfabc03ae629bc4769c4fe05ea
--- /dev/null
+++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/python/SCT_FlaggedConditionTestAlgConfig.py
@@ -0,0 +1,44 @@
+"""Define method to configure and test SCT_FlaggedConditionTestAlg
+
+Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+"""
+from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
+from AthenaConfiguration.ComponentFactory import CompFactory
+
+def SCT_FlaggedConditionTestAlgCfg(flags, name="SCT_FlaggedConditionTestAlg", **kwargs):
+    """Return a configured SCT_FlaggedConditionTestAlg"""
+    acc = ComponentAccumulator()
+    from InDetConfig.InDetRecToolConfig import SCT_FlaggedConditionToolCfg
+    kwargs.setdefault("FlaggedConditionTool", acc.popToolsAndMerge(SCT_FlaggedConditionToolCfg(flags)))
+    acc.addEventAlgo(CompFactory.SCT_FlaggedConditionTestAlg(**kwargs))
+    return acc
+
+if __name__=="__main__":
+    from AthenaCommon.Logging import log
+    from AthenaCommon.Constants import INFO
+    log.setLevel(INFO)
+
+    from AthenaCommon.Configurable import Configurable
+    Configurable.configurableRun3Behavior=1
+    
+    from AthenaConfiguration.AllConfigFlags import ConfigFlags
+    ConfigFlags.Input.isMC = False
+    ConfigFlags.Input.Files = ["./myESD.pool.root"]
+    ConfigFlags.Input.ProjectName = "data17_13TeV" # q431 input
+    ConfigFlags.Input.RunNumber = 330470 # q431 input
+    ConfigFlags.IOVDb.GlobalTag = "CONDBR2-BLKPA-2018-03" # q431 setup
+    ConfigFlags.GeoModel.AtlasVersion = "ATLAS-R2-2016-01-00-01" # q431 setup
+    ConfigFlags.Detector.GeometrySCT = True
+    ConfigFlags.lock()
+
+    from AthenaConfiguration.MainServicesConfig import MainServicesCfg
+    cfg = MainServicesCfg(ConfigFlags)
+
+    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
+    cfg.merge(PoolReadCfg(ConfigFlags))
+
+    algkwargs = {}
+    algkwargs["OutputLevel"] = INFO
+    cfg.merge(SCT_FlaggedConditionTestAlgCfg(ConfigFlags, **algkwargs))
+
+    cfg.run(maxEvents=25)
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testFlagged.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testFlagged.py
index edf7353918aae18d5dbc5485b287ee6663357aba..cc4f961850660d8058fc9b2d05db360949077a8a 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testFlagged.py
+++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testFlagged.py
@@ -96,7 +96,7 @@ import AthenaPoolCnvSvc.ReadAthenaPool
 from PoolSvc.PoolSvcConf import PoolSvc
 ServiceMgr += PoolSvc()
 
-athenaCommonFlags.FilesInput = [ "./ESD.pool.root" ]
+athenaCommonFlags.FilesInput = [ "./myESD.pool.root" ]
 ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput.get_Value()
 
 theApp.EvtMax = -1
diff --git a/InnerDetector/InDetConfig/python/InDetRecToolConfig.py b/InnerDetector/InDetConfig/python/InDetRecToolConfig.py
index 640aec7d2fce85b6b07cde857167ec07bc76cb53..d7b58eb7e96e446239af7d66bc8041e521ea5392 100644
--- a/InnerDetector/InDetConfig/python/InDetRecToolConfig.py
+++ b/InnerDetector/InDetConfig/python/InDetRecToolConfig.py
@@ -415,8 +415,13 @@ def SCT_ReadCalibDataToolCfg(flags, name="SCT_ReadCalibDataTool", cond_kwargs={}
 
 
 def SCT_FlaggedConditionToolCfg(flags, name="SCT_FlaggedConditionTool", **kwargs):
-  tool = CompFactory.SCT_FlaggedConditionTool(name, **kwargs)
   result = ComponentAccumulator()
+
+  # For SCT_ID and SCT_DetectorElementCollection used in SCT_FlaggedConditionTool
+  from SCT_GeoModel.SCT_GeoModelConfig import SCT_GeometryCfg
+  result.merge(SCT_GeometryCfg(flags))
+
+  tool = CompFactory.SCT_FlaggedConditionTool(name, **kwargs)
   result.setPrivateTools(tool)
   return result
 
diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/InDetDetectorManager.h b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/InDetDetectorManager.h
index c2ea0c39a35fda9c80f14e8fa7b28c9282501a47..3043161171fc41af9128c3fa5d29be8c57bf6999 100755
--- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/InDetDetectorManager.h
+++ b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/InDetDetectorManager.h
@@ -155,7 +155,7 @@ namespace InDetDD {
 
       /** Called by processAlignmentContainer, 
           applies only one key on the transform Collections */
-      bool processKey(const std::string key, 
+      bool processKey(const std::string& key, 
                       const AlignableTransform* transformCollection,
                       GeoVAlignmentStore* alignStore=nullptr) const;
     
diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/InDetDetectorManager.cxx b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/InDetDetectorManager.cxx
index 79cb1406e003146fa891db61d40edadaf5db7eea..f84612d42a002ca6b2a998e18f275d236b4fff70 100755
--- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/InDetDetectorManager.cxx
+++ b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/InDetDetectorManager.cxx
@@ -326,14 +326,14 @@ namespace InDetDD
              pat!=container->end();++pat) {
             stringToTransform[(*pat)->tag()] = *pat;
         }
-        for (std::pair<const std::string, const AlignableTransform*> value: stringToTransform) {
+        for (const std::pair<const std::string, const AlignableTransform*>& value: stringToTransform) {
             bool status = processKey(value.first, value.second, alignStore);
             alignmentChange = (alignmentChange || status);
         }
         return alignmentChange;
     }
 
-    bool InDetDetectorManager::processKey(const std::string key,
+    bool InDetDetectorManager::processKey(const std::string& key,
                                           const AlignableTransform* transformCollection,
                                           GeoVAlignmentStore* alignStore) const 
     {  
diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/SiDetectorElementMap.cxx b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/SiDetectorElementMap.cxx
index c446f33acdf366ac604e2748aa5b771b2daf6b0d..90fed1c4a4c700f86b64c92ad6a8f503981b5e84 100644
--- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/SiDetectorElementMap.cxx
+++ b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/SiDetectorElementMap.cxx
@@ -26,6 +26,6 @@ const InDetDD::SiDetectorElement* SiDetectorElementMap::readEntry(const Identifi
   for (auto it = m_detElementMap.begin(); it != m_detElementMap.end(); it++) {
     if(it->first==hashId) return it->second;
   }
-  return 0;
+  return nullptr;
 }
 
diff --git a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_BaseElement.h b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_BaseElement.h
index 328f2cb92dcaa00baa54549e284c6bff40d4f55f..4176b9a07a0041f52c956474e22c733af0e3fbf9 100755
--- a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_BaseElement.h
+++ b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_BaseElement.h
@@ -28,10 +28,7 @@
 #include "CLHEP/Geometry/Point3D.h"
 
 #include "CxxUtils/CachedUniquePtr.h"
-#include "CxxUtils/checker_macros.h"
-
-#include <atomic>
-#include <mutex>
+#include "CxxUtils/CachedValue.h"
 #include <vector>
 
 
@@ -79,15 +76,15 @@ namespace InDetDD {
     virtual TRT_BaseElement::Type type() const = 0; 
 
     /** identifier of this detector element: */
-    Identifier identify() const;
+    virtual Identifier identify() const override final;
 
     /** identifier hash */
-    IdentifierHash identifyHash() const;
+    virtual IdentifierHash identifyHash() const override final;
 
     // --- GeoModel transformation forwards ----------------------------------------------------- //
 
     /** Get Default Transform (of module in barrel, layer in endcap) from GeoModel before alignment corrections */
-    inline const GeoTrf::Transform3D& defTransform() const { return getMaterialGeom()->getDefAbsoluteTransform(); }
+    const GeoTrf::Transform3D& defTransform() const;
     
     /** Default Local -> global transform of the straw (ie before alignment corrections) : CLHEP */
     virtual HepGeom::Transform3D defStrawTransform(int straw) const = 0;
@@ -99,37 +96,37 @@ namespace InDetDD {
     // (a) Element Surface section - accesses the m_surfaceCache store
     
     /** Element Surface: access to the Surface (straw layer) */
-    virtual const Trk::Surface& surface () const;
+    virtual const Trk::Surface& surface () const override final;
     
     /** Straw layer bounds */
-    virtual const Trk::SurfaceBounds& bounds() const;
+    virtual const Trk::SurfaceBounds& bounds() const override final;
         
     /** Element Surface: Get Transform of element in Tracking frame: Amg */
-    virtual const Amg::Transform3D& transform() const;
+    virtual const Amg::Transform3D& transform() const override final;
 
     /** Element Surface: center of a straw layer. */
-    virtual const Amg::Vector3D& center() const;
+    virtual const Amg::Vector3D& center() const override final;
     
     /** Element Surface: normal of a straw layer */
-    virtual const Amg::Vector3D& normal() const;
+    virtual const Amg::Vector3D& normal() const override final;
     
     // (b) Straw Surface section - accesses the vector<SurfaceCache> m_strawSurfacesCache store
     
     /** Straw Surface: access to the surface via identifier */
-    virtual const Trk::Surface& surface (const Identifier& id) const;
+    virtual const Trk::Surface& surface (const Identifier& id) const override final;
     
     /** Returns the full list of all detection surfaces associated to this detector element */
-    virtual const std::vector<const Trk::Surface*>& surfaces() const;
+    const std::vector<const Trk::Surface*>& surfaces() const;
     
     /** Straw Surface: access to the bounds via Identifier */
-    virtual const Trk::SurfaceBounds& bounds(const Identifier& id) const;
+    virtual const Trk::SurfaceBounds& bounds(const Identifier& id) const override final;
 
     /** Straw Surface: access to the transform of individual straw in Tracking frame: Amg */
-    virtual const Amg::Transform3D& transform(const Identifier& id) const;
+    virtual const Amg::Transform3D& transform(const Identifier& id) const override final;
 
     /** Straw transform - fast access in array, in Tracking frame: Amg */
     /** Straw Surface: access to the transform of individual straw in Tracking frame: Amg */
-    virtual const Amg::Transform3D& strawTransform(unsigned int straw) const;
+    const Amg::Transform3D& strawTransform(unsigned int straw) const;
             
     /** Straw Surface: Center of a straw using Identifier 
         Straw center and straw axis can be obtained by the following:
@@ -140,10 +137,10 @@ namespace InDetDD {
         double phi = element->strawCenter()->phi();
         Amg::Vector3D strawAxis =  element->strawTransform(straw)* Vector3D(0,0,1) * strawDirection() */
         
-    virtual const Amg::Vector3D& center(const Identifier& id) const;
+    virtual const Amg::Vector3D& center(const Identifier& id) const override final;
 
     /** Normal of a straw. (Not very meaningful). */
-    virtual const Amg::Vector3D& normal(const Identifier& id) const;
+    virtual const Amg::Vector3D& normal(const Identifier& id) const override final;
     
     /** Straw Surface: access to the surface via integer */
     const Trk::StraightLineSurface& strawSurface(int straw) const;
@@ -173,22 +170,22 @@ namespace InDetDD {
     // the cache changed to Amg, hence CLHEP methods don't return by reverence anymore
 
     /** Element Surface: Get Transform of element in Tracking frame - CLHEP converted */
-    virtual const HepGeom::Transform3D transformCLHEP() const;
+    const HepGeom::Transform3D transformCLHEP() const;
 
     /**  Element Surface: Straw center - CLHEP converted*/
-    virtual const HepGeom::Point3D<double> centerCLHEP() const;
+    const HepGeom::Point3D<double> centerCLHEP() const;
 
     /**  Element Surface: Normal of a straw layer - CLHEP converted */
-    virtual const HepGeom::Vector3D<double> normalCLHEP() const; 
+    const HepGeom::Vector3D<double> normalCLHEP() const; 
 
     /** Straw Surface : get Transform of individual straw in Tracking frame - CLHEP converted */
-    virtual const HepGeom::Transform3D transformCLHEP(const Identifier& id) const;
+    const HepGeom::Transform3D transformCLHEP(const Identifier& id) const;
 
     /** Straw Surface : Center of a straw using Identifier - CLHEP converted */
-    virtual const HepGeom::Point3D<double> centerCLHEP(const Identifier& id) const;
+    const HepGeom::Point3D<double> centerCLHEP(const Identifier& id) const;
 
     /** Straw Surface : Center of a straw using Identifier - CLHEP converted */
-    virtual const HepGeom::Vector3D<double> normalCLHEP(const Identifier& id) const;
+    const HepGeom::Vector3D<double> normalCLHEP(const Identifier& id) const;
 
     // ---- CLHEP methods ---- to be checked if needed ---------------------------------------------  (end)
    
@@ -201,8 +198,6 @@ namespace InDetDD {
     /** Return the TRT_Conditions object associated to this Detector element */
     const TRT_Conditions* conditions() const;
 
-
-  protected:
     /** to be overloaded by the extended classes */
     virtual   HepGeom::Transform3D calculateStrawTransform(int straw) const = 0;
 
@@ -219,7 +214,7 @@ namespace InDetDD {
     void createSurfaceCache(Identifier id) const;
     
     /** invalidate action on the cache */
-    virtual void invalidateOther() const {};
+    void invalidateOther() const {};
 
   private:
     
@@ -230,6 +225,7 @@ namespace InDetDD {
     void deleteCache();
     void createStrawSurfaces() const;
     void createStrawSurfacesCache() const;
+    std::unique_ptr<SurfaceCache> createSurfaceCacheHelper(int straw) const;
 
   protected:
     Identifier                                          m_id;
@@ -249,9 +245,8 @@ namespace InDetDD {
     //!< helper element surface for the cache   
     CxxUtils::CachedUniquePtr<SurfaceCache> m_surfaceCache;
     CxxUtils::CachedUniquePtr<Trk::Surface> m_surface;
-    
-    mutable std::vector<const Trk::Surface*> m_surfaces ATLAS_THREAD_SAFE; // Guarded by m_mutex
-    mutable std::mutex m_mutex;
+   
+    CxxUtils::CachedValue<std::vector<const Trk::Surface*>> m_surfaces; 
     const GeoAlignmentStore* m_geoAlignStore=nullptr;
 
   };
diff --git a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_BaseElement.icc b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_BaseElement.icc
index e48aed5da52160c20e0411e45a5f079cc584ac05..3e63e67b5156f64baeac21832e6942805e6ccc2b 100755
--- a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_BaseElement.icc
+++ b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_BaseElement.icc
@@ -11,4 +11,10 @@ TRT_BaseElement::nStraws() const
   return m_nstraws;
 }
 
+inline const GeoTrf::Transform3D&
+TRT_BaseElement::defTransform() const
+{
+  return getMaterialGeom()->getDefAbsoluteTransform();
+}
+
 }
diff --git a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_BaseElement.cxx b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_BaseElement.cxx
index b1d19eb1a7f63a9db2a18ec3f878fd0ed7b5cd61..d438c6eccc8f111d24dcca3c3556eb0a826d55f9 100755
--- a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_BaseElement.cxx
+++ b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_BaseElement.cxx
@@ -30,7 +30,6 @@ TRT_BaseElement::TRT_BaseElement(const GeoVFullPhysVol* volume,
   , m_surfaceCache{}
   , m_surface{}
   , m_surfaces{}
-  , m_mutex{}
   , m_geoAlignStore(geoAlignStore)
 {
   m_idHash = m_idHelper->straw_layer_hash(id);
@@ -117,19 +116,21 @@ TRT_BaseElement::surface(const Identifier& id) const
   if (!m_strawSurfaces[straw]) {
     createSurfaceCache(id);
   }
-  return *(m_strawSurfaces[straw].get());
+  return *(m_strawSurfaces[straw]);
 }
 
 const std::vector<const Trk::Surface*>&
 TRT_BaseElement::surfaces() const
 {
-  std::lock_guard<std::mutex> lock{ m_mutex };
-  if (!m_surfaces.size()) {
-    m_surfaces.reserve(nStraws());
-    for (unsigned is = 0; is < nStraws(); ++is)
-      m_surfaces.push_back(&strawSurface(is));
+  if (!m_surfaces.isValid()) {
+    std::vector<const Trk::Surface*> tmp_surfaces;
+    tmp_surfaces.reserve(nStraws());
+    for (unsigned is = 0; is < nStraws(); ++is) {
+      tmp_surfaces.push_back(&strawSurface(is));
+    }
+    m_surfaces.set(tmp_surfaces);
   }
-  return m_surfaces;
+  return *(m_surfaces.ptr());
 }
 
 const Trk::SurfaceBounds&
@@ -280,12 +281,8 @@ TRT_BaseElement::createSurfaceCache(Identifier id) const
 
   // convert neccessary parts to Amg
   if (!m_strawSurfacesCache[straw]) {
-    Amg::Transform3D* sTransform =
-      new Amg::Transform3D(Amg::CLHEPTransformToEigen(cStrawTransform));
-    Amg::Vector3D* sCenter = new Amg::Vector3D(sTransform->translation());
     // create the surface cache & fill it
-    m_strawSurfacesCache[straw].set(
-      std::make_unique<SurfaceCache>(sTransform, sCenter, nullptr, nullptr));
+    m_strawSurfacesCache[straw].set(createSurfaceCacheHelper(straw));
   }
   // creaete the surface only if needed (the links are still intact)
   if (!m_strawSurfaces[straw]) {
@@ -294,6 +291,19 @@ TRT_BaseElement::createSurfaceCache(Identifier id) const
   }
 }
 
+std::unique_ptr<SurfaceCache>
+TRT_BaseElement::createSurfaceCacheHelper(int straw) const
+{
+  // get the StrawTransform from GeoModel
+  HepGeom::Transform3D cStrawTransform = calculateStrawTransform(straw);
+  auto sTransform = std::make_unique<Amg::Transform3D>(
+    Amg::CLHEPTransformToEigen(cStrawTransform));
+  auto sCenter = std::make_unique<Amg::Vector3D>(sTransform->translation());
+  // create the surface cache & fill it
+  return std::make_unique<SurfaceCache>(
+    sTransform.release(), sCenter.release(), nullptr, nullptr);
+}
+
 void
 TRT_BaseElement::invalidate()
 {
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/CMakeLists.txt b/InnerDetector/InDetExample/InDetBeamSpotExample/CMakeLists.txt
index f21e04492db8de425e4e1be36e2474709455034b..13568a474a2f9382600231bd7c29c07956ab0384 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/CMakeLists.txt
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/CMakeLists.txt
@@ -1,6 +1,4 @@
-################################################################################
-# Package: InDetBeamSpotExample
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( InDetBeamSpotExample )
@@ -10,7 +8,7 @@ find_package( cx_Oracle )
 find_package( pyyaml )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/*.py )
 atlas_install_scripts( bin/dumpBeamSpot.py bin/checkJobs.py bin/runJobs.py bin/beamSpotT0_ESDToDPD_trf.py bin/beamSpotT0_Vertex_tf.py bin/taskman.py bin/beamspotman.py bin/beamspotnt.py bin/pickleTool.py bin/plotBeamSpotMon.py bin/plotBeamSpotVert.py bin/plotBeamSpotVxVal.py bin/beamSpotT1_Vertex_trf.py bin/dumpLBFileMap.py bin/makeDatasetOnDiskList bin/plotBeamSpotCompare.py bin/dqBeamSpot.py bin/periodInfo.py bin/resolveBeamSpotTag.py bin/bsCompare.py bin/getLatestRuns.py bin/updateCoolNtuple.py bin/extractScanInfo.py )
 
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotDPDFlags.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotDPDFlags.py
index 1ff2ece608df7505df32988bca4c2cc96136f9f6..e4070de4e67d834c8b0694f59abdf053cf586eb0 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotDPDFlags.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotDPDFlags.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        BeamSpotDPDFlags
@@ -16,10 +16,7 @@ __version__ = "0.0.1"
 __author__  = "James Walder <jwalder@cern.ch>"
 __version__ = "$Id $"
 
-## Import the module that allows to use named units, e.g. GeV
-import AthenaCommon.SystemOfUnits as Units
-
-from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
+from AthenaCommon.JobProperties import JobProperty
 from AthenaCommon.JobProperties import jobproperties
 
 # Filename stream
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotData.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotData.py
index d46effd0531afc6952d0f2ecc7204776e5b595eb..cb7e7df529dd78051e11105ec595e040a0c12f63 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotData.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotData.py
@@ -2,8 +2,6 @@
 
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
 """
 Tools for handling beam spot data in ntuples or in COOL.
 For functionality requiring COOL access, you'll probably need to use
@@ -17,9 +15,7 @@ __version__ = '$Id: BeamSpotData.py 759522 2016-07-04 12:47:58Z amorley $'
 import time
 import copy
 from array import array
-#from CoolConvUtilities import AtlCoolLib
-#from PyCool import cool
-from math import *
+from math import sqrt, atan
 import csv
 
 import numpy   # WARNING: must be last import, so numpy can override sqrt etc
@@ -37,7 +33,7 @@ varDefsGen = {
     'fill':  {},
     'bcid':  {},
     'nEvents':   {},
-    'nValid':    {'altfmt': '%i', 'latexheader': '$n_{\mathrm{vtx}}$'},
+    'nValid':    {'altfmt': '%i', 'latexheader': r'$n_{\mathrm{vtx}}$'},
     'nVtxAll':   {},
     'nVtxPrim':  {},
     'status':    {'fmt': '%4i', 'altfmt': '%4i','latexheader' : 'Status' },
@@ -50,13 +46,13 @@ varDefsGen = {
     'posZ':      {'units': 'mm', 'fmt': '%10.2f', 'latexheader': '$z$ [mm]',
                   'altfmt': '%10.1f', 'altlatexheader': '\\lumposz [mm]',
                   'title': 'Beam Spot Position z', 'atit': 'Luminous centroid z [mm]', 'min': -100, 'max': 100},
-    'sigmaX':    {'units': 'mm', 'fmt': '%10.4f', 'latexheader': '$\sigma_x$ [mm]',
-                  'altfmt': '%10.0f', 'altfactor': 1000., 'altlatexheader': '\\lumsigx [$\mu$m]',
+    'sigmaX':    {'units': 'mm', 'fmt': '%10.4f', 'latexheader': r'$\sigma_x$ [mm]',
+                  'altfmt': '%10.0f', 'altfactor': 1000., 'altlatexheader': r'\\lumsigx [$\mu$m]',
                   'title': 'Beam Spot Size #sigma_{x}', 'atit': 'Luminous size #sigma_{x} [mm]', 'min': 0, 'max': 0.6},
-    'sigmaY':    {'units': 'mm', 'fmt': '%10.4f', 'latexheader': '$\sigma_y$ [mm]',
-                  'altfmt': '%10.0f','altfactor': 1000., 'altlatexheader': '\\lumsigy [$\mu$m]',
+    'sigmaY':    {'units': 'mm', 'fmt': '%10.4f', 'latexheader': r'$\sigma_y$ [mm]',
+                  'altfmt': '%10.0f','altfactor': 1000., 'altlatexheader': r'\\lumsigy [$\mu$m]',
                   'title': 'Beam Spot Size #sigma_{y}', 'atit': 'Luminous size #sigma_{y} [mm]', 'min': 0, 'max': 0.6},
-    'sigmaZ':    {'units': 'mm', 'fmt': '%10.2f', 'latexheader': '$\sigma_z$ [mm]',
+    'sigmaZ':    {'units': 'mm', 'fmt': '%10.2f', 'latexheader': r'$\sigma_z$ [mm]',
                   'altfmt': '%10.0f', 'altlatexheader': '\\lumsigz [mm]',
                   'title': 'Beam Spot Size #sigma_{z}', 'atit': 'Luminous size #sigma_{z} [mm]', 'min': 0, 'max': 150},
     'tiltX':     {'units': 'rad', 'fmt': '%10.6f', 'latexheader': 'tilt$_{xz}$ [rad]',
@@ -96,7 +92,7 @@ varDefsGen = {
                   'title': 'Error Scale Factor k', 'atit': 'k', 'min': 0.5, 'max': 2.0},
     'kErr':      {'fmt': '%10.3f',
                   'title': 'Uncertainty on Error Scale Factor k', 'atit': 'Uncertainty on k', 'min': 0, 'max': 0.2},
-    'sigmaXY':   {'fmt': '%10.6f', 'latexheader': '$\sigma_{xy}$',
+    'sigmaXY':   {'fmt': '%10.6f', 'latexheader': r'$\sigma_{xy}$',
                   'title': 'Beam Spot Size #sigma_{xy}', 'atit': '#sigma_{xy}', 'min': -0.0005, 'max': 0.0005},
 }
 
@@ -246,7 +242,7 @@ def varDef(var,property,default='',useAlternate=False,override=None):
         if useAlternate:
             v = varDefs[var].get('alt'+property,v)
         return v
-    except:
+    except Exception:
         return default
 
 def fmtVal(var,value,strip=False,useAlternate=False):
@@ -402,7 +398,7 @@ class BeamSpotValue:
     def thetaXY(self):
         try:
             txy = .5*atan((2*self.sigmaX*self.sigmaY*self.rhoXY)/(self.sigmaY**2-self.sigmaX**2))
-        except:
+        except Exception:
             txy = 0
         return txy
 
@@ -413,7 +409,7 @@ class BeamSpotValue:
             tpy = -1*(self.rhoXY*self.sigmaX*(self.sigmaX**2+self.sigmaY**2))/(self.sigmaX**4+2*(2*self.rhoXY**2-1)*self.sigmaX**2*self.sigmaY**2+self.sigmaY**4)
             tpr = (self.sigmaX*self.sigmaY**3-self.sigmaY*self.sigmaX**3)/(self.sigmaX**4+2*(2*self.rhoXY**2-1)*self.sigmaX**2*self.sigmaY**2+self.sigmaY**4)
             txye = sqrt(tpx*tpx*self.sigmaXErr**2 + tpy*tpy*self.sigmaYErr**2 + tpr*tpr*self.rhoXYErr**2 + 2*(tpx*tpy*self.covSxSy + tpx*tpr*self.covSxRhoXY + tpy*tpr*self.covSyRhoXY))
-        except:
+        except Exception:
             txye = 0
         return txye
 
@@ -430,15 +426,15 @@ class BeamSpotValue:
             BeamSpotValue.coolQuery = COOLQuery()
         try:
             self.timeStart = BeamSpotValue.coolQuery.lbTime(self.run,self.lbStart)[0]
-        except:
+        except Exception:
             pass
         try:
             self.timeEnd = BeamSpotValue.coolQuery.lbTime(self.run,self.lbEnd-1)[1]
-        except:
+        except Exception:
             pass
         try:
             self.fill = BeamSpotValue.coolQuery.getLHCInfo(self.timeStart).get('FillNumber',0)
-        except:
+        except Exception:
             pass
     
     def fillDataFromPseudoLb(self, pseudoLbFile, timeUnit = 1.):
@@ -451,7 +447,7 @@ class BeamSpotValue:
                 print ("point %s %s %s %s" % (point,start,sep,acq))
                 BeamSpotValue.pseudoLbDict[int(point)] = (int(int(start)*timeUnit), int(int(end)*timeUnit), float(sep), float(acq))
 
-        if not self.lbStart in self.pseudoLbDict:
+        if self.lbStart not in self.pseudoLbDict:
             print ("Missing %s in pseudoLbDict" % self.lbStart)
             return
 
@@ -468,7 +464,7 @@ class BeamSpotValue:
 
         try:
             self.fill = BeamSpotValue.coolQuery.getLHCInfo(self.timeStart).get('FillNumber',0)
-        except:
+        except Exception:
             pass
         
         return
@@ -590,7 +586,7 @@ class BeamSpotAverage:
             lumi = lumiNt.IntLumi
             try:
                 self.lumiData[run][lb] = lumi
-            except:
+            except Exception:
                 self.lumiData[run] = {}
                 self.lumiData[run][lb] = lumi
         lumiSum = 0.
@@ -610,7 +606,7 @@ class BeamSpotAverage:
             for lb in range(b.lbStart,b.lbEnd):
                 try:
                     lumi += self.lumiData[b.run][lb]
-                except:
+                except Exception:
                     print ('ERROR: missing luminosity information for run %i LB %i (in [%i,%i]) - weight set to zero!!' % (b.run,lb,b.lbStart,b.lbEnd))
                     self.nWarnings += 1
         for i in range(len(self.varList)):
@@ -647,7 +643,7 @@ class BeamSpotAverage:
             self.ave = self.sumx/self.sum
             self.err = self.rms/numpy.sqrt(self.sum)
 
-    def getIndex(varName):
+    def getIndex(self, varName):
         for i in range(len(self.varList)):
             if self.varList[i]==varName:
                 return i
@@ -847,7 +843,7 @@ class BeamSpotContainer:
         cache = {}
         for b in self:
             r = b.run
-            if not r in cache:
+            if r not in cache:
                 cache[r] = {}
             if b.lbEnd-b.lbStart > 500:
                 print ('WARNING: Cannot cache LB range %i ... %i for run %i' % (b.lbStart,b.lbEnd,r))
@@ -986,28 +982,28 @@ class BeamSpotFinderNt(BeamSpotContainer):
             bs = BeamSpotValue(self.fullCorrelations)
             try:
                 bs.status = BeamSpotFinderNt.fitIdToStatusMap[self.nt.fitID]+BeamSpotFinderNt.fitResultToStatusMap[self.nt.fitStatus]
-            except:
+            except Exception:
                 bs.status = 0
                 print ("ERROR: can't translate (fitID,fitStatus) = (%i,%i) into status word" % (self.nt.fitID,self.nt.fitStatus))
             bs.run = self.nt.run
             try:
                 bs.bcid = self.nt.bcid
-            except:
+            except Exception:
                 pass
             bs.lbStart = self.nt.lumiStart
             bs.lbEnd = self.nt.lumiStart+self.nt.lumiRange
             bs.nEvents = self.nt.nEvents
             try:
                 bs.nValid = self.nt.nValid
-            except:
+            except Exception:
                 pass
             try:
                 bs.nVtxAll = self.nt.nVtxAll
-            except:
+            except Exception:
                 pass
             try:
                 bs.nVtxPrim = self.nt.nVtxPrim
-            except:
+            except Exception:
                 pass                        
             bs.posX = self.nt.xc
             bs.posY = self.nt.yc
@@ -1128,7 +1124,6 @@ class BeamSpotCOOL(BeamSpotContainer):
             lumiBegin = since & 0xFFFFFFFF
 
             until = obj.until()
-            runUntil = until >> 32
             lumiUntil = until & 0xFFFFFFFF
 
             bs            = BeamSpotValue()                            
@@ -1163,7 +1158,7 @@ class BeamSpotCOOL(BeamSpotContainer):
 
             try:
                 rhoXYtmp = sigmaXYtmp / sigmaXtmp / sigmaYtmp
-            except:
+            except Exception:
                 rhoXYtmp = 0
             bs.rhoXY      = rhoXYtmp
 
@@ -1172,7 +1167,7 @@ class BeamSpotCOOL(BeamSpotContainer):
                 sumtmp += sigmaXErrtmp * sigmaXErrtmp / sigmaXtmp / sigmaXtmp
                 sumtmp += sigmaYErrtmp * sigmaYErrtmp / sigmaYtmp / sigmaYtmp
                 rhoXYErrtmp = sqrt(rhoXYtmp * rhoXYtmp * sumtmp)
-            except:
+            except Exception:
                 rhoXYErrtmp = 0
 
             bs.rhoXYErr = rhoXYErrtmp
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotJobProperties.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotJobProperties.py
index 1561eeb926f14de0af450e71fb79400e7df25493..0c54dd14f3955c84e7f4bfea08423ebaea19d72e 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotJobProperties.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotJobProperties.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        BeamSpotFlags
@@ -16,9 +16,6 @@ __version__ = "0.0.1"
 __author__  = "James Walder <jwalder@cern.ch>"
 __version__ = "$Id $"
 
-## Import the module that allows to use named units, e.g. GeV
-import AthenaCommon.SystemOfUnits as Units
-
 from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
 from AthenaCommon.JobProperties import jobproperties
 
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotPostProcessing.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotPostProcessing.py
index cf0fbbc24a70220363a2355614cad8e353577e63..e6317a61f9e2abffb20639a7145ad976cc8b2c95 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotPostProcessing.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotPostProcessing.py
@@ -2,8 +2,6 @@
 
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
 """
 Beam spot postprocessing library.
 """
@@ -13,7 +11,7 @@ __version__ = '$Id $'
 
 import os
 
-from InDetBeamSpotExample.PostProcessing import *
+from InDetBeamSpotExample.PostProcessing import PostProcessingStep, PostProcessingError, PostponeProcessing, runPostProcStep
 from InDetBeamSpotExample.TaskManager import TaskManager
 from InDetBeamSpotExample import COOLUtils
 
@@ -74,7 +72,7 @@ class JobPostProcessing(PostProcessingStep):
         #if self.oldStatus==TaskManager.StatusCodes['POSTPROCESSING']:
         try:
             postProcSteps = self.getJobConfig(self.jobName)['jobpostprocsteps'].split()
-        except:
+        except Exception:
             raise PostProcessingError('ERROR: No config file or jobpostprocsteps parameter found for %s/%s' % (self.dsName,self.taskName),self.executedSteps)
         for step in postProcSteps:
             self.log('Running postprocessing step:  %s' % step)
@@ -143,7 +141,7 @@ class PlotBeamSpotCompareReproc(PostProcessingStep):
         # tag will be the one containing the best results to date and hence we compare to that
         try: 
             beamspottag = COOLUtils.resolveCurrentBeamSpotFolder()
-        except:
+        except Exception:
             raise PostProcessingError('ERROR: Unable to resolve beamspot folder tag',self.executedSteps,TaskManager.StatusCodes['POSTPROCFAILED'])
 
         if os.path.exists('/'.join([self.taskDir,ntFileName])):
@@ -307,7 +305,7 @@ class CheckT0Status(PostProcessingStep):
             f = self.getJobConfig(self.jobName)['inputfiles'][0]
             if 'ESD' in f:
                 filter = 'ESD'
-        except:
+        except Exception:
             self.log('WARNING: Unable to determine input file type - will assume default (%s)\n' % filter, doPrint=True)
         cmd = 'beamspotman.py -n -f %s queryT0 %s %s' % (filter,self.dsName,self.taskName)
         status = self.logExec(cmd,doPrint=True,abortOnError=False)
@@ -330,7 +328,7 @@ class UploadBeamSpot(PostProcessingStep):
         # Resolve beamspot tag
         try: 
             beamspottag = COOLUtils.resolveCurrentBeamSpotFolder()
-        except:
+        except Exception:
             raise PostProcessingError('ERROR: Unable to resolve beamspot folder tag',self.executedSteps,TaskManager.StatusCodes['POSTPROCFAILED'])
         
         # Check that we haven't uploaded yet
@@ -414,7 +412,7 @@ class UploadDataQuality(PostProcessingStep):
         if os.path.exists('/'.join([self.taskDir,dataQualityDbFileName])):
             self.logExec('beamspotman.py -b -n --dqtag %s dqflag %s %s' % (dqtag,self.dsName,self.taskName))            
         else:
-            self.log(text='ERROR: No beam spot DQ flag SQLite file %s\n       Nothing to upload - was DQ determination successful?\n' % dqDbFileName,doPrint=True)
+            self.log(text='ERROR: No beam spot DQ flag SQLite file %s\n       Nothing to upload - was DQ determination successful?\n' % dataQualityDbFileName,doPrint=True)
 
 
 class BeamSpotNtNoAve(PostProcessingStep):
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/COOLUtils.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/COOLUtils.py
index ae5ba68c96dca06b2c39f85556f6fbb2dfcbddde..86b222a1b9e92af300859dfb0cf1e43025573371 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/COOLUtils.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/COOLUtils.py
@@ -1,7 +1,5 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
 """
 Miscellaneous utilities related to COOL.
 """
@@ -149,7 +147,7 @@ class COOLQuery:
           self.cooldb.closeDatabase()
           self.cooltrigdb.closeDatabase()
           self.cooldcsdb.closeDatabase()
-        except:
+        except Exception:
           print ("DB time out -- ignore")
 
     def getRunStartTime(self,runnr):
@@ -161,10 +159,9 @@ class COOLQuery:
         try:
             itr.goToNext()
             obj = itr.currentRef()
-            run = obj.payload()['RunNumber']
             sorTime = obj.payload()['SORTime']
             return COOLToUnixTime(sorTime)
-        except:
+        except Exception:
             return
 
 
@@ -186,10 +183,10 @@ class COOLQuery:
             for k in info.keys():
                 try:
                     info[k] = obj.payload()[k]
-                except:
+                except Exception:
                     print ('WARNING: Cannot find value for',k)
             return info
-        except:
+        except Exception:
             return None
 
     def getRunEndTime(self,runnr):
@@ -201,10 +198,9 @@ class COOLQuery:
         try:
             itr.goToNext()
             obj = itr.currentRef()
-            run = obj.payload()['RunNumber']
             eorTime = obj.payload()['EORTime']
             return COOLToUnixTime(eorTime)
-        except:
+        except Exception:
             return
 
     def getLbTimes(self,runnr):
@@ -257,7 +253,7 @@ def resolveNextAlias(tagtype='ST'):
     alias = ''
     try:
         alias = resolveAlias.getNext()
-    except:
+    except Exception:
         alias = ''
         
     return alias.replace('*', tagtype)
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/DQUtilities.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/DQUtilities.py
index 73f4ee4d47d5051abf66b475806e61e85e48c3bd..87c099835e80b8c864d862202a2ea850e161e5ee 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/DQUtilities.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/DQUtilities.py
@@ -1,15 +1,8 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import absolute_import, print_function
-
-import os, sys
-from operator import itemgetter
-from itertools import groupby
-from PyCool import cool
-from CoolConvUtilities import AtlCoolLib
-from DetectorStatus import DetStatusLib
+import os
 from DQDefects import DefectsDB
-from DQUtils.sugar import IOVSet,RANGEIOV_VAL,RunLumiType, RunLumi, define_iov_type
+from DQUtils.sugar import IOVSet, RunLumiType, RunLumi, define_iov_type
 from DQUtils import fetch_iovs, process_iovs    
 
 
@@ -167,7 +160,7 @@ class IDBSDefectWriter:
         Write a single defect to the database
         """
 
-        if not defect in self.db.defect_names:
+        if defect not in self.db.defect_names:
             self.db.create_defect(defect, description)
 
         self.db.insert(defect, since, until, comment, self.user, present, recoverable) 
@@ -366,7 +359,7 @@ class IDBSDefectEncoding:
     def defectToInt(cls, defect):
         """Encode defect as an int.  If defect is unknown raise error"""
 
-        if not defect in IDBSDefectEncoding.defectBitPos:
+        if defect not in IDBSDefectEncoding.defectBitPos:
             raise DefectError ('ERROR: Unknown defect %s encountered' % defect)
 
         return (1 << IDBSDefectEncoding.defectBitPos.index(defect))
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/JobRunner.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/JobRunner.py
index 7641ef2386920d3f4ef94270bbb78ff832f32b84..03d487e5103b30335382e1944052aa7ea397f44b 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/JobRunner.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/JobRunner.py
@@ -158,13 +158,13 @@ class JobRunner:
            parameters is relevant. insertAtFront can be set to True to force early
            evaluation of a given parameter."""
         p = self.params[name] = self.params.get(name,JobRunnerParameter(name))
-        if value!=None:
+        if value is not None:
             p.value = value
-        if description!=None:
+        if description is not None:
             p.description = description
-        if isSpecial!=None:
+        if isSpecial is not None:
             p.isSpecial=isSpecial
-        if not name in self.paramOrder:
+        if name not in self.paramOrder:
             if insertAtFront:
                 self.paramOrder.insert(0,name)
             else:
@@ -176,7 +176,7 @@ class JobRunner:
            setParam is called to create it. If it does exist, only the value is updated
            and the description and flag arguments are ignored."""
         if name in self.params:
-            if value!=None:
+            if value is not None:
                 p = self.params[name]
                 if isinstance(p.value,str) and p.value:
                     p.value = p.value + endOfLine + value
@@ -217,7 +217,7 @@ class JobRunner:
                     tmp[p] = value % tmp
                 else:
                     tmp[p] = value
-        except:
+        except Exception:
             raise JobRunnerError ('Unable to evaluate parameter: '+p+' = '+value+' (check parameter order)')
 
 
@@ -380,7 +380,7 @@ class JobRunner:
             inputfiles = self.getParam('inputfiles')
             jobInputDict = {}
             jobLBDict = {}
-            lbpattern = re.compile('lb(\d+)')
+            lbpattern = re.compile(r'lb(\d+)')
             for f in inputfiles:
                 lbnrs = lbpattern.findall(f)
                 
@@ -400,13 +400,13 @@ class JobRunner:
 
                     jobId = int((lbnr-1)/lbperjob)
                     #print ('LB = %4i  jobid = %i' % (lbnr,jobId))
-                    if not jobId in jobInputDict:
+                    if jobId not in jobInputDict:
                         jobInputDict[jobId] = [f]
                         jobLBDict[jobId] = [lbnr]
                     else:
-                        if not f in jobInputDict[jobId] :
+                        if f not in jobInputDict[jobId] :
                             jobInputDict[jobId].append(f)
-                        if not lbnr in jobLBDict[jobId] :    
+                        if lbnr not in jobLBDict[jobId] :
                             jobLBDict[jobId].append(lbnr)
 
                     lbnr = lbnr+1
@@ -451,7 +451,7 @@ class JobRunner:
 
     def runJob(self,jobnr):
         """Run a single configured job."""
-        if not jobnr in self.jobs:
+        if jobnr not in self.jobs:
             raise JobRunnerError ('Job number %s is not configured' % jobnr)
         jobConfig = self.jobs[jobnr]
         subprocess.call('touch '+jobConfig['subflag'], shell=True)
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/PlotLibrary.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/PlotLibrary.py
index 3e4bbbe1bd1c16bc115008a71fd0092350302de7..f5a077bff65611d91f3f982ff39b985c22336c64 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/PlotLibrary.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/PlotLibrary.py
@@ -2,8 +2,6 @@
 
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
 """
 A library with miscellaneous beam spot related utilities and plots.
 """
@@ -11,9 +9,9 @@ __author__  = 'Juerg Beringer'
 __version__ = '$Id $'
 
 
-from math import *
-from time import *
-from numpy import *
+from math import sqrt
+from time import mktime, strptime
+from numpy import array
 
 import ROOT
 from InDetBeamSpotExample import ROOTUtils
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/PostProcessing.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/PostProcessing.py
index cf7253f21e5f2946c57bfc3f8076caf8f5a4da23..036fe32d463baaa41be1ea57ddbbe6e5a269db83 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/PostProcessing.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/PostProcessing.py
@@ -2,8 +2,6 @@
 
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
 """
 This module defines the generic infrastructure for task postprocessing.
 """
@@ -11,14 +9,13 @@ __author__  = 'Juerg Beringer'
 __version__ = '$Id $'
 
 
-import dircache, glob, re, time, sys, os, math
+import dircache, glob, time, sys, os, math
+import subprocess
 
-from InDetBeamSpotExample.TaskManager import *
+from InDetBeamSpotExample.TaskManager import TaskAnalyzer, TaskManager, getKey
 from InDetBeamSpotExample.Utils import getUserName
 
-from future import standard_library
-standard_library.install_aliases()
-import subprocess
+
 
 
 # Exception classes
@@ -221,7 +218,7 @@ class PostProcessingStep:
     def jobList(self):
         try:
             l = dircache.listdir(self.taskDir)
-        except:
+        except Exception:
             l = []
         return l
 
@@ -273,9 +270,9 @@ class PostProcessingStep:
         if not resultFileName:
             return
         resultFiles = self.taskDict['RESULTFILES']
-        if resultFiles==None:
+        if resultFiles is None:
             resultFiles = ''
-        if not resultFileName in resultFiles.split():
+        if resultFileName not in resultFiles.split():
             resultFiles = ' '.join([resultFiles,resultFileName])
             self.taskman.setValue(self.dsName,self.taskName,'RESULTFILES',resultFiles)
             self.taskDict['RESULTFILES'] = resultFiles
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/ROOTUtils.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/ROOTUtils.py
index 2d1be151f5cead947676be3559ce96a95e15cbb8..82ac2d544196bfd8206e295e025229a40b644a22 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/ROOTUtils.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/ROOTUtils.py
@@ -1,9 +1,5 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-# $Id: ROOTUtils.py 759047 2016-07-01 00:45:13Z beringer $
-
-from __future__ import print_function
-
 """
 Miscellaneous utilities for PyROOT.
 """
@@ -12,8 +8,6 @@ __version__ = '$Id: ROOTUtils.py 759047 2016-07-01 00:45:13Z beringer $'
 
 
 import ROOT
-from array import array
-
 
 protectedObjectList = []
 
@@ -54,11 +48,11 @@ class MyCanvas(ROOT.TCanvas):
     def __init__(self,name='MyCanvas', size='default', xdivs=1, ydivs=1, saveAsList=None, autoSaveOnExit=None):
         super(MyCanvas,self).__init__(name,name,myCanvasSizes[size][0],myCanvasSizes[size][1])
         self.name = name
-        if saveAsList!=None:
+        if saveAsList is not None:
             self.saveAsList = saveAsList
         else:
             self.saveAsList = MyCanvas.saveAsList
-        if autoSaveOnExit!=None:
+        if autoSaveOnExit is not None:
             self.autoSaveOnExit = autoSaveOnExit
         else:
             self.autoSaveOnExit = MyCanvas.autoSaveOnExit
@@ -130,7 +124,7 @@ class PlotLibrary:
                 c.cd(iCanvas)
                 try:
                     self.__class__.__dict__[code](self,w,*args)
-                except:
+                except Exception:
                     self.__class__.__bases__[0].__dict__[code](self,w,*args)
                 ROOT.gPad.Update()
                 # For some strange reason, this works only for .eps, but not e.g. for gif files...???
@@ -162,7 +156,7 @@ class PlotLibrary:
             c = self.protect( MyCanvas(what,self.singleCanvasSize) )
             try:
                 self.__class__.__dict__[code](self,what,*args)
-            except:
+            except Exception:
                 self.__class__.__bases__[0].__dict__[code](self,what,*args)
             ROOT.gPad.Update()
             for o in self.saveAsList:
@@ -216,9 +210,9 @@ class StyleFactory:
 def drawAxisFrame(xmin,xmax,ymin,ymax,title='',xTitleOffset=None,yTitleOffset=None,doPlot=True,protectFrame=True):
     frame = ROOT.TH2F('axisFrame',title,100,xmin,xmax,100,ymin,ymax)
     frame.SetStats(False)
-    if xTitleOffset!=None:
+    if xTitleOffset is not None:
         frame.GetXaxis().SetTitleOffset(xTitleOffset)
-    if yTitleOffset!=None:
+    if yTitleOffset is not None:
         frame.GetYaxis().SetTitleOffset(yTitleOffset)
     if doPlot:
         frame.Draw()
@@ -304,7 +298,7 @@ def moveStats(h,dx,dy,xw=0,yw=0,label=''):
 
 
 def atlasLabel(x,y,isPreliminary=False,color=1,offset=0.115,isForApproval=False,energy=8,customstring="",size=0.05):
-    if x==None or y==None:
+    if x is None or y is None:
         print ("Must set (x,y) position using --atlasx and --atlasy to add labels.  No ATLAS labels created.")
         return
     offset = offset/0.05*size
@@ -343,69 +337,69 @@ def atlasStyle(protectStyle=True):
 
     # use plain black on white colors
     icol=0  # WHITE
-    s.SetFrameBorderMode(icol);
-    s.SetFrameFillColor(icol);
-    s.SetCanvasBorderMode(icol);
-    s.SetCanvasColor(icol);
-    s.SetPadBorderMode(icol);
-    s.SetPadColor(icol);
-    s.SetStatColor(icol);
-    #s.SetFillColor(icol); # don't use: white fill color floa *all* objects
+    s.SetFrameBorderMode(icol)
+    s.SetFrameFillColor(icol)
+    s.SetCanvasBorderMode(icol)
+    s.SetCanvasColor(icol)
+    s.SetPadBorderMode(icol)
+    s.SetPadColor(icol)
+    s.SetStatColor(icol)
+    #s.SetFillColor(icol) # don't use: white fill color floa *all* objects
 
     # set the paper & margin sizes
-    s.SetPaperSize(20,26);
-    s.SetPadTopMargin(0.05);
-    s.SetPadRightMargin(0.05);
-    s.SetPadBottomMargin(0.16);
-    s.SetPadLeftMargin(0.16);
+    s.SetPaperSize(20,26)
+    s.SetPadTopMargin(0.05)
+    s.SetPadRightMargin(0.05)
+    s.SetPadBottomMargin(0.16)
+    s.SetPadLeftMargin(0.16)
 
     # set title offsets (for axis label)
     s.SetTitleXOffset(1.4)
     s.SetTitleYOffset(1.4)
 
     # use large fonts
-    #Int_t font=72; # Helvetica italics
+    #Int_t font=72 # Helvetica italics
     font = 42 # Helvetica
     tsize = 0.05
-    s.SetTextFont(font);
-
-    s.SetTextSize(tsize);
-    s.SetLabelFont(font,"x");
-    s.SetTitleFont(font,"x");
-    s.SetLabelFont(font,"y");
-    s.SetTitleFont(font,"y");
-    s.SetLabelFont(font,"z");
-    s.SetTitleFont(font,"z");
-
-    s.SetLabelSize(tsize,"x");
-    s.SetTitleSize(tsize,"x");
-    s.SetLabelSize(tsize,"y");
-    s.SetTitleSize(tsize,"y");
-    s.SetLabelSize(tsize,"z");
-    s.SetTitleSize(tsize,"z");
+    s.SetTextFont(font)
+
+    s.SetTextSize(tsize)
+    s.SetLabelFont(font,"x")
+    s.SetTitleFont(font,"x")
+    s.SetLabelFont(font,"y")
+    s.SetTitleFont(font,"y")
+    s.SetLabelFont(font,"z")
+    s.SetTitleFont(font,"z")
+
+    s.SetLabelSize(tsize,"x")
+    s.SetTitleSize(tsize,"x")
+    s.SetLabelSize(tsize,"y")
+    s.SetTitleSize(tsize,"y")
+    s.SetLabelSize(tsize,"z")
+    s.SetTitleSize(tsize,"z")
 
     # use bold lines and markers
-    s.SetMarkerStyle(20);
-    s.SetMarkerSize(1.2);
-    s.SetHistLineWidth(2);
-    s.SetLineStyleString(2,"[12 12]"); # postscript dashes
+    s.SetMarkerStyle(20)
+    s.SetMarkerSize(1.2)
+    s.SetHistLineWidth(2)
+    s.SetLineStyleString(2,"[12 12]") # postscript dashes
 
     # get rid of X error bars and y error bar caps
-    #s.SetErrorX(0.001);
+    #s.SetErrorX(0.001)
 
     # get rid of error bar caps
-    s.SetEndErrorSize(0.);
+    s.SetEndErrorSize(0.)
 
     # do not display any of the standard histogram decorations
-    s.SetOptTitle(0);
-    #s.SetOptStat(1111);
-    s.SetOptStat(0);
-    #s.SetOptFit(1111);
-    s.SetOptFit(0);
+    s.SetOptTitle(0)
+    #s.SetOptStat(1111)
+    s.SetOptStat(0)
+    #s.SetOptFit(1111)
+    s.SetOptFit(0)
 
     # put tick marks on top and RHS of plots
-    s.SetPadTickX(1);
-    s.SetPadTickY(1);
+    s.SetPadTickX(1)
+    s.SetPadTickY(1)
 
     if protectStyle:
         protect(s)
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/TaskManager.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/TaskManager.py
index 10cc9d48be6ac4c403a2a6173140eef3b12676cc..bcbd33f4a2afecd8f09f97339ed93eb7c05104b3 100755
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/TaskManager.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/TaskManager.py
@@ -2,8 +2,6 @@
 
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
 """
 TaskManager is a tool for keeping track of JobRunner jobs using a
 database. TaskManager uses the notion of a task as the primary unit for
@@ -19,7 +17,7 @@ Written by Juerg Beringer (LBNL) in 2009.
 __author__  = 'Juerg Beringer'
 __version__ = 'TaskManager.py atlas/athena'
 
-import time, os, glob, dircache, sys
+import time, os, glob, dircache
 
 from InDetBeamSpotExample.Utils import getRunFromName
 from InDetBeamSpotExample.Utils import getUserName
@@ -68,7 +66,7 @@ def getStatusClass(status):
 def appendUnique(s,v):
     if not s:
         s = ''   # make sure it is not None
-    if not v in s.split():
+    if v not in s.split():
         s = ' '.join([s,v])
     return s
 
@@ -151,7 +149,7 @@ class TaskManager:
 
         try:
             dbtype, dbname = connstring.split(':', 1)
-        except:
+        except Exception:
             raise ValueError ('Illegal database connection string {}'.format(connstring))
 
         if dbtype == 'auth_file':
@@ -161,7 +159,7 @@ class TaskManager:
                 with open(authfile) as af:
                     connstring = af.read().strip()
                 dbtype, dbname = connstring.split(':', 1)
-            except:
+            except Exception:
                 raise ValueError ('Invalid authorization file {} (not readable or invalid format)'.format(authfile))
 
         return dbtype, dbname
@@ -196,7 +194,7 @@ class TaskManager:
             self.paramstyle = 'named'
             try:
                 self.dbcon = cx_Oracle.connect(self.dbname)
-            except:
+            except Exception:
                 print ('ERROR: First connection attempt to Beam Spot Oracle database failed; will retry in 10s ...')
                 time.sleep(10)
                 self.dbcon = cx_Oracle.connect(self.dbname)
@@ -214,7 +212,7 @@ class TaskManager:
         ''' Close the database connection at the end of the 'with' statement. '''
         try:
             self.dbcon.close()
-        except:
+        except Exception:
             print ('ERROR: Unable to close database connection')
 
     def _createSQLiteSchema(self):
@@ -357,7 +355,7 @@ end;
                 else:
                     sqlParts.append(p)
 
-        if sqlParts==None:
+        if sqlParts is None:
             raise ValueError ('Unknown SQL parameter style %s' % self.paramstyle)
             return None
         sql = ' '.join(sqlParts)
@@ -420,7 +418,7 @@ end;
                              ', NJOBS = ',DbParam(task['NJOBS']+njobs),
                              ', ONDISK = ',DbParam(onDisk)]
 
-                if not release in task['ATLREL']:
+                if release not in task['ATLREL']:
                     print ('WARNING: Updating task using different release: DSNAME = %s, TASKNAME = %s, release = = %s vs %s' % (dsName,taskName,task['ATLREL'],release))
                     release = '; '.join([task['ATLREL'],release])
                     updateStr += [', ATLREL = ',DbParam(release)]
@@ -687,7 +685,7 @@ class JobAnalyzer:
     def jobList(self):
         try:
             l = dircache.listdir(self.path)
-        except:
+        except Exception:
             l = []
         return l
 
@@ -719,7 +717,7 @@ class JobAnalyzer:
                     status = TaskManager.StatusCodes['FAILED']
             try:
                 exitcode = open(glob.glob(p+'/*.exitstatus.dat')[0]).read()
-            except:
+            except Exception:
                 pass
             if len(glob.glob(p+'/*.exit.*'))>len(glob.glob(p+'/*.exit.0')):
                 status = TaskManager.StatusCodes['FAILED']
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/TrfUtils.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/TrfUtils.py
index 24bafb7a0ceeed181696a44773bf3705a9d037e6..fc61851a540389cd329c7455ee6337cf09c24ad0 100755
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/TrfUtils.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/TrfUtils.py
@@ -2,8 +2,6 @@
 
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
 """
 Utilities for writing job transforms for use at T0 and at the CAF Task Management System.
 """
@@ -16,9 +14,6 @@ import json, yaml
 from InDetBeamSpotExample import JobRunner
 from InDetBeamSpotExample.TaskManager import TaskManager
 from optparse import OptionParser
-
-from future import standard_library
-standard_library.install_aliases()
 import subprocess
 
 def readJSON(fname):
@@ -71,7 +66,7 @@ def getGuid(name):
         try :
             (s,o) = subprocess.getstatusoutput('uuidgen')
             guid = o.strip()
-        except :
+        except Exception:
             guid = 'UUIDGENERROR'
     else :
         try :
@@ -83,7 +78,7 @@ def getGuid(name):
             if guid == '' :
                 (s,o) = subprocess.getstatusoutput('uuidgen')
                 guid = o.strip()
-        except :
+        except Exception:
             guid = 'PFCPARSINGERROR'
     return guid
 
@@ -121,9 +116,9 @@ class JobRunnerTransform:
         self.inputParamName = inputParamName
         self.outputParamName = outputParamName
         self.mandatoryArgs = mandatoryArgs
-        if not inputParamName in mandatoryArgs:
+        if inputParamName not in mandatoryArgs:
             mandatoryArgs.append(inputParamName)
-        if not outputParamName in mandatoryArgs:
+        if outputParamName not in mandatoryArgs:
             mandatoryArgs.append(outputParamName)
         self.optionalArgs = optionalArgs
         self.runner = None
@@ -159,7 +154,7 @@ class JobRunnerTransform:
         print ('\n')
 
         # Check for all mandatory parameters
-        missingArgs = [ x for x in mandatoryArgs if not x in self.argdict ]
+        missingArgs = [ x for x in mandatoryArgs if x not in self.argdict ]
         if missingArgs:
             self.report('MISSINGPARAM_ERROR','Mandatory parameter(s) missing from argdict: '+str(missingArgs))
             print ('ERROR: mandatory parameter(s) missing from argdict:', missingArgs)
@@ -307,7 +302,7 @@ class JobRunnerTransform:
             try:
                 jobStatus = self.runner.jobStatus[0]   # Assume we always run single jobs
                 jobStatusAcronym = 'OK' if jobStatus==0 else 'ATHENA_ERROR'
-            except:
+            except Exception:
                 jobStatus = 999
                 jobStatusAcronym = 'NOJOBSTATUS_ERROR'
                 moreText = "Jobrunner terminated abnormally and w/o a job status; athena job may or may not have run"
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/Utils.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/Utils.py
index 2dbabd669d87fcfa024739488e2d8129922abde7..7c0802a6ac34d81acbcd2c475ce2d7d5d066071c 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/Utils.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/Utils.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 This module defines miscellaneous utility functions.
 """
@@ -17,12 +17,12 @@ def getRunFromName(name,default='',asInt=False):
     name = os.path.basename(name)
     try:
         run = re.sub('^0*','',name.split('.')[1])
-        if not re.search('^\d+$',run):
+        if not re.search(r'^\d+$',run):
             # Probably wasn't the run number, so use the default instead
             run = default
         else:
             run = int(run) if asInt else run
-    except:
+    except Exception:
         run = default
     return run
 
@@ -50,7 +50,7 @@ def getUserName(default='UNKNOWN'):
     user = ''
     try:
         user = os.getlogin()     # this doesn't seem to work with acrontab
-    except:
+    except Exception:
         pass
     if not user:
         user = os.getenv('USER',default)
diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/ConfiguredNewTrackingTrigCuts.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/ConfiguredNewTrackingTrigCuts.py
index a5392b9879eb73ae7c005c0f30ffee783207b7cf..1835a9e49e02466e0db0a87784578a8ac04dee73 100644
--- a/InnerDetector/InDetExample/InDetTrigRecExample/python/ConfiguredNewTrackingTrigCuts.py
+++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/ConfiguredNewTrackingTrigCuts.py
@@ -16,11 +16,8 @@ else:
 del _sharedcuts
 
 class ConfiguredNewTrackingTrigCuts(InDetTrigTrackingCuts):
-  def __set_indetflags(self):
-    from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags
-    self.__indetflags = InDetTrigFlags
-
-
+  pass
+  
 if not 'EFIDTrackingCuts' in globals():
   EFIDTrackingCuts = ConfiguredNewTrackingTrigCuts("Offline")
   EFIDTrackingCutsCosmics = ConfiguredNewTrackingTrigCuts("Cosmics")
diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigTrackingCuts.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigTrackingCuts.py
index 7e2476b027b9ae7519ad5a230db0f22958c255d7..3eb6db3aa4d3ac8692226543a7782d83eb482588 100755
--- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigTrackingCuts.py
+++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigTrackingCuts.py
@@ -194,7 +194,6 @@ class InDetTrigTrackingCuts :
       self.__nHolesMax               = 2 # was 3
       self.__nHolesGapMax            = 2 # was 3
 
-    """
     if self.__indetflags.cutLevel() >= 13 and DetFlags.detdescr.Calo_allOn():
       # --- turn on RoI seeded for Back Tracking and TRT only
       self.__RoISeededBackTracking   = True
@@ -232,7 +231,6 @@ class InDetTrigTrackingCuts :
       self.__minRoIClusterEt         = 6000. * Units.MeV
       self.__minSecondaryPt          = 3.0 * Units.GeV  # Increase pT cut used for back-tracking to match calo-RoI
 
-    """
 
     if self.__indetflags.cutLevel() >= mxlevel:
       print ('InDetTrigTrackingCuts INFO using cutLevel %d/%d' % (mxlevel,self.__indetflags.cutLevel()))
@@ -433,8 +431,8 @@ class InDetTrigTrackingCuts :
 # ----------------------------------------------------------------------------
 # --- private method
   def __set_indetflags(self):
-    from InDetRecExample.InDetJobProperties import InDetFlags
-    self.__indetflags = InDetFlags
+    from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags
+    self.__indetflags = InDetTrigFlags
 
 # ----------------------------------------------------------------------------
 # --- return methods for the cut values - the main purpose of this class
diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/share/InDetTrigRec_jobOptions.py b/InnerDetector/InDetExample/InDetTrigRecExample/share/InDetTrigRec_jobOptions.py
index 6262b5f47feddd2542a51e8eeaf9aef2bf759cfc..75f5fdef7cdbaa2eb71b869497bbd66977e7ba52 100755
--- a/InnerDetector/InDetExample/InDetTrigRecExample/share/InDetTrigRec_jobOptions.py
+++ b/InnerDetector/InDetExample/InDetTrigRecExample/share/InDetTrigRec_jobOptions.py
@@ -15,7 +15,7 @@ log = logging.getLogger("InDetTrigRec_jobOptions.py")
 log.info("InDetTrigRec_jobOptions: InDetTrigFlags - setting to defaults")
 from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags
 InDetTrigFlags.doNewTracking.set_Value_and_Lock(True)
-InDetTrigFlags.cutLevel.set_Value_and_Lock(12)      
+InDetTrigFlags.cutLevel=12
 #InDetTrigFlags.InDet25nsec = True      #autoconfig and runHLT_standalone setting for BS 
 InDetTrigFlags.primaryVertexSetup = "IterativeFinding"
 InDetTrigFlags.doRefit = True    # switched on for ATR-12226 (z0 uncertainties in bjets)
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
index 80e6c92b7dbad134ba61c94727bc6fd38b44d857..9fd4e138df9196827adde02bc2ec707e9fcd727b 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
@@ -4957,32 +4957,32 @@ void IDAlignMonResiduals::MakeTRTEndcapHistograms(MonGroup& al_mon){
       /** Endcap Residual plots vs Radius & Wheel */
       m_trt_ec_hist->resVsRadiusWheelPos[endcap] = new TH3F(("trt_ec_resVsRadiusWheelPos_"+endcapName[endcap]).c_str(),
 							    ("Residual Distribution vs Wheel & Radius on Wheel for TRT "+endcapName[endcap]+";Wheel;Radius [mm]; Res [mm]").c_str(),
-							    40, -0.5, 39.5, 60, 644,1004/*these are the radius limits in mm according to TRT SW*/,
+							    40, -0.5, 39.5, 30, 644,1004/*these are the radius limits in mm according to TRT SW*/,
 							    50, m_minTRTResWindow, m_maxTRTResWindow);
       RegisterHisto(al_mon,m_trt_ec_hist->resVsRadiusWheelPos[endcap]);
       m_trt_ec_hist->aveResVsRadiusWheelPos[endcap] = MakeHist("trt_ec_aveResVsRadiusWheelPos_"+endcapName[endcap],
 							       "Average Residual vs Wheel & Radius on Wheel for TRT "+endcapName[endcap],
-							       40, -0.5, 39.5, 60, 644, 1004,
+							       40, -0.5, 39.5, 30, 644, 1004,
 							       "Wheel Number","Radius on Wheel [mm]");
       RegisterHisto(al_mon,m_trt_ec_hist->aveResVsRadiusWheelPos[endcap]);
       m_trt_ec_hist->rmsResVsRadiusWheelPos[endcap] = MakeHist("trt_ec_rmsResVsRadiusWheelPos_"+endcapName[endcap],
 							       "Residual RMS vs Wheel & Radius on Wheel for TRT "+endcapName[endcap],
-							       40, -0.5, 39.5, 60, 644, 1004,
+							       40, -0.5, 39.5, 30, 644, 1004,
 							       "Wheel Number","Radius on Wheel [mm]");
       RegisterHisto(al_mon,m_trt_ec_hist->rmsResVsRadiusWheelPos[endcap]);
       m_trt_ec_hist->resVsRadiusWheelNeg[endcap] = new TH3F(("trt_ec_resVsRadiusWheelNeg_"+endcapName[endcap]).c_str(),
 							    ("Residual Distribution vs Wheel & Radius on Wheel for TRT "+endcapName[endcap]+";Wheel;Radius [mm]; Res [mm]").c_str(),
-							    40, -0.5, 39.5, 60, 644, 1004/*these are the radius limits in mm according to TRT SW*/,
+							    40, -0.5, 39.5, 30, 644, 1004/*these are the radius limits in mm according to TRT SW*/,
 							    50, m_minTRTResWindow, m_maxTRTResWindow);
       RegisterHisto(al_mon,m_trt_ec_hist->resVsRadiusWheelNeg[endcap]);
       m_trt_ec_hist->aveResVsRadiusWheelNeg[endcap] = MakeHist("trt_ec_aveResVsRadiusWheelNeg_"+endcapName[endcap],
 							       "Average Residual vs Wheel & Radius on Wheel for TRT "+endcapName[endcap],
-							       40, -0.5, 39.5, 60,644,1004,
+							       40, -0.5, 39.5, 30, 644,1004,
 							       "Wheel Number","Radius on Wheel [mm]");
       RegisterHisto(al_mon,m_trt_ec_hist->aveResVsRadiusWheelNeg[endcap]);
       m_trt_ec_hist->rmsResVsRadiusWheelNeg[endcap] = MakeHist("trt_ec_rmsResVsRadiusWheelNeg_"+endcapName[endcap],
 							       "Residual RMS vs Wheel & Radius on Wheel for TRT "+endcapName[endcap],
-							       40, -0.5, 39.5, 60, 644, 1004,
+							       40, -0.5, 39.5, 30, 644, 1004,
 							       "Wheel Number","Radius on Wheel [mm]");
       RegisterHisto(al_mon,m_trt_ec_hist->rmsResVsRadiusWheelNeg[endcap]);
 
diff --git a/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/InDetExtensionProcessor/InDetExtensionProcessor.h b/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/InDetExtensionProcessor/InDetExtensionProcessor.h
index 3fb3c1a7b8767ebb7c7230411811ac97397aee75..3a27486c946a2300336d4b00d4222b83ae2f425d 100644
--- a/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/InDetExtensionProcessor/InDetExtensionProcessor.h
+++ b/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/InDetExtensionProcessor/InDetExtensionProcessor.h
@@ -46,11 +46,13 @@ namespace InDet {
     MsgStream &dumpStat(MsgStream &out) const;
 
     //! process events
-    TrackCollection* createExtendedTracks(const TrackCollection* tracks_in,
+    TrackCollection* createExtendedTracks(const EventContext& ctx,
+                                          const TrackCollection* tracks_in,
                                           const TrackExtensionMap* track_extension_map) const;
 
     //! internal structuring: creates new track with original one plus extension as outliers
-    Trk::Track* trackPlusExtension(const Trk::Track*,
+    Trk::Track* trackPlusExtension(const EventContext& ctx,
+                                   const Trk::Track*,
                                    const std::vector<const Trk::MeasurementBase*>&) const;
 
     //
diff --git a/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/src/InDetExtensionProcessor.cxx b/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/src/InDetExtensionProcessor.cxx
index 019d08e5334f716fec9074d657da6dc85c6539bc..67b0a53a28822c71287bf5b974757c85afac25ad 100644
--- a/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/src/InDetExtensionProcessor.cxx
+++ b/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/src/InDetExtensionProcessor.cxx
@@ -121,16 +121,18 @@ InDet::InDetExtensionProcessor::execute(const EventContext& ctx) const {
     ++m_Nevents;
     m_Ninput[InDet::InDetExtensionProcessor::iAll] += nTracks;
   }
-  ATH_CHECK(extendedTracksResult.record(std::unique_ptr<TrackCollection>(createExtendedTracks(tracks.cptr(),
-                                                                                              trackExtensionMap.cptr()))));
-  ATH_MSG_DEBUG(
-    "Container '" << m_newTrackName.key() << "' recorded in StoreGate, size : " << extendedTracksResult->size());
+  ATH_CHECK(extendedTracksResult.record(std::unique_ptr<TrackCollection>(
+    createExtendedTracks(ctx, tracks.cptr(), trackExtensionMap.cptr()))));
+  ATH_MSG_DEBUG("Container '" << m_newTrackName.key()
+                              << "' recorded in StoreGate, size : "
+                              << extendedTracksResult->size());
   if (extendedTracksResult->size() != nTracks) ATH_MSG_WARNING("Lost tracks after extension ??? This is a bug !");
   return StatusCode::SUCCESS;
 }
 
 TrackCollection*
-InDet::InDetExtensionProcessor::createExtendedTracks(const TrackCollection* pTracks,
+InDet::InDetExtensionProcessor::createExtendedTracks(const EventContext& ctx,
+                                                     const TrackCollection* pTracks,
                                                      const TrackExtensionMap* trackExtensionMap) const {
   std::unique_ptr<TrackCollection> newTracks(std::make_unique<TrackCollection>());
   std::array<int, Nregions> Ninput {}, Nrecognised {}, Nextended {}, Nrejected {}, Nfailed {},
@@ -182,21 +184,24 @@ InDet::InDetExtensionProcessor::createExtendedTracks(const TrackCollection* pTra
             //statistics
             incrementRegionCounter(NbremFits, thisTrack);
             // try brem fit of combined track
-            newtrack.reset(m_trackFitter->fit(*thisTrack, vecPrd, m_runOutlier, Trk::electron));
+            newtrack = m_trackFitter->fit(
+              ctx, *thisTrack, vecPrd, m_runOutlier, Trk::electron);
           } else {
             ATH_MSG_DEBUG("normal fit track");
             //statistics
             incrementRegionCounter(Nfits, thisTrack);
             // normal fit of combined track
-            newtrack.reset(m_trackFitter->fit(*thisTrack, vecPrd, m_runOutlier, m_particleHypothesis));
+            newtrack = m_trackFitter->fit(ctx,
+              *thisTrack, vecPrd, m_runOutlier, m_particleHypothesis);
             if (!newtrack && m_tryBremFit &&
                 thisTrack->trackParameters()->front()->pT() > m_pTminBrem &&
-                (!m_caloSeededBrem || thisTrack->info().patternRecoInfo(Trk::TrackInfo::TrackInCaloROI))) {
+                (!m_caloSeededBrem || thisTrack->info().patternRecoInfo(
+                                        Trk::TrackInfo::TrackInCaloROI))) {
               ATH_MSG_DEBUG("normal fit track failed, try to recover with brem fit");
               // statistics
               incrementRegionCounter(NrecoveryBremFits, thisTrack);
               // try brem fit of combined track
-              newtrack.reset(m_trackFitter->fit(*thisTrack, vecPrd, m_runOutlier, Trk::electron));
+              newtrack=m_trackFitter->fit(ctx,*thisTrack, vecPrd, m_runOutlier, Trk::electron);
             }
           }
         } else {
@@ -235,7 +240,8 @@ InDet::InDetExtensionProcessor::createExtendedTracks(const TrackCollection* pTra
             //statistics
             incrementRegionCounter(Nfits, thisTrack);
             // normal fit of combined track
-            newtrack.reset(m_trackFitter->fit(vecPrdComb, *siPerigee, m_runOutlier, m_particleHypothesis));
+            newtrack = m_trackFitter->fit(
+              ctx, vecPrdComb, *siPerigee, m_runOutlier, m_particleHypothesis);
           }
         }
       } else {
@@ -248,13 +254,13 @@ InDet::InDetExtensionProcessor::createExtendedTracks(const TrackCollection* pTra
             //statistics
             incrementRegionCounter(NbremFits, thisTrack);
             // try brem fit of combined track
-            newtrack.reset(m_trackFitter->fit(*thisTrack, RIOs_OnTrack, m_runOutlier, Trk::electron));
+            newtrack=m_trackFitter->fit(ctx,*thisTrack, RIOs_OnTrack, m_runOutlier, Trk::electron);
           } else {
             ATH_MSG_DEBUG("normal fit track");
             //statistics
             incrementRegionCounter(Nfits, thisTrack);
             // fit combined track
-            newtrack.reset(m_trackFitter->fit(*thisTrack, RIOs_OnTrack, m_runOutlier, m_particleHypothesis));
+            newtrack=m_trackFitter->fit(ctx,*thisTrack, RIOs_OnTrack, m_runOutlier, m_particleHypothesis);
             if (!newtrack && m_tryBremFit &&
                 thisTrack->trackParameters()->front()->pT() > m_pTminBrem &&
                 (!m_caloSeededBrem || thisTrack->info().patternRecoInfo(Trk::TrackInfo::TrackInCaloROI))) {
@@ -262,7 +268,7 @@ InDet::InDetExtensionProcessor::createExtendedTracks(const TrackCollection* pTra
               // statistics
               incrementRegionCounter(NrecoveryBremFits, thisTrack);
               // try to recover with brem fit
-              newtrack.reset(m_trackFitter->fit(*thisTrack, RIOs_OnTrack, m_runOutlier, Trk::electron));
+              newtrack=m_trackFitter->fit(ctx,*thisTrack, RIOs_OnTrack, m_runOutlier, Trk::electron);
             }
           }//end-if of normal track fit
         } else {
@@ -299,7 +305,7 @@ InDet::InDetExtensionProcessor::createExtendedTracks(const TrackCollection* pTra
             //statistics
             incrementRegionCounter(Nfits, thisTrack);
             // fit combined track
-            newtrack.reset(m_trackFitter->fit(rotSet, *siPerigee, m_runOutlier, m_particleHypothesis));
+            newtrack=m_trackFitter->fit(ctx,rotSet, *siPerigee, m_runOutlier, m_particleHypothesis);
           }
         }
       }
@@ -309,7 +315,7 @@ InDet::InDetExtensionProcessor::createExtendedTracks(const TrackCollection* pTra
         incrementRegionCounter(Nfailed, thisTrack);
         // push track into output, does copy, needs fixing
         if (m_keepFailedExtensionOnTrack) {
-          newTracks->push_back(trackPlusExtension(thisTrack, pThisExtensionPair->second));
+          newTracks->push_back(trackPlusExtension(ctx,thisTrack, pThisExtensionPair->second));
         } else {
           // copy track, set pattern info
           std::unique_ptr<Trk::Track>  ntrk(std::make_unique<Trk::Track>(*thisTrack));
@@ -318,7 +324,7 @@ InDet::InDetExtensionProcessor::createExtendedTracks(const TrackCollection* pTra
         }
       } else {
         if (m_trackSummaryTool.isEnabled()) {
-          m_trackSummaryTool->computeAndReplaceTrackSummary(*newtrack, nullptr, m_suppressHoleSearch);
+          m_trackSummaryTool->computeAndReplaceTrackSummary(ctx,*newtrack, nullptr, m_suppressHoleSearch);
         }
         // score old and new tool and decide which one to push back
         Trk::TrackScore oldScore = m_scoringTool->score(*thisTrack, m_suppressHoleSearch);
@@ -336,15 +342,15 @@ InDet::InDetExtensionProcessor::createExtendedTracks(const TrackCollection* pTra
           std::unique_ptr<Trk::Track> newBremTrack;
           // try to recover with brem fit
           if (m_refitPrds) {
-            newBremTrack.reset(m_trackFitter->fit(*thisTrack, vecPrd, m_runOutlier, Trk::electron));
+            newBremTrack=m_trackFitter->fit(ctx,*thisTrack, vecPrd, m_runOutlier, Trk::electron);
           } else {
-            newBremTrack.reset(m_trackFitter->fit(*thisTrack, pThisExtensionPair->second, m_runOutlier, Trk::electron));
+            newBremTrack=m_trackFitter->fit(ctx,*thisTrack, pThisExtensionPair->second, m_runOutlier, Trk::electron);
           }
           if (newBremTrack) {
             // score again
             // @TODO should score newBremTrack
             if (m_trackSummaryTool.isEnabled()) {
-              m_trackSummaryTool->computeAndReplaceTrackSummary(*newBremTrack, nullptr, m_suppressHoleSearch);
+              m_trackSummaryTool->computeAndReplaceTrackSummary(ctx,*newBremTrack, nullptr, m_suppressHoleSearch);
             }
             newScore = m_scoringTool->score(*newtrack, m_suppressHoleSearch);
             ATH_MSG_DEBUG("recovered new track has score      : " << newScore);
@@ -371,7 +377,7 @@ InDet::InDetExtensionProcessor::createExtendedTracks(const TrackCollection* pTra
           // push track into output, does copy
           std::unique_ptr<Trk::Track> ntrk;
           if (m_keepFailedExtensionOnTrack) {
-            ntrk.reset(trackPlusExtension(thisTrack, pThisExtensionPair->second));
+            ntrk.reset(trackPlusExtension(ctx,thisTrack, pThisExtensionPair->second));
           } else {
             ntrk.reset(new Trk::Track(*thisTrack));
           }
@@ -424,9 +430,12 @@ void InDet::InDetExtensionProcessor::incrementRegionCounter(std::array<int, 4>&
 //==================================================================================================
 
 Trk::Track*
-InDet::InDetExtensionProcessor::trackPlusExtension(const Trk::Track* siTrack,
-                                                   const std::vector<const Trk::MeasurementBase*>& extension) const {
-  const auto& trackStatesOnSurfaces {*(siTrack->trackStateOnSurfaces())};
+InDet::InDetExtensionProcessor::trackPlusExtension(
+  const EventContext& ctx,
+  const Trk::Track* siTrack,
+  const std::vector<const Trk::MeasurementBase*>& extension) const
+{
+  const auto& trackStatesOnSurfaces{ *(siTrack->trackStateOnSurfaces()) };
   auto pExtendedTrajectory = new DataVector<const Trk::TrackStateOnSurface>;
 
   pExtendedTrajectory->reserve(trackStatesOnSurfaces.size() + extension.size());
@@ -471,7 +480,7 @@ InDet::InDetExtensionProcessor::trackPlusExtension(const Trk::Track* siTrack,
   Trk::Track* extTrack =
     new Trk::Track(siTrack->info(), pExtendedTrajectory, (pFitQuality ? pFitQuality->clone() : nullptr));
   if (m_trackSummaryTool.isEnabled()) {
-    m_trackSummaryTool->computeAndReplaceTrackSummary(*extTrack, nullptr, m_suppressHoleSearch);
+    m_trackSummaryTool->computeAndReplaceTrackSummary(ctx,*extTrack, nullptr, m_suppressHoleSearch);
   }
   Trk::TrackScore extScore = m_scoringTool->score(*extTrack, m_suppressHoleSearch);
   ATH_MSG_DEBUG("rejected extension saved as Trk::Track with " << nSiStates <<
diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h b/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h
index 66a8b8da39be10f9e26a56a845628d226cb3f839..bd5dae5a11b04024fa7902a765d8f205785acfd5 100644
--- a/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h
+++ b/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h
@@ -37,12 +37,23 @@ namespace InDet {
 
       virtual ~PixelToTPIDTool ();
       virtual StatusCode initialize() override;
-      virtual StatusCode finalize  () override; 
+      virtual StatusCode finalize  () override;
 
-      virtual float dEdx(const Trk::Track& track, int& nUsedHits, int& nUsedIBLOverflowHits) const override;
+      virtual float dEdx(const EventContext& ctx,
+                         const Trk::Track& track,
+                         int& nUsedHits,
+                         int& nUsedIBLOverflowHits) const override final;
 
-      virtual std::vector<float> getLikelihoods(double dedx, double p, int nGoodPixels) const override;
-      virtual float getMass(double dedx, double p, int nGoodPixels) const override;
+      virtual std::vector<float> getLikelihoods(
+        const EventContext& ctx,
+        double dedx,
+        double p,
+        int nGoodPixels) const override final;
+
+      virtual float getMass(const EventContext& ctx,
+                            double dedx,
+                            double p,
+                            int nGoodPixels) const override final;
 
     private:
       ServiceHandle<IBLParameterSvc> m_IBLParameterSvc;
diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx b/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx
index 43d2f58d9a8bf073bec477bad7e70e1d35c8a73c..38eda409b243c7875853c56c0b89c2726b6167bf 100644
--- a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx
+++ b/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx
@@ -20,7 +20,7 @@
 // Pixels:
 #include "InDetRIO_OnTrack/PixelClusterOnTrack.h"
 #include "InDetIdentifier/PixelID.h"
-#include "PixelGeoModel/IBLParameterSvc.h" 
+#include "PixelGeoModel/IBLParameterSvc.h"
 
 // CLHEP:
 #include "CLHEP/Matrix/Vector.h"
@@ -41,10 +41,10 @@ InDet::PixelToTPIDTool::PixelToTPIDTool(const std::string& t, const std::string&
 
   float energyPair = 3.68e-6; // Energy in MeV to create an electron-hole pair in silicon
   float sidensity = 2.329; // silicon density in g cm^-3
- 
+
   //conversion Factor
   //{.025,.023,.020}; //{Old Planars,IBL_3Ds,IBL_Planars} the sensors thickness will be take into account in dEdx calculation
-  
+
   m_conversionfactor=energyPair/sidensity;
 
 }
@@ -57,11 +57,11 @@ StatusCode InDet::PixelToTPIDTool::initialize() {
 
   ATH_CHECK(detStore()->retrieve(m_pixelid,"PixelID"));
 
-  if (m_IBLParameterSvc.retrieve().isFailure()) { 
-    ATH_MSG_FATAL("Could not retrieve IBLParameterSvc"); 
-    return StatusCode::FAILURE; 
-  } else  
-    ATH_MSG_INFO("Retrieved service " << m_IBLParameterSvc); 
+  if (m_IBLParameterSvc.retrieve().isFailure()) {
+    ATH_MSG_FATAL("Could not retrieve IBLParameterSvc");
+    return StatusCode::FAILURE;
+  } else
+    ATH_MSG_INFO("Retrieved service " << m_IBLParameterSvc);
 
   ATH_CHECK(m_moduleDataKey.initialize());
 
@@ -82,19 +82,25 @@ StatusCode InDet::PixelToTPIDTool::finalize()
 
 //============================================================================================
 
-float InDet::PixelToTPIDTool::dEdx(const Trk::Track& track, int& nUsedHits, int& nUsedIBLOverflowHits) const {
- 
+float
+InDet::PixelToTPIDTool::dEdx(const EventContext& ctx,
+                             const Trk::Track& track,
+                             int& nUsedHits,
+                             int& nUsedIBLOverflowHits) const
+{
+
   unsigned int pixelhits = 0;
   nUsedHits=0;
   nUsedIBLOverflowHits=0;
   float Pixel_sensorthickness=.025; //250 microns Pixel Planars
-  float IBL_3D_sensorthickness=.023; //230 microns IBL 3D 
+  float IBL_3D_sensorthickness=.023; //230 microns IBL 3D
   float IBL_PLANAR_sensorthickness=.020;// 200 microns IBL Planars
   float dEdxValue=0;
-  
-  //std::multimap<float,int> chargesMap; //second value keeps track if the cluster is in IBL and has at least an overflow hit
+
+  //std::multimap<float,int> chargesMap;
+  ////second value keeps track if the cluster is in IBL and has at least an overflow hit
   std::multimap<float,int> dEdxMap;
-  
+
   // Check for track states:
   const DataVector<const Trk::TrackStateOnSurface>* recoTrackStates = track.trackStateOnSurfaces();
   if (recoTrackStates) {
@@ -125,22 +131,26 @@ float InDet::PixelToTPIDTool::dEdx(const Trk::Track& track, int& nUsedHits, int&
           int bec=m_pixelid->barrel_ec(pixclus->identify());
           int layer=m_pixelid->layer_disk(pixclus->identify());
           int eta_module=m_pixelid->eta_module(pixclus->identify());//check eta module to select thickness
-   
-          float dotProd = (*tsosIter)->trackParameters()->momentum().dot((*tsosIter)->trackParameters()->associatedSurface().normal());
-          float cosalpha=fabs(dotProd/(*tsosIter)->trackParameters()->momentum().mag());
-          
+
+          float dotProd = (*tsosIter)->trackParameters()->momentum().dot(
+            (*tsosIter)->trackParameters()->associatedSurface().normal());
+          float cosalpha =
+            fabs(dotProd / (*tsosIter)->trackParameters()->momentum().mag());
+
           if (std::abs(cosalpha)<0.16) { continue; }
-   
+
           float charge=pixclus->prepRawData()->totalCharge()*cosalpha;
-   
+
           //keep track if this is an ibl cluster with overflow
           int iblOverflow=0;
-          if ((m_IBLParameterSvc->containsIBL()) and (bec==0) and (layer==0)) { // check if IBL 
-   
+          if ((m_IBLParameterSvc->containsIBL()) and (bec==0) and (layer==0)) { // check if IBL
+
             //loop over ToT and check if anyone is overflow (ToT==14) check for IBL cluster overflow
-            int overflowIBLToT = SG::ReadCondHandle<PixelModuleData>(m_moduleDataKey)->getFEI4OverflowToT(0,0);
+            int overflowIBLToT =
+              SG::ReadCondHandle<PixelModuleData>(m_moduleDataKey, ctx)
+                ->getFEI4OverflowToT(0, 0);
             const std::vector<int>& ToTs = pixclus->prepRawData()->totList();
-   
+
             for (int pixToT : ToTs) {
               if (pixToT >= overflowIBLToT) {
                 //overflow pixel hit -- flag cluster
@@ -149,23 +159,35 @@ float InDet::PixelToTPIDTool::dEdx(const Trk::Track& track, int& nUsedHits, int&
               }
             }// end
 
-            //this is IBL layer -- @todo: check using proper service (safe against geometries)
-            if (((eta_module>=-10 && eta_module<=-7)||(eta_module>=6 && eta_module<=9)) && (fabs(locy)<10. && (locx>-8.33 && locx<8.3))) { //check if IBL 3D and good cluster selection
-              dEdxValue=charge*m_conversionfactor/IBL_3D_sensorthickness;
-              dEdxMap.insert(std::pair<float,int>(dEdxValue, iblOverflow));
+            // this is IBL layer -- @todo: check using proper service (safe
+            // against geometries)
+            if (((eta_module >= -10 && eta_module <= -7) ||
+                 (eta_module >= 6 && eta_module <= 9)) &&
+                (fabs(locy) < 10. &&
+                 (locx > -8.33 &&
+                  locx < 8.3))) { // check if IBL 3D and good cluster selection
+              dEdxValue = charge * m_conversionfactor / IBL_3D_sensorthickness;
+              dEdxMap.insert(std::pair<float, int>(dEdxValue, iblOverflow));
               pixelhits++;
-              if (iblOverflow==1) { nUsedIBLOverflowHits++; }
-            }
-            else if((eta_module>=-6 && eta_module<=5) && (fabs(locy)<20. &&(locx>-8.33 && locx<8.3))) { //check if IBL planar and good cluster selection
-              dEdxValue=charge*m_conversionfactor/IBL_PLANAR_sensorthickness; 
-              dEdxMap.insert(std::pair<float,int>(dEdxValue, iblOverflow));
+              if (iblOverflow == 1) {
+                nUsedIBLOverflowHits++;
+              }
+            } else if ((eta_module >= -6 && eta_module <= 5) &&
+                       (fabs(locy) < 20. &&
+                        (locx > -8.33 &&
+                         locx < 8.3))) { // check if IBL planar and good cluster
+                                         // selection
+              dEdxValue =
+                charge * m_conversionfactor / IBL_PLANAR_sensorthickness;
+              dEdxMap.insert(std::pair<float, int>(dEdxValue, iblOverflow));
               pixelhits++;
-              if (iblOverflow==1) { nUsedIBLOverflowHits++; }
-            }
-            else{
+              if (iblOverflow == 1) {
+                nUsedIBLOverflowHits++;
+              }
+            } else {
               dEdxValue=-1;
-            } //end check which IBL Module
-     
+            } // end check which IBL Module
+
           }
           //PIXEL layer and ENDCAP
           else if(bec==0 && fabs(locy)<30. &&  ((locx>-8.20 && locx<-0.60) || (locx>0.50 && locx<8.10))) {
@@ -187,7 +209,7 @@ float InDet::PixelToTPIDTool::dEdx(const Trk::Track& track, int& nUsedHits, int&
   float averagedEdx=0.;
   nUsedHits=0;
   int IBLOverflow=0;
-  
+
   for (std::pair<float,int> itdEdx : dEdxMap) {
     if (itdEdx.second==0) {
       averagedEdx += itdEdx.first;
@@ -197,35 +219,47 @@ float InDet::PixelToTPIDTool::dEdx(const Trk::Track& track, int& nUsedHits, int&
 
     //break, skipping last or the two last elements depending on total measurements
     if (((int)pixelhits>=5) and ((int)nUsedHits>=(int)pixelhits-2)) { break; }
-    
-    //break, IBL Overflow case pixelhits==3 and 4 
+
+    //break, IBL Overflow case pixelhits==3 and 4
     if ((int)IBLOverflow>0 and ((int)pixelhits==3) and (int)nUsedHits==1) { break; }
     if ((int)IBLOverflow>0 and ((int)pixelhits==4) and (int)nUsedHits==2) { break; }
-    
+
     if (((int)pixelhits > 1) and ((int)nUsedHits >=(int)pixelhits-1)) { break; }
-    
+
     if ((int)IBLOverflow>0 and (int)pixelhits==1) { //only IBL in overflow
       averagedEdx=itdEdx.first;
       break;
     }
   }
-  
+
   if (nUsedHits>0 or (nUsedHits==0 and(int)IBLOverflow>0 and (int)pixelhits==1)) {
     if (nUsedHits>0) { averagedEdx=averagedEdx/nUsedHits; }
-    
+
     ATH_MSG_DEBUG("NEW dEdx = " << averagedEdx);
     ATH_MSG_DEBUG("Used hits: " << nUsedHits << ", IBL overflows: " << IBLOverflow );
     ATH_MSG_DEBUG("Original number of measurements = " << pixelhits << "( map size = " << dEdxMap.size() << ")");
-    return averagedEdx;  
+    return averagedEdx;
   }
   return -1;
 }
 
-std::vector<float> InDet::PixelToTPIDTool::getLikelihoods(double dedx2, double p2, int nGoodPixels) const {
-  return SG::ReadCondHandle<PixeldEdxData>(m_dedxKey)->getLikelihoods(dedx2,p2,nGoodPixels);
+std::vector<float>
+InDet::PixelToTPIDTool::getLikelihoods(const EventContext& ctx,
+                                       double dedx2,
+                                       double p2,
+                                       int nGoodPixels) const
+{
+  return SG::ReadCondHandle<PixeldEdxData>(m_dedxKey, ctx)
+    ->getLikelihoods(dedx2, p2, nGoodPixels);
 }
 
-float InDet::PixelToTPIDTool::getMass(double dedx, double p, int nGoodPixels) const {
-  return SG::ReadCondHandle<PixeldEdxData>(m_dedxKey)->getMass(dedx,p/1000,nGoodPixels); 
+float
+InDet::PixelToTPIDTool::getMass(const EventContext& ctx,
+                                double dedx,
+                                double p,
+                                int nGoodPixels) const
+{
+  return SG::ReadCondHandle<PixeldEdxData>(m_dedxKey, ctx)
+    ->getMass(dedx, p / 1000, nGoodPixels);
 }
 
diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ToT_dEdx.h b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ToT_dEdx.h
index dfac72bfedcc9030b569ca7d8acdabf63c23bbbc..77c748e216d6ea3de7d791cd1c9d220937f952f0 100644
--- a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ToT_dEdx.h
+++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ToT_dEdx.h
@@ -67,8 +67,8 @@ public:
 
 private:
   SG::ReadDecorHandleKey<xAOD::EventInfo> m_rdhkEvtInfo {this
-      , "AveIntPerXKey"
-      , "EventInfo.AveIntPerXDecor"
+      , "averageInteractionsPerCrossingKey"
+      , "EventInfo.averageInteractionsPerCrossing"
       , "Decoration for Average Interaction Per Crossing"};
   const TRT_ID* m_trtId;                                                // ID TRT helper 
   Trk::ParticleMasses        m_particlemasses;
diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigVxSecondary/CMakeLists.txt b/InnerDetector/InDetTrigRecAlgs/InDetTrigVxSecondary/CMakeLists.txt
index d6786848fdd6cea6e68c9230538057ecdfac8fbc..b5a058c9c71cd08951ed97526aa58d50ffe5ee1b 100644
--- a/InnerDetector/InDetTrigRecAlgs/InDetTrigVxSecondary/CMakeLists.txt
+++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigVxSecondary/CMakeLists.txt
@@ -1,22 +1,17 @@
-################################################################################
-# Package: InDetTrigVxSecondary
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( InDetTrigVxSecondary )
 
 # External dependencies:
-find_package( Eigen )
-find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
+find_package( ROOT COMPONENTS Core MathCore )
 
 # Component(s) in the package:
 atlas_add_component( InDetTrigVxSecondary
                      src/*.cxx
                      src/components/*.cxx
-                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} xAODTracking GaudiKernel VxSecVertex TrigInterfacesLib AthContainers GeoPrimitives IRegionSelector xAODBase InDetRecToolInterfaces TrkParameters TrkTrack VxVertex TrigInDetEvent TrigSteeringEvent InDetBeamSpotServiceLib TrigInDetToolInterfacesLib )
+                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} xAODTracking CxxUtils GaudiKernel VxSecVertex TrigInterfacesLib AthContainers GeoPrimitives xAODBase InDetRecToolInterfaces TrkParameters TrkTrack VxVertex TrigInDetEvent TrigSteeringEvent InDetBeamSpotServiceLib TrigInDetToolInterfacesLib )
 
 # Install files from the package:
-atlas_install_headers( InDetTrigVxSecondary )
-atlas_install_python_modules( python/*.py )
-
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigVxSecondary/python/InDetTrigVxSecondary_LoadTools.py b/InnerDetector/InDetTrigRecAlgs/InDetTrigVxSecondary/python/InDetTrigVxSecondary_LoadTools.py
index fc0a0f244bc153dea17954ae001598fa0aa2a891..97da7866c41e674182e2a2c1aef892a333962764 100644
--- a/InnerDetector/InDetTrigRecAlgs/InDetTrigVxSecondary/python/InDetTrigVxSecondary_LoadTools.py
+++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigVxSecondary/python/InDetTrigVxSecondary_LoadTools.py
@@ -1,8 +1,7 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from InDetTrigVxSecondary.InDetTrigVxSecondaryConf import InDet__TrigVxSecondary
 from InDetTrigVxSecondary.InDetTrigVxSecondaryConf import InDet__TrigVxSecondaryCombo
-from GaudiKernel.Constants import VERBOSE,INFO,DEBUG
 
 class TrigVxSecondary_EF( InDet__TrigVxSecondary ):
    __slots__ = []
@@ -10,9 +9,7 @@ class TrigVxSecondary_EF( InDet__TrigVxSecondary ):
       super( InDet__TrigVxSecondary, self ).__init__( name )
       
       from AthenaCommon.AppMgr import ToolSvc
-      from AthenaCommon.Include import include
-      from AthenaCommon.GlobalFlags import GlobalFlags
-      
+
       # Start of offline vertex finder tool configuration
       
       from InDetVKalVxInJetTool.InDetVKalVxInJetToolConf import InDet__InDetVKalVxInJetTool
@@ -59,8 +56,6 @@ class TrigVxSecondaryCombo_EF( InDet__TrigVxSecondaryCombo ):
       super( InDet__TrigVxSecondaryCombo, self ).__init__( name )
 
       from AthenaCommon.AppMgr import ToolSvc
-      from AthenaCommon.Include import include
-      from AthenaCommon.GlobalFlags import GlobalFlags
 
       # Start of offline vertex finder tool configuration
 
diff --git a/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/CMakeLists.txt b/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/CMakeLists.txt
index 12c4f27b4b77bf2ff4e330796715ba7fa52a320e..5967bd8c0ee99a3d0c2ca89eefe136ca2f6d63b9 100644
--- a/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/CMakeLists.txt
+++ b/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/CMakeLists.txt
@@ -10,4 +10,4 @@ atlas_add_component( SiTrigSPSeededTrackFinder
                      LINK_LIBRARIES GaudiKernel TrigInterfacesLib TrigNavigationLib AthenaKernel GeoPrimitives IRegionSelector EventPrimitives SiSPSeededTrackFinderData InDetRecToolInterfaces TrkMeasurementBase TrkParameters TrkRIO_OnTrack TrkTrack TrigInDetEvent TrigSteeringEvent TrigTimeAlgsLib TrkEventUtils )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/python/SiTrigSPSeededTrackFinderMonitoring.py b/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/python/SiTrigSPSeededTrackFinderMonitoring.py
index 1376b9d857270265be3eec27dee5422e2ede0b56..b40ae9cbf6c7281504aac8ff05ce2c447fecb942 100755
--- a/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/python/SiTrigSPSeededTrackFinderMonitoring.py
+++ b/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/python/SiTrigSPSeededTrackFinderMonitoring.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from TrigMonitorBase.TrigGenericMonitoringToolConfig import defineHistogram, \
   TrigGenericMonitoringToolConfig
@@ -24,7 +24,7 @@ class SiTrigSPSeededTrackFinderMonitorBase(TrigGenericMonitoringToolConfig):
     if deta>3:
       maxtr = 1000
       maxid = 3000
-      maxseed = 30000
+      maxseeds = 30000
     elif deta>0.7:
       maxtr = 400
       maxid = 2000
diff --git a/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx b/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx
index d78f1876804a8b7a322f1d09fa62fa3ab6a6279e..4b3feda323344eea55c8022436aff5a02775f71a 100755
--- a/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx
+++ b/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx
@@ -610,11 +610,8 @@ selectGenSignal  (const McEventCollection* SimTracks,
 	  //if (genEvent == *inTimeMBbegin) inTimeStart = ievt;
 	  //if (genEvent == *inTimeMBend)   inTimeEnd   = ievt;
 	}
-      HepMC::GenParticle * particle = NULL;
-      for (HepMC::GenEvent::particle_const_iterator it = genEvent->particles_begin();
-	   it != genEvent->particles_end(); ++it)
+      for (auto particle: *genEvent)
 	{
-	  particle = *it;
 	  // require stable particle from generation or simulation\	  s
 	  if ((particle->status()%1000) != 1 )
 	    continue;
@@ -632,7 +629,7 @@ selectGenSignal  (const McEventCollection* SimTracks,
 	      continue;
 	  if (fabs(particle->momentum().perp()) >  m_minPt  &&  
 	      fabs(particle->momentum().pseudoRapidity()) < m_maxEta ) { 
-	    std::pair<HepMC::GenParticle *,int> thisPair(particle,ievt);
+	    std::pair<HepMC::GenParticlePtr,int> thisPair(particle,ievt);
 	    GenSignal.push_back(thisPair);
 	  }
 	} // End of a particle iteration
diff --git a/LArCalorimeter/LArG4/LArG4GenShowerLib/src/LArG4GenShowerLib.cxx b/LArCalorimeter/LArG4/LArG4GenShowerLib/src/LArG4GenShowerLib.cxx
index cf21d3190a0ed5b71198b5c49d9df9eef56597bd..9c6b92d30c2d7646cf12724a09b87b7f98dcd823 100644
--- a/LArCalorimeter/LArG4/LArG4GenShowerLib/src/LArG4GenShowerLib.cxx
+++ b/LArCalorimeter/LArG4/LArG4GenShowerLib/src/LArG4GenShowerLib.cxx
@@ -147,8 +147,8 @@ StatusCode LArG4GenShowerLib::execute()
 {
   const ShowerLib::StepInfoCollection* eventStepsES = getStepInfo();
 
-  const HepMC::GenParticle* theParticle = getParticleFromMC();
-  if (theParticle == NULL) {
+  auto theParticle = getParticleFromMC();
+  if (!theParticle) {
     ATH_MSG_ERROR ( "Couldn't get truth particle" );
     return StatusCode::FAILURE;
   }
diff --git a/LArCalorimeter/LArTrackingGeometry/LArTrackingGeometry/LArVolumeBuilder.h b/LArCalorimeter/LArTrackingGeometry/LArTrackingGeometry/LArVolumeBuilder.h
index fed7a5420371899f23bc24460a28fae8c8097951..daf517aad4341370c980d26954c3b2ce9e1d2e84 100755
--- a/LArCalorimeter/LArTrackingGeometry/LArTrackingGeometry/LArVolumeBuilder.h
+++ b/LArCalorimeter/LArTrackingGeometry/LArTrackingGeometry/LArVolumeBuilder.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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -18,12 +18,9 @@
 // STL
 #include <vector>
 
-class LArDetectorManager;
-class CaloDepthTool;
 class GeoPVConstLink;
 
 namespace Trk {
-  class ILayerArrayCreator;
   class ITrackingVolumeHelper;
   class ITrackingVolumeCreator;
   class TrackingVolume;
@@ -102,7 +99,6 @@ namespace LAr {
 
       // ------------- private members -----------------------------------------
                                      
-      const LArDetectorManager*                         m_lArMgr;                     //!< Calo DetDescrMgr
       std::string                                       m_lArMgrLocation;             //!< Location of the CaloDetDescrMgr
                                                                                       
       ToolHandle<Trk::ITrackingVolumeHelper>            m_lArTrackingVolumeHelper;     //!< Helper Tool to create TrackingVolumes
diff --git a/LArCalorimeter/LArTrackingGeometry/src/LArVolumeBuilder.cxx b/LArCalorimeter/LArTrackingGeometry/src/LArVolumeBuilder.cxx
index 894ae8676d695ab75e7db26d517a87617c790e86..dc65355f37ce18a9a262662a687529871a088e01 100755
--- a/LArCalorimeter/LArTrackingGeometry/src/LArVolumeBuilder.cxx
+++ b/LArCalorimeter/LArTrackingGeometry/src/LArVolumeBuilder.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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -53,7 +53,6 @@ using Gaudi::Units::mm;
 // constructor
 LAr::LArVolumeBuilder::LArVolumeBuilder(const std::string& t, const std::string& n, const IInterface* p) :
   AthAlgTool(t,n,p),
-  m_lArMgr(0),
   m_lArMgrLocation("LArMgr"),
   m_lArTrackingVolumeHelper("Trk::TrackingVolumeHelper/LArTrackingVolumeHelper"),
   m_trackingVolumeCreator("Trk::CylinderVolumeCreator/TrackingVolumeCreator"),
@@ -96,11 +95,6 @@ LAr::LArVolumeBuilder::~ LArVolumeBuilder()
 // initialize
 StatusCode LAr::LArVolumeBuilder::initialize()
 {
-  // get LAr Detector Description Manager
-  if (detStore()->retrieve(m_lArMgr, m_lArMgrLocation).isFailure()) {
-    ATH_MSG_FATAL( "Could not get LArDetectorManager! Calo TrackingGeometry will not be built");
-    return StatusCode::FAILURE;
-  }
   
   // Retrieve the tracking volume helper   -------------------------------------------------    
   if (m_lArTrackingVolumeHelper.retrieve().isFailure())
@@ -156,12 +150,18 @@ const std::vector<const Trk::TrackingVolume*>* LAr::LArVolumeBuilder::trackingVo
   
   Trk::Material dummyMaterial;
 
+  // get LAr Detector Description Manager
+  const LArDetectorManager* lArMgr=nullptr;
+  if (detStore()->retrieve(lArMgr, m_lArMgrLocation).isFailure()) {
+    ATH_MSG_FATAL( "Could not get LArDetectorManager! Calo TrackingGeometry will not be built");
+  }
+
   // out of couriosity
-  unsigned int numTreeTops =  m_lArMgr->getNumTreeTops();
+  unsigned int numTreeTops =  lArMgr->getNumTreeTops();
   ATH_MSG_DEBUG( "Retrieved " << numTreeTops << " tree tops from the LArDetDescrManager. " );
   
   for (unsigned int itreetop = 0; itreetop<numTreeTops; ++itreetop){
-    PVConstLink currentVPhysVolLink   = m_lArMgr->getTreeTop(itreetop);
+    PVConstLink currentVPhysVolLink   = lArMgr->getTreeTop(itreetop);
     const GeoLogVol* currentLogVol = currentVPhysVolLink->getLogVol();
     
     unsigned int currentChilds = currentVPhysVolLink->getNChildVols();
@@ -1703,7 +1703,7 @@ const std::vector<const Trk::TrackingVolume*>* LAr::LArVolumeBuilder::trackingVo
    // ST this better to be done by CaloTrackingGeometry ( to glue with BeamPipe )
    // pass MBTS info to CaloTG 
   // MBTS
-  const PVConstLink topEC = m_lArMgr->getTreeTop(1U);
+  const PVConstLink topEC = lArMgr->getTreeTop(1U);
   Amg::Transform3D trIn= topEC->getX();   
   Amg::Transform3D tr2(trIn);   
   const PVConstLink mbts= getChild(topEC,"MBTS_mother",trIn);
diff --git a/LumiBlock/LumiBlockComps/src/LumiBlockMuTool.h b/LumiBlock/LumiBlockComps/src/LumiBlockMuTool.h
index fd231a87ac8623246d246f46213f428adcc08766..7da01e053c2d55972b9d6325ee1fe816f970f47f 100644
--- a/LumiBlock/LumiBlockComps/src/LumiBlockMuTool.h
+++ b/LumiBlock/LumiBlockComps/src/LumiBlockMuTool.h
@@ -51,13 +51,13 @@ class LumiBlockMuTool: public extends<AthAlgTool, ILumiBlockMuTool> {
       ,"RHK for EventInfo"};
 
   SG::ReadDecorHandleKey<xAOD::EventInfo>  m_rdhkActMu {this
-      ,"ActIntPerXKey"
-      ,"EventInfo.ActIntPerXDecor"
+      ,"actualInteractionsPerCrossingKey"
+      ,"EventInfo.actualInteractionsPerCrossing"
       ,"Decoration for Actual Interaction Per Crossing"};
 
   SG::ReadDecorHandleKey<xAOD::EventInfo>  m_rdhkAveMu {this
-      ,"AveIntPerXKey"
-      ,"EventInfo.AveIntPerXDecor"
+      ,"averageInteractionsPerCrossingKey"
+      ,"EventInfo.averageInteractionsPerCrossing"
       ,"Decoration for Average Interaction Per Crossing"};
 };
 
diff --git a/LumiBlock/LumiBlockComps/src/LumiBlockMuWriter.cxx b/LumiBlock/LumiBlockComps/src/LumiBlockMuWriter.cxx
index 99854b1abb697114400af524d91a59faf4817422..2aa9358a054738f9cefc30dba4f4901ae4f823d4 100644
--- a/LumiBlock/LumiBlockComps/src/LumiBlockMuWriter.cxx
+++ b/LumiBlock/LumiBlockComps/src/LumiBlockMuWriter.cxx
@@ -16,8 +16,8 @@ StatusCode LumiBlockMuWriter::initialize()
   ATH_MSG_INFO("LumiBlockMuWriter::initialize()");
 
   ATH_CHECK(m_lumiDataKey.initialize(SG::AllowEmpty));
-  ATH_CHECK(m_actIntPerXKey.initialize());
-  ATH_CHECK(m_aveIntPerXKey.initialize());
+  ATH_CHECK(m_actMuKey.initialize());
+  ATH_CHECK(m_aveMuKey.initialize());
 
   return StatusCode::SUCCESS;
 }
@@ -28,7 +28,7 @@ StatusCode LumiBlockMuWriter::execute(const EventContext& ctx)  const
 
   float actualMu = 0.0;
   float muToLumi = 0.0;
-  float aveIntPerX = 0.0;
+  float averageMu = 0.0;
   if (!m_lumiDataKey.empty()) {
     SG::ReadCondHandle<LuminosityCondData> lumiData (m_lumiDataKey, ctx);
     if (lumiData->lbAverageLuminosity() != 0 ||
@@ -39,25 +39,25 @@ StatusCode LumiBlockMuWriter::execute(const EventContext& ctx)  const
         actualMu = lumiData->lbLuminosityPerBCIDVector().at(bcid) / muToLumi;
       }
     }
-    aveIntPerX = lumiData->lbAverageInteractionsPerCrossing();
+    averageMu = lumiData->lbAverageInteractionsPerCrossing();
   }
 
-  SG::WriteDecorHandle<xAOD::EventInfo,float> actIntPerXDecor(m_actIntPerXKey,ctx);
-  if (!actIntPerXDecor.isPresent()) {
-    ATH_MSG_ERROR( "actIntPerXDecor.isPresent check fails" );
+  SG::WriteDecorHandle<xAOD::EventInfo,float> actMu(m_actMuKey,ctx);
+  if (!actMu.isPresent()) {
+    ATH_MSG_ERROR( "actualInteractionsPerCrossing.isPresent check fails" );
     return StatusCode::FAILURE;
   }
-  if (!actIntPerXDecor.isAvailable()) {
-    actIntPerXDecor(0) = actualMu;
+  if (!actMu.isAvailable()) {
+    actMu(0) = actualMu;
   }
     
-  SG::WriteDecorHandle<xAOD::EventInfo,float> aveIntPerXDecor(m_aveIntPerXKey,ctx);
-  if (!aveIntPerXDecor.isPresent()) {
-    ATH_MSG_ERROR( "aveIntPerXDecor.isPresent check fails" );
+  SG::WriteDecorHandle<xAOD::EventInfo,float> aveMu(m_aveMuKey,ctx);
+  if (!aveMu.isPresent()) {
+    ATH_MSG_ERROR( "averageInteractionsPerCrossing.isPresent check fails" );
     return StatusCode::FAILURE;
   }
-  if (!aveIntPerXDecor.isAvailable()) {
-    aveIntPerXDecor(0) = aveIntPerX;
+  if (!aveMu.isAvailable()) {
+    aveMu(0) = averageMu;
   }
 
   return StatusCode::SUCCESS;
diff --git a/LumiBlock/LumiBlockComps/src/LumiBlockMuWriter.h b/LumiBlock/LumiBlockComps/src/LumiBlockMuWriter.h
index d8421df6862a038fd13bb1060f2aec1bf0b4ef7e..ec3012fed6acb769379dff856f4a72956fcb3849 100644
--- a/LumiBlock/LumiBlockComps/src/LumiBlockMuWriter.h
+++ b/LumiBlock/LumiBlockComps/src/LumiBlockMuWriter.h
@@ -33,14 +33,14 @@ class LumiBlockMuWriter : public AthReentrantAlgorithm
       ,"LuminosityCondData"
       ,"RCHK for LuminosityCondData"};
 
-  SG::WriteDecorHandleKey<xAOD::EventInfo> m_actIntPerXKey {this
-      ,"ActIntPerXKey"
-      ,"EventInfo.ActIntPerXDecor"
+  SG::WriteDecorHandleKey<xAOD::EventInfo> m_actMuKey {this
+      ,"actualInteractionsPerCrossingKey"
+      ,"EventInfo.actualInteractionsPerCrossing"
       ,"Decoration for Actual Interaction Per Crossing"};
 
-  SG::WriteDecorHandleKey<xAOD::EventInfo> m_aveIntPerXKey {this
-      ,"AveIntPerXKey"
-      ,"EventInfo.AveIntPerXDecor"
+  SG::WriteDecorHandleKey<xAOD::EventInfo> m_aveMuKey {this
+      ,"averageInteractionsPerCrossingKey"
+      ,"EventInfo.averageInteractionsPerCrossing"
       ,"Decoration for Average Interaction Per Crossing"};
 
 };
diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibSvc/src/MdtCalibrationDbTool.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibSvc/src/MdtCalibrationDbTool.cxx
index 6f51e34e97c8492a78af820102a431d6ec7f16ba..4f6d2dd822460671661ad8716b049277e5a4351d 100644
--- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibSvc/src/MdtCalibrationDbTool.cxx
+++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibSvc/src/MdtCalibrationDbTool.cxx
@@ -10,6 +10,7 @@
 #include "MdtCalibData/WireSagCorFunc.h"
 #include "MdtCalibData/MdtSlewCorFuncHardcoded.h"
 #include "MdtCalibData/CalibFunc.h"
+#include <atomic>
 
 MdtCalibrationDbTool::MdtCalibrationDbTool(const std::string& type, const std::string &name, const IInterface* parent)
   : base_class(type, name, parent),
@@ -96,7 +97,12 @@ MuonCalib::MdtFullCalibData MdtCalibrationDbTool::getCalibration( const Identifi
   // find t0's
   if( m_getTubeConstants && tubeHash.is_valid() ) {
     if (m_hasBISsMDT) {
-      ATH_MSG_WARNING("skipping retrieval of TubeCalibContainer since no BIS sMDT calibrations available in conditions database");
+      // the following check/warning can be removed as soon as sMDT calibration data is available for BIS sMDTs
+      static std::atomic<bool> bisWarningPrinted = false;
+      if (!bisWarningPrinted) {
+        ATH_MSG_WARNING("skipping retrieval of TubeCalibContainer since no BIS sMDT calibrations available in conditions database, cf. ATLASRECTS-5805");
+        bisWarningPrinted.store(true, std::memory_order_relaxed);
+      }
     } else {
       tube = getTubeCalibContainer( tubeHash );
       if( !tube ){
diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx
index 5d9197b2a43bae264aa33b2e5b2939e14e49402a..7d26d9ffd4fd9d8d0ec4502faece58980a99e47c 100644
--- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx
@@ -208,7 +208,7 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata(const EventContext& ctx) const {
              && std::abs(m_idHelperSvc->mdtIdHelper().stationEta(channelId))>6
              && m_idHelperSvc->issMdt(channelId)) {
              if (!bisWarningPrinted) {
-               ATH_MSG_WARNING("Found BIS sMDT with tubeLayer="<<layer<<" and tubeNumber="<<tube<<". Setting to 1,1 until a proper cabling is implemented...");
+               ATH_MSG_WARNING("Found BIS sMDT with tubeLayer="<<layer<<" and tubeNumber="<<tube<<". Setting to 1,1 until a proper cabling is implemented, cf. ATLASRECTS-5804");
                bisWarningPrinted.store(true, std::memory_order_relaxed);
              }
              cabling = readCdo->getOnlineId(name, eta, phi, multilayer, 1, 1,subsystem, mrod, link, tdc, channel);
diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h
index bbf103e0c54b794a2a4508ecab32da6132c0c013..88889315372a71844846999f95f7a75a705ef3c8 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h
+++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h
@@ -70,8 +70,8 @@ public:
    inline int getNLayers() const;
    inline int getNtubesperlayer() const;
    inline int getNtubesinastep() const;
-   inline void setMultilayer(int ml);
-   inline void setNLayers(int nl);
+   inline void setMultilayer(const int ml);
+   inline void setNLayers(const int nl);
    inline bool isInBarrel() const;
    void  setIdentifier(Identifier id);
    bool getWireFirstLocalCoordAlongZ(int tubeLayer, double& coord) const;
@@ -80,10 +80,10 @@ public:
    virtual bool containsId(Identifier id) const override;
     
     // detector specific 
-    inline double getTubeLength(int tubeLayer, int tube) const;
-    inline double getActiveTubeLength(int tubeLayer, int tube) const;
-    inline double getGasLength(int tubeLayer, int tube) const;
-    inline double getWireLength(int tubeLayer, int tube) const;
+    inline double getTubeLength(const int tubeLayer, const int tube) const;
+    inline double getActiveTubeLength(const int tubeLayer, const int tube) const;
+    inline double getGasLength(const int tubeLayer, const int tube) const;
+    inline double getWireLength(const int tubeLayer, const int tube) const;
     double tubeLength(Identifier id) const;
     double innerTubeRadius() const;
     double outerTubeRadius() const;
@@ -92,7 +92,7 @@ public:
     // local(tube frame) to global coord.
     const Amg::Vector3D                    localToGlobalCoords(Amg::Vector3D x, Identifier id) const;
     const Amg::Transform3D                localToGlobalTransf(Identifier id) const;
-    const Amg::Transform3D                localToGlobalTransf(int tubeLayer, int tube) const;
+    const Amg::Transform3D                localToGlobalTransf(const int tubeLayer, const int tube) const;
     const Amg::Vector3D           nodeform_localToGlobalCoords(Amg::Vector3D x, Identifier id) const;
     const Amg::Transform3D       nodeform_localToGlobalTransf(Identifier id) const;
     // global to local(tube frame) coord.
@@ -114,36 +114,36 @@ public:
     // in the native MDT reference system
     const Amg::Vector3D localTubePos(Identifier id) const;
     const Amg::Vector3D localTubePos(IdentifierHash id) const;
-    const Amg::Vector3D localTubePos(int multilayer, int tubelayer, int tube) const;
+    const Amg::Vector3D localTubePos(const int multilayer, const int tubelayer, const int tube) const;
     const Amg::Vector3D nodeform_localTubePos(Identifier id) const;
     const Amg::Vector3D nodeform_localTubePos(IdentifierHash id) const;
-    const Amg::Vector3D nodeform_localTubePos(int multilayer, int tubelayer, int tube) const;
+    const Amg::Vector3D nodeform_localTubePos(const int multilayer, const int tubelayer, const int tube) const;
     // in the global reference system
     const Amg::Vector3D          tubePos(Identifier id) const;
     const Amg::Vector3D          tubePos(IdentifierHash id) const;
-    const Amg::Vector3D          tubePos(int multilayer, int tubelayer, int tube) const;
+    const Amg::Vector3D          tubePos(const int multilayer, const int tubelayer, const int tube) const;
     const Amg::Vector3D nodeform_tubePos(Identifier id) const;
     const Amg::Vector3D nodeform_tubePos(IdentifierHash id) const;
-    const Amg::Vector3D nodeform_tubePos(int multilayer, int tubelayer, int tube) const;
+    const Amg::Vector3D nodeform_tubePos(const int multilayer, const int tubelayer, const int tube) const;
     // in the Amdb local (szt) reference system //////////////// check here ////////////
     const Amg::Vector3D AmdbLRStubePos(Identifier id) const;
-    const Amg::Vector3D AmdbLRStubePos(int multilayer, int tubelayer, int tube) const;
+    const Amg::Vector3D AmdbLRStubePos(const int multilayer, const int tubelayer, const int tube) const;
 
     // Readout / HV side
     double signedRODistanceFromTubeCentre(const Identifier& id) const;
-    double signedRODistanceFromTubeCentre(int ml, int tl, int tube) const;
+    double signedRODistanceFromTubeCentre(const int ml, const int tl, const int tube) const;
     double RODistanceFromTubeCentre(const Identifier& id) const;
-    double RODistanceFromTubeCentre(int ml, int tl, int tube) const;
+    double RODistanceFromTubeCentre(const int ml, const int tl, const int tube) const;
     double distanceFromRO(Amg::Vector3D GlobalHitPosition, Identifier id) const;
-    double distanceFromRO(Amg::Vector3D GlobalHitPosition, int multilayer, int tubelayer, int tube) const;
+    double distanceFromRO(Amg::Vector3D GlobalHitPosition, const int multilayer, const int tubelayer, const int tube) const;
     int isAtReadoutSide(Amg::Vector3D GlobalHitPosition, Identifier id) const;
-    int isAtReadoutSide(Amg::Vector3D GlobalHitPosition, int multilayer, int tubelayer, int tube) const;
-    const Amg::Vector3D localROPos(int multilayer, int tubelayer, int tube) const;
-    const Amg::Vector3D ROPos(int multilayer, int tubelayer, int tube) const;
-    const Amg::Vector3D tubeFrame_localROPos(int multilayer, int tubelayer, int tube) const;
-    const Amg::Vector3D localROPos(Identifier id) const;
-    const Amg::Vector3D ROPos(Identifier id) const;
-    const Amg::Vector3D tubeFrame_localROPos(Identifier id) const;
+    int isAtReadoutSide(Amg::Vector3D GlobalHitPosition, const int multilayer, const int tubelayer, const int tube) const;
+    const Amg::Vector3D localROPos(const int multilayer, const int tubelayer, const int tube) const;
+    const Amg::Vector3D ROPos(const int multilayer, const int tubelayer, const int tube) const;
+    const Amg::Vector3D tubeFrame_localROPos(const int multilayer, const int tubelayer, const int tube) const;
+    const Amg::Vector3D localROPos(const Identifier id) const;
+    const Amg::Vector3D ROPos(const Identifier id) const;
+    const Amg::Vector3D tubeFrame_localROPos(const Identifier id) const;
 
     // defining B-line parameters 
     /*inline*/ void setBLinePar(const BLinePar*  bLine);
@@ -162,23 +162,23 @@ public:
     //void         fillBLineCache() const;
     virtual const Trk::Surface& surface() const override;
     virtual const Trk::SaggedLineSurface& surface(const Identifier& id) const override;
-    virtual const Trk::SaggedLineSurface& surface(int tubeLayer, int tube) const;
+    virtual const Trk::SaggedLineSurface& surface(const int tubeLayer, const int tube) const;
     virtual const Trk::SurfaceBounds& bounds() const override;
     virtual const Trk::CylinderBounds& bounds(const Identifier& id) const override;
-    virtual const Trk::CylinderBounds& bounds(int tubeLayer, int tube) const;
+    virtual const Trk::CylinderBounds& bounds(const int tubeLayer, const int tube) const;
     
     virtual const Amg::Transform3D& transform(const Identifier&) const override;
-    virtual const Amg::Transform3D& transform(int tubeLayer, int tube) const;
+    virtual const Amg::Transform3D& transform(const int tubeLayer, const int tube) const;
     virtual const Amg::Transform3D& transform() const override {return absTransform();}
     
     virtual const Amg::Vector3D& center(const Identifier&) const override;
-    virtual const Amg::Vector3D& center(int tubeLayer, int tube) const;
+    virtual const Amg::Vector3D& center(const int tubeLayer, const int tube) const;
     virtual const Amg::Vector3D& center() const override;
     
     virtual const Amg::Vector3D& normal(const Identifier&) const override {return normal();}
     virtual const Amg::Vector3D tubeNormal(const Identifier&) const;
-    virtual const Amg::Vector3D& normal(int , int ) const {return normal();}
-    virtual const Amg::Vector3D tubeNormal(int, int ) const;
+    virtual const Amg::Vector3D& normal(const int , const int ) const {return normal();}
+    virtual const Amg::Vector3D tubeNormal(const int, const int ) const;
     virtual const Amg::Vector3D& normal() const override;
       
     /** returns all the surfaces contained in this detector element */
@@ -186,21 +186,21 @@ public:
 
     // methods handling deformations
     const Amg::Transform3D& fromIdealToDeformed(const Identifier&) const;
-    const Amg::Transform3D& fromIdealToDeformed(int multilayer, int tubelayer, int tube) const;
+    const Amg::Transform3D& fromIdealToDeformed(const int multilayer, const int tubelayer, const int tube) const;
     
 private:
     // Called from MuonChamber
     void geoInitDone();
 
-    double getTubeLengthForCaching(int tubeLayer, int tube) const;
-    double getNominalTubeLengthWoCutouts(int tubeLayer, int tube) const;
-    Amg::Vector3D localNominalTubePosWoCutouts(int tubelayer, int tube) const;
+    double getTubeLengthForCaching(const int tubeLayer, const int tube) const;
+    double getNominalTubeLengthWoCutouts(const int tubeLayer, const int tube) const;
+    Amg::Vector3D localNominalTubePosWoCutouts(const int tubelayer, const int tube) const;
 
     Amg::Vector3D posOnDefChamWire(const Amg::Vector3D& locAMDBPos, double, double, double, double, 
 	double, double, double, double, double, double, double, double,
 	double, double, double, const Amg::Vector3D fixedPoint) const;
     Amg::Vector3D posOnDefChamWire(const Amg::Vector3D& locAMDBPos, const BLinePar* bLine, const Amg::Vector3D fixedPoint) const;
-    void wireEndpointsAsBuilt(Amg::Vector3D& locAMDBWireEndP, Amg::Vector3D& locAMDBWireEndN, int multilayer, int tubelayer, int tube) const;
+    void wireEndpointsAsBuilt(Amg::Vector3D& locAMDBWireEndP, Amg::Vector3D& locAMDBWireEndN, const int multilayer, const int tubelayer, const int tube) const;
 
     // methods used only by friend class MdtAlignModule to shift chambers
     void shiftTube(const Identifier& id);
@@ -240,9 +240,9 @@ private:
       Amg::Transform3D m_transform;
       Amg::Vector3D m_center;
     };
-    std::unique_ptr<GeoInfo> makeGeoInfo (int tubelayer, int tube) const;
-    const GeoInfo& geoInfo (int tubeLayer, int tube) const;
-    Amg::Transform3D deformedTransform (int multilayer, int tubelayer, int tube) const;
+    std::unique_ptr<GeoInfo> makeGeoInfo (const int tubelayer, const int tube) const;
+    const GeoInfo& geoInfo (const int tubeLayer, const int tube) const;
+    Amg::Transform3D deformedTransform (const int multilayer, const int tubelayer, const int tube) const;
 
     std::vector<CxxUtils::CachedUniquePtr<GeoInfo> > m_tubeGeo;   // one per tube
     std::vector<CxxUtils::CachedUniquePtr<GeoInfo> > m_backupTubeGeo;   // one per tube
@@ -276,9 +276,9 @@ int MdtReadoutElement::getNtubesperlayer() const
   {return m_ntubesperlayer;}
 int MdtReadoutElement::getNtubesinastep() const
   {return m_ntubesinastep;}
-void MdtReadoutElement::setMultilayer(int ml)
+void MdtReadoutElement::setMultilayer(const int ml)
   {m_multilayer = ml;}
-void MdtReadoutElement::setNLayers(int nl)
+void MdtReadoutElement::setNLayers(const int nl)
   {m_nlayers = nl;}
 bool MdtReadoutElement::isInBarrel() const
   {return  m_inBarrel;}
@@ -286,19 +286,19 @@ double MdtReadoutElement::tubePitch() const
   {return m_tubepitch;}
 void MdtReadoutElement::clearBLinePar()
   {m_BLinePar = 0;}
-double MdtReadoutElement::getWireLength(int tubeLayer, int tube) const
+double MdtReadoutElement::getWireLength(const int tubeLayer, const int tube) const
 {
   return getGasLength(tubeLayer, tube);
 }
-double MdtReadoutElement::getGasLength(int tubeLayer, int tube) const
+double MdtReadoutElement::getGasLength(const int tubeLayer, const int tube) const
 {
   return getTubeLength(tubeLayer,tube) - 2.*m_endpluglength;
 }
-double MdtReadoutElement::getTubeLength(int tubeLayer, int tube) const
+double MdtReadoutElement::getTubeLength(const int tubeLayer, const int tube) const
 {
   return getActiveTubeLength(tubeLayer, tube) + 2.*m_deadlength;
 }
-double MdtReadoutElement::getActiveTubeLength(int tubeLayer, int tube) const
+double MdtReadoutElement::getActiveTubeLength(const int tubeLayer, const int tube) const
 {
   return 2.*(bounds(tubeLayer,tube).halflengthZ());
 }
diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx
index f2855ac8e70c1706072722b04991f222b463793b..43cfc28b74a01ec42f25a23d61dcb4457bd0d145 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx
@@ -119,8 +119,11 @@ void MdtReadoutElement::geoInitDone()
 }
 
 
-double MdtReadoutElement::getTubeLengthForCaching(int tubeLayer, int tube) const
+double MdtReadoutElement::getTubeLengthForCaching(const int tubeLayer, const int tube) const
 {
+  if (tube<=0 || (unsigned int)(tube)>maxNTubesPerLayer) throw std::runtime_error(Form("File: %s, Line: %d\nMdtReadoutElement::getTubeLengthForCaching() - got called with tube=%d which is definitely out of range", __FILE__, __LINE__,tube));
+  if (tubeLayer<=0 || tubeLayer>4) throw std::runtime_error(Form("File: %s, Line: %d\nMdtReadoutElement::getTubeLengthForCaching() - got called with tubeLayer=%d which is definitely out of range", __FILE__, __LINE__,tubeLayer));
+
   const MdtIdHelper* idh = manager()->mdtIdHelper();
   double nominalTubeLength = 0.;
   if (m_inBarrel) nominalTubeLength = m_Ssize;
@@ -151,6 +154,9 @@ double MdtReadoutElement::getTubeLengthForCaching(int tubeLayer, int tube) const
       if (nGrandchildren <= 0) return tlength;
       // child vol 0 is foam; 1 to (nGrandchildren-1) should be tubes
       int ii = (tubeLayer-1)*m_ntubesperlayer+tube;
+      const Identifier id=identify();
+      // BIS78 only (the BIS7 of Run1/2 has no cutouts, thus, this block won't be reached)
+      if ((idh->stationName(id)==1 && std::abs(idh->stationEta(id))==7)) --ii;
       if (idh->isBMG(identify())) {
         // usually the tube number corresponds to the child number, however for
         // BMG chambers full tubes are skipped during the building process
@@ -177,7 +183,7 @@ double MdtReadoutElement::getTubeLengthForCaching(int tubeLayer, int tube) const
         log << MSG::WARNING << "returning nominalTubeLength "<<endmsg; 
 	  return tlength;
 	}
-      if (ii<=0) {
+      if (ii<0) {
         log << MSG::WARNING << " MdtReadoutElement " << getStationName() << " stEta " << getStationEta()
 		  << " stPhi " << getStationPhi() << " multilayer "<<getMultilayer()<<" has cutouts, nChild = "<<nGrandchildren
 		  <<" --- getTubeLength is looking for child with index ii="<<ii<<" for tubeL and tube = "<<tubeLayer<<" "<<tube<< endmsg;
@@ -317,7 +323,7 @@ double MdtReadoutElement::signedRODistanceFromTubeCentre(const Identifier& id) c
     int tube     = idh->tube(id);
     return signedRODistanceFromTubeCentre(ml, layer, tube);
 }
-double MdtReadoutElement::RODistanceFromTubeCentre(int multilayer, int tubelayer, int tube) const
+double MdtReadoutElement::RODistanceFromTubeCentre(const int multilayer, const int tubelayer, const int tube) const
 {
     // it is a un-signed quantity:
     if (multilayer != m_multilayer) {
@@ -325,7 +331,7 @@ double MdtReadoutElement::RODistanceFromTubeCentre(int multilayer, int tubelayer
     }
     return getWireLength(tubelayer, tube)/2.;
 }
-double MdtReadoutElement::signedRODistanceFromTubeCentre(int multilayer, int tubelayer, int tube) const
+double MdtReadoutElement::signedRODistanceFromTubeCentre(const int multilayer, const int tubelayer, const int tube) const
 {
     // it is a signed quantity:
     // the sign corresponds to the sign of the z coordinate of the RO endplug in the tube
@@ -393,12 +399,12 @@ double MdtReadoutElement::signedRODistanceFromTubeCentre(int multilayer, int tub
     return amdb_plus_minus1*getWireLength(tubelayer, tube)/2.;
 }
 
-const Amg::Vector3D MdtReadoutElement::tubeFrame_localROPos(int multilayer, int tubelayer, int tube) const
+const Amg::Vector3D MdtReadoutElement::tubeFrame_localROPos(const int multilayer, const int tubelayer, const int tube) const
 {
     Amg::Vector3D Pro(0., 0., signedRODistanceFromTubeCentre(multilayer, tubelayer, tube));
     return Pro;
 }
-const Amg::Vector3D MdtReadoutElement::tubeFrame_localROPos(Identifier id) const
+const Amg::Vector3D MdtReadoutElement::tubeFrame_localROPos(const Identifier id) const
 {
     const MdtIdHelper* idh = manager()->mdtIdHelper();
     int ml   = idh->multilayer(id);
@@ -406,25 +412,25 @@ const Amg::Vector3D MdtReadoutElement::tubeFrame_localROPos(Identifier id) const
     int tube     = idh->tube(id);
     return tubeFrame_localROPos(ml, layer, tube);
 }
-const Amg::Vector3D MdtReadoutElement::localROPos(int multilayer, int tubelayer, int tube) const
+const Amg::Vector3D MdtReadoutElement::localROPos(const int multilayer, const int tubelayer, const int tube) const
 {
     const MdtIdHelper* idh = manager()->mdtIdHelper();
     Identifier id = idh->channelID(idh->parentID(identify()), multilayer, tubelayer, tube);
     return tubeToMultilayerCoords(tubeFrame_localROPos(multilayer, tubelayer, tube) , id);    
 }
-const Amg::Vector3D MdtReadoutElement::localROPos(Identifier id) const
+const Amg::Vector3D MdtReadoutElement::localROPos(const Identifier id) const
 {
     return tubeToMultilayerCoords(tubeFrame_localROPos(id) , id);
 }
 
 const Amg::Vector3D 
-MdtReadoutElement::ROPos(int multilayer, int tubelayer, int tube) const
+MdtReadoutElement::ROPos(const int multilayer, const int tubelayer, const int tube) const
 {
   return transform(tubelayer, tube)*tubeFrame_localROPos(multilayer, tubelayer, tube);
 }
 
 const Amg::Vector3D 
-MdtReadoutElement::ROPos(Identifier id) const
+MdtReadoutElement::ROPos(const Identifier id) const
 {
   const MdtIdHelper* idh = manager()->mdtIdHelper();
   int ml = idh->multilayer(id);
@@ -435,7 +441,7 @@ MdtReadoutElement::ROPos(Identifier id) const
 
 
 const Amg::Vector3D 
-MdtReadoutElement::localTubePos(int multilayer, int tubelayer, int tube) const
+MdtReadoutElement::localTubePos(const int multilayer, const int tubelayer, const int tube) const
 {
   const Amg::Vector3D idealPos     = nodeform_localTubePos(multilayer, tubelayer, tube);
   const Amg::Transform3D toDeform = fromIdealToDeformed(multilayer, tubelayer, tube);
@@ -444,22 +450,23 @@ MdtReadoutElement::localTubePos(int multilayer, int tubelayer, int tube) const
 
 
 const Amg::Vector3D 
-MdtReadoutElement::nodeform_localTubePos(int multilayer, int tubelayer, int tube) const
+MdtReadoutElement::nodeform_localTubePos(const int multilayer, const int tubelayer, const int tube) const
 {
-    if (multilayer != m_multilayer)
+    int theMultilayer=multilayer;
+    if (theMultilayer != m_multilayer)
     {
         MsgStream log(Athena::getMessageSvc(),"MdtReadoutElement");
-        log << MSG::WARNING<<"asking WRONG QUESTION: nodeform_localTubePos with args. ml/tl/t = "<<multilayer<<"/"<<tubelayer<<"/"<<tube
+        log << MSG::WARNING<<"asking WRONG QUESTION: nodeform_localTubePos with args. ml/tl/t = "<<theMultilayer<<"/"<<tubelayer<<"/"<<tube
                <<" to MdtReadoutElement "<<getStationName()<<"/"<<getTechnologyName()<<" eta/phi "<<getStationEta()<<"/"<<getStationPhi()
                <<" multilayer "<<getMultilayer()<<endmsg;
         log << MSG::WARNING<<"will answer for  args:                                  ml/tl/t = "<<getMultilayer()<<"/"<<tubelayer<<"/"<<tube<<endmsg;
-        multilayer = m_multilayer;
+        theMultilayer = m_multilayer;
     }
 #ifndef NDEBUG
         MsgStream log(Athena::getMessageSvc(),"MdtReadoutElement");
         if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<" Computing LocalTubePos for "
                <<getStationName()<<"/"<<getTechnologyName()<<" eta/phi "<<getStationEta()<<"/"<<getStationPhi()
-               <<" ml/tl/t "<<multilayer<<"/"<<tubelayer<<"/"<<tube<<endmsg;
+               <<" ml/tl/t "<<theMultilayer<<"/"<<tubelayer<<"/"<<tube<<endmsg;
 #endif
 
     double xtube = 0.;
@@ -483,6 +490,10 @@ MdtReadoutElement::nodeform_localTubePos(int multilayer, int tubelayer, int tube
         int nGrandchildren = cv->getNChildVols();
         // child vol 0 is foam; 1 to (nGrandchildren-1) should be tubes
         int ii = (tubelayer-1)*m_ntubesperlayer+tube;
+        const Identifier id=identify();
+        const MdtIdHelper* idh = manager()->mdtIdHelper();
+        // BIS78 only (the BIS7 of Run1/2 has no cutouts, thus, this block won't be reached)
+        if ((idh->stationName(id)==1 && std::abs(idh->stationEta(id))==7)) --ii;
         if (manager()->mdtIdHelper()->isBMG(identify())) {
           // usually the tube number corresponds to the child number, however for
           // BMG chambers full tubes are skipped during the building process
@@ -510,26 +521,9 @@ MdtReadoutElement::nodeform_localTubePos(int multilayer, int tubelayer, int tube
 
         if (std::abs(xtube - tubeTrans(0,3)) > maxtol ||
             std::abs(ztube - tubeTrans(2,3)) > maxtol) {
-#ifdef NDEBUG
-          MsgStream log(Athena::getMessageSvc(),"MdtReadoutElement");
-#endif
-        const MdtIdHelper* idh = manager()->mdtIdHelper();
-        const Identifier id = identify();
-          log << MSG::WARNING << "taking localTubepos from RAW geoModel!!! MISMATCH IN local Y-Z (amdb) for MDT with stationName="
-            << idh->stationName(id) << " ("<< idh->stationNameString(idh->stationName(id)) << "), stationEta="<< idh->stationEta(id) << ", stationPhi="<< idh->stationPhi(id)<< ", multilayer="
-            << idh->multilayer(id) << ", tubeLayer="<< idh->tubeLayer(id) << ", tube="<< idh->tube(id) 
-                 << ": from tube-id and pitch, tube pos = " << xtube
-                 << ", " << ytube << ", " << ztube
-                 << " but geoModel gives " << tubeTrans(0,3)
-                 << ", " << tubeTrans(1,3) << ", " << tubeTrans(2,3)
-                 << endmsg
-                 << " for tube " << tube << " tube layer " << tubelayer
-                 << " multilayer " << multilayer << endmsg
-                 << " There are " << nGrandchildren << " child volumes & "
-                 << m_ntubesperlayer*m_nlayers << " tubes expected."
-                 << " There should be " << m_nlayers << " layers and "
-                 << m_ntubesperlayer << " tubes per layer."
-                 <<endmsg;
+          throw std::runtime_error(Form("File: %s, Line: %d\nMdtReadoutElement::nodeform_localTubePos(%d,%d,%d) - mismatch between local from tube-id/pitch/cutout tube position (x,y,z=%.3f,%.3f,%.3f) and GeoModel (x,y,z=%.3f,%.3f,%.3f)\nfor MdtReadoutElement with stationName=%d (%s), stationEta=%d, stationPhi=%d, multilayer=%d, tubeLayer=%d, tube=%d\nThere are %d child volumes & %d tubes expected. There should be %d layers and %d tubes per layer.",
+                                   __FILE__, __LINE__, theMultilayer, tubelayer, tube, xtube, ytube, ztube, tubeTrans(0,3), tubeTrans(1,3), tubeTrans(2,3), idh->stationName(id), idh->stationNameString(idh->stationName(id)).c_str(),
+                                   idh->stationEta(id), idh->stationPhi(id), idh->multilayer(id), idh->tubeLayer(id), idh->tube(id), nGrandchildren, m_ntubesperlayer*m_nlayers, m_nlayers, m_ntubesperlayer));
         }
         if (tubeTrans(1,3)> maxtol) {
 #ifndef NDEBUG
@@ -538,10 +532,8 @@ MdtReadoutElement::nodeform_localTubePos(int multilayer, int tubelayer, int tube
 #endif
             if (std::abs(m_cutoutShift - tubeTrans(1,3)) > maxtol) // check only for tubes actually shifted 
             {
-              const MdtIdHelper* idh = manager()->mdtIdHelper();
-              const Identifier id = identify();
               throw std::runtime_error(Form("File: %s, Line: %d\nMdtReadoutElement::nodeform_localTubePos(%d,%d,%d) - mismatch between local from tube-id/pitch/cutout tube position (x,y,z=%.3f,%.3f,%.3f) and GeoModel (x,y,z=%.3f,%.3f,%.3f)\nfor MdtReadoutElement with stationName=%d (%s), stationEta=%d, stationPhi=%d, multilayer=%d, tubeLayer=%d, tube=%d\nThere are %d child volumes & %d tubes expected. There should be %d layers and %d tubes per layer.", 
-                                       __FILE__, __LINE__, multilayer, tubelayer, tube, xtube, m_cutoutShift, ztube, tubeTrans(0,3), tubeTrans(1,3), tubeTrans(2,3), idh->stationName(id), idh->stationNameString(idh->stationName(id)).c_str(),
+                                       __FILE__, __LINE__, theMultilayer, tubelayer, tube, xtube, m_cutoutShift, ztube, tubeTrans(0,3), tubeTrans(1,3), tubeTrans(2,3), idh->stationName(id), idh->stationNameString(idh->stationName(id)).c_str(),
                                        idh->stationEta(id), idh->stationPhi(id), idh->multilayer(id), idh->tubeLayer(id), idh->tube(id), nGrandchildren, m_ntubesperlayer*m_nlayers, m_nlayers, m_ntubesperlayer));
             }
         }
@@ -817,7 +809,7 @@ MdtReadoutElement::fromIdealToDeformed(const Identifier& id) const
 }
 
 
-double MdtReadoutElement::getNominalTubeLengthWoCutouts(int tubeLayer, int tube) const {
+double MdtReadoutElement::getNominalTubeLengthWoCutouts(const int tubeLayer, const int tube) const {
   const MdtIdHelper* idh = manager()->mdtIdHelper();
   if (m_inBarrel) return m_Ssize;
   else {
@@ -834,7 +826,7 @@ double MdtReadoutElement::getNominalTubeLengthWoCutouts(int tubeLayer, int tube)
   }
 }
 
-Amg::Vector3D MdtReadoutElement::localNominalTubePosWoCutouts(int tubelayer, int tube) const
+Amg::Vector3D MdtReadoutElement::localNominalTubePosWoCutouts(const int tubelayer, const int tube) const
 {
   double xtube = 0.;
   double ytube = 0.;
@@ -849,7 +841,7 @@ Amg::Vector3D MdtReadoutElement::localNominalTubePosWoCutouts(int tubelayer, int
   return Amg::Vector3D(xtube,ytube,ztube);
 }
 
-const Amg::Transform3D & MdtReadoutElement::fromIdealToDeformed(int multilayer, int tubelayer, int tube) const
+const Amg::Transform3D & MdtReadoutElement::fromIdealToDeformed(const int multilayer, const int tubelayer, const int tube) const
 {
   size_t itube = (tubelayer-1)*m_ntubesperlayer + tube - 1;
   if( itube >= m_deformTransf.size() ) {
@@ -1190,7 +1182,7 @@ MdtReadoutElement::posOnDefChamWire( const Amg::Vector3D& locAMDBPos,
 // to be inlined here if possible.
 __attribute__ ((flatten))
 #endif
-void MdtReadoutElement::wireEndpointsAsBuilt(Amg::Vector3D& locAMDBWireEndP, Amg::Vector3D& locAMDBWireEndN, int multilayer, int tubelayer, int tube) const
+void MdtReadoutElement::wireEndpointsAsBuilt(Amg::Vector3D& locAMDBWireEndP, Amg::Vector3D& locAMDBWireEndN, const int multilayer, const int tubelayer, const int tube) const
 {
   const MdtAsBuiltPar* params = parentMuonStation()->getMdtAsBuiltParams();
   if (!params) {
@@ -1337,7 +1329,7 @@ MdtReadoutElement::transform(const Identifier & id) const
 
 
 std::unique_ptr<MdtReadoutElement::GeoInfo>
-MdtReadoutElement::makeGeoInfo (int tubelayer, int tube) const
+MdtReadoutElement::makeGeoInfo (const int tubelayer, const int tube) const
 {
   const Amg::Transform3D& toDeformed = fromIdealToDeformed (getMultilayer(), tubelayer, tube);
   const Amg::Transform3D transform = globalTransform (nodeform_localTubePos(getMultilayer(), tubelayer, tube),
@@ -1347,7 +1339,7 @@ MdtReadoutElement::makeGeoInfo (int tubelayer, int tube) const
 
 
 const MdtReadoutElement::GeoInfo&
-MdtReadoutElement::geoInfo (int tubeLayer, int tube) const
+MdtReadoutElement::geoInfo (const int tubeLayer, const int tube) const
 {
   size_t itube = (tubeLayer-1)*m_ntubesperlayer + tube - 1;
   if( itube >= m_tubeGeo.size() ) {
@@ -1372,7 +1364,7 @@ MdtReadoutElement::geoInfo (int tubeLayer, int tube) const
 
 
 const Amg::Transform3D &
-MdtReadoutElement::transform(int tubeLayer, int tube) const 
+MdtReadoutElement::transform(const int tubeLayer, const int tube) const 
 {
   return geoInfo (tubeLayer, tube).m_transform;
 }
@@ -1424,7 +1416,7 @@ void MdtReadoutElement::shiftTube(const Identifier& id)
 }
   
 const Trk::SaggedLineSurface&
-MdtReadoutElement::surface (int tubeLayer, int tube) const
+MdtReadoutElement::surface(const int tubeLayer, const int tube) const
 {
     const MdtIdHelper* idh = manager()->mdtIdHelper();
     Identifier id = idh->channelID(idh->parentID(identify()), getMultilayer(), tubeLayer, tube);
@@ -1455,7 +1447,7 @@ MdtReadoutElement::surface (int tubeLayer, int tube) const
     return *ptr;
 }
 const Trk::SaggedLineSurface&
-MdtReadoutElement::surface (const Identifier& id) const
+MdtReadoutElement::surface(const Identifier& id) const
 {
     const MdtIdHelper* idh = manager()->mdtIdHelper();
 #ifndef NDEBUG
@@ -1478,7 +1470,7 @@ MdtReadoutElement::surface (const Identifier& id) const
     return surface(idh->tubeLayer(id), idh->tube(id));    
 }
 const Trk::CylinderBounds  &
-MdtReadoutElement::bounds(int tubeLayer, int tube) const
+MdtReadoutElement::bounds(const int tubeLayer, const int tube) const
 {  
     int istep = 0;
     int ntot_steps = m_nsteps;
@@ -1502,9 +1494,12 @@ MdtReadoutElement::bounds(int tubeLayer, int tube) const
 	  istep = 0;
 	}
       }
-
-    const CxxUtils::CachedUniquePtr<Trk::CylinderBounds>& ptr =
-      m_tubeBounds.at(istep);
+    if ((unsigned int)istep>=m_tubeBounds.size()) {
+      const MdtIdHelper* idh = manager()->mdtIdHelper();
+      const Identifier id=identify();
+      throw std::runtime_error(Form("File: %s, Line: %d\nMdtReadoutElement::bounds(%d,%d) - istep=%d but m_tubeBounds.size()=%lu for station %s, stationEta=%d", __FILE__, __LINE__,tubeLayer,tube,istep,m_tubeBounds.size(),idh->stationNameString(idh->stationName(id)).c_str(),idh->stationEta(id)));
+    }
+    const CxxUtils::CachedUniquePtr<Trk::CylinderBounds>& ptr = m_tubeBounds.at(istep);
     if (!ptr) {
       double tubelength = getTubeLengthForCaching(tubeLayer, tube);
       ptr.set (std::make_unique<Trk::CylinderBounds>(innerTubeRadius(), 0.5*tubelength - m_deadlength));
@@ -1537,7 +1532,7 @@ MdtReadoutElement::bounds(const Identifier& id) const
     return bounds(idh->tubeLayer(id), idh->tube(id));
 }
 const Amg::Vector3D&
-MdtReadoutElement::center (const Identifier& id) const
+MdtReadoutElement::center(const Identifier& id) const
 {
     const MdtIdHelper* idh = manager()->mdtIdHelper();
 #ifndef NDEBUG
@@ -1560,12 +1555,12 @@ MdtReadoutElement::center (const Identifier& id) const
     return center (idh->tubeLayer(id), idh->tube(id));
 }
 const Amg::Vector3D&
-MdtReadoutElement::center (int tubeLayer, int tube) const
+MdtReadoutElement::center(const int tubeLayer, const int tube) const
 {
     return geoInfo (tubeLayer, tube).m_center;
 }
 const Amg::Vector3D&
-MdtReadoutElement::normal () const
+MdtReadoutElement::normal() const
 {
     if (!m_elemNormal.isValid()) {
       m_elemNormal.set (Amg::Vector3D( transform().linear()*Amg::Vector3D(1.,0.,0.)) );
@@ -1574,7 +1569,7 @@ MdtReadoutElement::normal () const
 }
 
 const Amg::Vector3D
-MdtReadoutElement::tubeNormal (const Identifier& id) const
+MdtReadoutElement::tubeNormal(const Identifier& id) const
 {
   const MdtIdHelper* idh = manager()->mdtIdHelper();
   return tubeNormal( idh->tubeLayer(id), idh->tube(id) );
diff --git a/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx
index 4591ff9ea78990a3106901472ce9a5fe631c3aff..fbf744756cb06b318052e63fbc7a09c75da4c3a8 100644
--- a/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx
+++ b/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx
@@ -613,7 +613,7 @@ StatusCode RpcDigitizationTool::doDigitization(const EventContext& ctx, RpcDigit
       static std::atomic<bool> biWarningPrinted = false;
       if (stationName.find("BI")!=std::string::npos) {
         if (!biWarningPrinted) {
-          ATH_MSG_WARNING("skipping call of RPC DetectionEfficiency for BI as long as no proper cabling is implemented");
+          ATH_MSG_WARNING("skipping call of RPC DetectionEfficiency for BI as long as no proper cabling is implemented, cf. ATLASRECTS-5803");
           biWarningPrinted.store(true, std::memory_order_relaxed);
         }
       } else {
@@ -2151,7 +2151,7 @@ int RpcDigitizationTool::ClusterSizeEvaluation(const EventContext& ctx, const Id
     if(readCdo->getFracClusterSize1Map().find(Id) != readCdo->getFracClusterSize1Map().end()) FracClusterSize1  = float(readCdo->getFracClusterSize1Map().find(Id)->second) ;
     else {
       if (!fracCluster1Printed) {
-        ATH_MSG_WARNING("FracClusterSize1 entry not found for id = " <<m_idHelper->show_to_string(*IdRpcStrip)<<" (stationName="<<stationName<<") default will be used");
+        ATH_MSG_WARNING("FracClusterSize1 entry not found for id = " <<m_idHelper->show_to_string(*IdRpcStrip)<<" (stationName="<<stationName<<") default will be used, cf. ATLASRECTS-5800");
         fracCluster1Printed.store(true, std::memory_order_relaxed);
       }
     }
@@ -2159,7 +2159,7 @@ int RpcDigitizationTool::ClusterSizeEvaluation(const EventContext& ctx, const Id
     if(readCdo->getFracClusterSize2Map().find(Id) != readCdo->getFracClusterSize2Map().end()) FracClusterSize2	= float(readCdo->getFracClusterSize2Map().find(Id)->second) ;
     else {
       if (!fracCluster2Printed) {
-        ATH_MSG_WARNING("FracClusterSize2 entry not found for id = " <<m_idHelper->show_to_string(*IdRpcStrip)<<" (stationName="<<stationName<<") default will be used");
+        ATH_MSG_WARNING("FracClusterSize2 entry not found for id = " <<m_idHelper->show_to_string(*IdRpcStrip)<<" (stationName="<<stationName<<") default will be used, cf. ATLASRECTS-5800");
         fracCluster2Printed.store(true, std::memory_order_relaxed);
       }
     }
@@ -2172,7 +2172,7 @@ int RpcDigitizationTool::ClusterSizeEvaluation(const EventContext& ctx, const Id
     if(readCdo->getMeanClusterSizeMap().find(Id) != readCdo->getMeanClusterSizeMap().end()) MeanClusterSize     = float(readCdo->getMeanClusterSizeMap().find(Id)->second)  ;
     else {
       if (!meanClusterPrinted) {
-        ATH_MSG_WARNING ("MeanClusterSize entry not found for id = " <<m_idHelper->show_to_string(*IdRpcStrip)<<" (stationName="<<stationName<<") default will be used");
+        ATH_MSG_WARNING ("MeanClusterSize entry not found for id = " <<m_idHelper->show_to_string(*IdRpcStrip)<<" (stationName="<<stationName<<") default will be used, cf. ATLASRECTS-5801");
         meanClusterPrinted.store(true, std::memory_order_relaxed);
       }
     }
@@ -2188,7 +2188,7 @@ int RpcDigitizationTool::ClusterSizeEvaluation(const EventContext& ctx, const Id
         index>m_FracClusterSizeTail_A.size() || index>m_MeanClusterSizeTail_A.size() ) {
         if (stationName==0 || stationName==1) {
           if (!clusterIndexAPrinted) {
-            ATH_MSG_WARNING("Index out of array in ClusterSizeEvaluation SideA " << index << " statName "<<stationName);
+            ATH_MSG_WARNING("Index out of array in ClusterSizeEvaluation SideA " << index << " statName "<<stationName<<", cf. ATLASRECTS-5802");
             clusterIndexAPrinted.store(true, std::memory_order_relaxed);
           }
         } else ATH_MSG_WARNING("Index out of array in ClusterSizeEvaluation SideA " << index << " statName "<<stationName);
@@ -2205,7 +2205,7 @@ int RpcDigitizationTool::ClusterSizeEvaluation(const EventContext& ctx, const Id
           index>m_FracClusterSizeTail_C.size() || index>m_MeanClusterSizeTail_C.size() ) {
           if (stationName==0 || stationName==1) {
             if (!clusterIndexCPrinted) {
-              ATH_MSG_WARNING("Index out of array in ClusterSizeEvaluation SideC " << index << " statName "<<stationName);
+              ATH_MSG_WARNING("Index out of array in ClusterSizeEvaluation SideC " << index << " statName "<<stationName<<", cf. ATLASRECTS-5802");
               clusterIndexCPrinted.store(true, std::memory_order_relaxed);
             }
           } else ATH_MSG_WARNING("Index out of array in ClusterSizeEvaluation SideC " << index << " statName "<<stationName);
diff --git a/MuonSpectrometer/MuonGeoModel/src/MultiLayer.cxx b/MuonSpectrometer/MuonGeoModel/src/MultiLayer.cxx
index 1074115ca8589ce129b57a4010e7f9b4263a973d..514e8861de3b87e898c28174591617b85663eb51 100755
--- a/MuonSpectrometer/MuonGeoModel/src/MultiLayer.cxx
+++ b/MuonSpectrometer/MuonGeoModel/src/MultiLayer.cxx
@@ -336,7 +336,8 @@ GeoFullPhysVol* MultiLayer::build()
   slay = &(slay->subtract( (*sbox)<<GeoTrf::Translate3D(0.,0.,length/2.)));
 
   for (int i = 0; i < nrOfLayers; i++) {
-    if (xx[i] > tubePitch/2. + 10.*Gaudi::Units::mm) {
+    // check in which tubeLayers the layer x position is outside of the envelope and add tube to envelope (not for BMG)
+    if (logVolName.find("BMG")==std::string::npos && 2*xx[i]>=tubePitch) {
       // subtract tube at the start
       if (verbose_multilayer) {
         log << MSG::VERBOSE
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackSegmentMatchingTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackSegmentMatchingTool.h
index 81fd9e986b2347a490bc85396f0ae65ce8b42d8f..540f3cc3cfe5db0bd5f2100f6d743537875a6124 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackSegmentMatchingTool.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackSegmentMatchingTool.h
@@ -32,7 +32,7 @@ namespace Muon {
 	The caller should ensure the track gets deleted. */
     virtual bool match( const Trk::Track& track, const MuonSegment& segment, bool useTightCuts = false ) const = 0;
 
-    void cleanUp() const {};
+    virtual void cleanUp() const {};
   };
   
   inline const InterfaceID& IMuonTrackSegmentMatchingTool::interfaceID()
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthTrackBuilder.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthTrackBuilder.cxx
index e198e68b2abfe4cd513bbf8434d7c6720b962847..aae845927cffa88a2bfd5b9f9a00cc40c98a350a 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthTrackBuilder.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthTrackBuilder.cxx
@@ -203,7 +203,7 @@ MuonTruthTrackBuilder::createTrack(const Trk::PRD_TruthTrajectory& prdTraj, Trk:
     ATH_MSG_VERBOSE("Got PRD Truth trajectory with " << prdTraj.nDoF << " degrees of freedom, PdgID "
                                                      << genPart->pdg_id());
     // check min degrees of freedom
-    if (abs(genPart->pdg_id()) != 13 || (m_minNdof > 0 && prdTraj.nDoF < m_minNdof)) return 0;
+    if (std::abs(genPart->pdg_id()) != 13 || (m_minNdof > 0 && prdTraj.nDoF < m_minNdof)) return 0;
 
     const TrackRecord* trackRecord = getEntryRecord(*genPart);
     if (!trackRecord) {
diff --git a/PhysicsAnalysis/AnalysisCommon/AssociationUtils/Root/OverlapRemovalGenUseAlg.cxx b/PhysicsAnalysis/AnalysisCommon/AssociationUtils/Root/OverlapRemovalGenUseAlg.cxx
index b60460a5a9b32657c477d4923e707127b9fb63a7..ec278f2abe49dabd8b894b281cf1f9c6cb02f192 100644
--- a/PhysicsAnalysis/AnalysisCommon/AssociationUtils/Root/OverlapRemovalGenUseAlg.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/AssociationUtils/Root/OverlapRemovalGenUseAlg.cxx
@@ -44,7 +44,7 @@ OverlapRemovalGenUseAlg::OverlapRemovalGenUseAlg(const std::string& name,
                     "Input label for passing photons");
     declareProperty("MuonKey", m_muonKey="Muons",
                     "StoreGate/TEvent key for muons");
-    declareProperty("MuonLabel", m_muonLabel="DFCommonGoodMuon",
+    declareProperty("MuonLabel", m_muonLabel="DFCommonMuonPassIDCuts",
                     "Input label for passing muons");
     declareProperty("TauKey", m_tauKey="TauJets",
                     "StoreGate/TEvent key for taus");
diff --git a/PhysicsAnalysis/AnalysisCommon/PMGTools/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/PMGTools/CMakeLists.txt
index 9a81cd237969d1c6ce78bf6437002858ec1cbda6..478e348b38650138abc8c52d7a284a9cb8fb9087 100644
--- a/PhysicsAnalysis/AnalysisCommon/PMGTools/CMakeLists.txt
+++ b/PhysicsAnalysis/AnalysisCommon/PMGTools/CMakeLists.txt
@@ -17,16 +17,14 @@ endif()
 
 # External(s) used by the package:
 find_package( ROOT COMPONENTS Core Hist RIO )
-find_package( Boost )
 
 # Libraries in the package:
 atlas_add_library( PMGToolsLib
    PMGTools/*.h Root/*.cxx
    PUBLIC_HEADERS PMGTools
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-   PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
    LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools PATCoreLib PATInterfaces PMGAnalysisInterfacesLib xAODTruth
-   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} CxxUtils FourMomUtils PathResolver RootCoreUtils xAODBase xAODEventInfo xAODJet xAODMetaData ${extra_private_libs})
+   PRIVATE_LINK_LIBRARIES FourMomUtils PathResolver RootCoreUtils xAODEventInfo xAODJet xAODMetaData ${extra_private_libs})
 
 if( NOT XAOD_STANDALONE )
    atlas_add_component( PMGTools
@@ -57,15 +55,17 @@ if( XAOD_STANDALONE )
    atlas_add_test( ut_PMGSherpa22VJetsWeightTool_test
       SOURCES test/ut_PMGSherpa22VJetsWeightTool_test.cxx
       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-      LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools PATInterfaces PMGToolsLib ${xaod_access_lib} )
+      LINK_LIBRARIES ${ROOT_LIBRARIES} PMGToolsLib ${xaod_access_lib} )
 
    atlas_add_test( ut_PMGSherpaVjetsSysTool_test
       SOURCES test/ut_PMGSherpaVjetsSysTool_test.cxx
       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-      LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools PATInterfaces PMGAnalysisInterfacesLib PMGToolsLib ${xaod_access_lib} )
+      LINK_LIBRARIES ${ROOT_LIBRARIES} PMGToolsLib ${xaod_access_lib} )
 endif()
 # ... AthAnalysis/AnalysisBase
+if( XAOD_STANDALONE ) # temporarily disabled in Athena (ATEAM-681)
 atlas_add_test( ut_PMGTruthWeightTool_test
    SOURCES test/ut_PMGTruthWeightTool_test.cxx
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
    LINK_LIBRARIES ${ROOT_LIBRARIES} AsgMessagingLib AsgTools PMGAnalysisInterfacesLib PMGToolsLib xAODTruth ${xaod_access_lib} )
+endif()
diff --git a/PhysicsAnalysis/AnalysisCommon/PMGTools/Root/PMGTruthWeightTool.cxx b/PhysicsAnalysis/AnalysisCommon/PMGTools/Root/PMGTruthWeightTool.cxx
index 1e5cf58d3c7078ce7b8f3801dce3b1684e1751b6..8067c8d33a764c29381ba278889625e5347ef728 100644
--- a/PhysicsAnalysis/AnalysisCommon/PMGTools/Root/PMGTruthWeightTool.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/PMGTools/Root/PMGTruthWeightTool.cxx
@@ -19,9 +19,6 @@
 
 #include <PMGTools/PMGTruthWeightTool.h>
 
-// For replacing substrings
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/algorithm/string/case_conv.hpp>
 
 namespace PMGTools
 {
@@ -125,9 +122,14 @@ namespace PMGTools
       return m_weights.at(m_weightIndices.at(weightName));
     } catch (const std::out_of_range& e) {
       // Before throwing an exception, try to recover with bad naming conventions
-      std::string strippedName = boost::algorithm::to_lower_copy(boost::replace_all_copy(weightName, " ", ""));
-      for (const auto & weight:m_weightNames){
-        if (strippedName==boost::algorithm::to_lower_copy(boost::replace_all_copy(weight," ", ""))){
+      std::string strippedName = RCU::substitute (weightName, " ", "_");
+      std::transform(strippedName.begin(), strippedName.end(), strippedName.begin(),
+        [](unsigned char c){ return std::tolower(c); });
+      for (const std::string &weight : m_weightNames) {
+        std::string modifiedName = RCU::substitute (weight, " ", "_");
+        std::transform(modifiedName.begin(), modifiedName.end(), modifiedName.begin(),
+          [](unsigned char c){ return std::tolower(c); });
+        if (strippedName == modifiedName){
           ATH_MSG_WARNING("Using weight name \"" << weight << "\" instead of requested \"" << weightName << "\"");
           return getWeight(weight);
         }
diff --git a/PhysicsAnalysis/AnalysisCommon/PMGTools/test/ut_PMGTruthWeightTool_test.cxx b/PhysicsAnalysis/AnalysisCommon/PMGTools/test/ut_PMGTruthWeightTool_test.cxx
index 7cf8129077802d0ed22d79c60ebda83a1ba5ee81..5438fa6f46a824bd29ad76b44f2ef547d63fcc08 100644
--- a/PhysicsAnalysis/AnalysisCommon/PMGTools/test/ut_PMGTruthWeightTool_test.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/PMGTools/test/ut_PMGTruthWeightTool_test.cxx
@@ -89,20 +89,12 @@ int main(int argc, char *argv[])
 
   // Create the truth weight tool:
   ANA_MSG_INFO("Creating PMGTruthWeightTool...");
-#ifdef XAOD_STANDALONE
-  asg::AnaToolHandle< PMGTools::IPMGTruthWeightTool > weightTool;
-  ASG_SET_ANA_TOOL_TYPE(weightTool, PMGTools::PMGTruthWeightTool);
-  weightTool.setName("PMGTruthWeightTool");
-  ANA_CHECK(weightTool.initialize());
-#else
   asg::AnaToolHandle< PMGTools::IPMGTruthWeightTool > weightTool("PMGTools::PMGTruthWeightTool/PMGTruthWeightTool");
   ANA_CHECK(weightTool.retrieve());
-#endif
 
   // Loop over a few events:
   ANA_MSG_INFO("Preparing to loop over events...");
   const Long64_t nEntries = 5;
-  // double retrievalTimeNanoSeconds = 0;
   for(Long64_t entry = 0; entry < nEntries; ++entry) {
     if (event.getEntry(entry) < 0) { ANA_MSG_ERROR("Failed to read event " << entry); continue; }
 
diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.cxx
index d810eae7f0f1ca7822d72815ef800ce042387e28..9e452a53e7966a3a4c298548f1b1698199ae3d53 100644
--- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.cxx
+++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.cxx
@@ -58,11 +58,10 @@ TruthLeptonParentAssociationTool::reset (const TruthParticle& p)
     // Loop over GenEvent's.
     for (const HepMC::GenEvent* ev_in : *mcec) {
       if (!ev_in) continue;
-      for (HepMC::GenEvent::particle_const_iterator itrPart = ev_in->particles_begin();
-           itrPart!=ev_in->particles_end();++itrPart){
-        if ( (*itrPart) && (*itrPart)->barcode()==p.barcode() ){
+      for (auto Part: *ev_in){
+        if ( (Part) && HepMC::barcode(Part)==p.barcode() ){
           // Found it!
-          addLeptonParent( (*itrPart) );
+          addLeptonParent( (Part) );
           break;
         }
       } // Loop over particles
diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.cxx
index 2fd1f3e2148273af02cd585702c45b2d2f788a8a..953fd2cf260d64cd42212fbafd6d580df71bc060 100644
--- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.cxx
+++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.cxx
@@ -52,11 +52,10 @@ TruthTauDecayAssociationTool::reset (const TruthParticle& p)
     // Loop over GenEvent's.
     for (const HepMC::GenEvent* ev_in : *mcec) {
       if (!ev_in) continue;
-      for (HepMC::GenEvent::particle_const_iterator itrPart = ev_in->particles_begin();
-           itrPart!=ev_in->particles_end();++itrPart){
-        if ( (*itrPart) && (*itrPart)->barcode()==p.barcode() ){
+      for (auto Part: *ev_in){
+        if ( (Part) && HepMC::barcode(Part)==p.barcode() ){
           // Found it!
-          addStableDaughters( (*itrPart) );
+          addStableDaughters( (Part) );
           break;
         }
       } // Loop over particles
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py
index cf21e8eff73426c1496bbd404daabd01d3d95561..5f055fe057c133aa21a80d18fa9a315566e2f943 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py
@@ -463,11 +463,6 @@ DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("EGamma
 # ADD TOOLS
 #=======================================
 
-#
-# Disabling this tool due to it's missing in R22
-#
-# import IsolationAlgs.IsoUpdatedTrackCones as isoCones
-# if not hasattr(DerivationFrameworkJob,"IsolationBuilderTight1000"):
-#     DerivationFrameworkJob += isoCones.GetUpdatedIsoTrackCones()
-
-
+from IsolationAlgs.IsoUpdatedTrackCones import GetUpdatedIsoTrackCones
+if not hasattr(DerivationFrameworkJob,"IsolationBuilderTight1000"):
+    DerivationFrameworkJob += GetUpdatedIsoTrackCones()
\ No newline at end of file
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCPContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCPContent.py
index b5744bd2aafbc8b5fccba8b63eb3e4a1b7691627..fbfe2b20fcaaca2b1e5ce62adfcb15b4cdebdd44 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCPContent.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCPContent.py
@@ -16,7 +16,7 @@ MuonsCPContent = [
 "InDetTrackParticlesAux.phi.theta.qOverP.numberOfPixelHits.numberOfPixelHoles.numberOfPixelDeadSensors.numberOfSCTHits.numberOfSCTHoles.numberOfSCTDeadSensors.numberOfTRTHits.numberOfTRTOutliers.numberOfPrecisionLayers.d0.z0.vz.definingParametersCovMatrix.vertexLink.truthParticleLink.chiSquared.numberDoF.numberOfPhiLayers.numberOfPhiHoleLayers.numberOfPrecisionHoleLayers",
 "MuonSpectrometerTrackParticles",
 "MuonSpectrometerTrackParticlesAux.phi.d0.z0.vz.definingParametersCovMatrix.vertexLink.theta.qOverP.truthParticleLink",
-"MuonsAux.pt.eta.phi.truthType.truthOrigin.author.muonType.quality.inDetTrackParticleLink.muonSpectrometerTrackParticleLink.combinedTrackParticleLink.InnerDetectorPt.MuonSpectrometerPt.DFCommonGoodMuon.DFCommonMuonsPreselection.momentumBalanceSignificance.clusterLink.ptcone20.ptcone30.ptcone40.ptvarcone20.ptvarcone30.ptvarcone40.topoetcone20.topoetcone30.topoetcone40.innerSmallHits.truthParticleLink.charge.CaloLRLikelihood.CaloMuonIDTag.extrapolatedMuonSpectrometerTrackParticleLink.numberOfPrecisionLayers.numberOfPrecisionHoleLayers.innerLargeHits.muonSegmentLinks.numberOfGoodPrecisionLayers.innerSmallHoles.innerLargeHoles.middleSmallHoles.middleLargeHoles.outerSmallHoles.outerLargeHoles.extendedSmallHoles.extendedLargeHoles.innerClosePrecisionHits.middleClosePrecisionHits.outerClosePrecisionHits.extendedClosePrecisionHits.innerOutBoundsPrecisionHits.middleOutBoundsPrecisionHits.outerOutBoundsPrecisionHits.extendedOutBoundsPrecisionHits.combinedTrackOutBoundsPrecisionHits.isEndcapGoodLayers.isSmallGoodSectors.middleLargeHits.middleSmallHits.outerLargeHits.outerSmallHits.extendedSmallHits.extendedLargeHits.cscEtaHits.cscUnspoiledEtaHits.spectrometerFieldIntegral.scatteringCurvatureSignificance.scatteringNeighbourSignificance.msOnlyExtrapolatedMuonSpectrometerTrackParticleLink.allAuthors.ptcone20_TightTTVA_pt1000.ptcone20_TightTTVA_pt500.ptvarcone30_TightTTVA_pt1000.ptvarcone30_TightTTVA_pt500.neflowisol20.segmentDeltaEta.DFCommonJetDr",
+"MuonsAux.pt.eta.phi.truthType.truthOrigin.author.muonType.quality.inDetTrackParticleLink.muonSpectrometerTrackParticleLink.combinedTrackParticleLink.InnerDetectorPt.MuonSpectrometerPt.DFCommonMuonPassIDCuts.DFCommonMuonPassPreselection.momentumBalanceSignificance.clusterLink.ptcone20.ptcone30.ptcone40.ptvarcone20.ptvarcone30.ptvarcone40.topoetcone20.topoetcone30.topoetcone40.innerSmallHits.truthParticleLink.charge.CaloLRLikelihood.CaloMuonIDTag.extrapolatedMuonSpectrometerTrackParticleLink.numberOfPrecisionLayers.numberOfPrecisionHoleLayers.innerLargeHits.muonSegmentLinks.numberOfGoodPrecisionLayers.innerSmallHoles.innerLargeHoles.middleSmallHoles.middleLargeHoles.outerSmallHoles.outerLargeHoles.extendedSmallHoles.extendedLargeHoles.innerClosePrecisionHits.middleClosePrecisionHits.outerClosePrecisionHits.extendedClosePrecisionHits.innerOutBoundsPrecisionHits.middleOutBoundsPrecisionHits.outerOutBoundsPrecisionHits.extendedOutBoundsPrecisionHits.combinedTrackOutBoundsPrecisionHits.isEndcapGoodLayers.isSmallGoodSectors.middleLargeHits.middleSmallHits.outerLargeHits.outerSmallHits.extendedSmallHits.extendedLargeHits.cscEtaHits.cscUnspoiledEtaHits.spectrometerFieldIntegral.scatteringCurvatureSignificance.scatteringNeighbourSignificance.msOnlyExtrapolatedMuonSpectrometerTrackParticleLink.allAuthors.ptcone20_TightTTVA_pt1000.ptcone20_TightTTVA_pt500.ptvarcone30_TightTTVA_pt1000.ptvarcone30_TightTTVA_pt500.neflowisol20.segmentDeltaEta.DFCommonJetDr",
 "PhotonsAux.pt.eta.phi.m.caloClusterLinks.author.f1.topoetcone40.Tight.truthParticleLink.vertexLinks",
 "egammaClustersAux.calEta.calPhi.calE.calM",
 "egammaTopoSeededClusters",
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCommon.py
index 4e5511a48f4f5c70a09bc3cb3c90b26a3074e128..96eb63474d669588ed304e62411e4cdf253a5a12 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCommon.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCommon.py
@@ -35,35 +35,25 @@ if DFCommonMuonsTrtCutOff is not None: DFCommonMuonsSelector.TrtCutOff = DFCommo
 ToolSvc += DFCommonMuonsSelector
 print (DFCommonMuonsSelector)
 
-DFCommonMuonToolWrapper = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonMuonToolWrapper",
+DFCommonMuonToolWrapperIDCuts = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonMuonToolWrapperIDCuts",
                                                                         AsgSelectionTool = DFCommonMuonsSelector,
                                                                         CutType = "IDHits",
-                                                                        StoreGateEntryName = "DFCommonGoodMuon",
+                                                                        StoreGateEntryName = "DFCommonMuonPassIDCuts",
                                                                         ContainerName = "Muons")
-ToolSvc += DFCommonMuonToolWrapper
-print (DFCommonMuonToolWrapper)
-DFCommonMuonToolWrapperTools.append(DFCommonMuonToolWrapper)
-
-### Preselection
-DFCommonMuonsSelectorPreselection = CP__MuonSelectionTool(name = "DFCommonMuonsSelectorPreselection")
-DFCommonMuonsSelectorPreselection.MaxEta = 3.
-DFCommonMuonsSelectorPreselection.MuQuality = 3
-# turn of the momentum correction which is not needed for IDHits cut and Preselection
-DFCommonMuonsSelectorPreselection.TurnOffMomCorr = True
-
-if DFCommonMuonsTrtCutOff is not None: DFCommonMuonsSelectorPreselection.TrtCutOff = DFCommonMuonsTrtCutOff
-ToolSvc += DFCommonMuonsSelectorPreselection
-print (DFCommonMuonsSelectorPreselection)
+#preselection
+ToolSvc += DFCommonMuonToolWrapperIDCuts
+print (DFCommonMuonToolWrapperIDCuts)
+DFCommonMuonToolWrapperTools.append(DFCommonMuonToolWrapperIDCuts)
 
 DFCommonMuonToolWrapperPreselection = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonMuonToolWrapperPreselection",
-                                                                        AsgSelectionTool = DFCommonMuonsSelectorPreselection,
+                                                                        AsgSelectionTool = DFCommonMuonsSelector,
                                                                         CutType = "Preselection",
-                                                                        StoreGateEntryName = "DFCommonMuonsPreselection",
+                                                                        StoreGateEntryName = "DFCommonMuonPassPreselection",
                                                                         ContainerName = "Muons")
+
 ToolSvc += DFCommonMuonToolWrapperPreselection
 print (DFCommonMuonToolWrapperPreselection)
 DFCommonMuonToolWrapperTools.append(DFCommonMuonToolWrapperPreselection)
-
 ### Decoration of the muon objects with the ID track covariances
 #from DerivationFrameworkMuons.DerivationFrameworkMuonsConf import DerivationFramework__MuonIDCovMatrixDecorator
 #DFCommonMuonIDCovMatrixDecorator = DerivationFramework__MuonIDCovMatrixDecorator( name = "DFCommonMuonIDCovMatrixDecorator")
@@ -78,6 +68,6 @@ DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("DFComm
                                                                          AugmentationTools = DFCommonMuonToolWrapperTools
                                                                         )
 
-#import IsolationAlgs.IsoUpdatedTrackCones as isoCones
-#if not hasattr(DerivationFrameworkJob,"IsolationBuilderTight1000"):
-#  DerivationFrameworkJob += isoCones.GetUpdatedIsoTrackCones()
+from IsolationAlgs.IsoUpdatedTrackCones import GetUpdatedIsoTrackCones
+if not hasattr(DerivationFrameworkJob,"IsolationBuilderTight1000"):
+    DerivationFrameworkJob += GetUpdatedIsoTrackCones()
\ No newline at end of file
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYSLITE.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYSLITE.py
index e587d5f38b9f03b1b406509d458d18270733111e..61f35465482fd6dd5beafdd24df3ff8112121d60 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYSLITE.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYSLITE.py
@@ -362,11 +362,11 @@ trigger_names_full_tau = list(set(trig_tau+trig_txe))
 from RecExConfig.InputFilePeeker import inputFileSummary
 trigger_names_notau = []
 trigger_names_tau = []
+'''
 for trig_item in inputFileSummary['metadata']['/TRIGGER/HLT/Menu']:
     if not 'ChainName' in trig_item: continue
     if trig_item['ChainName'] in trigger_names_full_notau: trigger_names_notau += [ trig_item['ChainName'] ]
     if trig_item['ChainName'] in trigger_names_full_tau:   trigger_names_tau   += [ trig_item['ChainName'] ]
-'''
 # Create trigger matching decorations
 trigmatching_helper_notau = TriggerMatchingHelper(name='PHSYLITETriggerMatchingToolNoTau',
         OutputContainerPrefix = "Analysis",
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt
index b5b19c5195c508c1e2bd95f04b99b8dabea4c1cd..702eea048d96ed1b21766ef284a03a8e517f8b65 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt
@@ -57,5 +57,5 @@ if( XAOD_STANDALONE )
 endif()
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_data( data/*.conf )
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMLooseSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMLooseSelectorCutDefs.py
index c5c8e5f890b62ecdfe093b25dfd63a1d7122c737..3f88ef7f7e047ed450a52e5350060a8fd3aaa735 100755
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMLooseSelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMLooseSelectorCutDefs.py
@@ -4,7 +4,7 @@
 # This one is used for loose++ menu
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 # Define GeV
 GeV = 1000.0
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMMediumSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMMediumSelectorCutDefs.py
index e3bd00e35f7f6d2f3a7c3607b86f9d816a32a6a2..ab77370f3d67909a073ca4f7e88749b52afff589 100755
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMMediumSelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMMediumSelectorCutDefs.py
@@ -4,7 +4,7 @@
 # This one is used for medium++ menu
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 # Define GeV
 GeV = 1000.0
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMSelectorCutDefs.py
index 773d93dc6cda0cf98c2212c3b15df0a4b90f4314..7d481c2715ef849e47b99f35750097b6911d1dcf 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMSelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMSelectorCutDefs.py
@@ -1,10 +1,10 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # default configuration of the ElectronIsEMSelectorCutDefs
 # This one is used for stadard loose, medium, and tight, not ++ menu
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 # Define GeV
 GeV = 1000.0
@@ -26,74 +26,74 @@ def ElectronIsEMSelectorConfig2011(theTool) :
     # cut on hadronic energy
     #  |eta|             0.0   0.1    0.6    0.8   1.15   1.37   1.52   1.81   2.01  2.37    2.47
     theTool.CutHadLeakage  += [0.031, 0.031, 0.021, 0.021, 0.019, 0.028, 0.065, 0.065, 0.046, 0.034, # < 5   GeV
-			   0.018, 0.018, 0.016, 0.015, 0.016, 0.028, 0.053, 0.038, 0.028, 0.025, # 5-10 
-			   0.015, 0.015, 0.014, 0.014, 0.016, 0.020, 0.039, 0.032, 0.027, 0.023, # 10-15 
-			   0.012, 0.012, 0.010, 0.010, 0.012, 0.015, 0.029, 0.022, 0.015, 0.021, # 15-20 
-			   0.010, 0.010, 0.010, 0.010, 0.010, 0.010, 0.020, 0.015, 0.014, 0.014, # 20-30 
-			   0.008, 0.008, 0.008, 0.008, 0.008, 0.010, 0.014, 0.015, 0.010, 0.010, # 30-40 
-			   0.008, 0.008, 0.008, 0.008, 0.008, 0.010, 0.015, 0.015, 0.010, 0.010, # 40-50 
-			   0.008, 0.008, 0.008, 0.008, 0.008, 0.010, 0.015, 0.015, 0.010, 0.010, # 50-60 
-			   0.008, 0.008, 0.008, 0.008, 0.008, 0.010, 0.015, 0.015, 0.010, 0.010, # 60-70 
-			   0.008, 0.008, 0.008, 0.008, 0.008, 0.010, 0.015, 0.015, 0.010, 0.010, # 70-80 
-			   0.008, 0.008, 0.008, 0.008, 0.008, 0.010, 0.015, 0.015, 0.010, 0.010] # 80< 
+                           0.018, 0.018, 0.016, 0.015, 0.016, 0.028, 0.053, 0.038, 0.028, 0.025, # 5-10
+                           0.015, 0.015, 0.014, 0.014, 0.016, 0.020, 0.039, 0.032, 0.027, 0.023, # 10-15
+                           0.012, 0.012, 0.010, 0.010, 0.012, 0.015, 0.029, 0.022, 0.015, 0.021, # 15-20
+                           0.010, 0.010, 0.010, 0.010, 0.010, 0.010, 0.020, 0.015, 0.014, 0.014, # 20-30
+                           0.008, 0.008, 0.008, 0.008, 0.008, 0.010, 0.014, 0.015, 0.010, 0.010, # 30-40
+                           0.008, 0.008, 0.008, 0.008, 0.008, 0.010, 0.015, 0.015, 0.010, 0.010, # 40-50
+                           0.008, 0.008, 0.008, 0.008, 0.008, 0.010, 0.015, 0.015, 0.010, 0.010, # 50-60
+                           0.008, 0.008, 0.008, 0.008, 0.008, 0.010, 0.015, 0.015, 0.010, 0.010, # 60-70
+                           0.008, 0.008, 0.008, 0.008, 0.008, 0.010, 0.015, 0.015, 0.010, 0.010, # 70-80
+                           0.008, 0.008, 0.008, 0.008, 0.008, 0.010, 0.015, 0.015, 0.010, 0.010] # 80<
 
     
     # cut on ratio e237/e277 
     # |eta|          0.0     0.1    0.6    0.8   1.15   1.37   1.52   1.81    2.01   2.37   2.47 
     theTool.CutReta37 += [ 0.700, 0.700, 0.700, 0.700, 0.700, 0.690, 0.848, 0.876, 0.870, 0.888, # < 5     GeV
-		       0.700, 0.700, 0.700, 0.700, 0.700, 0.715, 0.860, 0.880, 0.880, 0.880, # 5-10
-		       0.860, 0.860, 0.860, 0.860, 0.860, 0.730, 0.860, 0.880, 0.880, 0.880, # 10-15
-		       0.860, 0.860, 0.860, 0.860, 0.860, 0.740, 0.860, 0.880, 0.880, 0.880, # 15-20
-		       0.930, 0.930, 0.930, 0.925, 0.925, 0.750, 0.915, 0.915, 0.900, 0.900, # 20-30
-		       0.930, 0.930, 0.930, 0.925, 0.925, 0.790, 0.915, 0.920, 0.900, 0.900, # 30-40
-		       0.930, 0.930, 0.930, 0.925, 0.925, 0.790, 0.915, 0.920, 0.900, 0.900, # 40-50
-		       0.930, 0.930, 0.930, 0.930, 0.925, 0.790, 0.915, 0.920, 0.900, 0.900, # 50-60
-		       0.930, 0.930, 0.930, 0.930, 0.925, 0.790, 0.915, 0.920, 0.900, 0.900, # 60-70
-		       0.930, 0.930, 0.930, 0.930, 0.925, 0.790, 0.915, 0.920, 0.900, 0.900, # 70-80
-		       0.930, 0.930, 0.930, 0.930, 0.925, 0.790, 0.915, 0.920, 0.900, 0.900] # 80<
+                       0.700, 0.700, 0.700, 0.700, 0.700, 0.715, 0.860, 0.880, 0.880, 0.880, # 5-10
+                       0.860, 0.860, 0.860, 0.860, 0.860, 0.730, 0.860, 0.880, 0.880, 0.880, # 10-15
+                       0.860, 0.860, 0.860, 0.860, 0.860, 0.740, 0.860, 0.880, 0.880, 0.880, # 15-20
+                       0.930, 0.930, 0.930, 0.925, 0.925, 0.750, 0.915, 0.915, 0.900, 0.900, # 20-30
+                       0.930, 0.930, 0.930, 0.925, 0.925, 0.790, 0.915, 0.920, 0.900, 0.900, # 30-40
+                       0.930, 0.930, 0.930, 0.925, 0.925, 0.790, 0.915, 0.920, 0.900, 0.900, # 40-50
+                       0.930, 0.930, 0.930, 0.930, 0.925, 0.790, 0.915, 0.920, 0.900, 0.900, # 50-60
+                       0.930, 0.930, 0.930, 0.930, 0.925, 0.790, 0.915, 0.920, 0.900, 0.900, # 60-70
+                       0.930, 0.930, 0.930, 0.930, 0.925, 0.790, 0.915, 0.920, 0.900, 0.900, # 70-80
+                       0.930, 0.930, 0.930, 0.930, 0.925, 0.790, 0.915, 0.920, 0.900, 0.900] # 80<
 
     # cut on shower width in 2nd sampling                                    
     #                 0.0   0.1    0.6    0.8   1.15   1.37   1.52   1.81    2.01   2.37   2.47
     theTool.CutWeta2c += [ 0.014, 0.014, 0.014, 0.014, 0.014, 0.028, 0.017, 0.014, 0.014, 0.014, # < 5  GeV
-		       0.013, 0.013, 0.014, 0.014, 0.014, 0.026, 0.017, 0.014, 0.014, 0.014, # 5-10
-		       0.013, 0.013, 0.014, 0.014, 0.014, 0.025, 0.017, 0.014, 0.014, 0.014, # 10-15
-		       0.012, 0.012, 0.013, 0.013, 0.013, 0.025, 0.017, 0.014, 0.014, 0.014, # 15-20
-		       0.011, 0.011, 0.012, 0.012, 0.013, 0.025, 0.014, 0.013, 0.013, 0.013, # 20-30
-		       0.011, 0.011, 0.012, 0.012, 0.012, 0.025, 0.013, 0.013, 0.013, 0.013, # 30-40
-		       0.011, 0.011, 0.012, 0.012, 0.012, 0.025, 0.013, 0.013, 0.013, 0.013, # 40-50
-		       0.011, 0.011, 0.012, 0.012, 0.012, 0.025, 0.013, 0.012, 0.013, 0.013, # 50-60
-		       0.011, 0.011, 0.012, 0.012, 0.012, 0.025, 0.013, 0.012, 0.013, 0.013, # 60-70
-		       0.011, 0.011, 0.012, 0.012, 0.012, 0.025, 0.013, 0.012, 0.013, 0.013, # 70-80
-		       0.011, 0.011, 0.012, 0.012, 0.012, 0.025, 0.013, 0.012, 0.013, 0.013] # 80<       
+                       0.013, 0.013, 0.014, 0.014, 0.014, 0.026, 0.017, 0.014, 0.014, 0.014, # 5-10
+                       0.013, 0.013, 0.014, 0.014, 0.014, 0.025, 0.017, 0.014, 0.014, 0.014, # 10-15
+                       0.012, 0.012, 0.013, 0.013, 0.013, 0.025, 0.017, 0.014, 0.014, 0.014, # 15-20
+                       0.011, 0.011, 0.012, 0.012, 0.013, 0.025, 0.014, 0.013, 0.013, 0.013, # 20-30
+                       0.011, 0.011, 0.012, 0.012, 0.012, 0.025, 0.013, 0.013, 0.013, 0.013, # 30-40
+                       0.011, 0.011, 0.012, 0.012, 0.012, 0.025, 0.013, 0.013, 0.013, 0.013, # 40-50
+                       0.011, 0.011, 0.012, 0.012, 0.012, 0.025, 0.013, 0.012, 0.013, 0.013, # 50-60
+                       0.011, 0.011, 0.012, 0.012, 0.012, 0.025, 0.013, 0.012, 0.013, 0.013, # 60-70
+                       0.011, 0.011, 0.012, 0.012, 0.012, 0.025, 0.013, 0.012, 0.013, 0.013, # 70-80
+                       0.011, 0.011, 0.012, 0.012, 0.012, 0.025, 0.013, 0.012, 0.013, 0.013] # 80<
 
     # cut on total width in 1st sampling
     #              0.0   0.1  0.6   0.8   1.15   1.37   1.52  1.81 2.01   2.37   2.47
     theTool.CutWtot  += [3.48, 3.48, 3.78, 3.96, 4.20, 9999., 4.02, 2.70, 1.86,  9999., # < 5    GeV
-		     3.18, 3.18, 3.54, 3.90, 4.02, 9999., 3.96, 2.70, 1.80,  9999., # 5-10   
-		     2.81, 2.81, 2.97, 3.36, 3.48, 9999., 3.72, 2.42, 1.76,  9999., # 10-15  
-		     2.76, 2.76, 2.92, 3.24, 3.41, 9999., 3.67, 2.35, 1.72,  9999., # 15-20  
-		     2.50, 2.50, 2.70, 3.14, 3.23, 9999., 3.58, 2.32, 1.59,  9999., # 20-30  
-		     2.45, 2.45, 2.70, 2.98, 3.17, 9999., 3.52, 2.25, 1.58,  9999., # 30-40  
-		     2.27, 2.27, 2.61, 2.90, 3.17, 9999., 3.36, 2.25, 1.55,  9999., # 40-50  
-		     2.27, 2.27, 2.61, 2.90, 3.17, 9999., 3.36, 2.25, 1.55,  9999., # 50-60  
-		     2.27, 2.27, 2.61, 2.90, 3.17, 9999., 3.36, 2.25, 1.55,  9999., # 60-70  
-		     2.27, 2.27, 2.61, 2.90, 3.17, 9999., 3.36, 2.25, 1.55,  9999., # 70-80  
-		     2.27, 2.27, 2.61, 2.90, 3.17, 9999., 3.36, 2.25, 1.55,  9999.  # 80<    
-		     ]
+                     3.18, 3.18, 3.54, 3.90, 4.02, 9999., 3.96, 2.70, 1.80,  9999., # 5-10
+                     2.81, 2.81, 2.97, 3.36, 3.48, 9999., 3.72, 2.42, 1.76,  9999., # 10-15
+                     2.76, 2.76, 2.92, 3.24, 3.41, 9999., 3.67, 2.35, 1.72,  9999., # 15-20
+                     2.50, 2.50, 2.70, 3.14, 3.23, 9999., 3.58, 2.32, 1.59,  9999., # 20-30
+                     2.45, 2.45, 2.70, 2.98, 3.17, 9999., 3.52, 2.25, 1.58,  9999., # 30-40
+                     2.27, 2.27, 2.61, 2.90, 3.17, 9999., 3.36, 2.25, 1.55,  9999., # 40-50
+                     2.27, 2.27, 2.61, 2.90, 3.17, 9999., 3.36, 2.25, 1.55,  9999., # 50-60
+                     2.27, 2.27, 2.61, 2.90, 3.17, 9999., 3.36, 2.25, 1.55,  9999., # 60-70
+                     2.27, 2.27, 2.61, 2.90, 3.17, 9999., 3.36, 2.25, 1.55,  9999., # 70-80
+                     2.27, 2.27, 2.61, 2.90, 3.17, 9999., 3.36, 2.25, 1.55,  9999.  # 80<
+                     ]
 
     # cut on (Emax - Emax2)/(Emax + Emax2) in 1st sampling 
     #                0.0   0.1    0.6    0.8   1.15   1.37   1.52   1.81    2.01   2.37   2.47
     theTool.CutDEmaxs1 += [0.39,  0.39,  0.20,  0.07, 0.06,  -9999.,  0.07,  0.43,   0.75,  -9999.,  # < 5  GeV
-		       0.61,  0.61,  0.32,  0.11, 0.13,  -9999.,  0.12,  0.51,   0.62,  -9999.,  # 5-10  
-		       0.67,  0.67,  0.61,  0.43, 0.32,  -9999.,  0.36,  0.82 ,  0.82,  -9999.,  # 10-15  
-		       0.75,  0.75,  0.67,  0.51, 0.47,  -9999.,  0.43,  0.86 ,  0.84,  -9999.,  # 15-20  
-		       0.835,  0.835,  0.835,  0.73, 0.70,  -9999.,  0.8,  0.9 ,  0.9,  -9999.,  # 20-30  
-		       0.835,  0.835,  0.835,  0.73, 0.70,  -9999.,  0.8,  0.9 ,  0.9,  -9999.,  # 30-40  
-		       0.835,  0.835,  0.835,  0.73, 0.70,  -9999.,  0.8,  0.9 ,  0.9,  -9999.,  # 40-50  
-		       0.835,  0.835,  0.835,  0.73, 0.70,  -9999.,  0.8,  0.9 ,  0.9,  -9999.,  # 50-60  
-		       0.835,  0.835,  0.835,  0.73, 0.70,  -9999.,  0.8,  0.9 ,  0.9,  -9999.,  # 60-70  
-		       0.835,  0.835,  0.835,  0.73, 0.70,  -9999.,  0.8,  0.9 ,  0.9,  -9999.,  # 70-80  
-		       0.835,  0.835,  0.835,  0.73, 0.70,  -9999.,  0.8,  0.9 ,  0.9,  -9999.]  # 80<  
+                       0.61,  0.61,  0.32,  0.11, 0.13,  -9999.,  0.12,  0.51,   0.62,  -9999.,  # 5-10
+                       0.67,  0.67,  0.61,  0.43, 0.32,  -9999.,  0.36,  0.82 ,  0.82,  -9999.,  # 10-15
+                       0.75,  0.75,  0.67,  0.51, 0.47,  -9999.,  0.43,  0.86 ,  0.84,  -9999.,  # 15-20
+                       0.835,  0.835,  0.835,  0.73, 0.70,  -9999.,  0.8,  0.9 ,  0.9,  -9999.,  # 20-30
+                       0.835,  0.835,  0.835,  0.73, 0.70,  -9999.,  0.8,  0.9 ,  0.9,  -9999.,  # 30-40
+                       0.835,  0.835,  0.835,  0.73, 0.70,  -9999.,  0.8,  0.9 ,  0.9,  -9999.,  # 40-50
+                       0.835,  0.835,  0.835,  0.73, 0.70,  -9999.,  0.8,  0.9 ,  0.9,  -9999.,  # 50-60
+                       0.835,  0.835,  0.835,  0.73, 0.70,  -9999.,  0.8,  0.9 ,  0.9,  -9999.,  # 60-70
+                       0.835,  0.835,  0.835,  0.73, 0.70,  -9999.,  0.8,  0.9 ,  0.9,  -9999.,  # 70-80
+                       0.835,  0.835,  0.835,  0.73, 0.70,  -9999.,  0.8,  0.9 ,  0.9,  -9999.]  # 80<
 
 
 
@@ -111,32 +111,32 @@ def ElectronIsEMSelectorConfig2011(theTool) :
     # cut on delta eta
     #                0.0   0.1    0.6    0.8   1.15   1.37   1.52   1.81    2.01   2.37   2.47
     theTool.CutDeltaEta += [0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # < 5  GeV  
-			0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 5-10      
-			0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 10-15     
-			0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 15-20     
-			0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 20-30     
-			0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 30-40     
-			0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 40-50     
-			0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 50-60     
-			0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 60-70     
-			0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 70-80     
-			0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01   # 80<       
-			]
+                        0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 5-10
+                        0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 10-15
+                        0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 15-20
+                        0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 20-30
+                        0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 30-40
+                        0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 40-50
+                        0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 50-60
+                        0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 60-70
+                        0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,  # 70-80
+                        0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01   # 80<
+                        ]
 
     # cut on delta eta for tight selection
     #                      0.0   0.1    0.6    0.8   1.15   1.37   1.52   1.81    2.01   2.37   2.47
     theTool.CutDeltaEtaTight += [0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # < 5  GeV  
-			     0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 5-10      
-			     0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 10-15     
-			     0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 15-20     
-			     0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 20-30     
-			     0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 30-40     
-			     0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 40-50     
-			     0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 50-60     
-			     0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 60-70     
-			     0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 70-80     
-			     0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005   # 80<       
-			     ]
+                             0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 5-10
+                             0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 10-15
+                             0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 15-20
+                             0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 20-30
+                             0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 30-40
+                             0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 40-50
+                             0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 50-60
+                             0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 60-70
+                             0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005,  # 70-80
+                             0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005   # 80<
+                             ]
     
     theTool.useTRTOutliers  = True 
     # cut on b-layer hits
@@ -145,62 +145,62 @@ def ElectronIsEMSelectorConfig2011(theTool) :
     # cut on delta phi
     #                     0.0    0.1    0.6    0.8    1.15   1.37   1.52   1.81  2.01   2.37   2.47
     theTool.CutminDeltaPhi  += [-0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # < 5  GeV  
-			     -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 5-10      
-			     -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 10-15     
-			     -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 15-20     
-			     -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 20-30     
-			     -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 30-40     
-			     -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 40-50     
-			     -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 50-60     
-			     -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 60-70     
-			     -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 70-80     
-			     -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02   # 80<       
-			     ]
+                             -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 5-10
+                             -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 10-15
+                             -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 15-20
+                             -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 20-30
+                             -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 30-40
+                             -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 40-50
+                             -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 50-60
+                             -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 60-70
+                             -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02,  # 70-80
+                             -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02, -0.02   # 80<
+                             ]
     
     # cut on delta phi
     #                    0.0   0.1   0.6   0.8   1.15  1.37  1.52  1.81 2.01  2.37   2.47
     theTool.CutmaxDeltaPhi  += [0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # < 5  GeV  
-			    0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 5-10      
-			    0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 10-15     
-			    0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 15-20     
-			    0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 20-30     
-			    0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 30-40     
-			    0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 40-50     
-			    0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 50-60     
-			    0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 60-70     
-			    0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 70-80     
-			    0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02   # 80<       
-			    ]
+                            0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 5-10
+                            0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 10-15
+                            0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 15-20
+                            0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 20-30
+                            0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 30-40
+                            0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 40-50
+                            0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 50-60
+                            0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 60-70
+                            0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,  # 70-80
+                            0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02   # 80<
+                            ]
     
     # cut min on E/P
     #               0.0   0.1   0.6   0.8   1.15  1.37  1.52  1.81 2.01  2.37   2.47
     theTool.CutminEp  += [0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80,  # < 5  GeV  
-		      0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80,  # 5-10      
-		      0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80,  # 10-15     
-		      0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80,  # 15-20     
-		      0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80,  # 20-30     
-		      0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70,  # 30-40     
-		      0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70,  # 40-50     
-		      0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70,  # 50-60     
-		      0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70,  # 60-70     
-		      0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70,  # 70-80     
-		      0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00   # 80<       
-		      ]
+                      0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80,  # 5-10
+                      0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80,  # 10-15
+                      0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80,  # 15-20
+                      0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80, 0.80,  # 20-30
+                      0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70,  # 30-40
+                      0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70,  # 40-50
+                      0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70,  # 50-60
+                      0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70,  # 60-70
+                      0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70,  # 70-80
+                      0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00   # 80<
+                      ]
     
     # cut max on E/P
     #             0.0   0.1   0.6  0.8 1.15  1.37 1.52 1.81 2.01 2.37 2.47
     theTool.CutmaxEp  += [2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 3.0, 3.0, 3.0, 3.0,  # < 5  GeV  
-		      2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 3.0, 3.0, 3.0, 3.0,  # 5-10      
-		      2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 3.0, 3.0, 3.0, 3.0,  # 10-15     
-		      2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 3.0, 3.0, 3.0, 3.0,  # 15-20     
-		      2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 3.0, 3.0, 3.0, 3.0,  # 20-30     
-		      3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 3.0,  # 30-40     
-		      3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 5.0, 5.0, 4.0,  # 40-50     
-		      5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0,  # 50-60     
-		      5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0,  # 60-70     
-		      5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0,  # 70-80     
-		      10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0   # 80<       
-		      ]
+                      2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 3.0, 3.0, 3.0, 3.0,  # 5-10
+                      2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 3.0, 3.0, 3.0, 3.0,  # 10-15
+                      2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 3.0, 3.0, 3.0, 3.0,  # 15-20
+                      2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 3.0, 3.0, 3.0, 3.0,  # 20-30
+                      3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 3.0,  # 30-40
+                      3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 5.0, 5.0, 4.0,  # 40-50
+                      5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0,  # 50-60
+                      5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0,  # 60-70
+                      5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0,  # 70-80
+                      10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0   # 80<
+                      ]
     
     # cuts on TRT
     # range of eta bins for e-ID for TRT
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMSelectorMapping.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMSelectorMapping.py
index 85d28f240401119e79c59539dbea23197d286208..da8a78684fcf49999c15d7b8f8c5035a4f6999be 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMSelectorMapping.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMSelectorMapping.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        ElectronIsEMSelectorMapping.py
@@ -9,7 +9,7 @@
 ## Description: Find mapping of mask and function for ID quality
 ##=============================================================================
 
-import ROOT,cppyy
+import cppyy
 
 cppyy.include("ElectronPhotonSelectorTools/egammaPIDdefs.h")
 
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMTightSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMTightSelectorCutDefs.py
index d3c2f4347db267593eb8039264c4ff6438216159..b339fc42a2526ed1273f1f615ba7921e5fb295aa 100755
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMTightSelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronIsEMTightSelectorCutDefs.py
@@ -4,7 +4,7 @@
 # This one is used for tight++ menu
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 
 # Define GeV
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronLikelihoodMenuDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronLikelihoodMenuDefs.py
index 219e57db98941127e0fd5a45b9d26d174855a863..002977428248efa46982afaf2c16bb8e9d0bdf3b 100755
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronLikelihoodMenuDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronLikelihoodMenuDefs.py
@@ -1,7 +1,7 @@
 # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 def ElectronLikelihoodCUSTOMMediumConfig(theTool) :
     '''
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronLikelihoodToolMapping.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronLikelihoodToolMapping.py
index 5658e5707d1b1c396df326f3212085f582638bf1..5c52488af93e910eaaeb568d96218a8ebb125069 100755
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronLikelihoodToolMapping.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ElectronLikelihoodToolMapping.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        ElectronLikelihoodToolMapping.py
@@ -13,7 +13,7 @@ import cppyy
 try :
     #cppyy.load_library('libElectronPhotonSelectorToolsDict')
     cppyy.include("ElectronPhotonSelectorTools/LikelihoodEnums.h")
-except :
+except Exception:
     pass
 
 from ROOT import LikeEnum
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMLooseSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMLooseSelectorCutDefs.py
index e8037369b416fa7821fbf5bf6d05a6ebc42bed0c..82ec03b8a5eb2bfd55f766ec543bc000edc2195c 100755
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMLooseSelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMLooseSelectorCutDefs.py
@@ -4,7 +4,7 @@
 # This one is used for stadard Loose photons cuts menus
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 # Define GeV
 GeV = 1000.0
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMMediumSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMMediumSelectorCutDefs.py
index 56ff8e8fb02408d20d4bd05557c9ff227ab97712..08e58c678dd5f4827678155c120d0babe2f75f07 100755
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMMediumSelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMMediumSelectorCutDefs.py
@@ -4,7 +4,7 @@
 # This one is used for stadard photons cuts menus
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 # Define GeV
 GeV = 1000.0
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMSelectorMapping.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMSelectorMapping.py
index 314d92058ad0b2dab4a0173e316db329c834df88..07a2454796663560833860f0d5ff8bc67cf5ed0e 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMSelectorMapping.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMSelectorMapping.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        ForwardElectronIsEMSelectorMapping.py
@@ -9,7 +9,7 @@
 ## Description: Find mapping of mask and function for ID quality
 ##=============================================================================
 
-import ROOT,cppyy
+import cppyy
 cppyy.include("ElectronPhotonSelectorTools/egammaPIDdefs.h")
 
 from ROOT import egammaPID
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMTightSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMTightSelectorCutDefs.py
index 920c35d48025afcccad14299b8f01d7093b4c7ba..727df2547626c670ad429f74e080cf2208d045fa 100755
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMTightSelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMTightSelectorCutDefs.py
@@ -4,7 +4,7 @@
 # This one is used for stadard Tight photons cuts menus
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 
 def ForwardElectronIsEMTightSelectorConfigMC15(theTool) :
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMLooseSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMLooseSelectorCutDefs.py
index ba9d946a6c427d52afb0943ca146d7a8c76083b9..8266f3742e18fa765d1221dfc000e5f4e4d96a0e 100755
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMLooseSelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMLooseSelectorCutDefs.py
@@ -5,7 +5,7 @@
 
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 # Define GeV
 GeV = 1000.0
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMMediumSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMMediumSelectorCutDefs.py
index 1b519e4913aa085756f9f76e5284f6aa54340dd8..b318ebf20a7869d37483a1da34d2e97431b0c9a4 100755
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMMediumSelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMMediumSelectorCutDefs.py
@@ -5,7 +5,7 @@
 
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 
 def PhotonIsEMMediumSelectorConfig(theTool) :
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorCutDefs.py
index cadf6a08d0ce114f58c15d047338c0d1c54eda70..081690846a60093edeec640f5c0690d448c99a68 100755
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorCutDefs.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # default configuration of the PhotonIsEMSelectorCutDefs
 # This one is used for stadard photons cuts menus
@@ -6,13 +6,14 @@
 import cppyy
 try :
     cppyy.load_library('libElectronPhotonSelectorToolsDict')
-except :
+except Exception:
     pass
 
 from ROOT import egammaPID
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
+from AthenaCommon.SystemOfUnits import GeV
 
 ## obsolete the old cut-def should be updated with the new selectors.
 def PhotonIsEMSelectorConfig2011(theTool) :
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorMapping.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorMapping.py
index 7c258d13b1f40be555b6ecd7a7b98778abc503ef..2fea60837d31869b56c7f746b462b55555580b7d 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorMapping.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorMapping.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        PhotonIsEMSelectorMapping.py
@@ -12,7 +12,7 @@
 import cppyy
 try :
     cppyy.load_library('libElectronPhotonSelectorToolsDict')
-except :
+except Exception:
     pass
 
 from ROOT import egammaPID
@@ -34,12 +34,10 @@ class photonPIDmenu:
     menuCurrentCuts = 5
     menuPtInclJan2018 = 6
 
-import ElectronPhotonSelectorTools.PhotonIsEMSelectorCutDefs as PhotonIsEMSelectorCutDefs
 import ElectronPhotonSelectorTools.PhotonIsEMLooseSelectorCutDefs as PhotonIsEMLooseSelectorCutDefs
 import ElectronPhotonSelectorTools.PhotonIsEMMediumSelectorCutDefs as PhotonIsEMMediumSelectorCutDefs
 import ElectronPhotonSelectorTools.PhotonIsEMTightSelectorCutDefs as PhotonIsEMTightSelectorCutDefs
 
-import ElectronPhotonSelectorTools.TrigPhotonIsEMCaloCutsOnlySelectorCutDefs as TrigPhotonIsEMCaloCutsOnlySelectorCutDefs
 
 # format - key: (mask, function)
 
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMTightSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMTightSelectorCutDefs.py
index c34fbe4f771b88671ccaf024b629902935a63c0b..ce3215a7d2ad32e13b4f5e5bec1cf0304f4de36c 100755
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMTightSelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMTightSelectorCutDefs.py
@@ -4,7 +4,7 @@
 # This one is used for stadard Tight photons cuts menus
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 # Define GeV
 GeV = 1000.0
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TestEGammaAmbiguityTool.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TestEGammaAmbiguityTool.py
index dcfaed87fd2004f36ce473c6f032d87d0beb72dc..c5a72780db397281b8aae8be8a252a06041525ba 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TestEGammaAmbiguityTool.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TestEGammaAmbiguityTool.py
@@ -1,6 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-
-from __future__ import print_function
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 __doc__ = "Class / methods to test EGammaAmbiguityTool. Scripts in test/ directory"
 __author__ = "Bruno Lenzi"
@@ -51,7 +49,7 @@ if 'AtlasVersion' in os.environ:
   
     def execute(self):
       for container in 'Photons', 'Electrons':
-        self.msg.info('\n*** %s ****' % container)
+        self.msg.info('\n*** %s ****', container)
         for obj in self.storeGateSvc[container]:
           printAmbiguityInfo(obj, self.tool, self.msg.info)
     
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigEGammaPIDdefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigEGammaPIDdefs.py
index 4365b1e216ffa178ade69cf0190420710a6455d6..21b3e98e059af87ea619d722eec7b4512d11b8dc 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigEGammaPIDdefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigEGammaPIDdefs.py
@@ -1,6 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-
-from __future__ import print_function
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 class TrigEgammaIDQuality:
     ElectronIDLoose = 0
@@ -275,7 +273,7 @@ class SelectionDefElectron:
         Electron_trk = CutDefElectron.TRACKINGLOOSE_ELECTRON
         
 
-""" \enum Bitdefinitons for the egamma class for photon identification
+r""" \enum Bitdefinitons for the egamma class for photon identification
     see egammaParameters for info on the variable definitions """
 class BitDefPhoton:
    """ @brief cluster eta range """
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMLoose1SelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMLoose1SelectorCutDefs.py
index c5f481af9bc396e85843483c3ee6092b0994f65f..e42cb63c05873eb6bf21e5ac39daa311785d10ba 100755
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMLoose1SelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMLoose1SelectorCutDefs.py
@@ -11,7 +11,7 @@
 ##===============================================================================
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 # Define GeV
 GeV = 1000.0
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMLooseSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMLooseSelectorCutDefs.py
index bdcdafa4e8b36448c4ddb0b62c60e5e897af4652..d81ab4cf23441103c8f3686ebe3694a4bb5fa2a7 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMLooseSelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMLooseSelectorCutDefs.py
@@ -11,7 +11,7 @@
 ##===============================================================================
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 # Define GeV
 GeV = 1000.0
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMMedium1SelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMMedium1SelectorCutDefs.py
index 3cf1c5b182971c0394715ddcbe5da3638886aa94..9b725984b8e26d8867a4c4295801c9b5dc90261a 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMMedium1SelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMMedium1SelectorCutDefs.py
@@ -11,7 +11,7 @@
 ##===============================================================================
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 # Define GeV
 GeV = 1000.0
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMMediumSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMMediumSelectorCutDefs.py
index 394dfd117e1d93f6af97a842b417be0f89a29967..48c29a1a5baefac16743925dc3ea2e063f1a71c5 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMMediumSelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMMediumSelectorCutDefs.py
@@ -11,7 +11,7 @@
 ##===============================================================================
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 # Define GeV
 GeV = 1000.0
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMTight1SelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMTight1SelectorCutDefs.py
index 4c9953b7fdb8ca0af259ed7c8219058804521fdc..bb062f09d8c09f571f86033cc7325192cffd1603 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMTight1SelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMTight1SelectorCutDefs.py
@@ -11,7 +11,7 @@
 ##===============================================================================
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 # Define GeV
 GeV = 1000.0
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMTightSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMTightSelectorCutDefs.py
index 560a080b7bb18b636a86fd3d4b97a76200e48a00..ce05ff7c7528cfe034538b83a434b9ce729a1a95 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMTightSelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigElectronIsEMTightSelectorCutDefs.py
@@ -13,7 +13,7 @@
 
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 # Define GeV
 GeV = 1000.0
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigPhotonIsEMCaloCutsOnlySelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigPhotonIsEMCaloCutsOnlySelectorCutDefs.py
index fb19dde4c56d445e42ea9d97b52d266a5d54bde0..419c1a9aff549ee108b8b6bf165d19792b897b61 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigPhotonIsEMCaloCutsOnlySelectorCutDefs.py
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/TrigPhotonIsEMCaloCutsOnlySelectorCutDefs.py
@@ -12,7 +12,7 @@
 
 
 # Import a needed helper
-from PATCore.HelperUtils import *
+from PATCore.HelperUtils import GetTool
 
 # Define GeV
 GeV = 1000.0
diff --git a/PhysicsAnalysis/Interfaces/TriggerAnalysisInterfaces/TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h b/PhysicsAnalysis/Interfaces/TriggerAnalysisInterfaces/TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h
index 7063cd6bf7ec103001e4e3a2189ca1e405ea30d8..4b72be7f5a3040996ffdf52eb9d8e7661f3b12a2 100644
--- a/PhysicsAnalysis/Interfaces/TriggerAnalysisInterfaces/TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h
+++ b/PhysicsAnalysis/Interfaces/TriggerAnalysisInterfaces/TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 // contact: jmaurer@cern.ch
@@ -7,29 +7,109 @@
 #ifndef TRIGGERANALYSISINTERFACES_ITRIGGLOBALEFFICIENCYCORRECTIONTOOL_H
 #define TRIGGERANALYSISINTERFACES_ITRIGGLOBALEFFICIENCYCORRECTIONTOOL_H 1
 
-#include "AsgTools/IAsgTool.h"
-#include "xAODEgamma/ElectronFwd.h"
-#include "xAODMuon/Muon.h"
+#include "PATInterfaces/ISystematicsTool.h"
 #include "PATInterfaces/CorrectionCode.h"
+#include "xAODEgamma/Electron.h"
+#include "xAODMuon/Muon.h"
+#include "xAODEgamma/Photon.h"
+
+#include <vector>
+#include <type_traits>
 
-class ITrigGlobalEfficiencyCorrectionTool : public virtual asg::IAsgTool
+class ITrigGlobalEfficiencyCorrectionTool : public virtual CP::ISystematicsTool
 {
 public:
 	ASG_TOOL_INTERFACE(ITrigGlobalEfficiencyCorrectionTool)
+	
+	template<typename Arg> static constexpr bool validArgs(unsigned nTrailingDoubles);
+	template<typename Arg1, typename Arg2, typename... OtherArgs> static constexpr bool validArgs(unsigned nTrailingDoubles);
 
 	virtual CP::CorrectionCode getEfficiencyScaleFactor(const std::vector<const xAOD::IParticle*>& particles, double& efficiencyScaleFactor) = 0;
-	virtual CP::CorrectionCode getEfficiencyScaleFactor(unsigned runNumber, const std::vector<const xAOD::IParticle*>& particles, double& efficiencyScaleFactor) = 0;
 	virtual CP::CorrectionCode getEfficiency(const std::vector<const xAOD::IParticle*>& particles, double& efficiencyData, double& efficiencyMc) = 0;
-	virtual CP::CorrectionCode getEfficiency(unsigned runNumber, const std::vector<const xAOD::IParticle*>& particles, double& efficiencyData, double& efficiencyMc) = 0;		
+	virtual CP::CorrectionCode checkTriggerMatching(bool& matched, const std::vector<const xAOD::IParticle*>& particles) = 0;
+	
+	/// Alternatively, the list of particles can be supplied via one or several vectors of xAOD::Electron*/Muon*/Photon*
+	/// The generic signature is getEfficiencyScaleFactor((const) vector<(const)Type1*>&, ..., (const) vector<(const)TypeN*>&, double& efficiencyScaleFactor)
+	/// e.g. getEfficiencyScaleFactor(electrons, muons, sf);
+	///      getEfficiencyScaleFactor(photons, sf);
+	///      getEfficiencyScaleFactor(muons, electrons, photons, sf);
+	/// don't forget the last argument(s)! (scale factor for getEfficiencyScaleFactor(), data and MC efficiencies for getEfficiency())
+	template<typename... Args>
+	auto getEfficiencyScaleFactor(Args&... args) -> std::enable_if_t<validArgs<Args...>(1), CP::CorrectionCode>;
+	template<typename... Args>
+	auto getEfficiency(Args&... args) -> std::enable_if_t<validArgs<Args...>(2), CP::CorrectionCode>;
+	template<typename... Args>
+	auto checkTriggerMatching(bool& matched, Args&... args) -> std::enable_if_t<validArgs<Args...>(0), CP::CorrectionCode>;
+	
+	/// This will fill the 'triggers' argument with the names of the triggers relevant for the current run number, among those specified in the tool configuration
+	virtual CP::CorrectionCode getRelevantTriggers(std::vector<std::string>& triggers) = 0;
+	
+	/// This utility function provides the number of legs for the specified trigger
+	virtual CP::CorrectionCode countTriggerLegs(const std::string& trigger, std::size_t& numberOfLegs) = 0;
+	
+	/// These should in principle not be used (except by unit tests), as the CP tools require the EventInfo decoration "RandomRunNumber" to be present 
+	virtual CP::CorrectionCode getEfficiencyScaleFactor(unsigned runNumber, const std::vector<const xAOD::IParticle*>& particles, double& efficiencyScaleFactor) = 0;
+	virtual CP::CorrectionCode getEfficiency(unsigned runNumber, const std::vector<const xAOD::IParticle*>& particles, double& efficiencyData, double& efficiencyMc) = 0;	
 	
-	virtual CP::CorrectionCode getEfficiencyScaleFactor(const std::vector<const xAOD::Electron*>& electrons,
-			const std::vector<const xAOD::Muon*>& muons, double& efficiencyScaleFactor) = 0;
-	virtual CP::CorrectionCode getEfficiencyScaleFactor(unsigned runNumber, const std::vector<const xAOD::Electron*>& electrons,
-			const std::vector<const xAOD::Muon*>& muons, double& efficiencyScaleFactor) = 0;
-	virtual CP::CorrectionCode getEfficiency(const std::vector<const xAOD::Electron*>& electrons,
-			const std::vector<const xAOD::Muon*>& muons, double& efficiencyData, double& efficiencyMc) = 0;
-	virtual CP::CorrectionCode getEfficiency(unsigned runNumber, const std::vector<const xAOD::Electron*>& electrons,
-			const std::vector<const xAOD::Muon*>& muons, double& efficiencyData, double& efficiencyMc) = 0;	
+protected:
+	double* handleArg(double& arg, std::vector<const xAOD::IParticle*>&) { return &arg; }
+	template<typename P>  double* handleArg(const std::vector<P>& arg, std::vector<const xAOD::IParticle*>& particles)
+	{
+		for(auto ptr : arg) particles.push_back(static_cast<const xAOD::IParticle*>(ptr));
+		return nullptr;
+	}
 };
 
-#endif //> !TRIGGERANALYSISINTERFACES_ITRIGGLOBALEFFICIENCYCORRECTIONTOOL_H
\ No newline at end of file
+template<typename Arg>
+constexpr bool ITrigGlobalEfficiencyCorrectionTool::validArgs(unsigned nTrailingDoubles)
+{
+	if(std::is_same<double, Arg>::value) return (nTrailingDoubles==1);
+	using P = std::remove_cv_t<Arg>;
+	return std::is_same<P, std::vector<xAOD::Electron*>>::value
+		|| std::is_same<P, std::vector<const xAOD::Electron*>>::value
+		|| std::is_same<P, std::vector<xAOD::Muon*>>::value
+		|| std::is_same<P, std::vector<const xAOD::Muon*>>::value
+		|| std::is_same<P, std::vector<xAOD::Photon*>>::value
+		|| std::is_same<P, std::vector<const xAOD::Photon*>>::value;
+}
+
+template<typename Arg1, typename Arg2, typename... OtherArgs>
+constexpr bool ITrigGlobalEfficiencyCorrectionTool::validArgs(unsigned nTrailingDoubles)
+{
+	bool xs [] = { std::is_same<OtherArgs, double>::value..., true };
+	for(bool x : xs) if(!x) return validArgs<Arg1>(0) && validArgs<Arg2, OtherArgs...>(nTrailingDoubles);
+	unsigned nTD = sizeof...(OtherArgs);
+	if(nTD == nTrailingDoubles) return validArgs<Arg1>(0) && validArgs<Arg2>(0);
+	if(nTD == nTrailingDoubles-1) return validArgs<Arg1>(0) && std::is_same<Arg2, double>::value;
+	if(nTD == nTrailingDoubles-2) return std::is_same<Arg1, double>::value && std::is_same<Arg2, double>::value;
+	return false;
+}
+
+template<typename... Args>
+auto ITrigGlobalEfficiencyCorrectionTool::getEfficiencyScaleFactor(Args&... args)
+	-> std::enable_if_t<validArgs<Args...>(1), CP::CorrectionCode>
+{
+	std::vector<const xAOD::IParticle*> particles;
+	double* sf[] = { nullptr, handleArg(args, particles)... };
+	return getEfficiencyScaleFactor(particles, *sf[sizeof...(Args)]);
+}
+
+template<typename... Args>
+auto ITrigGlobalEfficiencyCorrectionTool::getEfficiency(Args&... args)
+	-> std::enable_if_t<validArgs<Args...>(2), CP::CorrectionCode>
+{
+	std::vector<const xAOD::IParticle*> particles;
+	double* eff[] = { nullptr, handleArg(args, particles)... };
+	return getEfficiency(particles, *eff[sizeof...(Args)-1], *eff[sizeof...(Args)]);
+}
+
+template<typename... Args>
+auto ITrigGlobalEfficiencyCorrectionTool::checkTriggerMatching(bool& matched, Args&... args)
+	-> std::enable_if_t<validArgs<Args...>(0), CP::CorrectionCode>
+{
+	std::vector<const xAOD::IParticle*> particles;
+	double* eff[] __attribute__((unused)) = { nullptr, handleArg(args, particles)... };
+	return checkTriggerMatching(matched, particles);
+}
+
+#endif //> !TRIGGERANALYSISINTERFACES_ITRIGGLOBALEFFICIENCYCORRECTIONTOOL_H
diff --git a/PhysicsAnalysis/MuonID/MuonSelectorTools/Root/MuonSelectionTool.cxx b/PhysicsAnalysis/MuonID/MuonSelectorTools/Root/MuonSelectionTool.cxx
index 1149b107390ff45960cf8007777c39dce2fdd871..229998fd8d618831579776d3bc0d4fb19470b5f3 100644
--- a/PhysicsAnalysis/MuonID/MuonSelectorTools/Root/MuonSelectionTool.cxx
+++ b/PhysicsAnalysis/MuonID/MuonSelectorTools/Root/MuonSelectionTool.cxx
@@ -285,19 +285,19 @@ namespace CP {
     }
     acceptData.setCutResult( "Eta", true );
 
-    // Passes ID hit cuts 
-    ATH_MSG_VERBOSE( "Passes ID Hit cuts " << passedIDCuts(mu) );
-    if( !passedIDCuts (mu) ) {
-      return acceptData;
-    }
-    acceptData.setCutResult( "IDHits", true );
+    // Passes ID hit cuts
+    bool passIDCuts=passedIDCuts(mu);
+    ATH_MSG_VERBOSE( "Passes ID Hit cuts " << passIDCuts);
+    acceptData.setCutResult( "IDHits", passIDCuts );
     
-    // Passes muon preselection
-    ATH_MSG_VERBOSE( "Passes preselection cuts " << passedMuonCuts(mu) );
-    if( !passedMuonCuts (mu) ) {
+    //passes muon preselection
+    bool passMuonCuts=passedMuonCuts(mu);
+    ATH_MSG_VERBOSE( "Passes preselection cuts " << passMuonCuts );
+    acceptData.setCutResult( "Preselection", passMuonCuts );
+    
+    if( !passIDCuts || !passMuonCuts ) {
       return acceptData;
-    }
-    acceptData.setCutResult( "Preselection", true );
+    }    
 
     // Passes quality requirements 
     xAOD::Muon::Quality thisMu_quality = getQuality(mu);
@@ -1169,7 +1169,7 @@ namespace CP {
       else return true;
     }
     // ::
-    if( mu.muonType() == xAOD::Muon::CaloTagged && std::abs(mu.eta())<0.105 && passedCaloTagQuality(mu)) return true;
+    if( mu.muonType() == xAOD::Muon::CaloTagged && std::abs(mu.eta())<0.105 ) return true; //removed the passedCaloTagQuality(mu) until this is better understood in r22
     // ::
     if( mu.muonType() == xAOD::Muon::SegmentTagged && std::abs(mu.eta())<0.105 ) return true;
     // ::
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/CMakeLists.txt b/PhysicsAnalysis/PrimaryDPDMaker/CMakeLists.txt
index 0b18f944b5edaad0bfd82afeb24f0d0a6c841953..dc9b8410d65a43b7b58baba07d14ee759c4a4f5e 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/CMakeLists.txt
+++ b/PhysicsAnalysis/PrimaryDPDMaker/CMakeLists.txt
@@ -1,37 +1,28 @@
-################################################################################
-# Package: PrimaryDPDMaker
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( PrimaryDPDMaker )
 
 # External dependencies:
-find_package( CLHEP )
-find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
+find_package( ROOT COMPONENTS Core MathCore )
 
 # Component(s) in the package:
 atlas_add_library( PrimaryDPDMakerLib
                    src/*.cxx
                    PUBLIC_HEADERS PrimaryDPDMaker
-                   INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                   DEFINITIONS ${CLHEP_DEFINITIONS}
-                   LINK_LIBRARIES ${CLHEP_LIBRARIES} CaloEvent AthenaBaseComps AthenaKernel AthLinks AthContainers IRegionSelector Identifier EventKernel GaudiKernel InDetIdentifier InDetReadoutGeometry InDetPrepRawData Particle TrkTrack TrkToolInterfaces StoreGateLib SGtests DerivationFrameworkInterfaces
-                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} RoiDescriptor FourMom FourMomUtils NavFourMom xAODEventInfo xAODMuon xAODTracking InDetRIO_OnTrack LArRecEvent AnalysisTriggerEvent MuonSelectorToolsLib JetEvent muonEvent egammaEvent tauEvent TileEvent TileIdentifier TrkParameters TrkParticleBase TrkPseudoMeasurementOnTrack TrkTrackSummary VxVertex )
+                   LINK_LIBRARIES AthenaBaseComps DerivationFrameworkInterfaces GaudiKernel MuonAnalysisInterfacesLib StoreGateLib TrkToolInterfaces TrkTrack
+                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} CxxUtils EventKernel LArRecEvent NavFourMom TileEvent TileIdentifier xAODEventInfo xAODMuon xAODTracking )
 
 atlas_add_component( PrimaryDPDMaker
                      src/components/*.cxx
-                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} CaloEvent AthenaBaseComps AthenaKernel AthLinks AthContainers StoreGateLib SGtests IRegionSelector Identifier EventKernel GaudiKernel InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetPrepRawData Particle TrkTrack TrkToolInterfaces RoiDescriptor FourMom FourMomUtils NavFourMom xAODEventInfo xAODMuon xAODTracking InDetRIO_OnTrack LArRecEvent AnalysisTriggerEvent MuonSelectorToolsLib JetEvent muonEvent egammaEvent tauEvent TileEvent TileIdentifier TrkParameters TrkParticleBase TrkPseudoMeasurementOnTrack TrkTrackSummary VxVertex PrimaryDPDMakerLib )
+                     LINK_LIBRARIES PrimaryDPDMakerLib )
 
 atlas_add_dictionary( PrimaryDPDMakerDict
                       PrimaryDPDMaker/PrimaryDPDMakerDict.h
                       PrimaryDPDMaker/selection.xml
-                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} CaloEvent AthenaBaseComps AthenaKernel AthLinks AthContainers StoreGateLib SGtests IRegionSelector Identifier EventKernel GaudiKernel InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetPrepRawData Particle TrkTrack TrkToolInterfaces RoiDescriptor FourMom FourMomUtils NavFourMom xAODEventInfo xAODMuon xAODTracking InDetRIO_OnTrack LArRecEvent AnalysisTriggerEvent MuonSelectorToolsLib JetEvent muonEvent egammaEvent tauEvent TileEvent TileIdentifier TrkParameters TrkParticleBase TrkPseudoMeasurementOnTrack TrkTrackSummary VxVertex PrimaryDPDMakerLib )
+                      LINK_LIBRARIES PrimaryDPDMakerLib )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/*.py )
-atlas_install_runtime( test/PrimaryDPDMaker_TestConfiguration.xml )
-
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/DummyFilter.py b/PhysicsAnalysis/PrimaryDPDMaker/python/DummyFilter.py
index 1d46a7f9a51f47abcbc437b60b7b3e8b54127891..4c12c30677caafa7fbb9fb7def4905350592fd6a 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/python/DummyFilter.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/python/DummyFilter.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        DummyFilter.py
@@ -49,7 +49,7 @@ class DummyFilter( PyAthena.AthFilterAlgorithm ):
 
     def execute(self):
         self.nProcessed += 1
-        self.msg.debug( '==> execute %s on %r. event...' % (self.name(), self.nProcessed) )
+        self.msg.debug( '==> execute %s on %r. event...', self.name(), self.nProcessed )
         self.setFilterPassed(True)
         
         return StatusCode.Success
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/ElectronFilter.py b/PhysicsAnalysis/PrimaryDPDMaker/python/ElectronFilter.py
index 05d6f74a01cba635aef1cbacb59e90a42502a05e..5ed593ddc1fcb848394c263abc3d23c83d073296 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/python/ElectronFilter.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/python/ElectronFilter.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        Electron Skimmer
@@ -95,7 +95,7 @@ class ElectronFilter( PyAthena.AthFilterAlgorithm ):
 
         ## Import needed modules
         import PyUtils.RootUtils as ru
-        ROOT = ru.import_root()
+        ROOT = ru.import_root()  # noqa: F841
 
         ## Get the StoreGate service
         self.storeGateSvc = PyAthena.py_svc('StoreGateSvc')
@@ -110,7 +110,7 @@ class ElectronFilter( PyAthena.AthFilterAlgorithm ):
 
     def execute(self):
         self.nProcessed+=1
-        self.msg.debug( '==> execute %s on %r. event...' % (self.name(), self.nProcessed) )
+        self.msg.debug( '==> execute %s on %r. event...', self.name(), self.nProcessed )
         
         nElPassEta    = 0
         nElPassEt     = 0
@@ -126,7 +126,7 @@ class ElectronFilter( PyAthena.AthFilterAlgorithm ):
         
         ## If passAll is selected, accept all events
         if self.passAll :
-            self.msg.debug( '%s event passed because passAll is true' % self.name() )
+            self.msg.debug( '%s event passed because passAll is true', self.name() )
             self.setFilterPassed(True)
             return StatusCode.Success
 
@@ -138,7 +138,7 @@ class ElectronFilter( PyAthena.AthFilterAlgorithm ):
             electronCollection = self.storeGateSvc.retrieve( self.electronCollectionType, self.electronCollectionName )
             pass
         except LookupError:
-            self.msg.warning( 'Collection %s not found' % self.electronCollectionName )           
+            self.msg.warning( 'Collection %s not found', self.electronCollectionName )
             self.setFilterPassed(True)
             return StatusCode.Success
 
@@ -148,7 +148,7 @@ class ElectronFilter( PyAthena.AthFilterAlgorithm ):
             # Use Et of CaloCluster.
             cluster = None
             cluster = electron.cluster()
-            if cluster == None :
+            if cluster is None :
                 self.msg.warning( 'Could not get the cluster for this electron!' )
                 pass
             else :
@@ -193,18 +193,18 @@ class ElectronFilter( PyAthena.AthFilterAlgorithm ):
         #    goodElectronColl.push_back(el)
         #    pass
         if self.storeGateSvc.record( goodElectrons, self.goodElectronCollectionName ) != StatusCode.Success :
-            self.msg.error( 'Could not record the goodElectrons into StoreGate with the key = ' % self.goodElectronCollectionName )
+            self.msg.error( 'Could not record the goodElectrons into StoreGate with the key = ', self.goodElectronCollectionName )
             pass
 
 
         ## Check if the event is accepted
         if goodElectrons.__len__() >= self.minNumberPassed :
             self.nEventMinNumPassed += 1
-            self.msg.debug( '%s event passed.' % self.name() )
+            self.msg.debug( '%s event passed.', self.name() )
             self.setFilterPassed(True)
             pass
         else :
-            self.msg.debug( '%s event failed.' % self.name() )
+            self.msg.debug( '%s event failed.', self.name() )
             self.setFilterPassed(False)
             pass
 
@@ -257,17 +257,17 @@ class ElectronFilter( PyAthena.AthFilterAlgorithm ):
             pass
 
         
-        self.msg.info( '==> finalize %s...' % self.name() )
+        self.msg.info( '==> finalize %s...', self.name() )
         self.msg.info( '***************************************************************' )
-        self.msg.info( 'Cut-flow table of %s skimming algorithm:' % self.name() )
+        self.msg.info( 'Cut-flow table of %s skimming algorithm:', self.name() )
         self.msg.info( '-------------' )
-        self.msg.info( ' Number of processed events:  %r' % self.nProcessed )
-        self.msg.info( ' Number of all electrons:     %r and number of electrons per event: %3.3f +/- %3.3f' % ( self.nElectrons, effiElectrons, effiErrElectrons ) )
-        self.msg.info( ' Events after eta cut:        %r and resulting efficiency = (%3.3f +/- %3.3f)%%' % ( self.nEventElPassEta,    effiElPassEta,    effiErrElPassEta ) )
-        self.msg.info( ' Events after E_T cut:        %r and resulting efficiency = (%3.3f +/- %3.3f)%%' % ( self.nEventElPassEt,     effiElPassEt,     effiErrElPassEt ) )
-        self.msg.info( ' Events after author cut:     %r and resulting efficiency = (%3.3f +/- %3.3f)%%' % ( self.nEventElPassAuthor, effiElPassAuthor, effiErrElPassAuthor ) )
-        self.msg.info( ' Events after IsEM cut:       %r and resulting efficiency = (%3.3f +/- %3.3f)%%' % ( self.nEventElPassIsEM,   effiElPassIsEM,   effiErrElPassIsEM ) )
-        self.msg.info( ' Events after minNumberPassed %r and resulting efficiency = (%3.3f +/- %3.3f)%%' % ( self.nEventMinNumPassed, effiMinNumPassed, effiErrMinNumPassed ) )
+        self.msg.info( ' Number of processed events:  %r', self.nProcessed )
+        self.msg.info( ' Number of all electrons:     %r and number of electrons per event: %3.3f +/- %3.3f', self.nElectrons, effiElectrons, effiErrElectrons )
+        self.msg.info( ' Events after eta cut:        %r and resulting efficiency = (%3.3f +/- %3.3f)%%', self.nEventElPassEta,    effiElPassEta,    effiErrElPassEta )
+        self.msg.info( ' Events after E_T cut:        %r and resulting efficiency = (%3.3f +/- %3.3f)%%', self.nEventElPassEt,     effiElPassEt,     effiErrElPassEt )
+        self.msg.info( ' Events after author cut:     %r and resulting efficiency = (%3.3f +/- %3.3f)%%', self.nEventElPassAuthor, effiElPassAuthor, effiErrElPassAuthor )
+        self.msg.info( ' Events after IsEM cut:       %r and resulting efficiency = (%3.3f +/- %3.3f)%%', self.nEventElPassIsEM,   effiElPassIsEM,   effiErrElPassIsEM )
+        self.msg.info( ' Events after minNumberPassed %r and resulting efficiency = (%3.3f +/- %3.3f)%%', self.nEventMinNumPassed, effiMinNumPassed, effiErrMinNumPassed )
         self.msg.info( '***************************************************************' )
 
         return StatusCode.Success
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/JobTransformConfiguration.py b/PhysicsAnalysis/PrimaryDPDMaker/python/JobTransformConfiguration.py
index fda61e91ba222fc97bf39bfae5bc05b0d14767d3..ddffdb150c2d6018d4e2fef43409460d0f396508 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/python/JobTransformConfiguration.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/python/JobTransformConfiguration.py
@@ -7,8 +7,6 @@
 # Creation: David Cote (DESY), August 2008 #
 ############################################
 
-from __future__ import print_function
-
 __doc__ = """Set of functions to configure DPD from PATJobTransforms"""
     
 def ApplyPrescale(arg):
@@ -18,13 +16,13 @@ def ApplyPrescale(arg):
             name_val=arg[4:]
             try:
                 i=name_val.rindex('_')
-            except:
+            except Exception:
                 raise SyntaxError("ApplyPrescale arg needs to have the form 'SET_StreamName_val', arg= "+arg)
             name=name_val[:i]
             val=name_val[i+1:]
             try:
                 prescale=int(val)
-            except:
+            except Exception:
                 raise TypeError("ApplyPrescale val needs to be an integer: val= "+val)
         else:
             raise SyntaxError("ApplyPrescale arg needs to start with 'SET_'. arg= "+arg)
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/LogicalFilterCombiner.py b/PhysicsAnalysis/PrimaryDPDMaker/python/LogicalFilterCombiner.py
index bfa191a6f1a62dfd6e9dd9ef37bdfb26a50c592e..cf7072bb97794cde0fb026a809658a573dd9553e 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/python/LogicalFilterCombiner.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/python/LogicalFilterCombiner.py
@@ -19,9 +19,6 @@ __author__  = "Marcello Barisonzi <Marcello.Barisonzi@desy.de>"
 
 import AthenaPython.PyAthena as PyAthena
 
-from AthenaCommon.AlgSequence import AlgSequence
-from AthenaCommon.Logging import logging
-
 import tokenize
 from io import StringIO
 
@@ -93,7 +90,7 @@ class LogicalFilterCombiner( PyAthena.AthFilterAlgorithm ):
                         self.msg.error("Algorithm %s not found" , tokval)
                         return False
                     else:
-                        self.msg.debug("Found algorithm: %s -> %s" % (tokval, _alg))
+                        self.msg.debug("Found algorithm: %s -> %s", tokval, _alg)
 
                     exec('self.%s = _alg' % tokval)
                     self.cutFlowSvc().declareChildFilter(tokval,self.cutID)
@@ -114,7 +111,7 @@ class LogicalFilterCombiner( PyAthena.AthFilterAlgorithm ):
             self.msg.debug("String changed internally to:\n%s", self.cmd)
 
             #execute command once to validate
-            response = bool(eval(self.cmd))
+            eval(self.cmd)
         except Exception as e:
             self.msg.fatal("Not a valid Python string. Exception: %s" % e)
             import traceback
@@ -129,7 +126,7 @@ class LogicalFilterCombiner( PyAthena.AthFilterAlgorithm ):
 
         self.nEventsProcessed+=1
         for k,v in self.algdict.iteritems():
-            self.msg.debug("Alg %s : %s" % (k, v.filterPassed()))
+            self.msg.debug("Alg %s : %s", k, v.filterPassed())
             pass
 
         
@@ -137,13 +134,13 @@ class LogicalFilterCombiner( PyAthena.AthFilterAlgorithm ):
         response = bool(eval(self.cmd))
         if response:
             self.nEventsPassed+=1
-        self.msg.debug("Response is: %s" % response)
+        self.msg.debug("Response is: %s", response)
         self.setFilterPassed(response)
         return True
 
     def finalize(self):
-        self.msg.info("nEventsProcessed is: %s" % self.nEventsProcessed)
-        self.msg.info("nEventsPassed is: %s" % self.nEventsPassed)        
+        self.msg.info("nEventsProcessed is: %s", self.nEventsProcessed)
+        self.msg.info("nEventsPassed is: %s", self.nEventsPassed)
         return True
 
 
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/MissingEtFilter.py b/PhysicsAnalysis/PrimaryDPDMaker/python/MissingEtFilter.py
index 3db0f7cca3d55af99452b8f640ccb73c8791203c..0c7bb2c7c8b04e110d32f59fc9dabc3ce04fb9d7 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/python/MissingEtFilter.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/python/MissingEtFilter.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        MissingEtFilter.py
@@ -27,8 +27,6 @@ __author__  = "Karsten Koeneke <karsten.koeneke@cern.ch>"
 import AthenaPython.PyAthena as PyAthena
 from AthenaPython.PyAthena import StatusCode
 
-from PrimaryDPDMaker import PrimaryDPDHelpers
-
 ## Import the module that allows to use named units, e.g. GeV
 import AthenaCommon.SystemOfUnits as Units
 
@@ -102,7 +100,7 @@ class MissingEtFilter( PyAthena.AthFilterAlgorithm ):
 
         ## Import needed modules
         import PyUtils.RootUtils as ru
-        ROOT = ru.import_root()
+        ROOT = ru.import_root()  # noqa: F841
 
         ## Eagerly load library due to reflex bug (autoloading enums/namespaces doesn't work)
         #PyAthena.load_library ('FourMomUtils')
@@ -112,7 +110,7 @@ class MissingEtFilter( PyAthena.AthFilterAlgorithm ):
         self.jss = PyAthena.SignalStateHelper(PyAthena.P4SignalState.JETFINAL)
 
         ## import some 4-mom utils
-        import FourMomUtils.Bindings
+        import FourMomUtils.Bindings  # noqa: F401
         self.utils = { 'deltaR' :   PyAthena.P4Helpers.deltaR ,
                        'deltaEta' : PyAthena.P4Helpers.deltaEta ,
                        'deltaPhi' : PyAthena.P4Helpers.deltaPhi }
@@ -128,12 +126,12 @@ class MissingEtFilter( PyAthena.AthFilterAlgorithm ):
         self.nProcessed+=1
 
         # Print a message to the log file
-        self.msg.debug( '==> execute %s on %r. event...' % (self.name(), self.nProcessed) )
+        self.msg.debug( '==> execute %s on %r. event...', self.name(), self.nProcessed )
         
 
         ## If passAll is selected, accept all events
         if self.passAll :
-            self.msg.debug( '%s event passed because passAll is true' % self.name() )
+            self.msg.debug( '%s event passed because passAll is true', self.name() )
             self.setFilterPassed(True)
             return StatusCode.Success
 
@@ -144,7 +142,7 @@ class MissingEtFilter( PyAthena.AthFilterAlgorithm ):
             met = self.storeGateSvc.retrieve( self.metCollectionType, self.metCollectionName )
             pass
         except LookupError:
-            self.msg.warning( 'Collection %s not found' % self.metCollectionName )           
+            self.msg.warning( 'Collection %s not found', self.metCollectionName )
             if self.requireMet:
                 self.setFilterPassed(False)
             else:
@@ -157,28 +155,28 @@ class MissingEtFilter( PyAthena.AthFilterAlgorithm ):
         jetList = []
         leadJet   = None
         if self.useLeadingJet :
-            self.msg.debug( 'Going to load the jets of type %s and key %s.' % (self.jetCollectionTypeList, self.jetCollectionNameList) )
+            self.msg.debug( 'Going to load the jets of type %s and key %s.', self.jetCollectionTypeList, self.jetCollectionNameList)
             if self.jetCollectionTypeList.__len__() == self.jetCollectionNameList.__len__() :
                 for i in range( self.jetCollectionTypeList.__len__() ) :
                     try:
                         lepColl = self.storeGateSvc.retrieve( self.jetCollectionTypeList[i],
                                                               self.jetCollectionNameList[i] )
-                        self.msg.debug( 'Loading the jet collection %s from the input file.'
-                                        % self.jetCollectionNameList[i] )
+                        self.msg.debug( 'Loading the jet collection %s from the input file.',
+                                        self.jetCollectionNameList[i] )
                         for lep in lepColl :
                             jetList.append(lep)
                             pass
                         pass
                     except LookupError:
                         if self.nProcessed <100:
-                            self.msg.warning( 'Collection %s not found' % self.jetCollectionNameList[i] )           
+                            self.msg.warning( 'Collection %s not found', self.jetCollectionNameList[i] )
                             pass
                         pass
                     pass
                 pass
             else :
-                self.msg.error( 'List of jets type %s and key %s has different lenght!'
-                                % (self.jetCollectionTypeList, self.jetCollectionNameList) )
+                self.msg.error( 'List of jets type %s and key %s has different lenght!',
+                                self.jetCollectionTypeList, self.jetCollectionNameList )
                 pass
                 
 
@@ -242,10 +240,10 @@ class MissingEtFilter( PyAthena.AthFilterAlgorithm ):
 
         ## Check if the event is accepted
         if PassMet and PassDeltaPhi :
-            self.msg.debug( '%s event passed ' % self.name() )
+            self.msg.debug( '%s event passed ', self.name() )
             self.setFilterPassed(True)
         else:
-            self.msg.debug( '%s event failed ' % self.name() )
+            self.msg.debug( '%s event failed ', self.name() )
             self.setFilterPassed(False)
             pass
         
@@ -279,15 +277,15 @@ class MissingEtFilter( PyAthena.AthFilterAlgorithm ):
             pass
 
         
-        self.msg.info( '==> finalize %s...' % self.name() )
+        self.msg.info( '==> finalize %s...', self.name() )
         self.msg.info( '***************************************************************' )
-        self.msg.info( 'Cut-flow table of %s skimming algorithm:' % self.name() )
+        self.msg.info( 'Cut-flow table of %s skimming algorithm:', self.name() )
         self.msg.info( '-------------' )
-        self.msg.info( ' Number of processed events: %r' % self.nProcessed )
-        self.msg.info( ' Events after Met cut:       %r, efficiency = (%3.3f +/- %3.3f)%%' %
-                       ( self.nEventPassMet, effPassMet, efferrPassMet ) )
-        self.msg.info( ' Events after deltaPhi cut:  %r, efficiency = (%3.3f +/- %3.3f)%%' %
-                       ( self.nEventPassDeltaPhi, effDeltaPhi, efferrDeltaPhi ) )
+        self.msg.info( ' Number of processed events: %r', self.nProcessed )
+        self.msg.info( ' Events after Met cut:       %r, efficiency = (%3.3f +/- %3.3f)%%',
+                       self.nEventPassMet, effPassMet, efferrPassMet )
+        self.msg.info( ' Events after deltaPhi cut:  %r, efficiency = (%3.3f +/- %3.3f)%%',
+                       self.nEventPassDeltaPhi, effDeltaPhi, efferrDeltaPhi )
         self.msg.info( '***************************************************************' )
 
         return StatusCode.Success
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_PerfMS.py b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_PerfMS.py
index 3484d461c87766aacf063bef3d1dab8a81901c2f..f7345496c1fac07b7de7f131e8f80c8b7f36b4f0 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_PerfMS.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_PerfMS.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        PrimaryDESDMFlags_PerfMSStream
@@ -15,7 +15,6 @@ __author__  = "Saminder Dhaliwal <s.dhaliwal@cern.ch>"
 
 from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
 from AthenaCommon.JobProperties import jobproperties
-import AthenaCommon.SystemOfUnits as Units
 
 
 #=====================================================================
@@ -39,11 +38,11 @@ primDPDAlignTrigMu=jobproperties.PrimaryDESDMFlags_PerfMSStream
 ## General switches
 
 class doAlignmentFormat(JobProperty):
-		"""  Switch between Alignment and Trigger DESDM format. Default is Trigger. """
-		statusOn			= True
-		allowedTypes	= ['bool']
-		StoredValue		= False
-		pass
+    """  Switch between Alignment and Trigger DESDM format. Default is Trigger. """
+    statusOn			= True
+    allowedTypes	= ['bool']
+    StoredValue		= False
+    pass
 jobproperties.PrimaryDESDMFlags_PerfMSStream.add_JobProperty(doAlignmentFormat)
 
 class ApplySkimming(JobProperty):
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_TileMu.py b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_TileMu.py
index 5fb3f3b1af629907173500661977918c52d4137b..ab0c6e8ee3b4ccc904a5d703f19c1fdb32f28ae2 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_TileMu.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDESDMFlags_TileMu.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        PrimaryDESDMFlags_TileMuStream
@@ -14,7 +14,6 @@ __author__  = "Tomoe Kishimoto <tomoe.kishimoto@cern.ch>"
 
 from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
 from AthenaCommon.JobProperties import jobproperties
-import AthenaCommon.SystemOfUnits as Units
 
 
 #=====================================================================
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDFlags.py b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDFlags.py
index c086a7c36e3a594f5a299cd977c27b39caa2a449..225a35b8777a0482b7221b1d861e4ab077774d6d 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDFlags.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDFlags.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        PrimaryDPDFlags
@@ -9,16 +9,12 @@
 ## Description: Here, all neccessary job flags for the PrimaryDPDMaker
 ##              are defined.
 ##
-## $Id: PrimaryDPDFlags.py,v 1.44 2009-05-11 12:20:32 cgatti Exp $
 ##=============================================================================
 
 __doc__ = """Here, all neccessary job flags for the PrimaryDPDMaker are defined."""
 __version__ = "0.0.1"
 __author__  = "Karsten Koeneke <karsten.koeneke@desy.de>"
 
-## Import the module that allows to use named units, e.g. GeV
-import AthenaCommon.SystemOfUnits as Units
-
 from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
 from AthenaCommon.JobProperties import jobproperties
 
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDHelpers.py b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDHelpers.py
index a6255a9e8a45c432038e3c28295d60e5be44aa73..c3ce176bf7fe72c51cdbc18c7ca2f40356b8d345 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDHelpers.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPDHelpers.py
@@ -19,7 +19,6 @@ msg = logging.getLogger( 'PrimaryDPDHelpers' )
 ## Import needed modules
 import PyUtils.RootUtils as ru
 ROOT = ru.import_root()
-import cppyy
 
 
 # This function correctly determines the name of the output file.
@@ -50,42 +49,42 @@ def checkEgammaAuthor(egammaCand, authorName="either"):
             if ROOT.egamma.author(egammaCand) != 8 :
                 return True
             else :
-                msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) )
+                msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName)
                 return False
 
         elif authorName == "forward" :
             if ROOT.egamma.author(egammaCand) == 8 :
                 return True
             else :
-                msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) )
+                msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName)
                 return False
 
         elif authorName == "onlyEgamma" or authorName == "onlyElectron" :
             if ROOT.egamma.author(egammaCand) == 1 :
                 return True
             else :
-                msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) )
+                msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName)
                 return False
 
         elif authorName == "egamma" or authorName == "Electron" :
             if ROOT.egamma.author(egammaCand) == 1 or ROOT.egamma.author(egammaCand) == 3 :
                 return True
             else :
-                msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) )
+                msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName)
                 return False
 
         elif authorName == "onlySofte" :
             if ROOT.egamma.author(egammaCand) == 2 :
                 return True
             else :
-                msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) )
+                msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName)
                 return False
 
         elif authorName == "softe" :
             if ROOT.egamma.author(egammaCand) == 2 or ROOT.egamma.author(egammaCand) == 3 :
                 return True
             else :
-                msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) )
+                msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName)
                 return False
 
         elif authorName == "eitherElectron" :
@@ -94,18 +93,18 @@ def checkEgammaAuthor(egammaCand, authorName="either"):
                    or ROOT.egamma.author(egammaCand) == 3 :
                 return True
             else :
-                msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) )
+                msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName)
                 return False
 
         elif authorName == "Photon" :
             if ROOT.egamma.author(egammaCand) == 4 :
                 return True
             else :
-                msg.debug("Egamma object of type=%s failed authorName=%s" % (type(egammaCand), authorName) )
+                msg.debug("Egamma object of type=%s failed authorName=%s", type(egammaCand), authorName)
                 return False
 
         else :
-            msg.debug("Unrecognized authorName=%s of egamma object of type=%s" % (authorName, type(egammaCand)) )
+            msg.debug("Unrecognized authorName=%s of egamma object of type=%s", authorName, type(egammaCand))
             return False
         
 
@@ -116,7 +115,7 @@ def checkEgammaAuthor(egammaCand, authorName="either"):
         return e
 
 
-    msg.error("Problem checking the author of the egamm object with provided authorName=%s and type of passed object=%s" % (authorName, type(egammaCand)) )
+    msg.error("Problem checking the author of the egamm object with provided authorName=%s and type of passed object=%s", authorName, type(egammaCand))
     return False
 
 
@@ -134,28 +133,28 @@ def checkElectronIsEM(electronCand, isemName="None"):
             if electronCand.isem(ROOT.egammaPID.ElectronLoose) == 0 or electronCand.isem(ROOT.egammaPID.frwdElectronLoose) == 0 :
                 return True
             else :
-                msg.debug("Electron object of type=%s failed isemName=%s" % (type(electronCand), isemName) )
+                msg.debug("Electron object of type=%s failed isemName=%s", type(electronCand), isemName)
                 return False
 
         elif isemName == "Medium" :
             if electronCand.isem(ROOT.egammaPID.ElectronMedium) == 0 :
                 return True
             else :
-                msg.debug("Electron object of type=%s failed isemName=%s" % (type(electronCand), isemName) )
+                msg.debug("Electron object of type=%s failed isemName=%s", type(electronCand), isemName)
                 return False
 
         elif isemName == "Tight" :
             if electronCand.isem(ROOT.egammaPID.ElectronTight) == 0 or electronCand.isem(ROOT.egammaPID.frwdElectronTight) == 0 :
                 return True
             else :
-                msg.debug("Electron object of type=%s failed isemName=%s" % (type(electronCand), isemName) )
+                msg.debug("Electron object of type=%s failed isemName=%s", type(electronCand), isemName)
                 return False
 
         elif isemName == "TightNoIsolation" :
             if electronCand.isem(ROOT.egammaPID.ElectronTightNoIsolation) == 0 :
                 return True
             else :
-                msg.debug("Electron object of type=%s failed isemName=%s" % (type(electronCand), isemName) )
+                msg.debug("Electron object of type=%s failed isemName=%s", type(electronCand), isemName)
                 return False
 
         else :
@@ -165,11 +164,11 @@ def checkElectronIsEM(electronCand, isemName="None"):
                 if electronCand.isem( cut ) == 0 :
                     return True
                 else :
-                    msg.debug("Electron object of type=%s failed isemName=%s" % (type(electronCand), isemName) )
+                    msg.debug("Electron object of type=%s failed isemName=%s", type(electronCand), isemName)
                     return False
                 pass
             except AttributeError as err :
-                msg.error("AttributeError when calling checkElectronIsEM with isemName=%s of electron object of type=%s. The error is %s" % (isemName, type(electronCand), err) )
+                msg.error("AttributeError when calling checkElectronIsEM with isemName=%s of electron object of type=%s. The error is %s", isemName, type(electronCand), err)
                 import traceback
                 msg.error(traceback.format_exc())
                 return False
@@ -181,7 +180,7 @@ def checkElectronIsEM(electronCand, isemName="None"):
         msg.error(traceback.format_exc())
         return e
 
-    msg.error("Problem checking the IsEM of the electron object with provided IsEM=%s and type of passed object=%s" % (isemName, type(electronCand)) )
+    msg.error("Problem checking the IsEM of the electron object with provided IsEM=%s and type of passed object=%s", isemName, type(electronCand))
     return False
 
 
@@ -198,14 +197,14 @@ def checkPhotonIsEM(photonCand, isemName="None"):
             if photonCand.isem(ROOT.egammaPID.PhotonLoose) == 0 :
                 return True
             else :
-                msg.debug("Photon object of type=%s failed isemName=%s" % (type(photonCand), isemName) )
+                msg.debug("Photon object of type=%s failed isemName=%s", type(photonCand), isemName)
                 return False
 
         elif isemName == "Photon" or isemName == "PhotonTight" or isemName == "Tight" :
             if photonCand.isem(ROOT.egammaPID.PhotonTight) == 0 :
                 return True
             else :
-                msg.debug("Photon object of type=%s failed isemName=%s" % (type(photonCand), isemName) )
+                msg.debug("Photon object of type=%s failed isemName=%s", type(photonCand), isemName)
                 return False
 
         else :
@@ -215,11 +214,11 @@ def checkPhotonIsEM(photonCand, isemName="None"):
                 if photonCand.isem( cut ) == 0 :
                     return True
                 else :
-                    msg.debug("Photon object of type=%s failed isemName=%s" % (type(photonCand), isemName) )
+                    msg.debug("Photon object of type=%s failed isemName=%s", type(photonCand), isemName)
                     return False
                 pass
             except AttributeError as err :
-                msg.error("AttributeError when calling checkElectronIsEM with isemName=%s of electron object of type=%s. The error is %s" % (isemName, type(photonCand), err) )
+                msg.error("AttributeError when calling checkElectronIsEM with isemName=%s of electron object of type=%s. The error is %s", isemName, type(photonCand), err)
                 import traceback
                 msg.error(traceback.format_exc())
                 return False
@@ -230,7 +229,7 @@ def checkPhotonIsEM(photonCand, isemName="None"):
         msg.error(traceback.format_exc())
         return e
 
-    msg.error("Problem checking the IsEM of the photon object with provided IsEM=%s and type of passed object=%s" % (isemName, type(photonCand)) )
+    msg.error("Problem checking the IsEM of the photon object with provided IsEM=%s and type of passed object=%s", isemName, type(photonCand))
     return False
 
 
@@ -238,7 +237,7 @@ def checkPhotonIsEM(photonCand, isemName="None"):
 def checkMuonAuthor(muonCandidate, authorName="all"):
 
     try:
-        if authorName is "all" :
+        if authorName == "all" :
             return True
     except TypeError as e:
         msg.error("Type error when calling checkMuonAuthor %s",e)
@@ -248,17 +247,17 @@ def checkMuonAuthor(muonCandidate, authorName="all"):
 
     muCandAuthor = ''
     authorNum = muonCandidate.author()
-    if authorNum is 1 or authorNum is 6 or authorNum is 12:
+    if authorNum == 1 or authorNum == 6 or authorNum == 12:
         muCandAuthor = 'combined'
-    elif authorNum is 2 or authorNum is 7 or authorNum is 13:
+    elif authorNum == 2 or authorNum == 7 or authorNum == 13:
         muCandAuthor = 'lowpt'
-    elif authorNum is 4 or authorNum is 5 or authorNum is 10 or authorNum is 11 :
+    elif authorNum == 4 or authorNum == 5 or authorNum == 10 or authorNum == 11 :
         muCandAuthor = 'standalone'
-    elif authorNum is 14 :
+    elif authorNum == 14 :
         muCandAuthor = 'calo'
     try:
 
-        if muCandAuthor is authorName :
+        if muCandAuthor == authorName :
             return True
         
         else :
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPD_OutputDefinitions.py b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPD_OutputDefinitions.py
index bb93dadf2dadfa7bd1220f0f52a6288d782c44b6..db5a65525cb315f16f1c6797dba733d6c2857751 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPD_OutputDefinitions.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/python/PrimaryDPD_OutputDefinitions.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##-----------------------------------------------------------------------------
 ## Name: PrimaryDPD_BasicOutput.py
@@ -9,7 +9,6 @@
 ## Description: This defines the basic output containers to be added to 
 ##              every output stream.
 ##
-## $Id: PrimaryDPD_OutputDefinitions.py,v 1.31 2009-05-04 19:56:52 kkoeneke Exp $
 ##-----------------------------------------------------------------------------
 
 
@@ -30,7 +29,7 @@ from OutputStreamAthenaPool.MultipleStreamManager import MSMgr # For release 14.
 def addAllItemsFromInputExceptExcludeList(streamName,ExcludeList):
     try:
         stream = MSMgr.GetStream(streamName)
-    except:
+    except Exception:
         raise RuntimeError("Unable to get stream %s"%streamName)
     
     # Get the list of all input event-type containers
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/TriggerFilter.py b/PhysicsAnalysis/PrimaryDPDMaker/python/TriggerFilter.py
index 08422f3fd96845f7a3724d07389d8a28f443dd93..a47fa0ce6f5c35c451848c14074ffa9a7b9bf06f 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/python/TriggerFilter.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/python/TriggerFilter.py
@@ -12,8 +12,6 @@
 ##              set of triggers.
 ##=============================================================================
 
-from __future__ import print_function
-
 __doc__ = """This is a short algorithm to select events that pass at least
 one out of a certain set of triggers.
 """
@@ -24,11 +22,6 @@ __author__  = "Eric Feng <Eric.Feng@cern.ch>"
 import AthenaPython.PyAthena as PyAthena
 from AthenaPython.PyAthena import StatusCode
 
-from PrimaryDPDMaker import PrimaryDPDHelpers
-
-## Import the module that allows to use named units, e.g. GeV
-import AthenaCommon.SystemOfUnits as Units
-
 class TriggerFilter( PyAthena.AthFilterAlgorithm ):
     """
     This class is a short algorithm to select events that pass at
@@ -62,7 +55,7 @@ class TriggerFilter( PyAthena.AthFilterAlgorithm ):
 
         ## Import needed modules
         import PyUtils.RootUtils as ru
-        ROOT = ru.import_root()
+        ROOT = ru.import_root()  # noqa: F841
 
         ## Get the TrigDecisionTool tool
         self.tdt = PyAthena.py_tool('Trig::TrigDecisionTool/TrigDecisionTool', iface='Trig::TrigDecisionTool')
@@ -90,12 +83,12 @@ class TriggerFilter( PyAthena.AthFilterAlgorithm ):
         isPassed = False
         
         self.nProcessed+=1
-        self.msg.debug( '==> execute %s on %r. event...' % (self.name, self.nProcessed) )
+        self.msg.debug( '==> execute %s on %r. event...', self.name, self.nProcessed )
         
 
         ## If passAll is selected, accept all events
         if self.passAll :
-            self.msg.debug( '%s event passed because passAll is true' % self.name )
+            self.msg.debug( '%s event passed because passAll is true', self.name )
             self.setFilterPassed(True)
             return StatusCode.Success        
 
@@ -103,8 +96,8 @@ class TriggerFilter( PyAthena.AthFilterAlgorithm ):
         #if self.tdt.isPassed(PyAthena.TrigDec.EF):
         if self.tdt.isPassed( self.trigger ):
             self.nEventPassTrigger += 1
-            self.msg.debug("Trigger %s passed. Count: %d"
-                           % ( self.trigger, self.nEventPassTrigger ) )
+            self.msg.debug("Trigger %s passed. Count: %d",
+                           self.trigger, self.nEventPassTrigger)
             isPassed = True
             pass
         
@@ -133,13 +126,13 @@ class TriggerFilter( PyAthena.AthFilterAlgorithm ):
         except ZeroDivisionError :
             self.msg.warning( 'Division by zero error when calculating the uncertainties on the pass efficiencies...' )
         
-        self.msg.info( '==> finalize %s...' % self.name )
+        self.msg.info( '==> finalize %s...', self.name )
         self.msg.info( '***************************************************************' )
-        self.msg.info( 'Cut-flow table of %s skimming algorithm:' % self.name )
+        self.msg.info( 'Cut-flow table of %s skimming algorithm:', self.name )
         self.msg.info( '-------------' )
-        self.msg.info( ' Number of processed events: %r' % self.nProcessed )
-        self.msg.info( ' Events passing trigger %s:   %r and resulting efficiency = (%3.3f +/- %3.3f)%%' \
-                       % ( self.trigger, self.nEventPassTrigger, effiPassTrigger, effiErrPassTrigger ) )
+        self.msg.info( ' Number of processed events: %r', self.nProcessed )
+        self.msg.info( ' Events passing trigger %s:   %r and resulting efficiency = (%3.3f +/- %3.3f)%%',
+                       self.trigger, self.nEventPassTrigger, effiPassTrigger, effiErrPassTrigger )
         self.msg.info( '***************************************************************' )
 
         return StatusCode.Success
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/test/PrimaryDPDMaker_TestConfiguration.xml b/PhysicsAnalysis/PrimaryDPDMaker/test/PrimaryDPDMaker_TestConfiguration.xml
deleted file mode 100755
index 87c8f4103784f0aec00120989885c5d3c025a47d..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/PrimaryDPDMaker/test/PrimaryDPDMaker_TestConfiguration.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE unifiedTestConfiguration SYSTEM "http://www.hep.ucl.ac.uk/atlas/AtlasTesting/DTD/unifiedTestConfiguration.dtd">
- 
- 
-<unifiedTestConfiguration>
- 
-
-<rtt xmlns="http://www.hep.ucl.ac.uk/atlas/AtlasTesting/rtt">
-       <rttContactPerson> Karsten Koeneke </rttContactPerson>
-       <mailto>karsten.koeneke@cern.ch</mailto>
-       <refRelease>17.2.3</refRelease>
- 
-       <jobList>
-           <classification>
-           <displayClass>OfflineValidation</displayClass>
-           <displayProcess>Reco</displayProcess>
-           <displayComponent>Athena-Core</displayComponent>
-           </classification>
- 
-           <jobTransform userJobId="PrimaryDPDMaker_q122_test">
-               <doc>test Reco_trf ESD to DESD production, AMI=q122</doc> 
-               <jobTransformJobName>ESDtoDESDq122</jobTransformJobName>
-               <jobTransformCmd>
-                 Reco_trf.py maxEvents=100 AMITag=q122 autoConfiguration=everything --omitvalidation=ALL --ignoreerrors=ALL inputESDFile=root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-pat/data/ESD/data10_7TeV.00167607.physics_Egamma.merge.ESD.r1774_p327_tid203271_00/ESD.203271._000001.pool.root.1  outputDESD_CALJETFile=myDESD_CALJET.pool.root outputDESD_SGLELFile=myDESD_SGLEL.pool.root outputDESD_MBIASFile=myDESD_MBIAS.pool.root outputDESDM_TRACKFile=myDESDM_TRACK.pool.root outputDESD_SGLMUFile=myDESD_SGLMU.pool.root  outputDESD_PHOJETFile=myDESD_PHOJET.pool.root  outputDESDM_EGAMMAFile=myDESDM_EGAMMA.pool.root 
-               </jobTransformCmd>
-               <group>RecTrf</group>
-               <queue>medium</queue>
-           </jobTransform>
- 
-        </jobList>
-
-</rtt>
-
-</unifiedTestConfiguration>
-
-
-
-
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/CMakeLists.txt b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/CMakeLists.txt
index e33bb986ce929352f19cf00ca14c83604f100781..2c1d1c026e1abc280bee2673d3573c5c99bfc2ba 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/CMakeLists.txt
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/CMakeLists.txt
@@ -1,23 +1,19 @@
-################################################################################
-# Package: LongLivedParticleDPDMaker
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( LongLivedParticleDPDMaker )
 
 # External dependencies:
-find_package( CLHEP )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
 
 # Component(s) in the package:
 atlas_add_component( LongLivedParticleDPDMaker
                      src/*.cxx
                      src/components/*.cxx
-                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps xAODCaloEvent xAODEgamma xAODMuon xAODTracking GaudiKernel MuonSelectorToolsLib TrigDecisionToolLib TrigObjectMatchingLib AthenaKernel EventBookkeeperMetaData FourMomUtils xAODEventInfo xAODJet xAODMissingET DerivationFrameworkInterfaces )
+                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODCaloEvent xAODEgamma xAODMuon xAODTracking GaudiKernel MuonAnalysisInterfacesLib TrigDecisionToolLib TrigObjectMatchingLib EventBookkeeperMetaData FourMomUtils xAODJet xAODMissingET DerivationFrameworkInterfaces )
 
 # Install files from the package:
-atlas_install_headers( LongLivedParticleDPDMaker )
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/*.py )
 
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/DVFlags.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/DVFlags.py
index 576407591e3786777e1894c034179bc03784509c..fc29b6e325da5c828c23225fc58bd58d1193ef12 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/DVFlags.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/DVFlags.py
@@ -1,6 +1,6 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
+from AthenaCommon.JobProperties import JobProperty
 from AthenaCommon.JobProperties import jobproperties
 
 import AthenaCommon.SystemOfUnits as Units
@@ -31,11 +31,11 @@ class DV_MultiJetTriggerFlags(JobProperty):
     triggers += ["HLT_4j110","HLT_5j85","HLT_5j65_0eta240_L14J150ETA25","HLT_6j85","HLT_6j55_0eta240_L14J150ETA25"]  #2017
     triggers += ["HLT_4j120","HLT_4j130","HLT_5j60","HLT_5j70","HLT_5j90","HLT_5j100","HLT_6j45","HLT_6j60","HLT_6j70","HLT_7j50"] #L34
     triggers += ["HLT_4j60_gsc100_boffperf_split","HLT_4j60_gsc110_boffperf_split","HLT_4j60_gsc115_boffperf_split",
-			"HLT_4j70_gsc120_boffperf_split","HLT_4j70_gsc130_boffperf_split","HLT_5j50_gsc70_boffperf_split",
-			"HLT_5j55_gsc75_boffperf_split","HLT_5j60_gsc85_boffperf_split","HLT_5j60_gsc90_boffperf_split",
-			"HLT_5j60_gsc100_boffperf_split","HLT_6j45_gsc60_boffperf_split","HLT_6j50_gsc65_boffperf_split", 
-			"HLT_6j50_gsc70_boffperf_split","HLT_6j60_gsc85_boffperf_split","HLT_7j25_gsc45_boffperf_split_L14J20",
-			"HLT_7j25_gsc50_boffperf_split_L14J20" ]#gsc 
+                        "HLT_4j70_gsc120_boffperf_split","HLT_4j70_gsc130_boffperf_split","HLT_5j50_gsc70_boffperf_split",
+                        "HLT_5j55_gsc75_boffperf_split","HLT_5j60_gsc85_boffperf_split","HLT_5j60_gsc90_boffperf_split",
+                        "HLT_5j60_gsc100_boffperf_split","HLT_6j45_gsc60_boffperf_split","HLT_6j50_gsc65_boffperf_split",
+                        "HLT_6j50_gsc70_boffperf_split","HLT_6j60_gsc85_boffperf_split","HLT_7j25_gsc45_boffperf_split_L14J20",
+                        "HLT_7j25_gsc50_boffperf_split_L14J20" ]#gsc
     triggers += ["HLT_2j275_j140","HLT_2j250_j120","HLT_2j220_j120"]#3jet
     triggers += ["HLT_5j85_L14J15"] # 2018 5 jet
     if rpvllTrig.doRPVLLTriggerAPI:
@@ -262,21 +262,21 @@ class DV_MeffFilterFlags(JobProperty):
     cutJetEtaMax=2.5
     cutMETMin=150.0*Units.GeV
     triggers=["HLT_xe90_L1XE50","HLT_xe100_L1XE50","HLT_xe120_L1XE50",
-		          "HLT_xe90_L1XE55","HLT_xe100_L1XE55","HLT_xe120_L1XE55",
-		          "HLT_xe90_L1XE60","HLT_xe100_L1XE60","HLT_xe120_L1XE60",
-		          "HLT_xe90_tc_lcw_L1XE50","HLT_xe100_tc_lcw_L1XE50","HLT_xe120_tc_lcw_L1XE50",
-		          "HLT_xe90_tc_lcw_L1XE55","HLT_xe100_tc_lcw_L1XE55","HLT_xe120_tc_lcw_L1XE55",
-		          "HLT_xe90_tc_lcw_L1XE60","HLT_xe100_tc_lcw_L1XE60","HLT_xe120_tc_lcw_L1XE60",
-		          "HLT_xe90_mht_L1XE50","HLT_xe100_mht_L1XE50","HLT_xe110_mht_L1XE50","HLT_xe120_mht_L1XE50",
-		          "HLT_xe90_mht_L1XE55","HLT_xe100_mht_L1XE55","HLT_xe110_mht_L1XE51","HLT_xe120_mht_L1XE55",
-		          "HLT_xe90_mht_L1XE60","HLT_xe100_mht_L1XE60","HLT_xe110_mht_L1XE60","HLT_xe120_mht_L1XE60",
-		          "HLT_xe90_topoclPS_L1XE50","HLT_xe100_topoclPS_L1XE50","HLT_xe120_topoclPS_L1XE50",
-		          "HLT_xe90_topoclPS_L1XE55","HLT_xe100_topoclPS_L1XE55","HLT_xe120_topoclPS_L1XE55",
-		          "HLT_xe90_topoclPS_L1XE60","HLT_xe100_topoclPS_L1XE60","HLT_xe120_topoclPS_L1XE60",
-		          "HLT_xe90_topoclPUC_L1XE50","HLT_xe100_topoclPUC_L1XE50","HLT_xe120_topoclPUC_L1XE50",
-		          "HLT_xe90_topoclPUC_L1XE55","HLT_xe100_topoclPUC_L1XE55","HLT_xe120_topoclPUC_L1XE55",
-	      	    "HLT_xe90_topoclPUC_L1XE60","HLT_xe100_topoclPUC_L1XE60","HLT_xe120_topoclPUC_L1XE60"
-		         ]
+                          "HLT_xe90_L1XE55","HLT_xe100_L1XE55","HLT_xe120_L1XE55",
+                          "HLT_xe90_L1XE60","HLT_xe100_L1XE60","HLT_xe120_L1XE60",
+                          "HLT_xe90_tc_lcw_L1XE50","HLT_xe100_tc_lcw_L1XE50","HLT_xe120_tc_lcw_L1XE50",
+                          "HLT_xe90_tc_lcw_L1XE55","HLT_xe100_tc_lcw_L1XE55","HLT_xe120_tc_lcw_L1XE55",
+                          "HLT_xe90_tc_lcw_L1XE60","HLT_xe100_tc_lcw_L1XE60","HLT_xe120_tc_lcw_L1XE60",
+                          "HLT_xe90_mht_L1XE50","HLT_xe100_mht_L1XE50","HLT_xe110_mht_L1XE50","HLT_xe120_mht_L1XE50",
+                          "HLT_xe90_mht_L1XE55","HLT_xe100_mht_L1XE55","HLT_xe110_mht_L1XE51","HLT_xe120_mht_L1XE55",
+                          "HLT_xe90_mht_L1XE60","HLT_xe100_mht_L1XE60","HLT_xe110_mht_L1XE60","HLT_xe120_mht_L1XE60",
+                          "HLT_xe90_topoclPS_L1XE50","HLT_xe100_topoclPS_L1XE50","HLT_xe120_topoclPS_L1XE50",
+                          "HLT_xe90_topoclPS_L1XE55","HLT_xe100_topoclPS_L1XE55","HLT_xe120_topoclPS_L1XE55",
+                          "HLT_xe90_topoclPS_L1XE60","HLT_xe100_topoclPS_L1XE60","HLT_xe120_topoclPS_L1XE60",
+                          "HLT_xe90_topoclPUC_L1XE50","HLT_xe100_topoclPUC_L1XE50","HLT_xe120_topoclPUC_L1XE50",
+                          "HLT_xe90_topoclPUC_L1XE55","HLT_xe100_topoclPUC_L1XE55","HLT_xe120_topoclPUC_L1XE55",
+                    "HLT_xe90_topoclPUC_L1XE60","HLT_xe100_topoclPUC_L1XE60","HLT_xe120_topoclPUC_L1XE60"
+                         ]
     pass
 #primRPVLLDESDM.add_JobProperty(DV_MeffFilterFlags)
 
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/DiLepFlags.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/DiLepFlags.py
index 2b0130ed962b2fd7a47d551dfe8a012ad839a2cb..bd3b61ebd302256b43a8b8845fc53c139a0aca4d 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/DiLepFlags.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/DiLepFlags.py
@@ -1,10 +1,8 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
+from AthenaCommon.JobProperties import JobProperty
 from AthenaCommon.JobProperties import jobproperties
 
-import AthenaCommon.SystemOfUnits as Units
-
 primRPVLLDESDM = jobproperties.PrimaryDPDFlags_RPVLLStream
 
 ## TriggerAPI ##
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/EmergingFlags.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/EmergingFlags.py
index ae7464deaa27b7a305db397dc39a62812dae8e62..7e5d369bfa2588e89fa81ce5c8f4d6b42e747343 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/EmergingFlags.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/EmergingFlags.py
@@ -1,6 +1,6 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
+from AthenaCommon.JobProperties import JobProperty
 from AthenaCommon.JobProperties import jobproperties
 
 import AthenaCommon.SystemOfUnits as Units
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/FancyJetFilter.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/FancyJetFilter.py
index 74710a3a3eef32c228cb3a05d13ae647597e3c1b..53650d89fb674cda9860f7f3d7f5ca2ff78a75c2 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/FancyJetFilter.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/FancyJetFilter.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        Fancy Jet Skimmer (allows to also cut on jet moments)
@@ -11,7 +11,6 @@
 ## Description: This is a short algorithm to select events that contain a jet
 ##              that fulfills a certain set of criteria, including jet moments
 ##
-## $Id: FancyJetFilter.py,v 1.6 2009/01/14 20:46:32 mkaneda Exp $
 ##
 ##============================================================================
 
@@ -25,8 +24,6 @@ __author__  = "Andy Haas <ahaas@cern.ch>"
 import AthenaPython.PyAthena as PyAthena
 from AthenaPython.PyAthena import StatusCode
 
-from PrimaryDPDMaker import PrimaryDPDHelpers
-
 import PyUtils.RootUtils as ru
 ROOT = ru.import_root()
 
@@ -126,7 +123,7 @@ class FancyJetFilter( PyAthena.AthFilterAlgorithm ):
 
         ## Import needed modules
         import PyUtils.RootUtils as ru
-        ROOT = ru.import_root()
+        ROOT = ru.import_root()  # noqa: F841
 
         ## Get the StoreGate service
         self.storeGateSvc = PyAthena.py_svc('StoreGateSvc')
@@ -141,7 +138,7 @@ class FancyJetFilter( PyAthena.AthFilterAlgorithm ):
         self.jss = PyAthena.SignalStateHelper(PyAthena.P4SignalState.JETFINAL)
         
         ## import some 4-mom utils
-        import FourMomUtils.Bindings
+        import FourMomUtils.Bindings  # noqa: F401
         self.utils = { 'deltaR' : PyAthena.P4Helpers.deltaR }
 
 
@@ -151,12 +148,12 @@ class FancyJetFilter( PyAthena.AthFilterAlgorithm ):
 
     def execute(self):
         self.nProcessed+=1
-        self.msg.debug( '==> execute %s on %r. event...' % (self.name(), self.nProcessed) )
+        self.msg.debug( '==> execute %s on %r. event...', self.name(), self.nProcessed )
         
 
         ## If passAll is selected, accept all events
         if self.passAll :
-            self.msg.debug( '%s event passed because passAll is true' % self.name() )
+            self.msg.debug( '%s event passed because passAll is true', self.name() )
             self.setFilterPassed(True)
             self.nEventPassed += 1
             return StatusCode.Success
@@ -166,9 +163,9 @@ class FancyJetFilter( PyAthena.AthFilterAlgorithm ):
         jetCollection = None
         try:
             jetCollection = self.storeGateSvc.retrieve( self.jetCollectionType, self.jetCollectionName )
-            self.msg.debug( 'Loading the jet collection %s from the input file.' % self.jetCollectionName )
+            self.msg.debug( 'Loading the jet collection %s from the input file.', self.jetCollectionName )
         except LookupError:
-            self.msg.warning( 'Collection %s not found' % self.jetCollectionName )           
+            self.msg.warning( 'Collection %s not found', self.jetCollectionName )
             self.setFilterPassed(True)
             return StatusCode.Success   
    
@@ -185,7 +182,7 @@ class FancyJetFilter( PyAthena.AthFilterAlgorithm ):
 
 
         # Print a debug message
-        self.msg.debug( 'Starting loop over all jets. In this event, there are %s jets' % jetCollection.size() )
+        self.msg.debug( 'Starting loop over all jets. In this event, there are %s jets', jetCollection.size() )
 
 
         ## Find leading Et
@@ -198,7 +195,7 @@ class FancyJetFilter( PyAthena.AthFilterAlgorithm ):
 
         for jet in jetCollection :
             controlObject(jet)            
-            self.msg.debug( ' jet = '+str(jet))
+            self.msg.debug( ' jet = %s', jet)
             self.nJets += 1
             jet_n += 1
             if jet_n <= self.nLeadingsForCheck :
@@ -208,8 +205,7 @@ class FancyJetFilter( PyAthena.AthFilterAlgorithm ):
                         #ACH
                         pass_trk = False
                         for mk in jet.getMomentKeys():
-                            if not mk in ['sumPtTrk']: continue
-                            mom = jet.getMoment (mk)
+                            if mk not in ['sumPtTrk']: continue
                             value_mom=jet.getMoment (mk, True)
                             self.msg.debug("mom: %s %s", (mk, value_mom) )
                             if self.cutSumPtTrkMax>0.0 and value_mom < self.cutSumPtTrkMax:
@@ -223,7 +219,7 @@ class FancyJetFilter( PyAthena.AthFilterAlgorithm ):
                         if self.removeOverlap :
                             self.msg.debug( 'FancyJetFilter: I am in overlap!' )
                             doesOverlap = False
-                            for lep in leptonList :
+                            for lep in leptonList :   # noqa: F821 (FIXME, leptonList unknown)
                                 if self.utils['deltaR'](jet, lep) <= self.deltaR :
                                     doesOverlap = True
                                     break
@@ -253,7 +249,7 @@ class FancyJetFilter( PyAthena.AthFilterAlgorithm ):
             pass
 
         # Print a debug message
-        self.msg.debug( 'Done with the loop over the jets. Have %s jets in collection, put %s jets in goodJets, and the leading jet has et = %s GeV.' % ( jetCollection.size(), goodJets.__len__(), leadEt/Units.GeV ) )
+        self.msg.debug( 'Done with the loop over the jets. Have %s jets in collection, put %s jets in goodJets, and the leading jet has et = %s GeV.', jetCollection.size(), goodJets.__len__(), leadEt/Units.GeV )
 
         releaseObject()
 
@@ -261,12 +257,12 @@ class FancyJetFilter( PyAthena.AthFilterAlgorithm ):
         ## Check if the event is accepted
         if  goodJets.__len__() >= self.minNumberPassed and leadEt <= self.cutEtMax :
             self.msg.debug( 'The %d leading jets are within [%f , %f] GeV', jet_pass, self.cutEtMin/Units.GeV, self.cutEtMax/Units.GeV)
-            self.msg.debug( '%s event passed.' % self.name() )
+            self.msg.debug( '%s event passed.', self.name() )
             self.setFilterPassed(True)
             self.nEventPassed += 1
             pass
         else:
-            self.msg.debug( '%s event failed' % self.name() )
+            self.msg.debug( '%s event failed', self.name() )
             self.setFilterPassed(False)
             pass
         
@@ -299,13 +295,13 @@ class FancyJetFilter( PyAthena.AthFilterAlgorithm ):
 
 
         
-        self.msg.info( '==> finalize %s...' % self.name() )
+        self.msg.info( '==> finalize %s...', self.name() )
         self.msg.info( '***************************************************************' )
-        self.msg.info( 'Cut-flow table of %s skimming algorithm:' % self.name() )
+        self.msg.info( 'Cut-flow table of %s skimming algorithm:', self.name() )
         self.msg.info( '-------------' )
-        self.msg.info( ' Number of processed events: %r' % self.nProcessed )
-        self.msg.info( ' Number of all jets:    %r and number of jets per event: %3.3f +/- %3.3f' % ( self.nJets, effiJets, effiErrJets ) )
-        self.msg.info( ' Events accepted:    %r and resulting efficiency = (%3.3f +/- %3.3f)%%' % ( self.nEventPassed, effiEvents, effiErrEvents ) )
+        self.msg.info( ' Number of processed events: %r', self.nProcessed )
+        self.msg.info( ' Number of all jets:    %r and number of jets per event: %3.3f +/- %3.3f', self.nJets, effiJets, effiErrJets )
+        self.msg.info( ' Events accepted:    %r and resulting efficiency = (%3.3f +/- %3.3f)%%', self.nEventPassed, effiEvents, effiErrEvents )
         self.msg.info( '***************************************************************' )
 
         return StatusCode.Success
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HNLFlags.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HNLFlags.py
index d0efe972615c5787b1d22697bbc4fc0a819ff552..41913b8dd97ab24c09a3dd94125be4bd667ba921 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HNLFlags.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HNLFlags.py
@@ -14,8 +14,7 @@
 __doc__ = """job flags for the RPV/LL HNL DRAW"""
 __version__ = "0.0.1"
 
-from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
-from AthenaCommon.JobProperties import jobproperties
+from AthenaCommon.JobProperties import JobProperty
 
 import AthenaCommon.SystemOfUnits as Units
 from xAODPrimitives.xAODIso import xAODIso
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HVFlags.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HVFlags.py
index 850462b1bdd4cb6b0b83c9b494e73194ae9a9bb1..3ddfa4887d6be9a2b94a9c80343f97aeee8332b9 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HVFlags.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HVFlags.py
@@ -1,6 +1,6 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
+from AthenaCommon.JobProperties import JobProperty
 from AthenaCommon.JobProperties import jobproperties
 
 import AthenaCommon.SystemOfUnits as Units
@@ -48,7 +48,7 @@ class HV_JetMETFilterFlags(JobProperty):
     StoredValue  = True
     TriggerNames = [
   #      "HLT_j80_xe80",
-	"HLT_j120_xe80"
+        "HLT_j120_xe80"
     ]
     cutMetMin = 120.0*Units.GeV  # MET cut, currently placed on MET_Reference_AntiKt4TopoEM
     pass
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HipsFlags.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HipsFlags.py
index 8ecb80538bb839c2303a7cab6327ba3841a0dd17..2667df043a3dc0f2919f94e8c8c2fb334d30d735 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HipsFlags.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HipsFlags.py
@@ -1,10 +1,8 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
 from AthenaCommon.JobProperties import jobproperties
 
-import AthenaCommon.SystemOfUnits as Units
-
 class PrimaryDPDFlags_HIPsStream(JobPropertyContainer):
     """ The PrimaryDPD HIPs flag/job property  container."""
 
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/KinkedTrackFlags.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/KinkedTrackFlags.py
index f0ee1e7ee57747acee06599b08a6078b4b26b022..549defd6cb2ccdec5230de6903b420b2553709a7 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/KinkedTrackFlags.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/KinkedTrackFlags.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        KinkedTrackFlags.py
@@ -14,7 +14,7 @@
 __doc__ = """job flags for the RPV/LL KinkedTrack DESD"""
 __version__ = "0.0.1"
 
-from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
+from AthenaCommon.JobProperties import JobProperty
 from AthenaCommon.JobProperties import jobproperties
 
 import AthenaCommon.SystemOfUnits as Units
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/MultiJetMetFilter.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/MultiJetMetFilter.py
index d1bd1d7a5fc499c73a6f5cf0ec58e577ef4d80d2..5d4b5292cb3b1b1d52718e063ee217738d1bce3b 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/MultiJetMetFilter.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/MultiJetMetFilter.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        MultiJets+LargeMet Skimmer
@@ -17,7 +17,6 @@ __author__  = "Shimpei Yamamoto <shimpei.yamamoto@cern.ch>"
 
 import AthenaPython.PyAthena as PyAthena
 from AthenaPython.PyAthena import StatusCode
-from PrimaryDPDMaker import PrimaryDPDHelpers
 
 ## Import the module that allows to use named units, e.g. GeV
 import AthenaCommon.SystemOfUnits as Units
@@ -74,7 +73,7 @@ class MultiJetMetFilter( PyAthena.AthFilterAlgorithm ):
 
         ## Accept all events if passAll is set to be true
         if self.passAll :
-            self.msg.debug( '%s event passed because passAll is true' % self.name() )
+            self.msg.debug( '%s event passed because passAll is true', self.name() )
             self.setFilterPassed(True)
             return StatusCode.Success
 
@@ -89,7 +88,7 @@ class MultiJetMetFilter( PyAthena.AthFilterAlgorithm ):
         try:
             jetCollection = self.storeGateSvc.retrieve( self.jetCollectionType, self.jetCollectionName )
         except LookupError:
-            self.msg.warning( 'Collection %s not found' % self.jetCollectionName )           
+            self.msg.warning( 'Collection %s not found', self.jetCollectionName )
             self.setFilterPassed(False)
             return StatusCode.Success   
 
@@ -118,7 +117,7 @@ class MultiJetMetFilter( PyAthena.AthFilterAlgorithm ):
                 try:
                     met = self.storeGateSvc.retrieve( self.metCollectionType, self.metCollectionNames[i] )
                 except LookupError:
-                    self.msg.warning( 'Collection %s not found' % self.metCollectionNames[i] )           
+                    self.msg.warning( 'Collection %s not found', self.metCollectionNames[i] )
                     self.setFilterPassed(False)
                     return StatusCode.Success   
 
@@ -175,14 +174,14 @@ class MultiJetMetFilter( PyAthena.AthFilterAlgorithm ):
         except ZeroDivisionError :
             self.msg.warning( 'Division by zero error when calculating the uncertainties on the pass efficiencies...' )
 
-        self.msg.info( '==> finalize %s...' % self.name() )
+        self.msg.info( '==> finalize %s...', self.name() )
         self.msg.info( '***************************************************************' )
-        self.msg.info( 'Cut-flow table of %s skimming algorithm:' % self.name() )
+        self.msg.info( 'Cut-flow table of %s skimming algorithm:', self.name() )
         self.msg.info( '-------------' )
-        self.msg.info( ' Number of processed events:              %r' % self.nProcessed )
-        self.msg.info( ' Number of events with jet requirement:   %r, eff. = (%3.3f +/- %3.3f)%%' % ( self.nEventPassJet, effPassJet, effErrPassJet ) )
-        self.msg.info( ' Number of events with met requirement:   %r, eff. = (%3.3f +/- %3.3f)%%' % ( self.nEventPassMet, effPassMet, effErrPassMet ) )
-        self.msg.info( ' Number of events with all requirements:  %r, eff. = (%3.3f +/- %3.3f)%%' % ( self.nEventPassed, effPassAll, effErrPassAll ) )
+        self.msg.info( ' Number of processed events:              %r', self.nProcessed )
+        self.msg.info( ' Number of events with jet requirement:   %r, eff. = (%3.3f +/- %3.3f)%%', self.nEventPassJet, effPassJet, effErrPassJet )
+        self.msg.info( ' Number of events with met requirement:   %r, eff. = (%3.3f +/- %3.3f)%%', self.nEventPassMet, effPassMet, effErrPassMet )
+        self.msg.info( ' Number of events with all requirements:  %r, eff. = (%3.3f +/- %3.3f)%%', self.nEventPassed, effPassAll, effErrPassAll )
         self.msg.info( '***************************************************************' )
 
 
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/MuonSegmentFilter.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/MuonSegmentFilter.py
index 66679a5c041ed813f4deeb4799be48d26bfc16a7..c70e74b55345027375a0ecd3f5ef395199b80a45 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/MuonSegmentFilter.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/MuonSegmentFilter.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        Single Muon Skimmer
@@ -19,10 +19,6 @@ __author__  = "David Lopez Mateos <David.Lopez@cern.ch>"
 
 import AthenaPython.PyAthena as PyAthena
 from AthenaPython.PyAthena import StatusCode
-from PrimaryDPDMaker import PrimaryDPDHelpers
-
-## Import the module that allows to use named units, e.g. GeV
-import AthenaCommon.SystemOfUnits as Units
 
 class MuonSegmentFilter( PyAthena.AthFilterAlgorithm ):
     """
@@ -74,31 +70,30 @@ class MuonSegmentFilter( PyAthena.AthFilterAlgorithm ):
 
     def execute(self):
         self.nProcessed+=1
-        self.msg.debug( '==> execute %s on %r. event...' % (self.name(), self.nProcessed) )
+        self.msg.debug( '==> execute %s on %r. event...', self.name(), self.nProcessed )
         
         ## If passAll is selected, accept all events
         if self.passAll :
-            self.msg.debug( '%s event passed because passAll is true' % self.name() )
+            self.msg.debug( '%s event passed because passAll is true', self.name() )
             self.setFilterPassed(True)
             return StatusCode.Success
 
-        jetCollection = None
         _retrieve = self.sgSvc.retrieve
 
         try :
             muSegCollection = _retrieve (self.muonSegmentContainerType, self.muonSegmentContainerName)            
         except LookupError :
-            self.msg.warning('%s container not found in StoreGate ' % self.muonSegmentContainerName)
+            self.msg.warning('%s container not found in StoreGate ', self.muonSegmentContainerName)
    
         ## Check if the event is accepted
         if muSegCollection.__len__() >=  self.minNumberSegments and \
              muSegCollection.__len__()<=  self.maxNumberSegments  :
             self.nEventPassed += 1
-            self.msg.debug( '%s event passed' % self.name() )
+            self.msg.debug( '%s event passed', self.name() )
             self.setFilterPassed(True)
             pass
         else :
-            self.msg.debug( '%s event failed' % self.name() )
+            self.msg.debug( '%s event failed', self.name() )
             self.setFilterPassed(False)
             pass
 
@@ -124,12 +119,12 @@ class MuonSegmentFilter( PyAthena.AthFilterAlgorithm ):
             pass
 
         
-        self.msg.info( '==> finalize %s...' % self.name() )
+        self.msg.info( '==> finalize %s...', self.name() )
         self.msg.info( '***************************************************************' )
-        self.msg.info( 'Cut-flow table of %s skimming algorithm:' % self.name() )
+        self.msg.info( 'Cut-flow table of %s skimming algorithm:', self.name() )
         self.msg.info( '-------------' )
-        self.msg.info( ' Number of processed events: %r' % self.nProcessed )
-        self.msg.info( ' Events after numberPassed %r and resulting efficiency = (%3.3f +/- %3.3f)%%' % ( self.nEventPassed, effiNumPassed, effiErrNumPassed ) )
+        self.msg.info( ' Number of processed events: %r', self.nProcessed )
+        self.msg.info( ' Events after numberPassed %r and resulting efficiency = (%3.3f +/- %3.3f)%%', self.nEventPassed, effiNumPassed, effiErrNumPassed )
         self.msg.info( '***************************************************************' )
 
         return StatusCode.Success
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/PrimaryDPDFlags_RPVLLStream.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/PrimaryDPDFlags_RPVLLStream.py
index 1ee10967382cfb7218348aba9aacab55e2106408..d1a4f592a799df64bc4aa0ceecc82ce2a1935d6f 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/PrimaryDPDFlags_RPVLLStream.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/PrimaryDPDFlags_RPVLLStream.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 
 ##=============================================================================
@@ -20,8 +20,6 @@ __version__ = "0.0.1"
 from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
 from AthenaCommon.JobProperties import jobproperties
 
-import AthenaCommon.SystemOfUnits as Units
-
 #=====================================================================
 # First define container for the PrimaryDPDMaker flags  
 #=====================================================================
@@ -32,18 +30,18 @@ jobproperties.add_Container(PrimaryDPDFlags_RPVLLStream)
 
 primRPVLLDESDM=jobproperties.PrimaryDPDFlags_RPVLLStream
 
-from LongLivedParticleDPDMaker import DiLepFlags
-from LongLivedParticleDPDMaker import DVFlags
-from LongLivedParticleDPDMaker import KinkedTrackFlags
-from LongLivedParticleDPDMaker import EmergingFlags
-from LongLivedParticleDPDMaker import StoppedFlags
-from LongLivedParticleDPDMaker import VH_DVFlags
-from LongLivedParticleDPDMaker import QuirksFlags
-from LongLivedParticleDPDMaker import HipsFlags
-from LongLivedParticleDPDMaker import HNLFlags
-from LongLivedParticleDPDMaker import HVFlags
-from LongLivedParticleDPDMaker import SmpCaloIdFlags
-from LongLivedParticleDPDMaker import SmpMsFlags
+from LongLivedParticleDPDMaker import DiLepFlags        # noqa: F401
+from LongLivedParticleDPDMaker import DVFlags           # noqa: F401
+from LongLivedParticleDPDMaker import KinkedTrackFlags  # noqa: F401
+from LongLivedParticleDPDMaker import EmergingFlags     # noqa: F401
+from LongLivedParticleDPDMaker import StoppedFlags      # noqa: F401
+from LongLivedParticleDPDMaker import VH_DVFlags        # noqa: F401
+from LongLivedParticleDPDMaker import QuirksFlags       # noqa: F401
+from LongLivedParticleDPDMaker import HipsFlags         # noqa: F401
+from LongLivedParticleDPDMaker import HNLFlags          # noqa: F401
+from LongLivedParticleDPDMaker import HVFlags           # noqa: F401
+from LongLivedParticleDPDMaker import SmpCaloIdFlags    # noqa: F401
+from LongLivedParticleDPDMaker import SmpMsFlags        # noqa: F401
 
 #===============================================================
 # Set specific properties for each of the analysis selections
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/QuirksFlags.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/QuirksFlags.py
index 4fadb4221d60ce7c5468a91727da32ae1fea15c3..b88ad7e70b499928a69791d054703440458e92a6 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/QuirksFlags.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/QuirksFlags.py
@@ -1,6 +1,6 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
+from AthenaCommon.JobProperties import JobProperty
 from AthenaCommon.JobProperties import jobproperties
 
 import AthenaCommon.SystemOfUnits as Units
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/RPVLLTriggers.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/RPVLLTriggers.py
index a8e594d2cabd38b8e6c7eb7abe5adcc1e6dcbb39..2cc3d96bb2cded0546ab5ce725f7017606821f04 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/RPVLLTriggers.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/RPVLLTriggers.py
@@ -1,12 +1,11 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 from TriggerMenu.api.TriggerAPI import TriggerAPI
 from TriggerMenu.api.TriggerEnums import TriggerPeriod, TriggerType
 
 from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
 from AthenaCommon.JobProperties import jobproperties
 
-import AthenaCommon.SystemOfUnits as Units
-
-
 # general function to get current menu unprescaled triggers for given trigger type
 #def getTriggerList( trigger_type, matching_pattern="", rejection_pattern="", test=[] ):
 def getTriggerList( trigger_type, matching_pattern="", reject_list=[] ):
@@ -32,8 +31,8 @@ def getTriggerList( trigger_type, matching_pattern="", reject_list=[] ):
         if trigger in triggerList: continue
         isRejected = False
         for reject in reject_list:
-            if reject is not "" and reject in trigger: isRejected = True
-        if isRejected == True: continue
+            if reject != "" and reject in trigger: isRejected = True
+        if isRejected is True: continue
         triggerList.append( trigger )
 
     return triggerList
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/SingleJetMetFilter.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/SingleJetMetFilter.py
index 45008830baea9c8061ec44797a9162e220a9c997..8d46b15a2e960423dc1fd726856fc0a977ef7521 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/SingleJetMetFilter.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/SingleJetMetFilter.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ##=============================================================================
 ## Name:        SingleJet+LargeMet Skimmer
@@ -18,7 +18,6 @@ __author__  = "Shimpei Yamamoto <shimpei.yamamoto@cern.ch>"
 
 import AthenaPython.PyAthena as PyAthena
 from AthenaPython.PyAthena import StatusCode
-from PrimaryDPDMaker import PrimaryDPDHelpers
 
 ## Import the module that allows to use named units, e.g. GeV
 import AthenaCommon.SystemOfUnits as Units
@@ -81,7 +80,7 @@ class SingleJetMetFilter( PyAthena.AthFilterAlgorithm ):
 
         ## Accept all events if passAll is set to be true
         if self.passAll :
-            self.msg.debug( '%s event passed because passAll is true' % self.name() )
+            self.msg.debug( '%s event passed because passAll is true', self.name() )
             self.setFilterPassed(True)
             return StatusCode.Success
 
@@ -91,7 +90,7 @@ class SingleJetMetFilter( PyAthena.AthFilterAlgorithm ):
         try:
             jetCollection = self.storeGateSvc.retrieve( self.jetCollectionType, self.jetCollectionName )
         except LookupError:
-            self.msg.warning( 'Collection %s not found' % self.jetCollectionName )           
+            self.msg.warning( 'Collection %s not found', self.jetCollectionName )
             self.setFilterPassed(False)
             return StatusCode.Success   
 
@@ -128,7 +127,7 @@ class SingleJetMetFilter( PyAthena.AthFilterAlgorithm ):
                 try:
                     met = self.storeGateSvc.retrieve( self.metCollectionType, self.metCollectionNames[i] )
                 except LookupError:
-                    self.msg.warning( 'Collection %s not found' % self.metCollectionNames[i] )           
+                    self.msg.warning( 'Collection %s not found', self.metCollectionNames[i] )
                     self.setFilterPassed(False)
                     return StatusCode.Success   
 
@@ -185,14 +184,14 @@ class SingleJetMetFilter( PyAthena.AthFilterAlgorithm ):
         except ZeroDivisionError :
             self.msg.warning( 'Division by zero error when calculating the uncertainties on the pass efficiencies...' )
 
-        self.msg.info( '==> finalize %s...' % self.name() )
+        self.msg.info( '==> finalize %s...', self.name() )
         self.msg.info( '***************************************************************' )
-        self.msg.info( 'Cut-flow table of %s skimming algorithm:' % self.name() )
+        self.msg.info( 'Cut-flow table of %s skimming algorithm:', self.name() )
         self.msg.info( '-------------' )
-        self.msg.info( ' Number of processed events:              %r' % self.nProcessed )
-        self.msg.info( ' Number of events with jet requirement:   %r, eff. = (%3.3f +/- %3.3f)%%' % ( self.nEventPassJet, effPassJet, effErrPassJet ) )
-        self.msg.info( ' Number of events with met requirement:   %r, eff. = (%3.3f +/- %3.3f)%%' % ( self.nEventPassMet, effPassMet, effErrPassMet ) )
-        self.msg.info( ' Number of events with all requirements:  %r, eff. = (%3.3f +/- %3.3f)%%' % ( self.nEventPassed, effPassAll, effErrPassAll ) )
+        self.msg.info( ' Number of processed events:              %r', self.nProcessed )
+        self.msg.info( ' Number of events with jet requirement:   %r, eff. = (%3.3f +/- %3.3f)%%', self.nEventPassJet, effPassJet, effErrPassJet )
+        self.msg.info( ' Number of events with met requirement:   %r, eff. = (%3.3f +/- %3.3f)%%', self.nEventPassMet, effPassMet, effErrPassMet )
+        self.msg.info( ' Number of events with all requirements:  %r, eff. = (%3.3f +/- %3.3f)%%', self.nEventPassed, effPassAll, effErrPassAll )
         self.msg.info( '***************************************************************' )
 
 
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/SmpCaloIdFlags.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/SmpCaloIdFlags.py
index 0610ca1f435196dca45c40b3f4d8ccd2abb22bb7..c398f2688942cd8538ace6da7133bc2f624400de 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/SmpCaloIdFlags.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/SmpCaloIdFlags.py
@@ -1,6 +1,6 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
+from AthenaCommon.JobProperties import JobProperty
 from AthenaCommon.JobProperties import jobproperties
 
 import AthenaCommon.SystemOfUnits as Units
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/SmpMsFlags.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/SmpMsFlags.py
index dfb0845ac115c77e0920d9650ababd7efd1be0bd..91166309847b006ec7feab041464bdf646c4c5a0 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/SmpMsFlags.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/SmpMsFlags.py
@@ -1,6 +1,6 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
+from AthenaCommon.JobProperties import JobProperty
 from AthenaCommon.JobProperties import jobproperties
 
 import AthenaCommon.SystemOfUnits as Units
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/StoppedFlags.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/StoppedFlags.py
index 28802bb3857c6cfdd3709fb74581b5c1150526fa..df4a69de24fa7ed2637be8e3e124d0d9011ff379 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/StoppedFlags.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/StoppedFlags.py
@@ -1,6 +1,6 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
+from AthenaCommon.JobProperties import JobProperty
 from AthenaCommon.JobProperties import jobproperties
 
 import AthenaCommon.SystemOfUnits as Units
@@ -14,20 +14,20 @@ class Stopped_triggerFilterFlags(JobProperty):
     TriggerNames = [] # only put trigger names in this list if you want to override the below stream-specific ones
     EgammaTriggerNames = []
     JetTauEtmissTriggerNames = [
-	"L1_RD0_EMPTY",
-	"L1_RD0_FIRSTEMPTY",
+        "L1_RD0_EMPTY",
+        "L1_RD0_FIRSTEMPTY",
         "L1_RD1_EMPTY",
-	"L1_RD1_FIRSTEMPTY",
+        "L1_RD1_FIRSTEMPTY",
         "L1_J10_FIRSTEMPTY",
         "L1_J10_EMPTY",
-	"L1_J10_UNPAIRED",
-	"L1_J10_UNPAIRED_ISO",
-	"L1_J10_UNPAIRED_NONISO",
+        "L1_J10_UNPAIRED",
+        "L1_J10_UNPAIRED_ISO",
+        "L1_J10_UNPAIRED_NONISO",
         "L1_J30_FIRSTEMPTY",
         "L1_J30_EMPTY",
-	"L1_J30_UNPAIRED",
-	"L1_J30_UNPAIRED_ISO",
-	"L1_J30_UNPAIRED_NONISO"
+        "L1_J30_UNPAIRED",
+        "L1_J30_UNPAIRED_ISO",
+        "L1_J30_UNPAIRED_NONISO"
         ]
     MuonsTriggerNames = []
     signalPrescale      = 1
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/VH_DVFlags.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/VH_DVFlags.py
index 07cbe219b345bbba08c87416c644b854e296352d..227b7864bd9ddc417b5b061f2c65645dd4b5acac 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/VH_DVFlags.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/VH_DVFlags.py
@@ -1,6 +1,6 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
+from AthenaCommon.JobProperties import JobProperty
 from AthenaCommon.JobProperties import jobproperties
 
 import AthenaCommon.SystemOfUnits as Units
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/src/HnlSkimmingTool.cxx b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/src/HnlSkimmingTool.cxx
index e699c5d6e4a81b57cf892f411bbd1d86bc2261c5..d74d739fff5ccb24a4509c91a707c25f225a3b26 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/src/HnlSkimmingTool.cxx
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/src/HnlSkimmingTool.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
 */
 
 /////////////////////////////////////////////////////////////////
@@ -11,8 +11,6 @@
 
 #include "LongLivedParticleDPDMaker/HnlSkimmingTool.h"
 
-#include "CLHEP/Units/SystemOfUnits.h"
-
 // Constructor
 DerivationFramework::HnlSkimmingTool::HnlSkimmingTool(const std::string& t,
                                                       const std::string& n,
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonSmearingTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonSmearingTool.cxx
index 31444f17d5c0b6fc87d98548320a24ead9c8834a..9026acf04f44bbec94c01895dcf26d7960ec0796 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonSmearingTool.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonSmearingTool.cxx
@@ -71,8 +71,8 @@ CommonSmearingTool::CommonSmearingTool(const std::string& sName)
   : asg::AsgMetadataTool( sName )
   , m_mSF(0)
   , m_sSystematicSet(0)
-  , m_fX(&caloTauPt)
-  , m_fY(&caloTauEta)
+  , m_fX(&finalTauPt)
+  , m_fY(&finalTauEta)
   , m_bIsData(false)
   , m_bIsConfigured(false)
   , m_tMvaTESVariableDecorator("MvaTESVariableDecorator", this)
@@ -80,17 +80,18 @@ CommonSmearingTool::CommonSmearingTool(const std::string& sName)
   , m_tCombinedP4FromRecoTaus("CombinedP4FromRecoTaus", this)
   , m_eCheckTruth(TauAnalysisTools::Unknown)
   , m_bNoMultiprong(false)
-  , m_bPtFinalCalibIsAvailable(false)
-  , m_bPtFinalCalibIsAvailableIsChecked(false)
   , m_bPtTauEtaCalibIsAvailable(false)
   , m_bPtTauEtaCalibIsAvailableIsChecked(false)
 {
+  m_mSystematics = {};
+
   declareProperty("InputFilePath",       m_sInputFilePath       = "" );
   declareProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck = false );
   declareProperty("ApplyFading",         m_bApplyFading         = true );
-  declareProperty("ApplyMVATES",         m_bApplyMVATES         = false );
+  declareProperty("ApplyMVATES",         m_bApplyMVATES         = true );
   declareProperty("ApplyCombinedTES",    m_bApplyCombinedTES    = false );
   declareProperty("ApplyMVATESQualityCheck", m_bApplyMVATESQualityCheck = true );
+  declareProperty("ApplyInsituCorrection",   m_bApplyInsituCorrection   = true );
 }
 
 /*
@@ -141,21 +142,10 @@ StatusCode CommonSmearingTool::initialize()
   if (applySystematicVariation(CP::SystematicSet()) != StatusCode::SUCCESS )
     return StatusCode::FAILURE;
 
-#ifndef XAODTAU_VERSIONS_TAUJET_V3_H
-  if (m_bApplyMVATES)
-  {
-    ATH_CHECK(ASG_MAKE_ANA_TOOL(m_tMvaTESVariableDecorator, MvaTESVariableDecorator));
-    ATH_CHECK(ASG_MAKE_ANA_TOOL(m_tMvaTESEvaluator, MvaTESEvaluator));
-    ATH_CHECK(m_tMvaTESEvaluator.setProperty("WeightFileName", "MvaTES_20161015_pi0fix_BDTG.weights.xml"));
-    ATH_CHECK(m_tMvaTESVariableDecorator.initialize());
-    ATH_CHECK(m_tMvaTESEvaluator.initialize());
-  }
-#endif
-
   if (m_bApplyCombinedTES || m_bApplyMVATES) // CombinedTES has to be available for MVA fix
   {
     ATH_CHECK(ASG_MAKE_ANA_TOOL(m_tCombinedP4FromRecoTaus, CombinedP4FromRecoTaus));
-    ATH_CHECK(m_tCombinedP4FromRecoTaus.setProperty("WeightFileName", "CalibLoopResult.root"));
+    ATH_CHECK(m_tCombinedP4FromRecoTaus.setProperty("WeightFileName", "CalibLoopResult_v04-04.root"));
     ATH_CHECK(m_tCombinedP4FromRecoTaus.initialize());
   }
 
@@ -187,35 +177,17 @@ CP::CorrectionCode CommonSmearingTool::applyCorrection( xAOD::TauJet& xTau )
   }
 
   if (m_bApplyMVATES)
-  {
-    if (not m_bPtFinalCalibIsAvailableIsChecked)
-    {
-      m_bPtFinalCalibIsAvailable = xTau.isAvailable<float>("ptFinalCalib");
-      m_bPtFinalCalibIsAvailableIsChecked = true;
-    }
-
-    if (not m_bPtFinalCalibIsAvailable)
-    {
-#ifndef XAODTAU_VERSIONS_TAUJET_V3_H
-      // TODO: only call eventInitialize once per event, probably via migration to
-      // AsgMetadataTool
-      if (m_tMvaTESVariableDecorator->eventInitialize().isFailure())
-        return CP::CorrectionCode::Error;
-      if (m_tMvaTESVariableDecorator->execute(xTau).isFailure())
-        return CP::CorrectionCode::Error;
-      if (m_tMvaTESEvaluator->execute(xTau).isFailure())
-        return CP::CorrectionCode::Error; 
-#else
-      ATH_MSG_ERROR("MVA TES decoration 'ptFinalCalib' is not available ");
-      return CP::CorrectionCode::Error;
-#endif
-    }
-    
+  {    
     // veto MVA TES for unreasonably low resolution values
     bool bVeto = dynamic_cast<CombinedP4FromRecoTaus*>(m_tCombinedP4FromRecoTaus.get())->getUseCaloPtFlag(xTau);
 
     if (xTau.nTracks() > 0 and xTau.nTracks() < 6)
     {
+      static SG::AuxElement::ConstAccessor<float> accPtFinalCalib("ptFinalCalib");
+      static SG::AuxElement::ConstAccessor<float> accEtaFinalCalib("etaFinalCalib");
+      static SG::AuxElement::ConstAccessor<float> accPhiFinalCalib("phiFinalCalib");
+      static SG::AuxElement::ConstAccessor<float> accMFinalCalib("mFinalCalib");
+
       xTau.auxdecor<char>("MVATESQuality") = (char)bVeto;
       if (bVeto && m_bApplyMVATESQualityCheck)
       {
@@ -227,10 +199,10 @@ CP::CorrectionCode CommonSmearingTool::applyCorrection( xAOD::TauJet& xTau )
       }
       else
       {
-        xTau.setP4(xTau.auxdata<float>("ptFinalCalib"),
-                   xTau.auxdata<float>("etaFinalCalib"),
-                   xTau.auxdata<float>("phiFinalCalib"),
-                   xTau.auxdata<float>("mFinalCalib"));
+        xTau.setP4(accPtFinalCalib(xTau),
+                   accEtaFinalCalib(xTau),
+                   accPhiFinalCalib(xTau),
+                   accMFinalCalib(xTau));
       }
     }
   }
@@ -258,7 +230,7 @@ CP::CorrectionCode CommonSmearingTool::applyCorrection( xAOD::TauJet& xTau )
     return CP::CorrectionCode::Ok;
 
   // check which true state is requestet
-  if (!m_bSkipTruthMatchCheck and checkTruthMatch(xTau) != m_eCheckTruth)
+  if (!m_bSkipTruthMatchCheck and getTruthParticleType(xTau) != m_eCheckTruth)
   {
     return CP::CorrectionCode::Ok;
   }
@@ -267,13 +239,17 @@ CP::CorrectionCode CommonSmearingTool::applyCorrection( xAOD::TauJet& xTau )
   std::string sProng = ConvertProngToString(xTau.nTracks());
 
   double dCorrection = 1.;
-  // get standard scale factor
-  CP::CorrectionCode tmpCorrectionCode = getValue("sf"+sProng,
-                                                  xTau,
-                                                  dCorrection);
-  // return correction code if histogram is not available
-  if (tmpCorrectionCode != CP::CorrectionCode::Ok)
-    return tmpCorrectionCode;
+  CP::CorrectionCode tmpCorrectionCode;
+  if (m_bApplyInsituCorrection)
+  {
+    // get standard scale factor
+    tmpCorrectionCode = getValue("sf"+sProng,
+                                                    xTau,
+                                                    dCorrection);
+    // return correction code if histogram is not available
+    if (tmpCorrectionCode != CP::CorrectionCode::Ok)
+      return tmpCorrectionCode;
+  }
 
   // skip further process if systematic set is empty
   if (m_sSystematicSet->size() > 0)
@@ -291,7 +267,6 @@ CP::CorrectionCode CommonSmearingTool::applyCorrection( xAOD::TauJet& xTau )
       tmpCorrectionCode = getValue(it->second+sProng,
                                    xTau,
                                    dUncertaintySyst);
-
       // return correction code if histogram is not available
       if (tmpCorrectionCode != CP::CorrectionCode::Ok)
         return tmpCorrectionCode;
@@ -471,8 +446,8 @@ template<class T>
 void CommonSmearingTool::ReadInputs(TFile* fFile, std::map<std::string, T>* mMap)
 {
   // initialize function pointer
-  m_fX = &caloTauPt;
-  m_fY = &caloTauEta;
+  m_fX = &finalTauPt;
+  m_fY = &finalTauEta;
 
   TKey *kKey;
   TIter itNext(fFile->GetListOfKeys());
@@ -485,18 +460,18 @@ void CommonSmearingTool::ReadInputs(TFile* fFile, std::map<std::string, T>* mMap
     std::string sKeyName = kKey->GetName();
     if (sKeyName == "Xaxis")
     {
-      TNamed* tObj = (T)kKey->ReadObj();
+      TNamed* tObj = (TNamed*)kKey->ReadObj();
       std::string sTitle = tObj->GetTitle();
       delete tObj;
-      if (sTitle == "P")
+      if (sTitle == "P" || sTitle == "PFinalCalib")
       {
-        m_fX = &caloTauP;
+        m_fX = &finalTauP;
         ATH_MSG_DEBUG("using full momentum for x-axis");
       }
     }
     if (sKeyName == "Yaxis")
     {
-      TNamed* tObj = (T)kKey->ReadObj();
+      TNamed* tObj = (TNamed*)kKey->ReadObj();
       std::string sTitle = tObj->GetTitle();
       delete tObj;
       if (sTitle == "track-eta")
@@ -506,7 +481,7 @@ void CommonSmearingTool::ReadInputs(TFile* fFile, std::map<std::string, T>* mMap
       }
       else if (sTitle == "|eta|")
       {
-        m_fY = &caloTauAbsEta;
+        m_fY = &finalTauAbsEta;
         ATH_MSG_DEBUG("using absolute tau eta for y-axis");
       }
     }
@@ -543,8 +518,16 @@ void CommonSmearingTool::generateSystematicSets()
     // parse for nuisance parameter in histogram name
     std::vector<std::string> vSplitNP = {};
     split(mSF.first,'_',vSplitNP);
-    std::string sNP = vSplitNP.at(0);
-    std::string sNPUppercase = vSplitNP.at(0);
+    std::string sNP;
+    std::string sNPUppercase;
+    if (vSplitNP.size() > 2)
+    {
+      sNP = vSplitNP.at(0)+'_'+vSplitNP.at(1);
+      sNPUppercase = vSplitNP.at(0)+'_'+vSplitNP.at(1);
+    } else {
+      sNP = vSplitNP.at(0);
+      sNPUppercase = vSplitNP.at(0);
+    }
 
     // skip nominal scale factors
     if (sNP == "sf") continue;
@@ -580,7 +563,7 @@ CP::CorrectionCode CommonSmearingTool::getValue(const std::string& sHistName,
     const xAOD::TauJet& xTau,
     double& dEfficiencyScaleFactor) const
 {
-  TH1F* hHist = (*m_mSF)[sHistName];
+  TH1* hHist = (*m_mSF)[sHistName];
   if (!hHist)
   {
     ATH_MSG_ERROR("Histogram with name "<<sHistName<<" was not found in input file.");
@@ -614,39 +597,3 @@ CP::CorrectionCode CommonSmearingTool::getValue(const std::string& sHistName,
   }
   return CP::CorrectionCode::Ok;
 }
-
-//______________________________________________________________________________
-e_TruthMatchedParticleType CommonSmearingTool::checkTruthMatch(const xAOD::TauJet& xTau) const
-{
-  // check if reco tau is a truth hadronic tau
-  typedef ElementLink< xAOD::TruthParticleContainer > Link_t;
-  if (!xTau.isAvailable< Link_t >("truthParticleLink"))
-    ATH_MSG_ERROR("No truth match information available. Please run TauTruthMatchingTool first.");
-
-  static SG::AuxElement::Accessor<Link_t> accTruthParticleLink("truthParticleLink");
-  const Link_t xTruthParticleLink = accTruthParticleLink(xTau);
-
-  // if there is no link, then it is a truth jet
-  e_TruthMatchedParticleType eTruthMatchedParticleType = TauAnalysisTools::TruthJet;
-
-  if (xTruthParticleLink.isValid())
-  {
-    const xAOD::TruthParticle* xTruthParticle = *xTruthParticleLink;
-    if (xTruthParticle->isTau())
-    {
-      static SG::AuxElement::ConstAccessor<char> accIsHadronicTau("IsHadronicTau");
-      if ((bool)accIsHadronicTau(*xTruthParticle))
-      {
-        eTruthMatchedParticleType = TruthHadronicTau;
-      }
-    }
-    else if (xTruthParticle->isElectron())
-      eTruthMatchedParticleType = TruthElectron;
-    else if (xTruthParticle->isMuon())
-      eTruthMatchedParticleType = TruthMuon;
-  }
-  else
-    ATH_MSG_VERBOSE("Truth particle link is not valid");
-
-  return eTruthMatchedParticleType;
-}
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSmearingTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSmearingTool.cxx
index 500275a6bf4697fa25fd353f47703801fe5cf120..cd5571488c10a056edaac62d22468173238e25ed 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSmearingTool.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSmearingTool.cxx
@@ -1,29 +1,34 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // EDM include(s):
 #include "PATInterfaces/SystematicRegistry.h"
+#include "xAODMetaData/FileMetaData.h"
 
 // Local include(s):
 #include "TauAnalysisTools/TauSmearingTool.h"
 #include "TauAnalysisTools/SharedFilesVersion.h"
 #include "TauAnalysisTools/TauSmearingRun1Tool.h"
 
+#include <boost/algorithm/string.hpp>
+
 namespace TauAnalysisTools
 {
 
 TauSmearingTool::TauSmearingTool( const std::string& sName )
-  : asg::AsgTool( sName )
+  : asg::AsgMetadataTool( sName )
   , m_tCommonSmearingTool(sName+"_CommonSmearingTool", this)
   , m_sInputFilePath("")
 {
-  declareProperty( "RecommendationTag",   m_sRecommendationTag = "2017-moriond" );
+  declareProperty( "RecommendationTag",   m_sRecommendationTag = "2019-summer" );
   declareProperty( "SkipTruthMatchCheck", m_bSkipTruthMatchCheck = false );
   declareProperty( "ApplyFading",         m_bApplyFading = true);
-  declareProperty( "ApplyMVATES",         m_bApplyMVATES = false);
+  declareProperty( "ApplyMVATES",         m_bApplyMVATES = true);
   declareProperty( "ApplyCombinedTES",    m_bApplyCombinedTES = false);
   declareProperty("ApplyMVATESQualityCheck", m_bApplyMVATESQualityCheck = true );
+  declareProperty("ApplyInsituCorrection",   m_bApplyInsituCorrection   = true );
+  declareProperty( "isAFII",	                   m_sAFII	                   = false );
 
   // deprecated property
   declareProperty( "IsData",              m_bIsData = false );
@@ -50,66 +55,23 @@ StatusCode TauSmearingTool::initialize()
 
   std::string sDirectory = "TauAnalysisTools/"+std::string(sSharedFilesVersion)+"/Smearing/";
 
-  if (m_sRecommendationTag == "2017-moriond")
+  if (m_sRecommendationTag == "2019-summer")
   {
     if (m_sInputFilePath.empty())
-      m_sInputFilePath = sDirectory+"TES_TrueHadTau_2017-moriond.root";
+    {
+	    if (m_sAFII) m_sInputFilePath = sDirectory+"TES_TrueHadTau_2019-summer_AFII.root";
+      else m_sInputFilePath = sDirectory+"TES_TrueHadTau_2019-summer.root";
+    }
     ATH_CHECK(ASG_MAKE_ANA_TOOL(m_tCommonSmearingTool, TauAnalysisTools::CommonSmearingTool));
     ATH_CHECK(m_tCommonSmearingTool.setProperty("InputFilePath", m_sInputFilePath));
     ATH_CHECK(m_tCommonSmearingTool.setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
     ATH_CHECK(m_tCommonSmearingTool.setProperty("ApplyFading", m_bApplyFading));
     ATH_CHECK(m_tCommonSmearingTool.setProperty("ApplyMVATES", m_bApplyMVATES));
     ATH_CHECK(m_tCommonSmearingTool.setProperty("ApplyMVATESQualityCheck", m_bApplyMVATESQualityCheck));
+    ATH_CHECK(m_tCommonSmearingTool.setProperty("ApplyInsituCorrection", m_bApplyInsituCorrection));
     ATH_CHECK(m_tCommonSmearingTool.setProperty("ApplyCombinedTES", m_bApplyCombinedTES));
     ATH_CHECK(m_tCommonSmearingTool.setProperty("OutputLevel", this->msg().level()));
   }
-  else if (m_sRecommendationTag == "2016-ichep")
-  {
-    if (m_sInputFilePath.empty())
-      m_sInputFilePath = sDirectory+"TES_TrueHadTau_2016-ichep.root";
-    ATH_CHECK(ASG_MAKE_ANA_TOOL(m_tCommonSmearingTool, TauAnalysisTools::CommonSmearingTool));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("InputFilePath", m_sInputFilePath));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("ApplyFading", m_bApplyFading));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("ApplyMVATES", m_bApplyMVATES));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("ApplyCombinedTES", m_bApplyCombinedTES));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("OutputLevel", this->msg().level()));
-  }
-  else if (m_sRecommendationTag == "mc15-moriond")
-  {
-    if (m_sInputFilePath.empty())
-      m_sInputFilePath = sDirectory+"TES_TrueHadTau_mc15_moriond.root";
-    ATH_CHECK(ASG_MAKE_ANA_TOOL(m_tCommonSmearingTool, TauAnalysisTools::CommonSmearingTool));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("InputFilePath", m_sInputFilePath));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("ApplyFading", m_bApplyFading));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("ApplyMVATES", m_bApplyMVATES));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("ApplyCombinedTES", m_bApplyCombinedTES));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("OutputLevel", this->msg().level()));
-  }
-  else if (m_sRecommendationTag == "mc15-pre-recommendations")
-  {
-    if (m_sInputFilePath.empty())
-      m_sInputFilePath = sDirectory+"TES_TrueHadTau_mc15_prerec.root";
-    ATH_CHECK(ASG_MAKE_ANA_TOOL(m_tCommonSmearingTool, TauAnalysisTools::CommonSmearingTool));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("InputFilePath", m_sInputFilePath));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("ApplyFading", false)); // apply fading off by default
-  }
-  else if (m_sRecommendationTag == "mc12-final")
-  {
-    if (m_sInputFilePath.empty())
-      m_sInputFilePath = sDirectory+"mc12_p1344_medium.root";
-    ATH_CHECK(ASG_MAKE_ANA_TOOL(m_tCommonSmearingTool, TauAnalysisTools::TauSmearingRun1Tool));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("InputFilePath", m_sInputFilePath));
-  }
-  else if (m_sRecommendationTag == "mc11-final")
-  {
-    if (m_sInputFilePath.empty())
-      m_sInputFilePath = sDirectory+"mc11.root";
-    ATH_CHECK(ASG_MAKE_ANA_TOOL(m_tCommonSmearingTool, TauAnalysisTools::TauSmearingRun1Tool));
-    ATH_CHECK(m_tCommonSmearingTool.setProperty("InputFilePath", m_sInputFilePath));
-  }
   else
   {
     ATH_MSG_FATAL("unknown recommendation tag "<<m_sRecommendationTag);
@@ -129,6 +91,27 @@ StatusCode TauSmearingTool::initialize()
   return StatusCode::SUCCESS;
 }
 
+// auto detection of simulation flavour, used to cross check configuration of tool
+//______________________________________________________________________________
+StatusCode TauSmearingTool::beginInputFile()
+{
+  if (m_sRecommendationTag == "2019-summer")
+  {
+    std::string simType("");
+    if (inputMetaStore()->contains<xAOD::FileMetaData>("FileMetaData"))
+    {
+      const xAOD::FileMetaData* fmd = 0;
+      ATH_CHECK( inputMetaStore()->retrieve( fmd, "FileMetaData" ) );
+      bool result = fmd->value( xAOD::FileMetaData::simFlavour , simType );
+      // if no result -> no simFlavor metadata, so must be data
+      if(result) boost::to_upper(simType);
+    }
+    if (simType.find("ATLFASTII")!=std::string::npos && !m_sAFII) ATH_MSG_WARNING("Input file is fast simulation but you are _not_ using AFII corrections and uncertainties, you should set \"isAFII\" to \"true\"");
+    else if (simType.find("FULLG4")!=std::string::npos && m_sAFII) ATH_MSG_WARNING("Input file is full simulation but you are using AFII corrections and uncertainties, you should set \"isAFII\" to \"false\"");
+  }
+  return StatusCode::SUCCESS;
+}
+
 CP::CorrectionCode TauSmearingTool::applyCorrection( xAOD::TauJet& xTau )
 {
 
@@ -158,7 +141,7 @@ CP::SystematicSet TauSmearingTool::recommendedSystematics() const
 {
   return m_tCommonSmearingTool->recommendedSystematics();
 }
-
+  
 StatusCode TauSmearingTool::applySystematicVariation ( const CP::SystematicSet& sSystematicSet)
 {
   return m_tCommonSmearingTool->applySystematicVariation( sSystematicSet );
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonSmearingTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonSmearingTool.h
index 2e36e758fa6ee275c65ed8917ab6a87d4ad5c6ed..736a6ac64af621bdffb7432c99dc91a4a482cd05 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonSmearingTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonSmearingTool.h
@@ -1,5 +1,7 @@
+// Dear emacs, this is -*- c++ -*-
+
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TAUANALYSISTOOLS_COMMONSMEARINGTOOL_H
@@ -35,7 +37,7 @@
 #include "TROOT.h"
 #include "TClass.h"
 #include "TFile.h"
-#include "TH1F.h"
+#include "TH1.h"
 #include "TKey.h"
 
 
@@ -83,12 +85,11 @@ public:
   /// ignored (unless they
   virtual StatusCode applySystematicVariation ( const CP::SystematicSet& sSystematicSet);
 
-
 protected:
 
   std::string ConvertProngToString(const int& iProngness);
 
-  typedef std::map<std::string, TH1F*> SFMAP;
+  typedef std::map<std::string, TH1*> SFMAP;
   SFMAP* m_mSF;
   std::unordered_map < CP::SystematicSet, std::string > m_mSystematicSets;
   const CP::SystematicSet* m_sSystematicSet;
@@ -104,7 +105,6 @@ protected:
   virtual CP::CorrectionCode getValue(const std::string& sHistName,
                                       const xAOD::TauJet& xTau,
                                       double& dEfficiencyScaleFactor) const;
-  e_TruthMatchedParticleType checkTruthMatch(const xAOD::TauJet& xTau) const;
   void generateSystematicSets();
 
   std::string m_sInputFilePath;
@@ -116,6 +116,7 @@ protected:
   bool m_bApplyMVATES;
   bool m_bApplyCombinedTES;
   bool m_bApplyMVATESQualityCheck;
+  bool m_bApplyInsituCorrection;
 
   asg::AnaToolHandle<ITauToolBase> m_tMvaTESVariableDecorator;
   asg::AnaToolHandle<ITauToolBase> m_tMvaTESEvaluator;
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSmearingTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSmearingTool.h
index e2fb28d03ef1f8f45e23997b3814e98f2c12516b..6d9ff02be7023b305a84ef3065d98ca7858b2923 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSmearingTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSmearingTool.h
@@ -1,7 +1,7 @@
 // Dear emacs, this is -*- c++ -*-
 
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TAUANALYSISTOOLS_TAUSMEARINGTOOL_H
@@ -20,6 +20,7 @@
 // Framework include(s):
 #include "AsgTools/AsgTool.h"
 #include "AsgTools/AnaToolHandle.h"
+#include "AsgTools/AsgMetadataTool.h"
 
 // Local include(s):
 #include "TauAnalysisTools/Enums.h"
@@ -30,7 +31,7 @@ namespace TauAnalysisTools
 {
 
 class TauSmearingTool
-  : public asg::AsgTool
+  : public asg::AsgMetadataTool
   , public virtual ITauSmearingTool
 {
   /// Create a proper constructor for Athena
@@ -44,7 +45,9 @@ public:
 
   /// Function initialising the tool
   virtual StatusCode initialize();
-
+  
+  virtual StatusCode beginInputFile();
+  
   /// Apply the correction on a modifyable object
   virtual CP::CorrectionCode applyCorrection( xAOD::TauJet& xTau );
   /// Create a corrected copy from a constant tau
@@ -67,12 +70,14 @@ private:
   std::string m_sInputFilePath;
   std::string m_sRecommendationTag;
   bool m_bIsData;
+  bool m_sAFII;
   bool m_bSkipTruthMatchCheck;
   bool m_bApplyFading;
 
   bool m_bApplyMVATES;
   bool m_bApplyMVATESQualityCheck;
   bool m_bApplyCombinedTES;
+  bool m_bApplyInsituCorrection;
 
 }; // class TauSmearingTool
 
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauSmearingTool.rst b/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauSmearingTool.rst
index dc45bb385944ec8dbfcc08ced96a8dc20d48df75..f0320cd93c5a9ff4727914d5d3772c2f958c19d7 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauSmearingTool.rst
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauSmearingTool.rst
@@ -74,19 +74,14 @@ The tool can be configured to use a specific set of systematic variations callin
 MVA TES and Combined TES
 ------------------------
 
-The MVA TES calibration can be applied as well with TauSmearingTool. In addition
-to your standard configuration set the option::
+By default TauSmearingTool applies MVA TES. This is applied on data and simulation. 
+First a quality check is performed to veto unreasonably low resolution values. If this check, 
+was successful the tau 4-momentum values are overwritten with the values from MVA TES. 
 
-  TauSmeTool.setProperty("ApplyMVATES", true );
+The MVA TES and the quality check can be disabled by the following options (meant only for testing purposes)::
 
-The MVA calibration will be applied to your taus, replacing the default
-four-momentum, when correcting your tau candidates via the standard
-``applyCorrection(xTau)`` and ``correctedCopy(xTauOrig, xTauCopy)``.
-
-Note: You must have at least tauRecTools-00-00-12-09. This package is only
-available in ABR since AnalysisBase-2.4.11. If you want to test the MVA
-calibration please update to that release or checkout and compile the package on
-your own.
+  TauSmeTool.setProperty("ApplyMVATES", false );
+  TauSmeTool.setProperty("ApplyMVATESQualityCheck", false );
 
 The combined TES can be applied with the following option::
 
@@ -130,7 +125,7 @@ The following table lists other properties for further configurations:
 
    * - ``ApplyMVATES``
      - ``bool``
-     - ``false``
+     - ``true``
      - apply new MVA based TES, see section `MVA TES and Combined TES`_
 
    * - ``ApplyCombinedTES``
@@ -218,9 +213,7 @@ FAQ
 #. **Question:** I try to apply systematic variation running on derived samples,
    but I get an error like::
      
-     TauAnalysisTools::CommonSmearingTool::checkTruthMatch(const TauJet&) const): No truth match information available. Please run TauTruthMatchingTool first.
-     terminate called after throwing an instance of 'SG::ExcBadAuxVar'
-     what():  SG::ExcBadAuxVar: Attempt to retrieve nonexistent aux data item `::truthParticleLink' (894).
+     TauAnalysisTools::getTruthParticleType: No truth match information available. Please run TauTruthMatchingTool first.
 
    **Answer:** Did you follow instructions for adding truth information in
    derivations as described in `TauPreRecommendations2015 TWiki
@@ -238,9 +231,7 @@ FAQ
 #. **Question:** I try to apply systematic variation running on xAOD samples,
    but I get an error like::
      
-     TauAnalysisTools::CommonSmearingTool::checkTruthMatch(const TauJet&) const): No truth match information available. Please run TauTruthMatchingTool first.
-     terminate called after throwing an instance of 'SG::ExcBadAuxVar'
-     what():  SG::ExcBadAuxVar: Attempt to retrieve nonexistent aux data item `::truthParticleLink' (894).
+     TauAnalysisTools::getTruthParticleType: No truth match information available. Please run TauTruthMatchingTool first.
 
    **Answer:** If you have full access to the TruthParticle container, you can
    create a TruthTau container and the link to the matched truth taus by setting
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcFloatWriterTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcFloatWriterTool.cxx
index b60f1bc1cf329e249951758bce32fcbc8e7d6752..30e99fce5df6a3514d12ea90f6d416be18b76164 100755
--- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcFloatWriterTool.cxx
+++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcFloatWriterTool.cxx
@@ -26,15 +26,7 @@
 
 static const char * s_protocolSep = ":";
 
-struct ToLower
-{
-  char operator() (char c) const  { return std::tolower(c); }
-};
-
 /////////////////////////////////////////////////////////////////// 
-/// Public methods: 
-/////////////////////////////////////////////////////////////////// 
-
 /// Constructors
 ////////////////
 HepMcFloatWriterTool::HepMcFloatWriterTool( const std::string& type, 
@@ -51,8 +43,7 @@ HepMcFloatWriterTool::HepMcFloatWriterTool( const std::string& type,
 		   m_ioBackendURL = "ascii:hepmc.genevent.txt", 
 		   "Name of the back-end we'll use to write out the HepMC::GenEvent."
 		   "\nEx: ascii:hepmc.genevent.txt" );
-  m_ioBackendURL.declareUpdateHandler( &HepMcFloatWriterTool::setupBackend,
-				       this );
+  m_ioBackendURL.declareUpdateHandler( &HepMcFloatWriterTool::setupBackend,this );
   
   declareProperty( "McEvents",
 		   m_mcEventsName = "GEN_EVENT",
@@ -107,16 +98,13 @@ StatusCode HepMcFloatWriterTool::execute()
 {
   // retrieve the McEventCollection
   const McEventCollection * mcEvts = 0;
-  if ( evtStore()->retrieve( mcEvts, m_mcEventsName ).isFailure() ||
-       0 == mcEvts ) {
-    ATH_MSG_ERROR("Could not retrieve a McEventCollection at ["
-		  << m_mcEventsName << "] !!");
+  if ( evtStore()->retrieve( mcEvts, m_mcEventsName ).isFailure() || 0 == mcEvts ) {
+    ATH_MSG_ERROR("Could not retrieve a McEventCollection at [" << m_mcEventsName << "] !!");
     return StatusCode::FAILURE;
   }
 
   if ( mcEvts->empty() ) {
-    ATH_MSG_WARNING("McEventCollection at [" << m_mcEventsName
-		    << "] is EMPTY !!");
+    ATH_MSG_WARNING("McEventCollection at [" << m_mcEventsName << "] is EMPTY !!");
     return StatusCode::FAILURE;
   }
 
@@ -129,18 +117,12 @@ StatusCode HepMcFloatWriterTool::execute()
   return write(evt);
 }
 
-/////////////////////////////////////////////////////////////////// 
-/// Const methods: 
-///////////////////////////////////////////////////////////////////
-
 /////////////////////////////////////////////////////////////////// 
 /// Non-const methods: 
 /////////////////////////////////////////////////////////////////// 
 
 StatusCode HepMcFloatWriterTool::write( const HepMC::GenEvent* evt )
 {
-  //m_ioBackend->write_comment( m_mcEventsName.value() );
-  //m_ioBackend->write_event(evt);
   std::ostringstream out;
 
   // precision 8 (# digits following decimal point) is the minimum that
@@ -193,20 +175,14 @@ StatusCode HepMcFloatWriterTool::write( const HepMC::GenEvent* evt )
       const float py = static_cast<float>(mom.py());
       const float pz = static_cast<float>(mom.pz());
       const float m  = static_cast<float>(mom.m());
-      const float e  = 
-	static_cast<float>(std::sqrt( std::pow( px, 2 ) +
-				      std::pow( py, 2 ) +
-				      std::pow( pz, 2 ) +
-				      std::pow( m,  2 ) ) );
-      buf << px << " " << py << " " << pz << " " << e 
-	  << " " << m 
-	  << "\n";
+      const float e  = static_cast<float>(std::sqrt( std::pow( px, 2 ) + std::pow( py, 2 ) + std::pow( pz, 2 ) + std::pow( m,  2 ) ) );
+      buf << px << " " << py << " " << pz << " " << e   << " " << m   << "\n";
 
       out << buf.str();
       out << "# "<< p->status() 
 	  << " " << p->polarization().theta()
 	  << " " << p->polarization().phi()
-	  << " " << ( p->end_vertex() ? p->end_vertex()->barcode() : 0 )
+	  << " " << ( p->end_vertex() ? HepMC::barcode(p->end_vertex()) : 0 )
 	  << " " << p->flow() 
 	  << "\n";
     }
@@ -244,14 +220,6 @@ StatusCode HepMcFloatWriterTool::write( const HepMC::GenEvent* evt )
   return StatusCode::SUCCESS;
 }
 
-/////////////////////////////////////////////////////////////////// 
-/// Protected methods: 
-/////////////////////////////////////////////////////////////////// 
-
-/////////////////////////////////////////////////////////////////// 
-/// Const methods: 
-///////////////////////////////////////////////////////////////////
-
 /////////////////////////////////////////////////////////////////// 
 /// Non-const methods: 
 /////////////////////////////////////////////////////////////////// 
@@ -282,23 +250,15 @@ void HepMcFloatWriterTool::setupBackend( Gaudi::Details::PropertyBase& /*prop*/
   }
 
   // get the protocol name in lower cases
-  std::transform( protocol.begin(), protocol.end(), 
-		  protocol.begin(),
-		  ToLower() );
-
+  std::transform( protocol.begin(), protocol.end(), protocol.begin(), [](unsigned char c){ return std::tolower(c); } );
   if ( "ascii" == protocol ) {
-    m_ioBackend = new std::ofstream( fileName.c_str(), 
-				     std::ios::out | std::ios::trunc );
+    m_ioBackend = new std::ofstream( fileName.c_str(), std::ios::out | std::ios::trunc );
 
   } else {
-    ATH_MSG_WARNING("UNKNOWN protocol [" << protocol << "] !!" << endmsg
-		    << "Will use [ascii] instead...");
+    ATH_MSG_WARNING("UNKNOWN protocol [" << protocol << "] !!" << endmsg << "Will use [ascii] instead...");
     protocol = "ascii";
-    m_ioBackend = new std::ofstream( fileName.c_str(), 
-				     std::ios::out | std::ios::trunc );
-  }    
-
-  ATH_MSG_DEBUG("Using protocol [" << protocol << "] and write to ["
-		<< fileName << "]");
+    m_ioBackend = new std::ofstream( fileName.c_str(), std::ios::out | std::ios::trunc );
+  }
+  ATH_MSG_DEBUG("Using protocol [" << protocol << "] and write to ["<< fileName << "]");
   return;
 }
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcFloatWriterTool.h b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcFloatWriterTool.h
index 81bff0a2447c71b6e647287d70f2678f01a55e60..22736bdf4aae3f7e8fbeb6b99354d554ae6cd727 100755
--- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcFloatWriterTool.h
+++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcFloatWriterTool.h
@@ -1,7 +1,5 @@
-///////////////////////// -*- C++ -*- /////////////////////////////
-
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // HepMcFloatWriterTool.h 
@@ -24,10 +22,8 @@
 
 // Forward declaration
 #include "AtlasHepMC/GenEvent_fwd.h"
-//namespace McAod { class IO_BaseClass; }
 
-class HepMcFloatWriterTool : virtual public IIOHepMcTool,
-			             public AthAlgTool
+class HepMcFloatWriterTool : virtual public IIOHepMcTool, public AthAlgTool
 { 
 
   /////////////////////////////////////////////////////////////////// 
@@ -38,9 +34,7 @@ class HepMcFloatWriterTool : virtual public IIOHepMcTool,
   // Copy constructor: 
 
   /// Constructor with parameters: 
-  HepMcFloatWriterTool( const std::string& type,
-		   const std::string& name, 
-		   const IInterface* parent );
+  HepMcFloatWriterTool( const std::string& type, const std::string& name,  const IInterface* parent );
 
   /// Destructor: 
   virtual ~HepMcFloatWriterTool(); 
@@ -50,10 +44,6 @@ class HepMcFloatWriterTool : virtual public IIOHepMcTool,
   StatusCode  execute();
   StatusCode  finalize();
 
-  /////////////////////////////////////////////////////////////////// 
-  // Const methods: 
-  ///////////////////////////////////////////////////////////////////
-
   /////////////////////////////////////////////////////////////////// 
   // Non-const methods: 
   /////////////////////////////////////////////////////////////////// 
@@ -99,11 +89,4 @@ class HepMcFloatWriterTool : virtual public IIOHepMcTool,
   std::ostream* m_ioBackend;
 }; 
 
-/// I/O operators
-//////////////////////
-
-/////////////////////////////////////////////////////////////////// 
-/// Inline methods: 
-/////////////////////////////////////////////////////////////////// 
-
 #endif //> MCPARTICLETOOLS_HEPMCFLOATWRITERTOOL_H
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.cxx
index 691f771c7b8580363b4b888848a33dea4dbf55d2..5d9f75f433afdd9c08ca684de67126bca4e32bea 100755
--- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.cxx
+++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.cxx
@@ -13,9 +13,8 @@
 #include <algorithm>
 #include <cctype>
 
-// FrameWork includes
 
-// CLHEP/HepMC includes
+//HepMC includes
 #include "GeneratorObjects/McEventCollection.h"
 #include "HepPDT/ParticleDataTable.hh"
 #include "AtlasHepMC/IO_GenEvent.h"
@@ -25,10 +24,6 @@
 
 static const char * s_protocolSep = ":";
 
-struct ToLower
-{
-  char operator() (char c) const  { return std::tolower(c); }
-};
 
 /////////////////////////////////////////////////////////////////// 
 /// Public methods: 
@@ -40,7 +35,7 @@ HepMcReaderTool::HepMcReaderTool( const std::string& type,
 				  const std::string& name, 
 				  const IInterface* parent ) : 
   AthAlgTool( type, name, parent ),
-  m_ioFrontend( 0 )
+  m_ioFrontend( nullptr )
 {
   //
   // Property declaration
@@ -100,14 +95,12 @@ StatusCode HepMcReaderTool::execute()
   // create a new McEventCollection and put it into StoreGate
   McEventCollection * mcEvts = new McEventCollection;
   if ( evtStore()->record( mcEvts, m_mcEventsOutputName ).isFailure() ) {
-    ATH_MSG_ERROR("Could not record a McEventCollection at ["
-		  << m_mcEventsOutputName << "] !!");
+    ATH_MSG_ERROR("Could not record a McEventCollection at ["<< m_mcEventsOutputName << "] !!");
     return StatusCode::FAILURE;
   }
   
   if ( evtStore()->setConst( mcEvts ).isFailure() ) {
-    ATH_MSG_WARNING("Could not setConst McEventCollection at ["
-		    << m_mcEventsOutputName << "] !!");
+    ATH_MSG_WARNING("Could not setConst McEventCollection at ["<< m_mcEventsOutputName << "] !!");
   }
 
   HepMC::GenEvent * evt = new HepMC::GenEvent;
@@ -116,28 +109,21 @@ StatusCode HepMcReaderTool::execute()
   return read(evt);
 }
 
-/////////////////////////////////////////////////////////////////// 
-/// Const methods: 
-///////////////////////////////////////////////////////////////////
-
 /////////////////////////////////////////////////////////////////// 
 /// Non-const methods: 
 /////////////////////////////////////////////////////////////////// 
 
 StatusCode HepMcReaderTool::read( HepMC::GenEvent* evt )
 {
+#ifdef HEPMC3
+  m_ioFrontend->read_event(*evt);
+#else
   m_ioFrontend->fill_next_event(evt);
+#endif
 
   return StatusCode::SUCCESS;
 }
 
-/////////////////////////////////////////////////////////////////// 
-/// Protected methods: 
-/////////////////////////////////////////////////////////////////// 
-
-/////////////////////////////////////////////////////////////////// 
-/// Const methods: 
-///////////////////////////////////////////////////////////////////
 
 /////////////////////////////////////////////////////////////////// 
 /// Non-const methods: 
@@ -169,23 +155,28 @@ void HepMcReaderTool::setupFrontend( Gaudi::Details::PropertyBase& /*prop*/ )
   }
 
   // get the protocol name in lower cases
-  std::transform( protocol.begin(), protocol.end(), 
-		  protocol.begin(),
-		  ToLower() );
+  std::transform( protocol.begin(), protocol.end(), protocol.begin(), [](unsigned char c){ return std::tolower(c); } );
+
+#ifdef HEPMC3
+  if ( "ascii" == protocol ) {
+    m_ioFrontend = new HepMC3::ReaderAsciiHepMC2( fileName.c_str());
 
+  } else {
+    msg(MSG::WARNING) << "UNKNOWN protocol [" << protocol << "] !!" << endmsg<< "Will use [ascii] instead..."<< endmsg;
+    protocol = "ascii";
+    m_ioFrontend = new HepMC3::ReaderAsciiHepMC2( fileName.c_str());
+  }    
+#else 
   if ( "ascii" == protocol ) {
     m_ioFrontend = new HepMC::IO_GenEvent( fileName.c_str(), std::ios::in );
 
   } else {
-    msg(MSG::WARNING)
-      << "UNKNOWN protocol [" << protocol << "] !!" << endmsg
-      << "Will use [ascii] instead..."
-      << endmsg;
+    msg(MSG::WARNING) << "UNKNOWN protocol [" << protocol << "] !!" << endmsg << "Will use [ascii] instead..."<< endmsg;
     protocol = "ascii";
     m_ioFrontend = new HepMC::IO_GenEvent( fileName.c_str(), std::ios::in );
   }    
+#endif
 
-  ATH_MSG_DEBUG("Using protocol [" << protocol << "] and write to ["
-		<< fileName << "]");
+  ATH_MSG_DEBUG("Using protocol [" << protocol << "] and write to ["<< fileName << "]");
   return;
 }
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.h b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.h
index dc1a82e20fc603eaaf51ea198b1a5da4d59bbc09..2e129d4ac5cf26e51766005fe57415237ffe1b51 100755
--- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.h
+++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcReaderTool.h
@@ -1,5 +1,3 @@
-///////////////////////// -*- C++ -*- /////////////////////////////
-
 /*
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
@@ -23,10 +21,13 @@
 
 // Forward declaration
 #include "AtlasHepMC/GenEvent_fwd.h"
-#include "AtlasHepMC/IO_BaseClass_fwd.h"
+#include "AtlasHepMC/IO_BaseClass.h"
+#ifdef HEPMC3
+#include "HepMC3/Reader.h"
+#include "HepMC3/ReaderAsciiHepMC2.h"
+#endif 
 
-class HepMcReaderTool : virtual public IIOHepMcTool,
-			        public AthAlgTool
+class HepMcReaderTool : virtual public IIOHepMcTool, public AthAlgTool
 { 
 
   /////////////////////////////////////////////////////////////////// 
@@ -37,9 +38,7 @@ class HepMcReaderTool : virtual public IIOHepMcTool,
   // Copy constructor: 
 
   /// Constructor with parameters: 
-  HepMcReaderTool( const std::string& type,
-		   const std::string& name, 
-		   const IInterface* parent );
+  HepMcReaderTool( const std::string& type, const std::string& name,  const IInterface* parent );
 
   /// Destructor: 
   virtual ~HepMcReaderTool(); 
@@ -49,10 +48,6 @@ class HepMcReaderTool : virtual public IIOHepMcTool,
   StatusCode  execute();
   StatusCode  finalize();
 
-  /////////////////////////////////////////////////////////////////// 
-  // Const methods: 
-  ///////////////////////////////////////////////////////////////////
-
   /////////////////////////////////////////////////////////////////// 
   // Non-const methods: 
   /////////////////////////////////////////////////////////////////// 
@@ -93,15 +88,11 @@ class HepMcReaderTool : virtual public IIOHepMcTool,
 
   /** Abstract base class for the back-end
    */
+#ifdef HEPMC3
+  HepMC3::Reader* m_ioFrontend;
+#else 
   HepMC::IO_BaseClass* m_ioFrontend;
+#endif
 
 }; 
-
-/// I/O operators
-//////////////////////
-
-/////////////////////////////////////////////////////////////////// 
-/// Inline methods: 
-/////////////////////////////////////////////////////////////////// 
-
 #endif //> MCPARTICLETOOLS_HEPMCREADERTOOL_H
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcTupleWriterTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcTupleWriterTool.cxx
index 3320a816c0939a114c98bdbc5909499ad2d33bdb..e4c6a5a059d0f64c085538b2d263417e5680868e 100755
--- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcTupleWriterTool.cxx
+++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcTupleWriterTool.cxx
@@ -8,10 +8,6 @@
 // Author: S.Binet<binet@cern.ch>
 /////////////////////////////////////////////////////////////////// 
 
-
-// STL includes
-//#include <sstream>
-
 // FrameWork includes
 #include "GaudiKernel/ITHistSvc.h"
 #include "Gaudi/Property.h"
@@ -27,10 +23,6 @@
 // McParticleTools includes
 #include "HepMcTupleWriterTool.h"
 
-/////////////////////////////////////////////////////////////////// 
-/// Public methods: 
-/////////////////////////////////////////////////////////////////// 
-
 /// Constructors
 ////////////////
 HepMcTupleWriterTool::HepMcTupleWriterTool( const std::string& type, 
@@ -48,8 +40,7 @@ HepMcTupleWriterTool::HepMcTupleWriterTool( const std::string& type,
 		   m_outputFileName = "hepmc.root", 
 		   "Name of the output file which will contain the HepMC tuple"
 		   "\nEx: hepmc.root" );
-  m_outputFileName.declareUpdateHandler( &HepMcTupleWriterTool::setupBackend,
-					 this );
+  m_outputFileName.declareUpdateHandler( &HepMcTupleWriterTool::setupBackend, this );
 
   declareProperty( "OutputStream", 
 		   m_outputStreamName = "hepmc", 
@@ -107,10 +98,8 @@ StatusCode HepMcTupleWriterTool::execute()
 {
   // retrieve the McEventCollection
   const McEventCollection * mcEvts = 0;
-  if ( evtStore()->retrieve( mcEvts, m_mcEventsName ).isFailure() ||
-       0 == mcEvts ) {
-    ATH_MSG_ERROR("Could not retrieve a McEventCollection at ["
-		  << m_mcEventsName << "] !!");
+  if ( evtStore()->retrieve( mcEvts, m_mcEventsName ).isFailure() || 0 == mcEvts ) {
+    ATH_MSG_ERROR("Could not retrieve a McEventCollection at [" << m_mcEventsName << "] !!");
     return StatusCode::FAILURE;
   }
 
@@ -128,50 +117,39 @@ StatusCode HepMcTupleWriterTool::execute()
   return write(evt);
 }
 
-/////////////////////////////////////////////////////////////////// 
-/// Const methods: 
-///////////////////////////////////////////////////////////////////
-
 /////////////////////////////////////////////////////////////////// 
 /// Non-const methods: 
 /////////////////////////////////////////////////////////////////// 
 
 StatusCode HepMcTupleWriterTool::write( const HepMC::GenEvent* evt )
 {
-  m_particles.m_nParticles = std::min<std::size_t>( s_nMax,
-						    evt->particles_size() );
+#ifdef HEPMC3
+  m_particles.m_nParticles = std::min<std::size_t>( s_nMax, evt->particles().size() );
+#else  
+  m_particles.m_nParticles = std::min<std::size_t>( s_nMax, evt->particles_size() );
+#endif
   std::size_t i = 0;
-  for ( HepMC::GenEvent::particle_const_iterator 
-	  p = evt->particles_begin(),
-	  pEnd = evt->particles_end();
-	p != pEnd && i != static_cast<std::size_t>(m_particles.m_nParticles);
-	++p,++i ) {
-    const HepMC::FourVector mom = (*p)->momentum();
+  for (auto p: *evt)
+  {
+    if (i == static_cast<std::size_t>(m_particles.m_nParticles)) break;
+    i++;
+    const HepMC::FourVector mom = p->momentum();
     m_particles.m_px [i] = mom.px();
     m_particles.m_py [i] = mom.py();
     m_particles.m_pz [i] = mom.pz();
     m_particles.m_m  [i] = mom.m();
     m_particles.m_ene[i] = mom.e();
 
-    m_particles.m_pdgId[i]   = (*p)->pdg_id();
-    m_particles.m_status[i]  = (*p)->status();
-    m_particles.m_barcode[i] = (*p)->barcode();
+    m_particles.m_pdgId[i]   = p->pdg_id();
+    m_particles.m_status[i]  = p->status();
+    m_particles.m_barcode[i] = HepMC::barcode(p);
   }
-
   // commit event
   m_tuple->Fill();
 
   return StatusCode::SUCCESS;
 }
 
-/////////////////////////////////////////////////////////////////// 
-/// Protected methods: 
-/////////////////////////////////////////////////////////////////// 
-
-/////////////////////////////////////////////////////////////////// 
-/// Const methods: 
-///////////////////////////////////////////////////////////////////
-
 /////////////////////////////////////////////////////////////////// 
 /// Non-const methods: 
 /////////////////////////////////////////////////////////////////// 
@@ -182,9 +160,7 @@ void HepMcTupleWriterTool::setupBackend( Gaudi::Details::PropertyBase& /*m_outpu
   IProperty * tSvc = 0;
   if ( !service( m_tupleSvc.name(), tSvc, createIf ).isSuccess() ) {
     ATH_MSG_ERROR("Could not retrieve THistSvc handle !!");
-    throw GaudiException( "Could not retrieve THistSvc", 
-			  name(), 
-			  StatusCode::FAILURE );
+    throw GaudiException( "Could not retrieve THistSvc",   name(),   StatusCode::FAILURE );
   }
 
   const std::string streamName = m_outputStreamName.value();
@@ -196,16 +172,12 @@ void HepMcTupleWriterTool::setupBackend( Gaudi::Details::PropertyBase& /*m_outpu
   updatedProp.push_back
     ( streamName+" DATAFILE='"+m_outputFileName.value()+"' "
       "TYP='ROOT' "
-      "OPT='RECREATE'" 
-      );
+      "OPT='RECREATE'" );
   outputFileName.set( updatedProp );
   outputFileName.setName( propName );
   if ( !tSvc->setProperty( outputFileName ).isSuccess() ) {
-    ATH_MSG_ERROR("Could not configure the THistSvc's output filename ["
-		  << m_outputFileName.value() << "] !!");
-    throw GaudiException( "Could not configure THistSvc output file !!", 
-			  name(),
-			  StatusCode::FAILURE );
+    ATH_MSG_ERROR("Could not configure the THistSvc's output filename ["<< m_outputFileName.value() << "] !!");
+    throw GaudiException( "Could not configure THistSvc output file !!",   name(),  StatusCode::FAILURE );
   }
 
   return;
@@ -218,9 +190,7 @@ void HepMcTupleWriterTool::bookTuple()
   if ( !m_tupleSvc->regTree( "/" + streamName + "/hepmc", t ).isSuccess() ) {
     ATH_MSG_ERROR("Could not register HepMC validation tuple !!");
     delete t; t = 0;
-    throw GaudiException( "Could not register HepMC validation tuple !!",
-			  name(),
-			  StatusCode::FAILURE );
+    throw GaudiException( "Could not register HepMC validation tuple !!",  name(),  StatusCode::FAILURE );
   }
 
   // booking branches
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcTupleWriterTool.h b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcTupleWriterTool.h
index cb27cf1700ea88718091212064b811eef8adfc69..909eaa774351ddd8afec684deb0e7359f9bddc8b 100755
--- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcTupleWriterTool.h
+++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcTupleWriterTool.h
@@ -1,5 +1,3 @@
-///////////////////////// -*- C++ -*- /////////////////////////////
-
 /*
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
@@ -29,8 +27,7 @@ class ITHistSvc;
 class TTree;
 #include "AtlasHepMC/GenEvent_fwd.h"
 
-class HepMcTupleWriterTool : virtual public IIOHepMcTool,
-			             public AthAlgTool
+class HepMcTupleWriterTool : virtual public IIOHepMcTool, public AthAlgTool
 { 
 
   /////////////////////////////////////////////////////////////////// 
@@ -41,9 +38,7 @@ class HepMcTupleWriterTool : virtual public IIOHepMcTool,
   // Copy constructor: 
 
   /// Constructor with parameters: 
-  HepMcTupleWriterTool( const std::string& type,
-			const std::string& name, 
-			const IInterface* parent );
+  HepMcTupleWriterTool( const std::string& type, const std::string& name, const IInterface* parent );
 
   /// Destructor: 
   virtual ~HepMcTupleWriterTool(); 
@@ -53,10 +48,6 @@ class HepMcTupleWriterTool : virtual public IIOHepMcTool,
   StatusCode  execute();
   StatusCode  finalize();
 
-  /////////////////////////////////////////////////////////////////// 
-  // Const methods: 
-  ///////////////////////////////////////////////////////////////////
-
   /////////////////////////////////////////////////////////////////// 
   // Non-const methods: 
   /////////////////////////////////////////////////////////////////// 
@@ -126,11 +117,4 @@ class HepMcTupleWriterTool : virtual public IIOHepMcTool,
   TTree* m_tuple;
 }; 
 
-/// I/O operators
-//////////////////////
-
-/////////////////////////////////////////////////////////////////// 
-/// Inline methods: 
-/////////////////////////////////////////////////////////////////// 
-
 #endif //> MCPARTICLETOOLS_HEPMCTUPLEWRITERTOOL_H
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.cxx
index 685b361fac618637ea23b958c74a3e0769c1d078..b2c01a57e2e85d0da5af029692280d60d25529b7 100755
--- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.cxx
+++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.cxx
@@ -8,14 +8,11 @@
 // Author: S.Binet<binet@cern.ch>
 /////////////////////////////////////////////////////////////////// 
 
-
 // STL includes
 #include <algorithm>
 #include <cctype>
 
-// FrameWork includes
-
-// CLHEP/HepMC includes
+// HepMC includes
 #include "GeneratorObjects/McEventCollection.h"
 #include "HepPDT/ParticleDataTable.hh"
 #include "AtlasHepMC/IO_GenEvent.h"
@@ -25,20 +22,10 @@
 
 static const char * s_protocolSep = ":";
 
-struct ToLower
-{
-  char operator() (char c) const  { return std::tolower(c); }
-};
-
-/////////////////////////////////////////////////////////////////// 
-/// Public methods: 
 /////////////////////////////////////////////////////////////////// 
-
 /// Constructors
 ////////////////
-HepMcWriterTool::HepMcWriterTool( const std::string& type, 
-				  const std::string& name, 
-				  const IInterface* parent ) : 
+HepMcWriterTool::HepMcWriterTool( const std::string& type,   const std::string& name,  const IInterface* parent ) : 
   AthAlgTool( type, name, parent ),
   m_ioBackend( 0 )
 {
@@ -102,10 +89,8 @@ StatusCode HepMcWriterTool::execute()
 {
   // retrieve the McEventCollection
   const McEventCollection * mcEvts = 0;
-  if ( evtStore()->retrieve( mcEvts, m_mcEventsName ).isFailure() ||
-       0 == mcEvts ) {
-    ATH_MSG_ERROR("Could not retrieve a McEventCollection at ["
-		  << m_mcEventsName << "] !!");
+  if ( evtStore()->retrieve( mcEvts, m_mcEventsName ).isFailure() || 0 == mcEvts ) {
+    ATH_MSG_ERROR("Could not retrieve a McEventCollection at ["  << m_mcEventsName << "] !!");
     return StatusCode::FAILURE;
   }
 
@@ -123,34 +108,20 @@ StatusCode HepMcWriterTool::execute()
   return write(evt);
 }
 
-/////////////////////////////////////////////////////////////////// 
-/// Const methods: 
-///////////////////////////////////////////////////////////////////
-
 /////////////////////////////////////////////////////////////////// 
 /// Non-const methods: 
 /////////////////////////////////////////////////////////////////// 
 
 StatusCode HepMcWriterTool::write( const HepMC::GenEvent* evt )
 {
-  //m_ioBackend->write_comment( m_mcEventsName.value() );
+#ifdef HEPMC3
+  m_ioBackend->write_event(*evt);
+#else
   m_ioBackend->write_event(evt);
-
+#endif
   return StatusCode::SUCCESS;
 }
 
-/////////////////////////////////////////////////////////////////// 
-/// Protected methods: 
-/////////////////////////////////////////////////////////////////// 
-
-/////////////////////////////////////////////////////////////////// 
-/// Const methods: 
-///////////////////////////////////////////////////////////////////
-
-/////////////////////////////////////////////////////////////////// 
-/// Non-const methods: 
-/////////////////////////////////////////////////////////////////// 
-
 void HepMcWriterTool::setupBackend( Gaudi::Details::PropertyBase& /*prop*/ )
 {
   // defaults
@@ -177,23 +148,26 @@ void HepMcWriterTool::setupBackend( Gaudi::Details::PropertyBase& /*prop*/ )
   }
 
   // get the protocol name in lower cases
-  std::transform( protocol.begin(), protocol.end(), 
-		  protocol.begin(),
-		  ToLower() );
-
+  std::transform( protocol.begin(), protocol.end(), protocol.begin(), [](unsigned char c){ return std::tolower(c); } );
+#ifdef HEPMC3
   if ( "ascii" == protocol ) {
-    m_ioBackend = new HepMC::IO_GenEvent( fileName.c_str(), 
-                                          std::ios::out | std::ios::trunc );
+    m_ioBackend = new HepMC3::WriterAsciiHepMC2( fileName.c_str());
 
   } else {
-    ATH_MSG_WARNING("UNKNOWN protocol [" << protocol << "] !!" << endmsg
-		    << "Will use [ascii] instead...");
+    ATH_MSG_WARNING("UNKNOWN protocol [" << protocol << "] !!" << endmsg  << "Will use [ascii] instead...");
     protocol = "ascii";
-    m_ioBackend = new HepMC::IO_GenEvent( fileName.c_str(),
-                                          std::ios::out | std::ios::trunc );
+    m_ioBackend = new HepMC3::WriterAsciiHepMC2( fileName.c_str());
   }    
+#else
+  if ( "ascii" == protocol ) {
+    m_ioBackend = new HepMC::IO_GenEvent( fileName.c_str(), std::ios::out | std::ios::trunc );
 
-  ATH_MSG_DEBUG("Using protocol [" << protocol << "] and write to ["
-		<< fileName << "]");
+  } else {
+    ATH_MSG_WARNING("UNKNOWN protocol [" << protocol << "] !!" << endmsg  << "Will use [ascii] instead...");
+    protocol = "ascii";
+    m_ioBackend = new HepMC::IO_GenEvent( fileName.c_str(), std::ios::out | std::ios::trunc );
+  }    
+#endif
+  ATH_MSG_DEBUG("Using protocol [" << protocol << "] and write to ["<< fileName << "]");
   return;
 }
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.h b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.h
index 1845fb6c6be3ccd748ad19b6a54e82cefdb41bb8..176419ac49f9c1cc9f1b097d2c64c239ecb337e4 100755
--- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.h
+++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/HepMcWriterTool.h
@@ -1,5 +1,3 @@
-///////////////////////// -*- C++ -*- /////////////////////////////
-
 /*
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
@@ -23,10 +21,12 @@
 
 // Forward declaration
 #include "AtlasHepMC/GenEvent_fwd.h"
-#include "AtlasHepMC/IO_BaseClass_fwd.h"
-
-class HepMcWriterTool : virtual public IIOHepMcTool,
-			        public AthAlgTool
+#include "AtlasHepMC/IO_BaseClass.h"
+#ifdef HEPMC3
+#include "HepMC3/Writer.h"
+#include "HepMC3/WriterAsciiHepMC2.h"
+#endif 
+class HepMcWriterTool : virtual public IIOHepMcTool, public AthAlgTool
 { 
 
   /////////////////////////////////////////////////////////////////// 
@@ -37,9 +37,7 @@ class HepMcWriterTool : virtual public IIOHepMcTool,
   // Copy constructor: 
 
   /// Constructor with parameters: 
-  HepMcWriterTool( const std::string& type,
-		   const std::string& name, 
-		   const IInterface* parent );
+  HepMcWriterTool( const std::string& type, const std::string& name,  const IInterface* parent );
 
   /// Destructor: 
   virtual ~HepMcWriterTool(); 
@@ -49,10 +47,6 @@ class HepMcWriterTool : virtual public IIOHepMcTool,
   StatusCode  execute();
   StatusCode  finalize();
 
-  /////////////////////////////////////////////////////////////////// 
-  // Const methods: 
-  ///////////////////////////////////////////////////////////////////
-
   /////////////////////////////////////////////////////////////////// 
   // Non-const methods: 
   /////////////////////////////////////////////////////////////////// 
@@ -95,15 +89,11 @@ class HepMcWriterTool : virtual public IIOHepMcTool,
 
   /** Abstract base class for the back-end
    */
+#ifdef HEPMC3
+  HepMC3::Writer* m_ioBackend;
+#else   
   HepMC::IO_BaseClass* m_ioBackend;
+#endif
 
 }; 
-
-/// I/O operators
-//////////////////////
-
-/////////////////////////////////////////////////////////////////// 
-/// Inline methods: 
-/////////////////////////////////////////////////////////////////// 
-
 #endif //> MCPARTICLETOOLS_HEPMCWRITERTOOL_H
diff --git a/Projects/AnalysisBase/externals.txt b/Projects/AnalysisBase/externals.txt
index 40606c93012f80464a5cc20b8d00996c03048224..7f4d60ef9b2c287ef59222023405efa7d4ac1507 100644
--- a/Projects/AnalysisBase/externals.txt
+++ b/Projects/AnalysisBase/externals.txt
@@ -6,4 +6,4 @@
 # forbidden.
 
 # The version of atlas/atlasexternals to use:
-AnalysisBaseExternalsVersion = 2.0.87
+AnalysisBaseExternalsVersion = 2.0.89
diff --git a/Projects/AthDataQuality/externals.txt b/Projects/AthDataQuality/externals.txt
index 866de32a6811b3a418963abae19a311144145db8..0c594889a0ad3ca6443b115437e1ddd2acef5ca8 100644
--- a/Projects/AthDataQuality/externals.txt
+++ b/Projects/AthDataQuality/externals.txt
@@ -5,4 +5,4 @@
 # an "origin/" prefix before it. For tags however this is explicitly
 # forbidden.
 
-AtlasExternalsVersion = 2.0.87
+AtlasExternalsVersion = 2.0.89
diff --git a/Projects/AthDataQuality/version.txt b/Projects/AthDataQuality/version.txt
index d4af495342f95cb7dd3f08f8aa62bef8e13b53a9..beb148da6ac7fd229df2a0f84137f6a0de206ba7 100644
--- a/Projects/AthDataQuality/version.txt
+++ b/Projects/AthDataQuality/version.txt
@@ -1 +1 @@
-22.0.21
+22.0.22
diff --git a/Projects/AthGeneration/externals.txt b/Projects/AthGeneration/externals.txt
index 7105fe145cbee2b298b31e964e2b6ddf19c0658b..b8583a418633424eddd94355d0fad69183f35c8c 100644
--- a/Projects/AthGeneration/externals.txt
+++ b/Projects/AthGeneration/externals.txt
@@ -6,4 +6,4 @@
 # forbidden.
 
 # The version of atlas/atlasexternals to use:
-AthGenerationExternalsVersion = 2.0.87
+AthGenerationExternalsVersion = 2.0.89
diff --git a/Projects/AthGeneration/version.txt b/Projects/AthGeneration/version.txt
index d4af495342f95cb7dd3f08f8aa62bef8e13b53a9..beb148da6ac7fd229df2a0f84137f6a0de206ba7 100644
--- a/Projects/AthGeneration/version.txt
+++ b/Projects/AthGeneration/version.txt
@@ -1 +1 @@
-22.0.21
+22.0.22
diff --git a/Projects/AthSimulation/externals.txt b/Projects/AthSimulation/externals.txt
index c53fbaca8821e0fab0722e3ef7032794aafbb183..8a54fbde1930857bfcb8d6d459c0c289d3d62323 100644
--- a/Projects/AthSimulation/externals.txt
+++ b/Projects/AthSimulation/externals.txt
@@ -6,4 +6,4 @@
 # forbidden.
 
 # The version of atlas/atlasexternals to use:
-AthSimulationExternalsVersion = 2.0.87
+AthSimulationExternalsVersion = 2.0.89
diff --git a/Projects/AthSimulation/version.txt b/Projects/AthSimulation/version.txt
index d4af495342f95cb7dd3f08f8aa62bef8e13b53a9..beb148da6ac7fd229df2a0f84137f6a0de206ba7 100644
--- a/Projects/AthSimulation/version.txt
+++ b/Projects/AthSimulation/version.txt
@@ -1 +1 @@
-22.0.21
+22.0.22
diff --git a/Projects/Athena/externals.txt b/Projects/Athena/externals.txt
index 4640e294a20e81eb6df53302e1469316d307ebf6..ca4d89ec730f9e5c7a02c855e28ce398cd94b022 100644
--- a/Projects/Athena/externals.txt
+++ b/Projects/Athena/externals.txt
@@ -6,4 +6,4 @@
 # forbidden.
 
 # The version of atlas/atlasexternals to use:
-AthenaExternalsVersion = 2.0.87
+AthenaExternalsVersion = 2.0.89
diff --git a/Projects/Athena/package_filters.txt b/Projects/Athena/package_filters.txt
index a193110e30bd7ac8b17bd78d35d6018831277d05..a28db6d9539bac1b873f39e752a301324a17cd83 100644
--- a/Projects/Athena/package_filters.txt
+++ b/Projects/Athena/package_filters.txt
@@ -32,7 +32,6 @@
 + PhysicsAnalysis/Algorithms/SelectionHelpers
 + PhysicsAnalysis/Algorithms/SystematicsHandles
 - PhysicsAnalysis/Algorithms/.*
-- PhysicsAnalysis/AnalysisCommon/PMGTools
 - PhysicsAnalysis/D3PDTools/EventLoop.*
 - PhysicsAnalysis/D3PDTools/MultiDraw
 - PhysicsAnalysis/D3PDTools/SampleHandler
diff --git a/Projects/Athena/version.txt b/Projects/Athena/version.txt
index d4af495342f95cb7dd3f08f8aa62bef8e13b53a9..beb148da6ac7fd229df2a0f84137f6a0de206ba7 100644
--- a/Projects/Athena/version.txt
+++ b/Projects/Athena/version.txt
@@ -1 +1 @@
-22.0.21
+22.0.22
diff --git a/Projects/VP1Light/externals.txt b/Projects/VP1Light/externals.txt
index bc0799b959c6c6f1433cfdef42f093eea66a5751..35f49b4e473919a25cda0238348a4e7247b8ea3b 100644
--- a/Projects/VP1Light/externals.txt
+++ b/Projects/VP1Light/externals.txt
@@ -6,4 +6,4 @@
 # forbidden.
 
 # The version of atlas/atlasexternals to use:
-VP1LightExternalsVersion = 2.0.87
+VP1LightExternalsVersion = 2.0.89
diff --git a/Projects/VP1Light/version.txt b/Projects/VP1Light/version.txt
index d4af495342f95cb7dd3f08f8aa62bef8e13b53a9..beb148da6ac7fd229df2a0f84137f6a0de206ba7 100644
--- a/Projects/VP1Light/version.txt
+++ b/Projects/VP1Light/version.txt
@@ -1 +1 @@
-22.0.21
+22.0.22
diff --git a/Reconstruction/AODFix/CMakeLists.txt b/Reconstruction/AODFix/CMakeLists.txt
index 80bab837d8a777bed0c9a1cbe7d7278b9cb94a78..a9e43ad643d2fc42cf65f8596850e47258f444d1 100644
--- a/Reconstruction/AODFix/CMakeLists.txt
+++ b/Reconstruction/AODFix/CMakeLists.txt
@@ -1,10 +1,7 @@
-################################################################################
-# Package: AODFix
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( AODFix )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
-
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Reconstruction/AODFix/python/AODFix.py b/Reconstruction/AODFix/python/AODFix.py
index f1909d49acac0a51fe864544b6fc0e67eafa0df5..649ca21173755fef5c52b640ef868ed484cb73a4 100644
--- a/Reconstruction/AODFix/python/AODFix.py
+++ b/Reconstruction/AODFix/python/AODFix.py
@@ -48,7 +48,7 @@ def AODFix_Init():
     ##################
     # exit if locked to false
     ##################
-    if rec.doApplyAODFix.is_locked() and rec.doApplyAODFix.get_Value() == False:
+    if rec.doApplyAODFix.is_locked() and rec.doApplyAODFix.get_Value() is False:
         logAODFix.info("doApplyAODFix is locked to False; not applying anything")
         return
 
@@ -60,7 +60,7 @@ def AODFix_Init():
     import os
     curRelease=os.getenv("AtlasVersion") or ''
 
-    logAODFix.debug("curRelease set to " + curRelease)
+    logAODFix.debug("curRelease set to %s", curRelease)
     
     
     ##################
@@ -113,8 +113,8 @@ def AODFix_Init():
         logAODFix.info(" Input file is MC")
     else:
         logAODFix.info(" Input file is DATA")
-    logAODFix.info(" Input file produced with Athena version <%s>." % prevRelease)
-    logAODFix.info(" AODFix version <%s> was previously applied." % prevAODFix)
+    logAODFix.info(" Input file produced with Athena version <%s>.", prevRelease)
+    logAODFix.info(" AODFix version <%s> was previously applied.", prevAODFix)
     if rec.doApplyAODFix.is_locked():
         logAODFix.info(" AODFix is forced to run!")
 
@@ -159,7 +159,7 @@ def AODFix_Init():
             logAODFix.info("No AODFix scheduled for this release.")
 
     else:
-        logAODFix.info("Current release is of strange form: %s" % curRelease)
+        logAODFix.info("Current release is of strange form: %s", curRelease)
 
 # To inquire whether AODFix will be run
 
diff --git a/Reconstruction/AODFix/python/AODFix_base.py b/Reconstruction/AODFix/python/AODFix_base.py
index a8d48a27738efd9582bf8f60e0ae054186cdae71..d2dafbbbaefabb2b1ea1b1c0b037061e03717fab 100644
--- a/Reconstruction/AODFix/python/AODFix_base.py
+++ b/Reconstruction/AODFix/python/AODFix_base.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon.Logging import logging
 
@@ -42,9 +42,9 @@ class AODFix_base(object):
         self.isHIP = isHIP
         self.prevAODFix = prevVersion if not force else 'none' # if forcing, ignore old AODFix
         self.newAODFix = "-".join(self.latestAODFixVersion())
-        logAODFix.debug( "latestAODFixVersion() = " +  self.newAODFix)
-        logAODFix.debug( "prevVersion = " +  prevVersion)
-        logAODFix.debug( "force = " +  str(force))
+        logAODFix.debug( "latestAODFixVersion() = %s", self.newAODFix)
+        logAODFix.debug( "prevVersion = %s", prevVersion)
+        logAODFix.debug( "force = %s", force)
         if self.newAODFix == "":
             # the AODFix is empty: do nothing
             self.doAODFix = False
@@ -58,7 +58,7 @@ class AODFix_base(object):
             self.doAODFix = True
 
         if self.doAODFix:
-            logAODFix.info("AODFix with version %s scheduled" % self.newAODFix)
+            logAODFix.info("AODFix with version %s scheduled", self.newAODFix)
 
     def addMetaData(self):
         '''standard function to apply metadata, can overload if necessary for complicated scenarios.'''
@@ -83,7 +83,7 @@ class AODFix_base(object):
 
             metastr = "AODFix_" + "-".join(metadataList) + suffix
 
-            logAODFix.info("executing addMetaData, will add as AODFixVersion %s" % metastr)
+            logAODFix.info("executing addMetaData, will add as AODFixVersion %s", metastr)
             from AthenaCommon.AppMgr import ServiceMgr as svcMgr
             svcMgr.TagInfoMgr.ExtraTagValuePairs["AODFixVersion"]=metastr
 
diff --git a/Reconstruction/Jet/JetCalibTools/JetCalibTools/JetCalibrationTool.h b/Reconstruction/Jet/JetCalibTools/JetCalibTools/JetCalibrationTool.h
index 6dcca2db70cb8ad2012c3dc95ee061b8c4acc2aa..b5ff925db866d9dea59e6646888cec2d03559a3e 100644
--- a/Reconstruction/Jet/JetCalibTools/JetCalibTools/JetCalibrationTool.h
+++ b/Reconstruction/Jet/JetCalibTools/JetCalibTools/JetCalibrationTool.h
@@ -95,8 +95,8 @@ private:
        "PrimaryVerticesContainerName",
        "PrimaryVertices"};
   SG::ReadDecorHandleKey<xAOD::EventInfo>        m_rdhkEvtInfo {this
-      ,"AveIntPerXKey"
-      ,"EventInfo.AveIntPerXDecor"
+      ,"averageInteractionsPerCrossingKey"
+      ,"EventInfo.averageInteractionsPerCrossing"
       ,"Decoration for Average Interaction Per Crossing"};
 
   //Variables for configuration
diff --git a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py
index e71c285f072130f3f6215480118aff09814ff11e..4e1950ae4a471c49ab38b9f3226829eae8220240 100644
--- a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py
+++ b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py
@@ -289,7 +289,8 @@ def getJetAlgorithm(jetname, jetdef, pjContNames, monTool = None):
     return jetalg
 
 ########################################################################
-# Function that substitues JetRecTool + JetAlgorithm
+# New JetRecAlgorithm to replace JetRecTool
+# This call is for a JRA that runs jet-finding
 #
 def getJetRecAlg( jetdef):
     """ """
@@ -318,6 +319,39 @@ def getJetRecAlg( jetdef):
     return jra
 
 
+########################################################################
+# Get a JetRecAlg set up to copy a jet collection and apply mods
+# In this setup we do not resolve dependencies because typically
+# these may be set up already in the original jet collection
+# In future we may wish to add a toggle.
+#
+def getJetCopyAlg(jetsin, jetsoutdef, shallowcopy=True, shallowIO=True):
+
+    jcopy = CompFactory.JetCopier(
+        "copier",
+        InputJets = jetsin,
+        ShallowCopy=shallowcopy,
+        ShallowIO=shallowIO)
+
+    # Convert mod aliases into concrete tools
+    from . import JetModConfig
+    mods = []
+    for mod in jetsoutdef.modifiers:
+        moddef = JetModConfig.aliasToModDef(mod,jetsoutdef)
+        mods.append(JetModConfig.getModifier(jetsoutdef,moddef,moddef.modspec))
+
+    jetsoutname = jetsoutdef.fullname()
+    jra = CompFactory.JetRecAlg(
+        "jetrecalg_copy_"+jetsoutname,
+        Provider = jcopy,
+        Modifiers = mods,
+        OutputContainer = jetsoutname)
+
+    autoconfigureModifiers(jra.Modifiers, jetsoutname)
+
+    return jra
+
+
 ########################################################################
 # For each modifier in the given list with a configurable input container
 # name ("JetContainer"), configure it to containerName.
diff --git a/Reconstruction/MET/METUtilities/Root/METMaker.cxx b/Reconstruction/MET/METUtilities/Root/METMaker.cxx
index 18bfcb87fa9d993a65e8e1a6b51094ae8f2e139c..997530d2e3b07ae8946f105df57dcb46f0af29bc 100644
--- a/Reconstruction/MET/METUtilities/Root/METMaker.cxx
+++ b/Reconstruction/MET/METUtilities/Root/METMaker.cxx
@@ -796,7 +796,7 @@ namespace met {
           ATH_MSG_VERBOSE("This key: " << assoc->calkey()[iKey] << ", selector: " << selector);
         }
         ATH_MSG_VERBOSE("Mu calovec pt, no Eloss:   " << mu_calovec.cpt());
-        if(m_muEloss) mu_calovec *= std::max(0.,1-(total_eloss/mu_calovec.ce()));
+        if(m_muEloss) mu_calovec *= std::max<float>(0.,1-(total_eloss/mu_calovec.ce()));
         ATH_MSG_VERBOSE("Mu calovec pt, with Eloss: " << mu_calovec.cpt());
 
         // re-add calo components of muons beyond Eloss correction
@@ -1014,7 +1014,7 @@ namespace met {
           if(selector) mu_calovec += assoc->calVec(iKey);
         }
         if(m_muEloss){
-          mu_calovec *= std::max(0.,1-(total_eloss/mu_calovec.ce()));
+          mu_calovec *= std::max<float>(0.,1-(total_eloss/mu_calovec.ce()));
           opx += mu_calovec.cpx();
           opy += mu_calovec.cpy();
           osumpt += mu_calovec.sumpt();
diff --git a/Reconstruction/MVAUtils/CMakeLists.txt b/Reconstruction/MVAUtils/CMakeLists.txt
index c93e0b83e7eec52708703bb1107c508cd612a5ca..4c99e1545ab663916886c20bdf0fc48d41146e5f 100644
--- a/Reconstruction/MVAUtils/CMakeLists.txt
+++ b/Reconstruction/MVAUtils/CMakeLists.txt
@@ -18,7 +18,7 @@ atlas_add_dictionary( MVAUtilsDict
                       MVAUtils/selection.xml
                       LINK_LIBRARIES MVAUtils)
 
-atlas_install_python_modules( util/*.py )
+atlas_install_python_modules( util/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 
 atlas_add_executable( convertXmlToRootTree util/convertXmlToRootTree.cxx
                       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} MVAUtils
diff --git a/Reconstruction/MVAUtils/util/convertLGBMToRootTree.py b/Reconstruction/MVAUtils/util/convertLGBMToRootTree.py
index 962a363f69fa82cad923b21e1d8478fcbd2bc328..fc663323b693e0bacd09dad8ff619a32a9340596 100755
--- a/Reconstruction/MVAUtils/util/convertLGBMToRootTree.py
+++ b/Reconstruction/MVAUtils/util/convertLGBMToRootTree.py
@@ -381,8 +381,8 @@ def test_multiclass(booster, mva_utils, ntests=10000, test_file=None):
             zip(data_input, results_lgbm, results_MVAUtils), 1):
         if not np.allclose(output_lgbm, output_MVAUtils):
             stop_event_loop = True
-            logging.info("output are different on input %d/%d:\n" %
-                         (ievent, len(data_input)))
+            logging.info("output are different on input %d/%d:\n",
+                         ievent, len(data_input))
             for ivar, input_value in enumerate(input_values):
                 logging.info("var %d: %.15f", ivar, input_value)
             logging.info("=" * 50)
@@ -405,13 +405,13 @@ def test_multiclass(booster, mva_utils, ntests=10000, test_file=None):
                 if not np.allclose(output_tree_mva_utils, output_tree_lgbm[0]):
                     stop_tree_loop = True
                     logging.info(
-                        "first tree/class with different answer (%d)" % itree)
+                        "first tree/class with different answer (%d)", itree)
                     for isubtree, (ol, om) in enumerate(
                             zip(output_tree_lgbm[0], output_tree_mva_utils)):
                         if not np.allclose(ol, om):
-                            logging.info("different in position %d" % isubtree)
-                            logging.info("lgbm:     %f" % ol)
-                            logging.info("mvautils: %f" % om)
+                            logging.info("different in position %d", isubtree)
+                            logging.info("lgbm:     %f", ol)
+                            logging.info("mvautils: %f", om)
                             logging.info("=" * 50)
                             logging.info("tree %d (itree) * %d (nclasses)"
                                          "+ %d (isubtree) = %d",
diff --git a/Reconstruction/MVAUtils/util/convertXGBoostToRootTree.py b/Reconstruction/MVAUtils/util/convertXGBoostToRootTree.py
index 96b7bca5e5ed7b6746e0c00947d55ee22992cff5..406de522a229b8cdca4c84f308f43ae921088592 100755
--- a/Reconstruction/MVAUtils/util/convertXGBoostToRootTree.py
+++ b/Reconstruction/MVAUtils/util/convertXGBoostToRootTree.py
@@ -150,7 +150,7 @@ def test(model_file, tree_file, objective, tree_name='xgboost', ntests=10000, te
     tree = f.Get(tree_name)
     try:
         _ = ROOT.MVAUtils.BDT
-    except:
+    except Exception:
         print("cannot import MVAUtils")
         return None
 
diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx
index b1f92b8658b4d270f37265db6211ecd7ef03eba9..82b44be853bd15818e739f1d7ee966964158eaec 100755
--- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx
+++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx
@@ -4781,6 +4781,6 @@ CombinedMuonTrackBuilder::checkTrack(std::string txt, Trk::Track* newTrack, Trk:
     return newTrackOK;
 }
   void CombinedMuonTrackBuilder::cleanUp() const {
-    m_muonHoleRecovery->cleanUp();
+    if (!m_muonHoleRecovery.empty()) m_muonHoleRecovery->cleanUp();
   }
 }  // namespace Rec
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx
index bb9f699334024ab3f2fcbe7ae6b100b7673711e9..ff7f207c0f721cf8a7fda4d87cc23afc5611887c 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx
@@ -386,4 +386,8 @@ namespace MuonCombined {
   }
 
 
+  void MuonCaloTagTool::cleanUp() const {
+    return;
+  }
+
 }	// end of namespace
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h
index a210e4dd12d8dfa29cb55d562ec1853a5121da9c..f8ac9cdb88e0572ca84c85b451bbc424a557bcbd 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.h
@@ -56,6 +56,7 @@ namespace MuonCombined {
     virtual void extendWithPRDs(const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData,
 				TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments, const EventContext& ctx) const override;
 
+    virtual void cleanUp() const override;
 
   private:
     
diff --git a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCandidateTrackBuilderTool.h b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCandidateTrackBuilderTool.h
index ff1d24891abd69faad9498e9035a8a6477737195..f7e5c62afa7466ed26b520572a01dac8bcd606aa 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCandidateTrackBuilderTool.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCandidateTrackBuilderTool.h
@@ -28,7 +28,7 @@ namespace Muon {
     /** @brief build a track out of a MuonCandidate */
     virtual Trk::Track* buildCombinedTrack( const Trk::Track& idTrack, const MuonCandidate& candidate ) const = 0;
 
-    void cleanUp() const {};
+    virtual void cleanUp() const {};
 
   };
  
diff --git a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedInDetExtensionTool.h b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedInDetExtensionTool.h
index 0fc9e834135e9d816cc71cdf1adbe9176b59fa6f..6a976a76b609677ff87039b85bae9239da629696 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedInDetExtensionTool.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedInDetExtensionTool.h
@@ -47,7 +47,7 @@ namespace MuonCombined {
     virtual void extendWithPRDs( const InDetCandidateCollection& inDetCandidates, InDetCandidateToTagMap* tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData,
 				 TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments, const EventContext& ctx) const = 0;
 
-    virtual void cleanUp() const {};
+    virtual void cleanUp() const = 0;
 
   };
 
diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h
index d9c3bc4f1cfa1812b9f6b9109e3577beb802cee7..a64b705591d02a7d1c75077c6186df95062750d1 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h
@@ -73,7 +73,7 @@ namespace Muon {
     /**IMuonCandidateTrackBuilderTool interface: buildCombinedTrack */   
     Trk::Track* buildCombinedTrack( const Trk::Track& idTrack, const MuonCandidate& candidate ) const;
 
-    void cleanUp() const;
+    virtual void cleanUp() const override;
 
   private:
     ToolHandle<IMuonSegmentTrackBuilder> m_muonTrackBuilder{this,"MuonSegmentTrackBuilder","Muon::MooTrackBuilder/MooMuonTrackBuilder"}; 
diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx
index 78fe252974eb9cd7df3b7c0a13d21441b70d89a0..c7b1a3d09ba8d3df48284b05e9af61b338e7f3f2 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx
@@ -1495,5 +1495,9 @@ namespace MuonCombined {
     time  -= 1.5;
     error *= 1.;
   }
+
+  void MuonStauRecoTool::cleanUp() const {
+    m_insideOutRecoTool->cleanUp();
+  }
+
 }
- 
diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.h b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.h
index d582c6c2111b2f22374ccedb0d902cddd838afe8..4c4b130b7c4a280425c9f037a4282df1ab1e9e44 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.h
@@ -285,6 +285,8 @@ namespace MuonCombined {
     std::set<int> m_selectedPdgs; // set storing particle PDG's considered for matching
     
     const double m_inverseSpeedOfLight = 1 / Gaudi::Units::c_light; // need 1/299.792458 inside calculateTof()/calculateBeta()
+
+    virtual void cleanUp() const override;
   };
 
   inline float MuonStauRecoTool::calculateTof(const float beta, const float dist) const {
diff --git a/Reconstruction/RecExample/RecExCommon/share/RecoUtils.py b/Reconstruction/RecExample/RecExCommon/share/RecoUtils.py
index 9b7a99627d2704b7c37b04ab39f5997fd3459291..de4bcb1340684990c305dfc6e3467c93b385712c 100644
--- a/Reconstruction/RecExample/RecExCommon/share/RecoUtils.py
+++ b/Reconstruction/RecExample/RecExCommon/share/RecoUtils.py
@@ -197,9 +197,9 @@ if not rec.OutputLevel.isDefault():
 
 #Adjust the message format for threaded vs serial jobs
 if jobproperties.ConcurrencyFlags.NumThreads() > 0:
-    ServiceMgr.MessageSvc.Format = "% F%50W%S%4W%R%e%s%8W%R%T %0W%M"
+    ServiceMgr.MessageSvc.Format = "% F%50W%C%4W%R%e%s%8W%R%T %0W%M"
 else:
-    ServiceMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M" 
+    ServiceMgr.MessageSvc.Format = "% F%50W%C%7W%R%T %0W%M" 
 
 
 #ServiceMgr.MessageSvc.defaultLimit = 9999999  # all messages
diff --git a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoUpdatedTrackCones.py b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoUpdatedTrackCones.py
new file mode 100644
index 0000000000000000000000000000000000000000..ace002a4830e736079fdda2d6d40f3228982063b
--- /dev/null
+++ b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoUpdatedTrackCones.py
@@ -0,0 +1,69 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.Logging import logging
+from AthenaCommon import CfgMgr
+
+log = logging.getLogger(__name__)
+
+
+def GetUpdatedIsoTrackCones(postfix="", object_types=("Electrons", "Photons", "Muons")):
+    """ Return a list of IsolationBuilder algorithms to calculate TTVA moments
+
+    ---------
+    Arguments
+    ---------
+    postfix: Optionally provide a postfix to add to the names of the isolation
+             builder algorithm instances
+    object_types: The object types to which to add the moments
+    """
+
+    import ROOT
+    # This is a doubly nested list
+    ptcone_list = [
+        [ROOT.xAOD.Iso.IsolationType.ptcone40, ROOT.xAOD.Iso.IsolationType.ptcone30, ROOT.xAOD.Iso.IsolationType.ptcone20]
+    ]
+
+    do_egamma = any(x in object_types for x in ("Electrons", "Photons"))
+
+    algs = []
+    for track_pt in (500, 1000):
+        for loose_cone in (True, False):
+            if loose_cone and not do_egamma:
+                # Loose cone isolation variables only for electrons and photons
+                continue
+            cone_str = "LooseCone" if loose_cone else ""
+            name = f"TightTTVA{cone_str}_pt{track_pt}"
+            # Build up extra IsolationBuilder kwargs
+            kwargs = {}
+            if "Electrons" in object_types:
+                kwargs["ElIsoTypes"] = ptcone_list
+                kwargs["ElCorTypes"] = [[]]
+                kwargs["ElCorTypesExtra"] = [[]]
+                kwargs["CustomConfigurationNameEl"] = name
+            if "Photons" in object_types:
+                kwargs["PhIsoTypes"] = ptcone_list
+                kwargs["PhCorTypes"] = [[]]
+                kwargs["PhCorTypesExtra"] = [[]]
+                kwargs["CustomConfigurationNamePh"] = name
+            if "Muons" in object_types:
+                kwargs["MuIsoTypes"] = ptcone_list
+                kwargs["MuCorTypes"] = [[]]
+                kwargs["MuCorTypesExtra"] = [[]]
+                kwargs["CustomConfigurationNameMu"] = name
+            algs.append(
+                CfgMgr.IsolationBuilder(
+                    f"IsolationBuilderTight{cone_str}{track_pt}{postfix}",
+                    TrackIsolationTool=CfgMgr.xAOD__TrackIsolationTool(
+                        f"TrackIsolationToolTight{track_pt}",
+                        TrackSelectionTool=CfgMgr.InDet__InDetTrackSelectionTool(
+                            minPt=track_pt, CutLevel="Loose"
+                        ),
+                        TTVATool=CfgMgr.CP__TrackVertexAssociationTool(
+                            WorkingPoint="Loose",
+                        ),
+                        CoreTrackEtaRange=0.01 if loose_cone else 0.0,
+                    ),
+                    **kwargs,
+                )
+            )
+    return algs
diff --git a/Reconstruction/RecoFix/CMakeLists.txt b/Reconstruction/RecoFix/CMakeLists.txt
index d5eee085547dbcf3d8d047b37b46bb15b61726ab..9ecaf2467e046e1aaf0194f8a3735d203fa6be8a 100644
--- a/Reconstruction/RecoFix/CMakeLists.txt
+++ b/Reconstruction/RecoFix/CMakeLists.txt
@@ -1,10 +1,7 @@
-################################################################################
-# Package: RecoFix
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( RecoFix )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
-
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Reconstruction/RecoFix/python/RecoFix.py b/Reconstruction/RecoFix/python/RecoFix.py
index d317492f55431abffeab6b5afbfc8b71a102d7c4..76406dea664e956eb3fbb5b32fa234af5d047fc1 100644
--- a/Reconstruction/RecoFix/python/RecoFix.py
+++ b/Reconstruction/RecoFix/python/RecoFix.py
@@ -53,7 +53,7 @@ def RecoFix_Init():
     import os
     curRelease=os.getenv("AtlasVersion") or ''
 
-    logRecoFix.debug("curRelease set to " + curRelease)
+    logRecoFix.debug("curRelease set to %s", curRelease)
     
     
     ##################
@@ -81,7 +81,7 @@ def RecoFix_Init():
             prevAODFix=''
 
     logRecoFix.info("Summary of MetaData for RecoFix:")
-    logRecoFix.info(" AODFix version <%s> was previously applied." % prevAODFix)
+    logRecoFix.info(" AODFix version <%s> was previously applied.", prevAODFix)
 
     ##################
     # determine which RecoFix to run (if actually running--to be determined later)
@@ -107,7 +107,7 @@ def RecoFix_Init():
             logRecoFix.info("No RecoFix scheduled for this release.")
 
     else:
-        logRecoFix.info("Current release is of strange form: %s" % curRelease)
+        logRecoFix.info("Current release is of strange form: %s", curRelease)
 
 # The interface routines
 def RecoFix_addMetaData():
diff --git a/Reconstruction/RecoFix/python/RecoFix_base.py b/Reconstruction/RecoFix/python/RecoFix_base.py
index d70f41f238d20b3a57446faa53fcd3220427e764..9df7c7935c829ee9d58b4c2df2f5c474e4463af6 100644
--- a/Reconstruction/RecoFix/python/RecoFix_base.py
+++ b/Reconstruction/RecoFix/python/RecoFix_base.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon.Logging import logging
 
@@ -47,7 +47,7 @@ class RecoFix_base(object):
 
             metastr = "AODFix_" + "-".join(self.latestAODFixVersion()) + suffix
 
-            logRecoFix.info("executing addMetaData, will add as AODFixVersion %s" % metastr)
+            logRecoFix.info("executing addMetaData, will add as AODFixVersion %s", metastr)
             from AthenaCommon.AppMgr import ServiceMgr as svcMgr
             svcMgr.TagInfoMgr.ExtraTagValuePairs["AODFixVersion"] = metastr
 
diff --git a/Reconstruction/RecoTools/IsolationTool/CMakeLists.txt b/Reconstruction/RecoTools/IsolationTool/CMakeLists.txt
index 60844d21711ec0982a33bb6c514d2c9201cebd42..e10b2d8ab69278881c9706e223ce6458ca62bec7 100644
--- a/Reconstruction/RecoTools/IsolationTool/CMakeLists.txt
+++ b/Reconstruction/RecoTools/IsolationTool/CMakeLists.txt
@@ -26,6 +26,7 @@ atlas_add_library( IsolationToolLib
    xAODEventShape xAODMuon xAODPFlow xAODPrimitives xAODTracking
    AsgDataHandlesLib InDetTrackSelectionToolLib
    IsolationCorrectionsLib RecoToolInterfaces
+   TrackVertexAssociationToolLib
    ${extra_lib}
    PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} CaloGeoHelpers FourMomUtils
    ${extra_lib_private}
diff --git a/Reconstruction/RecoTools/IsolationTool/IsolationTool/TrackIsolationTool.h b/Reconstruction/RecoTools/IsolationTool/IsolationTool/TrackIsolationTool.h
index f494ff171566c6f4394402b214c9809988c3e46e..922627e806bc774ae900a74e738733e5c9c9ce39 100644
--- a/Reconstruction/RecoTools/IsolationTool/IsolationTool/TrackIsolationTool.h
+++ b/Reconstruction/RecoTools/IsolationTool/IsolationTool/TrackIsolationTool.h
@@ -18,6 +18,7 @@
 #endif // XAOD_STANDALONE
 
 #include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h"
+#include "TrackVertexAssociationTool/ITrackVertexAssociationTool.h"
 #include "xAODTracking/TrackParticle.h"
 #include "xAODTracking/TrackParticleContainer.h"
 #include "xAODTracking/VertexContainer.h"
@@ -123,6 +124,12 @@ namespace xAOD {
     Gaudi::Property<float> m_overlapCone{this, "OverlapCone", 0.1};
 
     float m_overlapCone2; /// overlap cone size squared
+
+    /// The maximum eta range to consider something a core track
+    Gaudi::Property<float> m_coreTrackEtaRange{this,
+     "CoreTrackEtaRange", 0.0, "The maximum eta range to consider something a core track"};
+    /// Whether the loose core track eta range is used
+    bool m_useLooseTrackCore{false};
 #ifndef XAOD_ANALYSIS
     /// tracks in cone tool
     ToolHandle<ITrackParticlesInConeTool> m_tracksInConeTool {this, 
@@ -132,6 +139,12 @@ namespace xAOD {
     ToolHandle<InDet::IInDetTrackSelectionTool> m_trkselTool {this,
 	"TrackSelectionTool", "InDet::InDetTrackSelectionTool/TrackSelectionTool"};
 
+    /// Select tracks associated to the vertex
+    ToolHandle<CP::ITrackVertexAssociationTool> m_ttvaTool{this,
+      "TTVATool", "", "Optional track to vertex association tool to filter tracks"};
+    /// Use the ttva tool. Set to true if one was provided.
+    bool m_useTTVATool{false};
+
     SG::ReadHandleKey<VertexContainer> m_vertexLocation {this,
 	"VertexLocation", "PrimaryVertices"};
 
diff --git a/Reconstruction/RecoTools/IsolationTool/Root/TrackIsolationTool.cxx b/Reconstruction/RecoTools/IsolationTool/Root/TrackIsolationTool.cxx
index a178903ba184ccdef15644ca3597fc04386a306a..121c8ec86fbd772353cf28a27fceb06e10368479 100644
--- a/Reconstruction/RecoTools/IsolationTool/Root/TrackIsolationTool.cxx
+++ b/Reconstruction/RecoTools/IsolationTool/Root/TrackIsolationTool.cxx
@@ -48,6 +48,13 @@ namespace xAOD {
 	ATH_MSG_FATAL("Could not retrieve InDetTrackSelectionTool");
 	return StatusCode::FAILURE;
       }
+      if (!m_ttvaTool.empty()) {
+        ATH_MSG_DEBUG("Use TTVA tool " << m_ttvaTool);
+        m_useTTVATool = true;
+        ATH_CHECK( m_ttvaTool.retrieve() );
+      }
+      else
+        ATH_MSG_DEBUG("Will not use TTVA tool");
 
     /** square cone */
     m_overlapCone2 = m_overlapCone*m_overlapCone;
@@ -57,6 +64,9 @@ namespace xAOD {
     if (!m_vertexLocation.key().empty())
       ATH_CHECK(m_vertexLocation.initialize());
 
+    if (m_coreTrackEtaRange.value() > 0)
+      m_useLooseTrackCore = true;
+
     return StatusCode::SUCCESS;
   }
 
@@ -177,7 +187,8 @@ namespace xAOD {
 #endif
 
     for( const auto& tp : tps ) {
-      if( ! m_trkselTool->accept( *tp , input.vertex ) ){
+      if( (!m_trkselTool->accept( *tp , input.vertex)) ||
+        (m_useTTVATool && !m_ttvaTool->isCompatible(*tp, *input.vertex))){
 	ATH_MSG_DEBUG("reject track pt = " << tp->pt());
 	continue;
       } else
@@ -208,7 +219,8 @@ namespace xAOD {
 
     // loop over all track particles
     for( const auto& tp : *indetTrackParticles ) {
-      if( ! m_trkselTool->accept( *tp , input.vertex ) ){
+      if( (!m_trkselTool->accept(*tp, input.vertex)) ||
+        (m_useTTVATool && !m_ttvaTool->isCompatible(*tp, *input.vertex))){
 	ATH_MSG_DEBUG("[2] reject track pt = " << tp->pt());
 	continue;
       }
@@ -222,13 +234,22 @@ namespace xAOD {
   void TrackIsolationTool::add( TrackIsolationInput& input, const TrackParticle& tp2, TrackIsolation& result ) const
   {
     // check if track pointer matches the one of input or one of the exclusion set
+    // Jon Burr: I'm not completely convinced by the use of CoreTrackEtaRange.
+    // With this setup, if you're running in simple isolation mode any track
+    // within the same eta slice (even on the other side of the detector) will
+    // be included in the eta code. If you manually provide a track particle
+    // container then the tool automatically runs in this simple mode...
+    // This is fine in IsolationBuilder (the main client) but could produce
+    // unexpected results with other users
     if(input.corrections.trackbitset.test(static_cast<unsigned int>(Iso::coreTrackPtr))){
-	 if(input.particle == &tp2 || (input.exclusionSet && input.exclusionSet->count(&tp2))){
-	   ATH_MSG_DEBUG("track pointer " << &tp2 << ", track pt = " << tp2.pt() << ", input pt = " << input.particle->pt()) ;
-	   result.coreCorrections[Iso::coreTrackPtr] += tp2.pt();
-	   return;
-	 }
-       }
+      if(input.particle == &tp2 || 
+         (input.exclusionSet && input.exclusionSet->count(&tp2)) ||
+         (m_useLooseTrackCore && std::abs(input.particle->eta() - tp2.eta()) < m_coreTrackEtaRange)){
+        ATH_MSG_DEBUG("track pointer " << &tp2 << ", track pt = " << tp2.pt() << ", input pt = " << input.particle->pt()) ;
+        result.coreCorrections[Iso::coreTrackPtr] += tp2.pt();
+        return;
+      }
+    }
 
     // check eta
     float deta = input.particle->eta()-tp2.eta();
diff --git a/Reconstruction/RecoTools/TrackToCalo/CMakeLists.txt b/Reconstruction/RecoTools/TrackToCalo/CMakeLists.txt
index 179480de2faa184411352a8ad95ef681737bce17..d3df31711c2bde9f594628ffb6cef546665c9f2f 100644
--- a/Reconstruction/RecoTools/TrackToCalo/CMakeLists.txt
+++ b/Reconstruction/RecoTools/TrackToCalo/CMakeLists.txt
@@ -1,28 +1,18 @@
-################################################################################
-# Package: TrackToCalo
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TrackToCalo )
 
-# External dependencies:
-find_package( Eigen )
-
 # Component(s) in the package:
 atlas_add_library( TrackToCaloLib
                    src/*.cxx
                    PUBLIC_HEADERS TrackToCalo
-                   INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${EIGEN_LIBRARIES} CaloEvent CaloGeoHelpers GeoPrimitives xAODCaloEvent GaudiKernel ParticleCaloExtension RecoToolInterfaces 
-		   TrackCaloClusterRecToolsLib TrkCaloExtension TrkParametersIdentificationHelpers CaloDetDescrLib CaloUtilsLib InDetReadoutGeometry TRT_ReadoutGeometry
-                   PRIVATE_LINK_LIBRARIES CaloIdentifier AthenaBaseComps AtlasDetDescr FourMomUtils xAODTracking xAODMuon xAODEgamma xAODTruth TrkSurfaces 
-                   TrkEventPrimitives TrkParameters TrkTrack TrkExInterfaces TrkToolInterfaces CxxUtils StoreGateLib EventKernel ParticlesInConeToolsLib ITrackToVertex
-                   InDetTrackSelectionToolLib )
+                   LINK_LIBRARIES CaloEvent CaloGeoHelpers CaloUtilsLib GaudiKernel GeoPrimitives InDetReadoutGeometry ParticleCaloExtension RecoToolInterfaces TrkCaloExtension TrkExInterfaces TrkParametersIdentificationHelpers TrkToolInterfaces TRT_ReadoutGeometry xAODCaloEvent xAODTruth
+                   PRIVATE_LINK_LIBRARIES AthenaBaseComps AtlasDetDescr CaloConditions CaloDetDescrLib CaloIdentifier StoreGateLib TrkDetDescrUtils TrkEventPrimitives TrkParameters TrkSurfaces TrkTrack VxVertex xAODEgamma xAODMuon xAODTracking )
 
 atlas_add_component( TrackToCalo
                      src/components/*.cxx
-                     INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS}
-                     LINK_LIBRARIES GaudiKernel TrackToCaloLib InDetTrackSelectionToolLib 
-                     ITrackToVertex TrkLinks VxVertex TrackVertexAssociationToolLib)
+                     LINK_LIBRARIES TrackToCaloLib )
 
-atlas_install_python_modules( python/*.py )
+# Install files from the package:
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Reconstruction/RecoTools/TrackToCalo/python/CaloExtensionBuilderAlgConfig.py b/Reconstruction/RecoTools/TrackToCalo/python/CaloExtensionBuilderAlgConfig.py
index 4711c6011c609765daad507343209b993af4b36c..44520d826a592fb4aa347061c7ba5678a9c804e0 100644
--- a/Reconstruction/RecoTools/TrackToCalo/python/CaloExtensionBuilderAlgConfig.py
+++ b/Reconstruction/RecoTools/TrackToCalo/python/CaloExtensionBuilderAlgConfig.py
@@ -1,26 +1,30 @@
-## CaloExtensionBuilderAlg Stuff
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 def CaloExtensionBuilder(useLRT):
+    import traceback
+    from AthenaCommon.Logging import logging
+    mlog = logging.getLogger('CaloExtensionBuilder')
+
     try: 
         from TrkExTools.AtlasExtrapolator import AtlasExtrapolator
         from TrackToCalo.TrackToCaloConf import Trk__ParticleCaloExtensionTool
-    except:
+    except Exception:
         mlog.error("could not import" "TrackToCaloConf.Trk__ParticleCaloExtensionTool")
         mlog.error("could not import TrkExTools.AtlasExtrapolator")
         mlog.error (traceback.format_exc())
     try:
         from TrackToCalo.TrackToCaloConf import Trk__CaloExtensionBuilderAlg as CaloExtensionBuilderAlg
-    except:
+    except Exception:
         mlog.error("could not import TrackToCaloConf.Trk__CaloExtensionBuilderAlg")
         mlog.error (traceback.format_exc())
     try:
         from AthenaCommon.AppMgr import ToolSvc
-    except:
+    except Exception:
         mlog.error("could not import ToolSvc")
         mlog.error (traceback.format_exc())
     try:
         from AthenaCommon.AlgSequence import AlgSequence
-    except:
+    except Exception:
         mlog.error("could not import AlgSequence")
         mlog.error (traceback.format_exc())
 
@@ -32,19 +36,17 @@ def CaloExtensionBuilder(useLRT):
     pcExtensionTool = Trk__ParticleCaloExtensionTool(Extrapolator = theAtlasExtrapolator)
     ToolSvc += pcExtensionTool
 
-    if (True == useLRT):
+    if (True is useLRT):
       algName = "CaloExtensionBuilderAlg_LRT"      
     else:
       algName = "CaloExtensionBuilderAlg"
     CaloExtensionBuilderTool = CaloExtensionBuilderAlg(algName, LastCaloExtentionTool = pcExtensionTool)
 
-    if True == useLRT:
+    if True is useLRT:
       CaloExtensionBuilderTool.TrkPartContainerName = "InDetLargeD0TrackParticles"
       CaloExtensionBuilderTool.ParticleCache = "ParticleCaloExtension_LRT"
 
-    from AthenaCommon.BeamFlags import jobproperties
     ToolSvc += CaloExtensionBuilderTool.LastCaloExtentionTool
-
     topSequence += CaloExtensionBuilderTool
 
     return True
diff --git a/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p1_test.cxx b/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p1_test.cxx
index 2f348f9b821a8f06d277dbbf72da22644862f8d8..a9c66eae3e179467183475d1fa63b80a6f736064 100644
--- a/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p1_test.cxx
+++ b/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p1_test.cxx
@@ -20,6 +20,7 @@
 #include "GeneratorObjectsTPCnv/initMcEventCollection.h"
 #include "AtlasHepMC/GenEvent.h"
 #include "AtlasHepMC/GenParticle.h"
+#include "AtlasHepMC/Operators.h"
 #include <cassert>
 #include <iostream>
 
diff --git a/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p2_test.cxx b/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p2_test.cxx
index 362d914fe850ca30c1034a162340b17d4335ce66..891184bbfcc9755ce6284b85dd4452f885c9cfdd 100644
--- a/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p2_test.cxx
+++ b/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p2_test.cxx
@@ -19,6 +19,7 @@
 #include "GeneratorObjectsTPCnv/initMcEventCollection.h"
 #include "AtlasHepMC/GenEvent.h"
 #include "AtlasHepMC/GenParticle.h"
+#include "AtlasHepMC/Operators.h"
 #include <cassert>
 #include <iostream>
 
diff --git a/Reconstruction/egamma/egammaRec/CMakeLists.txt b/Reconstruction/egamma/egammaRec/CMakeLists.txt
index 7f7bda9f1a85ba8fac592d0d56087129dcd64de9..3d3a838af0c27391ee664f3f194019a4b05a626f 100644
--- a/Reconstruction/egamma/egammaRec/CMakeLists.txt
+++ b/Reconstruction/egamma/egammaRec/CMakeLists.txt
@@ -1,11 +1,9 @@
-################################################################################
-# Package: egammaRec
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( egammaRec )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/*.py )
 
diff --git a/Reconstruction/egamma/egammaRec/python/egammaTrackSlimmer.py b/Reconstruction/egamma/egammaRec/python/egammaTrackSlimmer.py
index 66048eb99194b5de56620eb7a6a4969a043c9dad..c352989ba0717a3d85438de6b8d0b8d403a98e7c 100755
--- a/Reconstruction/egamma/egammaRec/python/egammaTrackSlimmer.py
+++ b/Reconstruction/egamma/egammaRec/python/egammaTrackSlimmer.py
@@ -1,14 +1,8 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-
-from __future__ import print_function
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # specifies egamma"standard"
 from AthenaCommon.Logging import logging
-from AthenaCommon.SystemOfUnits import *
-from AthenaCommon.Constants import *
 import traceback
-import EventKernel.ParticleDataType
-from egammaRec.egammaRecFlags import jobproperties
 from egammaRec import egammaKeys
 from InDetRecExample.InDetKeys import InDetKeys
 from RecExConfig.Configured import Configured
diff --git a/Reconstruction/egamma/egammaTools/CMakeLists.txt b/Reconstruction/egamma/egammaTools/CMakeLists.txt
index 12849074ea01e792f56dafd68cfb759cc79ab9bb..b45acb932c041071ef4d6c54ccabec79d497fbea 100644
--- a/Reconstruction/egamma/egammaTools/CMakeLists.txt
+++ b/Reconstruction/egamma/egammaTools/CMakeLists.txt
@@ -1,19 +1,13 @@
-################################################################################
-# Package: egammaTools
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( egammaTools )
 
-
+# Component(s) in the package:
 atlas_add_component( egammaTools
-	src/*.cxx
-	src/components/*.cxx
-	INCLUDE_DIRS
-	LINK_LIBRARIES CaloConditions CaloEvent  CaloIdentifier CaloRecLib CaloUtilsLib AthenaBaseComps AthenaKernel
-	AthContainers StoreGateLib  Identifier EventKernel EventPrimitives FourMom FourMomUtils  xAODCaloEvent
-	xAODEgamma xAODTracking xAODTruth GaudiKernel LArRecConditions LArCablingLib LumiBlockCompsLib PATCoreLib
-	EgammaAnalysisInterfacesLib egammaRecEvent egammaUtils TrkEventPrimitives egammaInterfacesLib )
+   src/*.cxx
+   src/components/*.cxx
+   LINK_LIBRARIES AthenaBaseComps AthenaKernel CaloConditions CaloDetDescrLib CaloEvent CaloIdentifier CaloInterfaceLib CaloRecLib CaloUtilsLib EgammaAnalysisInterfacesLib EventPrimitives FourMom FourMomUtils GaudiKernel GeoPrimitives Identifier LArCablingLib LArRecConditions LumiBlockCompsLib PATCoreAcceptLib SGTools StoreGateLib TrkEventPrimitives egammaInterfacesLib egammaRecEvent egammaUtils xAODCaloEvent xAODEgamma xAODTracking )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Reconstruction/egamma/egammaTools/python/egammaToolsFactories.py b/Reconstruction/egamma/egammaTools/python/egammaToolsFactories.py
index 42024a9528de413d1f5fba1993b92a9168d708bf..17caae683d5bf62f4bb1088fd7994fd1d74b494b 100644
--- a/Reconstruction/egamma/egammaTools/python/egammaToolsFactories.py
+++ b/Reconstruction/egamma/egammaTools/python/egammaToolsFactories.py
@@ -6,7 +6,6 @@ __author__ = "Bruno Lenzi"
 
 
 from ROOT import egammaPID
-import cppyy
 from ElectronPhotonSelectorTools.ConfiguredAsgForwardElectronIsEMSelectors \
     import ConfiguredAsgForwardElectronIsEMSelector
 from .EMPIDBuilderBase import EMPIDBuilderPhotonBase
@@ -22,8 +21,6 @@ from egammaRec import egammaKeys
 # to set jobproperties.egammaRecFlags
 from egammaRec.egammaRecFlags import jobproperties
 
-import six
-
 
 _clusterTypes = dict(
     Ele35='ele35', Ele55='ele55', Ele37='ele37',
@@ -35,10 +32,7 @@ _clusterTypes = dict(
 # Configure fixed-size (non-supercell) corrections
 def configureFixedSizeClusterCorrections(swTool):
     "Add attributes ClusterCorrectionToolsXX to egammaSwTool object for fixed-size cluster corrections."
-    from CaloClusterCorrection.CaloSwCorrections import (
-        make_CaloSwCorrections, rfac, etaoff_b1, etaoff_e1,
-        etaoff_b2, etaoff_e2, phioff_b2, phioff_e2, update,
-        time, listBadChannel)
+    from CaloClusterCorrection.CaloSwCorrections import make_CaloSwCorrections
     from CaloRec.CaloRecMakers import _process_tools
 
     for attrName, clName in _clusterTypes.items():
@@ -161,6 +155,6 @@ TightForwardElectronSelector = ToolFactory(
 # -------------------------
 
 # Import the factories that are not defined here
-from .EMTrackMatchBuilder import EMTrackMatchBuilder
-from .egammaOQFlagsBuilder import egammaOQFlagsBuilder
-from .EMShowerBuilder import EMShowerBuilder
+from .EMTrackMatchBuilder import EMTrackMatchBuilder    # noqa: F401
+from .egammaOQFlagsBuilder import egammaOQFlagsBuilder  # noqa: F401
+from .EMShowerBuilder import EMShowerBuilder            # noqa: F401
diff --git a/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx b/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx
index 9afe98cfe36a0543bc5b81fcaa89615c2bd075fe..efb6bb9174d18840dfc2e92d2dab055d156d4623 100644
--- a/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx
+++ b/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx
@@ -11,7 +11,7 @@
 #include <cmath>
 #include <vector>
 
-#include "CLHEP/Units/SystemOfUnits.h"
+#include "GaudiKernel/SystemOfUnits.h"
 #include "CaloConditions/CaloAffectedRegionInfoVec.h"
 #include "CaloIdentifier/CaloCell_ID.h"
 #include "CaloIdentifier/LArEM_ID.h"
@@ -20,8 +20,6 @@
 #include "StoreGate/ReadHandle.h"
 #include "StoreGate/StoreGateSvc.h"
 
-using CLHEP::GeV;
-
 namespace {
 bool
 isbadtilecell(CaloCellList& ccl,
@@ -194,7 +192,7 @@ egammaOQFlagsBuilder::execute(const EventContext& ctx,
     egammaOQFlagsBuilder::findCentralCell(cluster, cellCentrId);
 
   // Set timing bit
-  const double absEnergyGeV = fabs(cluster->e() * (1. / GeV));
+  const double absEnergyGeV = fabs(cluster->e() * (1. / Gaudi::Units::GeV));
   if (absEnergyGeV != 0 &&
       fabs(cluster->time()) > m_TCut + m_TCutVsE / absEnergyGeV) {
     iflag |= (0x1 << xAOD::EgammaParameters::OutTime);
diff --git a/Reconstruction/egamma/egammaValidation/src/ClusterHistograms.h b/Reconstruction/egamma/egammaValidation/src/ClusterHistograms.h
index 643e25b6107adfb84b2781a77457cec2f18f97e1..ccfd903f28659f8b97799219d42828bd731a10d0 100644
--- a/Reconstruction/egamma/egammaValidation/src/ClusterHistograms.h
+++ b/Reconstruction/egamma/egammaValidation/src/ClusterHistograms.h
@@ -7,8 +7,6 @@
 
 #include <utility>
 
-#include <utility>
-
 #include "GaudiKernel/ITHistSvc.h"
 #include "xAODEgamma/Egamma.h"
 #include "xAODEgamma/EgammaxAODHelpers.h"
diff --git a/Reconstruction/egamma/egammaValidation/src/EfficiencyPlot.cxx b/Reconstruction/egamma/egammaValidation/src/EfficiencyPlot.cxx
index 62c370e1e0d37fab3feca5f6c78ed32ffba580a8..f59b2ad2a2ab048930239b9cb961401782d622bd 100644
--- a/Reconstruction/egamma/egammaValidation/src/EfficiencyPlot.cxx
+++ b/Reconstruction/egamma/egammaValidation/src/EfficiencyPlot.cxx
@@ -8,7 +8,6 @@
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "Gaudi/Property.h"
-#include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ITHistSvc.h"
 #include "AthenaBaseComps/AthAlgorithm.h"
 #include "AsgTools/AnaToolHandle.h"
diff --git a/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.h b/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.h
index c2d4c52b235072c55d4883c3091505f5acb7d282..3cd504034d2e8a3f7cb039fd6d51e5615543c869 100644
--- a/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.h
+++ b/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.h
@@ -27,7 +27,6 @@
 #include "GaudiKernel/ToolHandle.h"
 #include "Gaudi/Property.h"
 #include "GaudiKernel/ServiceHandle.h"
-#include "GaudiKernel/ToolHandle.h"
 #include "GaudiKernel/ITHistSvc.h"
 #include "AthenaBaseComps/AthAlgorithm.h"
 #include "AsgTools/AnaToolHandle.h"
diff --git a/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.cxx
index a4a584733bf6e0064b68c34a8c97cca8766ef7eb..7c58b8155b85d7e7aa3917ba2fccd7aef9f22cb6 100644
--- a/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.cxx
+++ b/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.cxx
@@ -7,7 +7,6 @@
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "Gaudi/Property.h"
-#include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ITHistSvc.h"
 #include "AthenaBaseComps/AthAlgorithm.h"
 #include "AsgTools/AnaToolHandle.h"
@@ -18,10 +17,10 @@ namespace egammaMonitoring {
     histoMap["pT"]   = new TH1D(Form("%s_%s",m_name.c_str(),"pT")  , ";p_{T} [GeV]; Track p_{T} Events",  40,            0,         200);
     histoMap["eta"]  = new TH1D(Form("%s_%s",m_name.c_str(),"eta") , ";#eta; Track #eta Events"        ,  40,           -3,           3);
     histoMap["phi"]  = new TH1D(Form("%s_%s",m_name.c_str(),"phi") , ";#phi; Track #phi Events"        ,  20, -TMath::Pi(), TMath::Pi());
-    
+
     histoMap["pT_15GeV"]   = new TH1D(Form("%s_%s",m_name.c_str(),"pT_15GeV")  , ";p_{T} [GeV]; Track p_{T} Events",  40,            0,         200);
     histoMap["eta_15GeV"]  = new TH1D(Form("%s_%s",m_name.c_str(),"eta_15GeV") , ";#eta; Track #eta Events"        ,  40,           -3,           3);
-    histoMap["phi_15GeV"]  = new TH1D(Form("%s_%s",m_name.c_str(),"phi_15GeV") , ";#phi; Track #phi Events"        ,  20, -TMath::Pi(), TMath::Pi());  
+    histoMap["phi_15GeV"]  = new TH1D(Form("%s_%s",m_name.c_str(),"phi_15GeV") , ";#phi; Track #phi Events"        ,  20, -TMath::Pi(), TMath::Pi());
 
     ATH_CHECK(m_rootHistSvc->regHist(m_folder+"pT", histoMap["pT"]));
     ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eta", histoMap["eta"]));
@@ -32,9 +31,9 @@ namespace egammaMonitoring {
     ATH_CHECK(m_rootHistSvc->regHist(m_folder+"phi_15GeV", histoMap["phi_15GeV"]));
     return StatusCode::SUCCESS;
   }
-  
+
   void ParticleHistograms::fill(const xAOD::IParticle& egamma) {
-    
+
     if((egamma.pt())/1000. > 0) histoMap["pT"]->Fill((egamma.pt())/1000.);
     histoMap["eta"]->Fill(egamma.eta());
     histoMap["phi"]->Fill(egamma.phi());
@@ -46,5 +45,5 @@ namespace egammaMonitoring {
     }
 
   }
-  
+
 }
diff --git a/Reconstruction/egamma/egammaValidation/src/ShowerShapesHistograms.h b/Reconstruction/egamma/egammaValidation/src/ShowerShapesHistograms.h
index 7a2efcf7f07025b0eb53a0437cf8b13eb2b77bb1..6a97b6b79d1e0f3e60b9279b0808dba1fe07408b 100644
--- a/Reconstruction/egamma/egammaValidation/src/ShowerShapesHistograms.h
+++ b/Reconstruction/egamma/egammaValidation/src/ShowerShapesHistograms.h
@@ -6,9 +6,6 @@
 #define EGAMMAVALIDATION_SHOWERSHAPESHISTOGRAMS_H
 
 #include <utility>
-
-#include <utility>
-
 #include "GaudiKernel/ITHistSvc.h"
 #include "xAODEgamma/Egamma.h"
 #include "xAODEgamma/EgammaxAODHelpers.h"
diff --git a/Reconstruction/egamma/egammaValidation/src/WidthPlot.cxx b/Reconstruction/egamma/egammaValidation/src/WidthPlot.cxx
index f8b214c78e72091213ed65577c321aab9a0071da..a4df3003adb1360c31d334df89f1360bc6d1d784 100644
--- a/Reconstruction/egamma/egammaValidation/src/WidthPlot.cxx
+++ b/Reconstruction/egamma/egammaValidation/src/WidthPlot.cxx
@@ -6,7 +6,6 @@
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "Gaudi/Property.h"
-#include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ITHistSvc.h"
 #include "AthenaBaseComps/AthAlgorithm.h"
 #include "AsgTools/AnaToolHandle.h"
diff --git a/Reconstruction/egamma/egammaValidation/src/widthestimators.h b/Reconstruction/egamma/egammaValidation/src/widthestimators.h
index 0a3a66af4e19894641bf524f3e2129ca6ee10530..eb256f0a7f51db66379c415d7cb3d6e96968c933 100644
--- a/Reconstruction/egamma/egammaValidation/src/widthestimators.h
+++ b/Reconstruction/egamma/egammaValidation/src/widthestimators.h
@@ -6,9 +6,6 @@
  * 
  * Example:
  * 
- *     #include <iostream>
- *     #include "widthestimators.h"
- * 
  *     using widthestimators;
  * 
  *     int main()
@@ -104,4 +101,4 @@ namespace widthestimators
         double s90(const T &histo) { return smallest_interval(histo, 0.90); }
 
     } // namespace binned
-}     // namespace widthestimators
\ No newline at end of file
+}     // namespace widthestimators
diff --git a/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h b/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h
index 346f0621e155e0fbcfb3d27ea033cfe06951353f..5e07b0c4267553f576ad3d7871e2f3b46d212beb 100644
--- a/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h
+++ b/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h
@@ -32,8 +32,8 @@ class MvaTESVariableDecorator
   bool m_useSubtractedCluster;
 
   SG::ReadDecorHandleKey<xAOD::EventInfo> m_aveIntPerXKey {this, 
-      "AveIntPerXKey", 
-      "EventInfo.AveIntPerXDecor",
+      "averageInteractionsPerCrossingKey", 
+      "EventInfo.averageInteractionsPerCrossing",
       "Decoration for Average Interaction Per Crossing"};
   
   SG::ReadHandleKey<xAOD::VertexContainer> m_vertexContainerKey {this,
diff --git a/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h b/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h
index 7e9dc8941152613bb9ab0f9ed8b4aed15da88d11..8fbaab7bc7e7c1d596a2468908469889b96a0209 100644
--- a/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h
+++ b/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h
@@ -53,8 +53,8 @@ class TauCalibrateLC : public TauRecToolBase {
     bool m_isCaloOnly;   //!< switch for CaloOnly corrections
 
     SG::ReadDecorHandleKey<xAOD::EventInfo> m_aveIntPerXKey {this, 
-        "AveIntPerXKey", 
-        "EventInfo.AveIntPerXDecor",
+        "averageInteractionsPerCrossingKey", 
+        "EventInfo.averageInteractionsPerCrossing",
         "Decoration for Average Interaction Per Crossing"};
   
     SG::ReadHandleKey<xAOD::VertexContainer> m_vertexInputContainer {this,
diff --git a/Reconstruction/tauRecTools/tauRecTools/TauWPDecorator.h b/Reconstruction/tauRecTools/tauRecTools/TauWPDecorator.h
index edd7691ba2b9c6f90d7f977c10a426b45d0a4886..e52041618a8c0fa6af14ee90c6470329ce499f4a 100644
--- a/Reconstruction/tauRecTools/tauRecTools/TauWPDecorator.h
+++ b/Reconstruction/tauRecTools/tauRecTools/TauWPDecorator.h
@@ -94,8 +94,8 @@ class TauWPDecorator : public TauRecToolBase {
     std::vector<float> m_decorWPEffs3p; //!< Efficiency of each WP to be docorated for 3-prong taus
     
     SG::ReadDecorHandleKey<xAOD::EventInfo> m_aveIntPerXKey {this, 
-        "AveIntPerXKey", 
-        "EventInfo.AveIntPerXDecor",
+        "averageInteractionsPerCrossingKey", 
+        "EventInfo.averageInteractionsPerCrossing",
         "Decoration for Average Interaction Per Crossing"};
     
     typedef std::pair<double, std::shared_ptr<TH2> > m_pair_t;
diff --git a/Simulation/Digitization/python/PileUpConfig.py b/Simulation/Digitization/python/PileUpConfig.py
index 5afe5d8744f24707cf5944f85dda28d263f866a7..b12d342d8faac0e80b4fbd0c07658969f1abc7d4 100644
--- a/Simulation/Digitization/python/PileUpConfig.py
+++ b/Simulation/Digitization/python/PileUpConfig.py
@@ -258,6 +258,9 @@ def getPileUpEventLoopMgr(name="PileUpEventLoopMgr", **kwargs):
         kwargs.setdefault('BeamLuminosity', noProfileSvc)
         ServiceMgr += noProfileSvc
 
-    kwargs.setdefault('EventInfoName', 'Input_EventInfo')  # for beam spot fix
+    kwargs.setdefault('EventInfoName', 'Input_EventInfo')
+    # Note that this is a hack. It is needed to fix beam spot information
+    # as original xAOD::EventInfo is created before conditions data could
+    # be read. Only the "EventInfoName" should change.
 
     return CfgMgr.PileUpEventLoopMgr(name, **kwargs)
diff --git a/Simulation/Digitization/python/PileUpConfigNew.py b/Simulation/Digitization/python/PileUpConfigNew.py
index 3b605d509f185b318462518be76be58c53411f0a..72194f7b362e3679e982a3a2e75ee9e8a38c3c21 100644
--- a/Simulation/Digitization/python/PileUpConfigNew.py
+++ b/Simulation/Digitization/python/PileUpConfigNew.py
@@ -320,8 +320,17 @@ def PileUpEventLoopMgrCfg(flags, name="PileUpEventLoopMgr", **kwargs):
         acc.merge(NoProfileSvcCfg(flags))
         kwargs.setdefault("BeamLuminosity", acc.getService("NoProfileSvc"))
 
-    # for beam spot fix
     kwargs.setdefault("EventInfoName", "Input_EventInfo")
+    # Note that this is a hack. It is needed to fix beam spot information
+    # as original xAOD::EventInfo is created before conditions data could
+    # be read. Only the "EventInfoName" should change.
 
     acc.addService(CompFactory.PileUpEventLoopMgr(name, **kwargs))
     return acc
+
+
+def NoPileUpMuWriterCfg(flags, name="NoPileUpMuWriter", **kwargs):
+    """NoPileUpMuWriter configuration."""
+    acc = ComponentAccumulator()
+    acc.addEventAlgo(CompFactory.NoPileUpMuWriter(name, **kwargs))
+    return acc
diff --git a/Simulation/Digitization/share/DetectorDigitization.py b/Simulation/Digitization/share/DetectorDigitization.py
index c801261154a6a52035732a5fad66d883b9cc3d9a..602197fe2dd4f0ee86ddf59ed6414827007b8ae7 100755
--- a/Simulation/Digitization/share/DetectorDigitization.py
+++ b/Simulation/Digitization/share/DetectorDigitization.py
@@ -41,6 +41,11 @@ if 'LegacyEventInfo' in digitizationFlags.experimentalDigi() and \
     from xAODEventInfoCnv.xAODEventInfoCnvAlgDefault import xAODEventInfoCnvAlgDefault
     xAODEventInfoCnvAlgDefault (sequence = job)
 
+# Decorate zero pile-up
+if not (DetFlags.pileup.any_on() or digitizationFlags.doXingByXingPileUp()):
+    from PileUpComps.PileUpCompsConf import NoPileUpMuWriter
+    job += NoPileUpMuWriter()
+
 # Beam spot
 include( "Digitization/BeamSpot.py" )
 
diff --git a/Simulation/Digitization/test/DigitizationComparisonNew_test.py b/Simulation/Digitization/test/DigitizationComparisonNew_test.py
index d98f9518b78ded1e7113337c434107e527a9d781..5cc02017cb98172c7d2cf3b8d8e7cbd92fb32e8b 100755
--- a/Simulation/Digitization/test/DigitizationComparisonNew_test.py
+++ b/Simulation/Digitization/test/DigitizationComparisonNew_test.py
@@ -8,6 +8,7 @@ from AthenaCommon.Logging import log
 from AthenaCommon.Constants import DEBUG
 from AthenaCommon.Configurable import Configurable
 from AthenaConfiguration.AllConfigFlags import ConfigFlags
+from Digitization.PileUpConfigNew import NoPileUpMuWriterCfg
 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
 from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg
@@ -65,6 +66,8 @@ if "EventInfo" not in ConfigFlags.Input.Collections:
     acc.merge(EventInfoCnvAlgCfg(ConfigFlags,
                                  inputKey="McEventInfo",
                                  outputKey="EventInfo"))
+# Decorate pile-up values
+acc.merge(NoPileUpMuWriterCfg(ConfigFlags))
 
 # Inner Detector
 acc.merge(BCM_DigitizationCfg(ConfigFlags))
diff --git a/Simulation/Digitization/test/DigitizationConfigNew_test.py b/Simulation/Digitization/test/DigitizationConfigNew_test.py
index 21bed961c1b818458ad2637be0d41bdc5c8d26d1..517ea1f96cad394a9d6b69718130d44d8673a9d7 100755
--- a/Simulation/Digitization/test/DigitizationConfigNew_test.py
+++ b/Simulation/Digitization/test/DigitizationConfigNew_test.py
@@ -13,6 +13,7 @@ from AthenaConfiguration.MainServicesConfig import MainServicesCfg
 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
 from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg
 from Digitization.DigitizationParametersConfig import writeDigitizationMetadata
+from Digitization.PileUpConfigNew import NoPileUpMuWriterCfg
 from BCM_Digitization.BCM_DigitizationConfigNew import BCM_DigitizationCfg
 from SCT_Digitization.SCT_DigitizationConfigNew import SCT_DigitizationCfg
 from TRT_Digitization.TRT_DigitizationConfigNew import TRT_DigitizationCfg
@@ -51,6 +52,8 @@ if "EventInfo" not in ConfigFlags.Input.Collections:
     acc.merge(EventInfoCnvAlgCfg(ConfigFlags,
                                  inputKey="McEventInfo",
                                  outputKey="EventInfo"))
+# Decorate pile-up values
+acc.merge(NoPileUpMuWriterCfg(ConfigFlags))
 
 # Inner Detector
 acc.merge(BCM_DigitizationCfg(ConfigFlags))
diff --git a/Simulation/G4Atlas/G4AtlasTests/src/LucidHitsTestTool.cxx b/Simulation/G4Atlas/G4AtlasTests/src/LucidHitsTestTool.cxx
index 2c82e6a39f5526dd27d94c42067dc3a0b8daee59..bdf19e15295456b86069c0096874c0213f34752d 100644
--- a/Simulation/G4Atlas/G4AtlasTests/src/LucidHitsTestTool.cxx
+++ b/Simulation/G4Atlas/G4AtlasTests/src/LucidHitsTestTool.cxx
@@ -1,16 +1,14 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "LucidHitsTestTool.h"
 
 #include "LUCID_SimEvent/LUCID_SimHitCollection.h"
-//#include "LUCID_SimEvent/LUCID_SimHit.h"
 #include "AtlasHepMC/GenParticle.h"
 
 #include <cmath>
 #include <string>
-#include <cmath>
 #include <TH2D.h>
 #include <TH1D.h>
 
diff --git a/Simulation/G4Atlas/G4AtlasTests/src/MDTHitsTestTool.cxx b/Simulation/G4Atlas/G4AtlasTests/src/MDTHitsTestTool.cxx
index ae2873aa66ad09ebb14a00db4e68b2dbef0a3a66..d43595b5b2f9d8231df5ae538d3d6bf639b30d29 100644
--- a/Simulation/G4Atlas/G4AtlasTests/src/MDTHitsTestTool.cxx
+++ b/Simulation/G4Atlas/G4AtlasTests/src/MDTHitsTestTool.cxx
@@ -32,7 +32,6 @@
 #include "TTree.h"
 #include "TROOT.h"
 #include "TFile.h"
-#include "TTree.h"
 #include "TF1.h"
 #include "TH1F.h"
 
diff --git a/Simulation/G4Atlas/G4AtlasTests/src/MMHitsTestTool.cxx b/Simulation/G4Atlas/G4AtlasTests/src/MMHitsTestTool.cxx
index 0c5ba191dfb05d47a502c54182e33e17b8a884c3..99fc4db1a96a44553f7d0a5597eef45d137c9a67 100644
--- a/Simulation/G4Atlas/G4AtlasTests/src/MMHitsTestTool.cxx
+++ b/Simulation/G4Atlas/G4AtlasTests/src/MMHitsTestTool.cxx
@@ -31,7 +31,6 @@
 #include "TTree.h"
 #include "TROOT.h"
 #include "TFile.h"
-#include "TTree.h"
 #include "TF1.h"
 #include "TH1F.h"
 
diff --git a/Simulation/G4Atlas/G4AtlasTests/src/SimTestToolBase.cxx b/Simulation/G4Atlas/G4AtlasTests/src/SimTestToolBase.cxx
index a822ac72a8fbd3b9bb4b644d3ba7c4cf5208ea54..7018bea0e415baf83c5a44f7a5f853946dfcb4ef 100644
--- a/Simulation/G4Atlas/G4AtlasTests/src/SimTestToolBase.cxx
+++ b/Simulation/G4Atlas/G4AtlasTests/src/SimTestToolBase.cxx
@@ -22,10 +22,9 @@ HepMC::ConstGenParticlePtr   SimTestToolBase::getPrimary()
   if (evtStore()->retrieve(mcCollection,m_key).isSuccess()) {
     DataVector<HepMC::GenEvent>::const_iterator e;
     for (e=mcCollection->begin();e!=mcCollection->end(); e++) {
-      HepMC::GenEvent::particle_const_iterator p;
-      for (p= (**e).particles_begin(); p!= (**e).particles_end(); p++) {
-	if ( HepMC::barcode(*p)<200000 ) {
-	  return (*p);
+      for (auto p : (**e)) {
+	if ( HepMC::barcode(p)<200000 ) {
+	  return p;
 	}
       }
     }
diff --git a/Simulation/G4Atlas/G4AtlasTests/src/sTGCHitsTestTool.cxx b/Simulation/G4Atlas/G4AtlasTests/src/sTGCHitsTestTool.cxx
index eb95ce9778a1bcb0bcc3679c99962fb4260875cc..8a8adce65fdf90c28bb8e66cfa4c5bb7a146626e 100644
--- a/Simulation/G4Atlas/G4AtlasTests/src/sTGCHitsTestTool.cxx
+++ b/Simulation/G4Atlas/G4AtlasTests/src/sTGCHitsTestTool.cxx
@@ -28,7 +28,6 @@
 #include "GaudiKernel/INTupleSvc.h"
 
 #include "TH2D.h"
-#include "TTree.h"
 #include "TROOT.h"
 #include "TFile.h"
 #include "TTree.h"
diff --git a/Simulation/G4Atlas/G4AtlasTools/G4AtlasTools/FastSimulationBase.h b/Simulation/G4Atlas/G4AtlasTools/G4AtlasTools/FastSimulationBase.h
index 911ad3554dc44bd71f055782bb027184f06c7cbc..0eac55bdd19226a36b182082e985f847fd54fc0b 100644
--- a/Simulation/G4Atlas/G4AtlasTools/G4AtlasTools/FastSimulationBase.h
+++ b/Simulation/G4Atlas/G4AtlasTools/G4AtlasTools/FastSimulationBase.h
@@ -8,7 +8,6 @@
 // Base classes
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "G4AtlasInterfaces/IFastSimulation.h"
-#include "G4VFastSimulationModel.hh"
 
 // Members
 #include "G4Types.hh"
diff --git a/Simulation/G4Extensions/Charginos/src/CharginosPhysicsTool.cxx b/Simulation/G4Extensions/Charginos/src/CharginosPhysicsTool.cxx
index fa0fd3061e14d55212144ae2fba564edfd591062..e800b9b3f5a592620bd1fda1ba8efe4ece3d93d2 100644
--- a/Simulation/G4Extensions/Charginos/src/CharginosPhysicsTool.cxx
+++ b/Simulation/G4Extensions/Charginos/src/CharginosPhysicsTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // Include files
@@ -17,7 +17,6 @@
 #include "G4hMultipleScattering.hh"
 #include "G4Transportation.hh"
 #include "G4MuIonisation.hh"
-#include "G4ProcessManager.hh"
 #include "G4DecayTable.hh"
 #include "G4VDecayChannel.hh"
 #include "G4PhaseSpaceDecayChannel.hh"
diff --git a/Simulation/G4Extensions/G4ScoringProcess/src/G4ScoringProcessTool.cxx b/Simulation/G4Extensions/G4ScoringProcess/src/G4ScoringProcessTool.cxx
index 1dde222df815eee0f743de93f89cd2ac00c9ad1e..99cb4d30b1be59dec1a7afb6adc61b3061fa8ca2 100644
--- a/Simulation/G4Extensions/G4ScoringProcess/src/G4ScoringProcessTool.cxx
+++ b/Simulation/G4Extensions/G4ScoringProcess/src/G4ScoringProcessTool.cxx
@@ -6,7 +6,6 @@
 #include "G4ScoringProcessTool.h"
 // package headers
 #include "G4ParallelWorldScoringProcess.hh"
-#include "G4ProcessManager.hh"
 // Geant4 headers
 #include "G4ProcessManager.hh"
 #include "G4Version.hh"
diff --git a/Simulation/G4Extensions/Quirks/standalone/src/ExN03PhysicsList.cc b/Simulation/G4Extensions/Quirks/standalone/src/ExN03PhysicsList.cc
index 09369deeda48169a4e8a4b8b75d9c29901137b86..355b985a52cfc1f1c6c3191a42d20cfecd9b5a29 100644
--- a/Simulation/G4Extensions/Quirks/standalone/src/ExN03PhysicsList.cc
+++ b/Simulation/G4Extensions/Quirks/standalone/src/ExN03PhysicsList.cc
@@ -41,7 +41,6 @@
 #include "G4BosonConstructor.hh"
 #include "G4LeptonConstructor.hh"
 #include "G4MesonConstructor.hh"
-#include "G4BosonConstructor.hh"
 #include "G4BaryonConstructor.hh"
 #include "G4IonConstructor.hh"
 
diff --git a/Simulation/G4Extensions/RHadrons/src/RHadronsPhysicsTool.cxx b/Simulation/G4Extensions/RHadrons/src/RHadronsPhysicsTool.cxx
index 5992cfda646644f98fc7b946b62777e0586b48f9..ac908cc2e63586b17690149b5802563ed133f69a 100644
--- a/Simulation/G4Extensions/RHadrons/src/RHadronsPhysicsTool.cxx
+++ b/Simulation/G4Extensions/RHadrons/src/RHadronsPhysicsTool.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
@@ -15,11 +15,9 @@
 #include "G4Transportation.hh"
 #include "G4hMultipleScattering.hh"
 #include "G4hIonisation.hh"
-#include "G4Transportation.hh"
 #include "G4ProcessManager.hh"
 #include "G4Decay.hh"
 #include "G4BaryonConstructor.hh"
-#include "G4ProcessManager.hh"
 
 // STL headers
 #include <string>
diff --git a/Simulation/G4Utilities/G4DebuggingTools/src/G4AtlantisDumper.cxx b/Simulation/G4Utilities/G4DebuggingTools/src/G4AtlantisDumper.cxx
index 0348c619bee471073e5e43386817ed862e02c56c..d5220b9636a20efbc1851fb5979b66cab8330005 100644
--- a/Simulation/G4Utilities/G4DebuggingTools/src/G4AtlantisDumper.cxx
+++ b/Simulation/G4Utilities/G4DebuggingTools/src/G4AtlantisDumper.cxx
@@ -14,9 +14,6 @@
 
 #include <iostream>
 
-
-#include "G4AtlantisDumper.h"
-
 #include "GaudiKernel/Bootstrap.h"
 #include "GaudiKernel/ISvcLocator.h"
 #include "GaudiKernel/IMessageSvc.h"
diff --git a/Simulation/G4Utilities/G4PhysicsLists/src/hadronicVariations/G4HadronPhysicsFTFP_BERP_ATL.cc b/Simulation/G4Utilities/G4PhysicsLists/src/hadronicVariations/G4HadronPhysicsFTFP_BERP_ATL.cc
index dc864527eb9a5721d3fc14e5a8eda66af1b6678a..1f5f078af1b131f88cb7fd6b1774e2eabd159bf6 100644
--- a/Simulation/G4Utilities/G4PhysicsLists/src/hadronicVariations/G4HadronPhysicsFTFP_BERP_ATL.cc
+++ b/Simulation/G4Utilities/G4PhysicsLists/src/hadronicVariations/G4HadronPhysicsFTFP_BERP_ATL.cc
@@ -261,7 +261,6 @@ void G4HadronPhysicsFTFP_BERP_ATL::ConstructParticle()
   pShortLivedConstructor.ConstructParticle();  
 }
 
-#include "G4ProcessManager.hh"
 void G4HadronPhysicsFTFP_BERP_ATL::ConstructProcess()
 {
   CreateModels();
diff --git a/Simulation/G4Utilities/G4PhysicsLists/src/hadronicVariations/G4HadronPhysicsFTFP_BERT_ATL_noDiffraction.cc b/Simulation/G4Utilities/G4PhysicsLists/src/hadronicVariations/G4HadronPhysicsFTFP_BERT_ATL_noDiffraction.cc
index f30eb9bcf64a1dc136aa5c0f2e857ce8a7dc762e..0b04360d80426f308bcaf8cd9523fe7eb4726f88 100644
--- a/Simulation/G4Utilities/G4PhysicsLists/src/hadronicVariations/G4HadronPhysicsFTFP_BERT_ATL_noDiffraction.cc
+++ b/Simulation/G4Utilities/G4PhysicsLists/src/hadronicVariations/G4HadronPhysicsFTFP_BERT_ATL_noDiffraction.cc
@@ -264,7 +264,6 @@ void G4HadronPhysicsFTFP_BERT_ATL_noDiffraction::ConstructParticle()
   pShortLivedConstructor.ConstructParticle();  
 }
 
-#include "G4ProcessManager.hh"
 void G4HadronPhysicsFTFP_BERT_ATL_noDiffraction::ConstructProcess()
 {
   CreateModels();
diff --git a/Simulation/G4Utilities/G4UserActions/src/HitWrapper.cxx b/Simulation/G4Utilities/G4UserActions/src/HitWrapper.cxx
index 59640102aded1fb4b70f2f26a3bd13ddf5b7e96f..a92dbb3790be947ff19829806b5b5567dc0abbd2 100644
--- a/Simulation/G4Utilities/G4UserActions/src/HitWrapper.cxx
+++ b/Simulation/G4Utilities/G4UserActions/src/HitWrapper.cxx
@@ -4,7 +4,6 @@
 
 #include <cmath>
 #include <iostream>
-#include <cmath>
 #include <cstdlib>
 
 #include "HitWrapper.h"
diff --git a/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.cxx b/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.cxx
index 1e78c6253b12e707d99baeda91f7152a65003686..21cda967cb79d4beb3e1456f87cd40031f4b4f64 100644
--- a/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.cxx
+++ b/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.cxx
@@ -31,7 +31,6 @@
 #include "G4AntiSigmaMinus.hh"
 #include "G4SigmaZero.hh"
 #include "G4AntiSigmaZero.hh"
-#include "G4AntiXiMinus.hh"
 #include "G4XiZero.hh"
 #include "G4AntiXiZero.hh"
 #include "G4XiMinus.hh"
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt
index 1d6c5e79795abb1f4c1ef484cf5778daf5fd541f..69602b2e8928c3737871b93b223f7edd4bca9d06 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt
@@ -1,6 +1,4 @@
-################################################################################
-# Package: ISF_FastCaloSimParametrization
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( ISF_FastCaloSimParametrization )
@@ -9,8 +7,7 @@ atlas_subdir( ISF_FastCaloSimParametrization )
 find_package( CLHEP )
 find_package( Geant4 )
 find_package( HepPDT )
-find_package( ROOT COMPONENTS TreePlayer Cint Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint TMVA Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 )
-find_package( XercesC )
+find_package( ROOT COMPONENTS TreePlayer Core Tree MathCore Hist RIO Physics Graf Gpad )
 
 # Component(s) in the package:
 atlas_add_root_dictionary( ISF_FastCaloSimParametrizationLib
@@ -24,25 +21,24 @@ atlas_add_root_dictionary( ISF_FastCaloSimParametrizationLib
                            ISF_FastCaloSimParametrization/CaloGeometry.h
                            ISF_FastCaloSimParametrization/CaloGeometryLookup.h
                            Root/LinkDef.h
-                           EXTERNAL_PACKAGES  ROOT HepPDT XercesC CLHEP HepMC Geant4 )
+                           EXTERNAL_PACKAGES ROOT HepPDT CLHEP Geant4 )
 
 atlas_add_library( ISF_FastCaloSimParametrizationLib
                    Root/*.cxx src/lib/CaloGeometryFromCaloDDM.cxx src/lib/CaloGeometryLookup.cxx src/lib/CaloGeometry.cxx
                    ${ISF_FastCaloSimParametrizationLibDictSource}
                    PUBLIC_HEADERS ISF_FastCaloSimParametrization
-                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} 
-                   PRIVATE_INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS}
+                   INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
-                   LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} AtlasHepMCLib CaloGeoHelpers AthenaBaseComps AthenaKernel Identifier GaudiKernel ISF_InterfacesLib TrkEventPrimitives TrkParameters TrkExInterfaces CaloDetDescrLib StoreGateLib SGtests TileConditionsLib
-                   PRIVATE_LINK_LIBRARIES ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} CaloEvent CaloIdentifier AthenaPoolUtilities GeoAdaptors EventInfo NavFourMom GeneratorObjects LArSimEvent ISF_Event ISF_FastCaloSimEvent ISF_FastCaloSimInterfaces TileDetDescr TileSimEvent TrkGeometry TrkSurfaces TrkMaterialOnTrack )
+                   LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel AtlasHepMCLib BarcodeEventLib CaloDetDescrLib CaloInterfaceLib GaudiKernel ISF_FastCaloSimEvent ISF_InterfacesLib LArElecCalib LArReadoutGeometry StoreGateLib TrkEventPrimitives TrkExInterfaces TrkParameters
+                   PRIVATE_LINK_LIBRARIES CaloGeoHelpers )
 
 atlas_add_component( ISF_FastCaloSimParametrization
                      src/*.cxx
                      src/components/*.cxx
-                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}  ${GEANT4_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} CaloDetDescrLib CaloGeoHelpers CaloInterfaceLib AthenaBaseComps AthenaKernel StoreGateLib SGtests Identifier GaudiKernel ISF_InterfacesLib TrkEventPrimitives TrkParameters TrkExInterfaces CaloEvent CaloIdentifier AthenaPoolUtilities GeoAdaptors EventInfo NavFourMom GeneratorObjects LArSimEvent ISF_Event ISF_FastCaloSimEvent ISF_FastCaloSimInterfaces TileConditionsLib TileDetDescr TileSimEvent TrkGeometry TrkSurfaces TrkMaterialOnTrack ISF_FastCaloSimParametrizationLib )
+                     INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
+                     LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthenaPoolUtilities AtlasHepMCLib CaloDetDescrLib CaloEvent CaloGeoHelpers CaloIdentifier EventInfo GaudiKernel GeneratorObjects GeoAdaptors GeoModelInterfaces GeoPrimitives ISF_Event ISF_FastCaloSimEvent ISF_FastCaloSimInterfaces ISF_FastCaloSimParametrizationLib ISF_InterfacesLib LArSimEvent NavFourMom StoreGateLib TileConditionsLib TileDetDescr TileSimEvent TrackRecordLib TrkExInterfaces TrkGeometry TrkMaterialOnTrack TrkParameters TrkSurfaces )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/*.py )
 atlas_install_runtime( scripts/*.py )
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfig.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfig.py
index e6faf6943f9c20ff59f6afbdedb00feb83115f22..6ffe0dc58854275dc1fc5ed2cff59848a30b5f9b 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfig.py
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfig.py
@@ -1,16 +1,13 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 
 """
 Tools configurations for ISF_FastCaloSimParametrization
 """
 from AthenaCommon import CfgMgr
-from AthenaCommon.Constants import *  # FATAL,ERROR etc.
-from AthenaCommon.SystemOfUnits import *
-from AthenaCommon.DetFlags import DetFlags
 
 def getFastCaloSimCaloExtrapolation(name="FastCaloSimCaloExtrapolation", **kwargs):
-    from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConf import FastCaloSimCaloExtrapolation
+    from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConf import FastCaloSimCaloExtrapolation  # noqa: F401
 
     kwargs.setdefault("CaloBoundaryR"             , [1148.0, 120.0, 41.0] )
     kwargs.setdefault("CaloBoundaryZ"             , [3550.0, 4587.0, 4587.0] )
@@ -23,5 +20,5 @@ def getFastCaloSimCaloExtrapolation(name="FastCaloSimCaloExtrapolation", **kwarg
 
 
 def getFastCaloSimGeometryHelper(name="FastCaloSimGeometryHelper", **kwargs):
-    from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConf import FastCaloSimGeometryHelper
+    from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConf import FastCaloSimGeometryHelper  # noqa: F401
     return CfgMgr.FastCaloSimGeometryHelper(name, **kwargs)
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfigDb.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfigDb.py
index add5acbb48a015c539655b8e739bb5ffc957e4d8..47c052d771621d50cbf9cfcbca4822427287125d 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfigDb.py
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfigDb.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 """
 Configuration database for ISF_FastCaloSimParametrization
@@ -6,9 +6,6 @@ Configuration database for ISF_FastCaloSimParametrization
 
 from AthenaCommon.CfgGetter import addTool
 
-from AthenaCommon.Constants import *  # FATAL,ERROR etc.
-import AthenaCommon.SystemOfUnits as Units
-
 # Common tools, services and algorithms used by jobs
 addTool("ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConfig.getFastCaloSimCaloExtrapolation" , "FastCaloSimCaloExtrapolation"   )
 addTool("ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConfig.getFastCaloSimGeometryHelper" , "FastCaloSimGeometryHelper"   )
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_NativeFastCaloSimServicesConfig.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_NativeFastCaloSimServicesConfig.py
index e4cb634abaae692110fce6fd40b4e28e42735e84..e34820e1978865c20a005a2304f1b0ebfb5a0cec 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_NativeFastCaloSimServicesConfig.py
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_NativeFastCaloSimServicesConfig.py
@@ -1,22 +1,18 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 """
 Tools configurations for ISF_NativeFastCaloSimServices
 KG Tan, 04/12/2012
 """
 
-from AthenaCommon.CfgGetter import getPrivateTool,getPrivateToolClone,getPublicTool,getPublicToolClone,\
-        getService,getServiceClone,getAlgorithm,getAlgorithmClone
-
-from AthenaCommon.Constants import *  # FATAL,ERROR etc.
-from AthenaCommon.SystemOfUnits import *
-from AthenaCommon.DetFlags import DetFlags
+from AthenaCommon.CfgGetter import getPublicTool, getService, getAlgorithm
 
 from ISF_Config.ISF_jobProperties import ISF_Flags # IMPORTANT: Flags must be set before tools are retrieved
 from ISF_FastCaloSimParametrization.ISF_NativeFastCaloSimJobProperties import ISF_NativeFastCaloSimFlags
 
 def getPunchThroughTool(name="ISF_PunchThroughTool", **kwargs):
-    from G4AtlasApps.SimFlags import SimFlags,simFlags
+    from G4AtlasApps.SimFlags import simFlags
+    from ISF_FastCaloSimServices.ISF_FastCaloSimJobProperties import ISF_FastCaloSimFlags
     kwargs.setdefault("RandomNumberService"     , simFlags.RandomSvc()                               )
     kwargs.setdefault("RandomStreamName"        , ISF_FastCaloSimFlags.RandomStreamName()            )
     kwargs.setdefault("FilenameLookupTable"     , "CaloPunchThroughParametrisation.root"             )
@@ -57,7 +53,6 @@ def getCaloCellContainerFinalizerTool(name="ISF_CaloCellContainerFinalizerTool",
 
 #### NativeFastCaloSimSvc
 def getNativeFastCaloSimSvc(name="ISF_NativeFastCaloSimSvc", **kwargs):
-    from ISF_FastCaloSimParametrization.ISF_NativeFastCaloSimJobProperties import ISF_NativeFastCaloSimFlags
     kwargs.setdefault("BatchProcessMcTruth"              , False                                             )
     kwargs.setdefault("SimulateUndefinedBarcodeParticles", False                                             )
     kwargs.setdefault("Identifier"                       , 'NativeFastCaloSim'                                     )
@@ -77,7 +72,7 @@ def getNativeFastCaloSimSvc(name="ISF_NativeFastCaloSimSvc", **kwargs):
     ISF_NativeFastCaloSimFlags.NativeFastCaloSimIsActive.set_Value_and_Lock(True)
 
     # register the FastCaloSim random number streams
-    from G4AtlasApps.SimFlags import SimFlags,simFlags
+    from G4AtlasApps.SimFlags import simFlags
     simFlags.RandomSeedList.addSeed( ISF_NativeFastCaloSimFlags.RandomStreamName(), 98346412, 12461240 )
 
     from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConf import ISF__NativeFastCaloSimSvc
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ShowerShapeRegression.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ShowerShapeRegression.py
index c4714fe68d5fc242c995c38f9953b44f11316ea9..e667fc9e969d6e457ab30c921928c9e3aceaa4fb 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ShowerShapeRegression.py
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ShowerShapeRegression.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 __author__ = 'Christopher Bock - LMU'
 
@@ -164,11 +164,11 @@ class ShowerShapeRegressor():
 
         self.obtain_output_names()
 
-        f = ROOT.TFile(self.root_file_name)
+        f = ROOT.TFile(self.root_file_name)  # noqa: F841
         chain = ROOT.gDirectory.Get('ISF_HitAnalysis/CaloHitAna')
         entries = chain.GetEntriesFast()
 
-        for current_entry in xrange(entries):
+        for current_entry in range(entries):
             print(' Loading entry: %i' % current_entry)
             j = chain.LoadTree(current_entry)
             if j < 0:
@@ -208,7 +208,7 @@ class ShowerShapeRegressor():
                                        self.cumulative_etaphi_nbins[0], self.cumulative_etaphi_xrange[0],
                                        self.cumulative_etaphi_xrange[1], self.cumulative_etaphi_nbins[1],
                                        self.cumulative_etaphi_yrange[0], self.cumulative_etaphi_yrange[1])
-        for i in xrange(num_hits):
+        for i in range(num_hits):
             layer_id = chain.HitSampling[i]
 
             if not layer_id == self.selected_layer:
@@ -280,9 +280,9 @@ class ShowerShapeRegressor():
 
             y_axis = self.eta_phi_efrac_hists[0].GetYaxis()
             n_bins_y = y_axis.GetNbins()
-            for x_bin in xrange(n_bins_x + 1):
+            for x_bin in range(n_bins_x + 1):
                 x_center = x_axis.GetBinCenter(x_bin)
-                for y_bin in xrange(n_bins_y + 1):
+                for y_bin in range(n_bins_y + 1):
                     y_center = x_axis.GetBinCenter(y_bin)
                     for hist in self.eta_phi_efrac_hists:
                         value = hist.GetBinContent(x_bin, y_bin)
@@ -294,9 +294,9 @@ class ShowerShapeRegressor():
 
             y_axis = cumulative_histogram.GetYaxis()
             n_bins_y = y_axis.GetNbins()
-            for x_bin in xrange(n_bins_x + 1):
+            for x_bin in range(n_bins_x + 1):
                 x_bin_width = x_axis.GetBinWidth(x_bin)
-                for y_bin in xrange(n_bins_y + 1):
+                for y_bin in range(n_bins_y + 1):
                     y_bin_width = y_axis.GetBinWidth(y_bin)
                     area = x_bin_width*y_bin_width
 
@@ -506,9 +506,9 @@ class ShowerShapeRegressor():
             y_axis = reference.GetYaxis()
             n_bins_x = x_axis.GetNbins()
             n_bins_y = y_axis.GetNbins()
-            for x in xrange(n_bins_x + 1):
+            for x in range(n_bins_x + 1):
                 d_eta[0] = x_axis.GetBinCenter(x)
-                for y in xrange(n_bins_y + 1):
+                for y in range(n_bins_y + 1):
                     d_phi[0] = y_axis.GetBinCenter(y)
                     r[0] = math.sqrt(d_eta[0]*d_eta[0] + d_phi[0]*d_phi[0])
 
@@ -555,7 +555,7 @@ class ShowerShapeRegressor():
         for key in input_file.GetListOfKeys():
             print('Key: %s' % key.GetName())
 
-            if not 'Method_' in key.GetName():
+            if 'Method_' not in key.GetName():
                 continue
             if not ROOT.gROOT.GetClass(key.GetClassName()).InheritsFrom('TDirectory'):
                 continue
@@ -584,11 +584,11 @@ class ShowerShapeRegressor():
                     plot_obj = plot_key.ReadObj()
                     if isinstance(plot_obj, ROOT.TH2F):
                         plot_name = plot_key.GetName()
-                        if not '_reg_' in plot_name:
+                        if '_reg_' not in plot_name:
                             continue
 
                         if not ((show_target and '_tgt' in plot_name) or
-                                (not show_target and (not '_tgt' in plot_name))):
+                                (not show_target and ('_tgt' not in plot_name))):
                             continue
 
                         if not ((compare_to_train and 'train' in plot_name) or
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py
index 17398d1204ebac51913aa0ed138d898d969ebb33..88d243aabfb69aac6d69b36d3519c1b7e27968be 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py
@@ -1,13 +1,10 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-import argparse
 import logging
 msg = logging.getLogger(__name__)
-import unittest
-import pickle
-import os
 
-from PyJobTransforms.trfArgClasses import argFactory, argFile, argInt, argFloat, argString, argSubstep, trfArgParser, argList, argBool, argPOOLFile, argHITSFile, argRDOFile, argSubstepInt, argSubstepBool
+from PyJobTransforms.trfArgClasses import argFactory, argPOOLFile, argBool, argString, argInt, argFile
+
 ## Add FCS Ntuple transform arguments
 def addFCS_NtupArgs(parser):
     parser.defineArgGroup('FCS_Ntup_tf', 'FCS_Ntup_tf specific options')
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Binning/PlotHits.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Binning/PlotHits.cxx
index 2ed5207a744d97dccff1a7ebc6f0e1bcb5075f33..a5a9b762fe4109b0b2522cb89e9b228411f0c8b7 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Binning/PlotHits.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Binning/PlotHits.cxx
@@ -1,55 +1,44 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #define PlotHits_cxx
-
-#include "fBinning.C"
-#include "TLorentzVector.h"
+// std includes
+#include <fstream>
 #include <iomanip>
-#include "TH1F.h"
-#include "TFile.h"
-#include "TPad.h"
 #include <iostream>
-#include <fstream>
 #include <iterator>
+#include <sstream>
+#include <string>
 #include <vector>
 #include <stdio.h>
 #include <string.h>
 #include <stddef.h>
-#include <string>
+#include <stdlib.h>
+// root includes
+#include "TCanvas.h"
+#include "TChain.h"
+#include "TDirectory.h"
+#include "TFile.h"
 #include "TGraph.h"
 #include "TGraphPolar.h"
-#include "TStyle.h"
-#include "TMatrixD.h"
-#include "TLine.h"
-#include "loader.C"
-#include <iostream>
-#include <fstream>
-#include <iterator>
-#include <vector>
-#include <stdio.h>
-#include <string.h>
-#include <stddef.h>
-#include <string>
-#include "TMath.h"
-#include "TH2F.h"
 #include "TH1F.h"
-#include "TFile.h"
-#include "TTree.h"
+#include "TH2F.h"
 #include "TLeaf.h"
-#include "TVector3.h"
-#include "TChain.h"
-#include <iostream>
-#include "TDirectory.h"
-#include "TROOT.h"
-#include "TCanvas.h"
-#include <string>
-#include <sstream>
 #include "TLegend.h"
+#include "TLine.h"
+#include "TLorentzVector.h"
+#include "TMath.h"
+#include "TMatrixD.h"
+#include "TPad.h"
 #include "TPie.h"
-#include <stdio.h>
-#include <stdlib.h>
+#include "TROOT.h"
+#include "TStyle.h"
+#include "TTree.h"
+#include "TVector3.h"
+// local includes
+#include "fBinning.C"
+#include "loader.C"
 
 
 using namespace std;
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Binning/fBinning.C b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Binning/fBinning.C
index 2a9f0fd5da69084c40ab679c7c0e0f7d2de4478d..154fc1ed741c5bbac1e0b6a97add3f729f48d2bb 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Binning/fBinning.C
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Binning/fBinning.C
@@ -1,52 +1,40 @@
 /*
   Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 */
-
-#include "TLorentzVector.h"
+// std includes
+#include <fstream>
 #include <iomanip>
-#include "TH1F.h"
-#include "TFile.h"
-#include "TPad.h"
 #include <iostream>
-#include <fstream>
 #include <iterator>
-#include <vector>
-#include <stdio.h>
-#include <string.h>
+#include <sstream>
 #include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string>
+#include <vector>
+// root includes
+#include "TCanvas.h"
+#include "TChain.h"
+#include "TDirectory.h"
+#include "TFile.h"
 #include "TGraph.h"
 #include "TGraphPolar.h"
-#include "TStyle.h"
-#include "TMatrixD.h"
-#include "TLine.h"
-#include "loader.C"
-#include <iostream>
-#include <fstream>
-#include <iterator>
-#include <vector>
-#include <stdio.h>
-#include <string.h>
-#include <stddef.h>
-#include <string>
-#include "TMath.h"
-#include "TH2F.h"
 #include "TH1F.h"
-#include "TFile.h"
-#include "TTree.h"
+#include "TH2F.h"
 #include "TLeaf.h"
-#include "TVector3.h"
-#include "TChain.h"
-#include <iostream>
-#include "TDirectory.h"
-#include "TROOT.h"
-#include "TCanvas.h"
-#include <string>
-#include <sstream>
 #include "TLegend.h"
+#include "TLine.h"
+#include "TLorentzVector.h"
+#include "TMath.h"
+#include "TMatrixD.h"
+#include "TPad.h"
 #include "TPie.h"
-#include <stdio.h>
-#include <stdlib.h>
+#include "TROOT.h"
+#include "TStyle.h"
+#include "TTree.h"
+#include "TVector3.h"
+// local includes
+#include "loader.C"
 
 using namespace std;
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TestFCalIdentifiers.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TestFCalIdentifiers.cxx
index db575ca60f20e54c0ca617f89f106c90aa4a97a8..d8c997d22ef30ad7f39e9536dcfb723d46d4c80e 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TestFCalIdentifiers.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/TestFCalIdentifiers.cxx
@@ -10,9 +10,7 @@
 #include "CaloHitAna.h"
 #include "../ISF_FastCaloSimParametrization/CaloGeometry.h"
 #include "../ISF_FastCaloSimParametrization/FCAL_ChannelMap.h"
-#include "TFile.h"
 #include "TTree.h"
-#include "TString.h"
 #include <string>
 #include <sstream>
 #include <iostream>
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/wiggleClosureAndComparison.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/wiggleClosureAndComparison.cxx
index f6d3dcda6c4b8c88f35651c144cc97b1367cc607..9f51c4f948786f388c913db23f7cc7a00a3336b1 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/wiggleClosureAndComparison.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/wiggleClosureAndComparison.cxx
@@ -17,9 +17,6 @@
 #include <string>
 #include <sstream>
 #include <iostream>
-#include "TSystem.h"
-#include "TString.h"
-#include "TFile.h"
 #include <stdlib.h>
 #include "TLorentzVector.h"
 #include "TH1.h"
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/wiggle_closure_inputs.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/wiggle_closure_inputs.cxx
index c9e0998489c91f35c4a356b04d25c3881eb73a9d..bc835164c93b3532905b8ac77976eda448c0e380 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/wiggle_closure_inputs.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/wiggle_closure_inputs.cxx
@@ -16,8 +16,6 @@
 #include <sstream>
 #include <iostream>
 #include "TSystem.h"
-#include "TString.h"
-#include "TFile.h"
 #include <stdlib.h>
 #include "TLorentzVector.h"
 #include "TH1.h"
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/McMaterialEffectsUpdator.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/McMaterialEffectsUpdator.cxx
index eab857db7247e8aff2bccb10d55bdd0d96e3ac6c..38356c51bedee84256c02f714419509eeb42fdfb 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/McMaterialEffectsUpdator.cxx
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/McMaterialEffectsUpdator.cxx
@@ -40,7 +40,6 @@
 #include "TrkGeometry/TrackingGeometry.h"
 #include "TrkGeometry/TrackingVolume.h"
 #include "TrkGeometry/MaterialProperties.h"
-#include "TrkGeometry/MaterialProperties.h"
 #include "TrkVolumes/CylinderVolumeBounds.h"
 #include "TrkMaterialOnTrack/EnergyLoss.h"
 // CLHEP
@@ -55,9 +54,6 @@
 // STD
 #include <math.h>
 
-// temporary
-#include "TrkGeometry/TrackingVolume.h"
-
 // constructor
 iFatras::McMaterialEffectsUpdator::McMaterialEffectsUpdator(const std::string& t, const std::string& n, const IInterface* p) :
   base_class(t,n,p),
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/src/G4HadIntProcessor.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/src/G4HadIntProcessor.cxx
index e09915300336d36009fe4280847ac394a0784792..6da748b08d119bd9d76aff2a629550af664c9340 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/src/G4HadIntProcessor.cxx
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/src/G4HadIntProcessor.cxx
@@ -43,10 +43,8 @@
 #include "G4UImanager.hh"
 #include "G4NistManager.hh"
 #include "G4VEnergyLossProcess.hh"
-#include <G4ProductionCutsTable.hh>
 #include <G4MaterialCutsCouple.hh>
 
-#include <G4NistManager.hh>
 #include "globals.hh"
 #include "G4CrossSectionDataStore.hh"
 #include "G4HadronElasticDataSet.hh"
diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4UserActions/src/FastCaloSimParamAction.h b/Simulation/ISF/ISF_Geant4/ISF_Geant4UserActions/src/FastCaloSimParamAction.h
index 99a867487294e510470b575de88d53b7ba769e38..f64c8c764a59c98324b786bcbaac5c63bb6b97ae 100644
--- a/Simulation/ISF/ISF_Geant4/ISF_Geant4UserActions/src/FastCaloSimParamAction.h
+++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4UserActions/src/FastCaloSimParamAction.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 ISF_FastCaloSimParamAction_H
@@ -9,17 +9,22 @@
 #include <string>
 #include <vector>
 
-// athena simulation includes
+// CLHEP include for Hep3Vector
+#include "CLHEP/Vector/ThreeVector.h"
+
+// Geant4 includes
+#include "G4UserRunAction.hh"
+#include "G4UserEventAction.hh"
+#include "G4UserSteppingAction.hh"
 
+// Gaudi/Athena includes
 #include "GaudiKernel/ServiceHandle.h"
+#include "Identifier/Identifier.h"
 #include "LArG4Code/ILArCalculatorSvc.h"
+#include "StoreGate/StoreGateSvc.h"
 #include "StoreGate/WriteHandle.h"
 #include "TileG4Interfaces/ITileCalculator.h"
 
-// CLHEP include for Hep3Vector
-#include "CLHEP/Vector/ThreeVector.h"
-#include "Identifier/Identifier.h"
-
 
 // forward declarations in namespaces
 namespace ISF_FCS_Parametrization {
@@ -51,15 +56,6 @@ class Hep3Vector;
  *
  */
 
-#include "G4UserRunAction.hh"
-#include "G4UserEventAction.hh"
-#include "G4UserSteppingAction.hh"
-
-
-#include "StoreGate/StoreGateSvc.h"
-#include "GaudiKernel/ServiceHandle.h"
-
-
 namespace G4UA{
 
 
diff --git a/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/src/TrkExtrapolator.cxx b/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/src/TrkExtrapolator.cxx
index 758185a0bb455e649c64509aa8ef4ed89e72952a..f6aec5b8442e12ddd7a22f03eae17f6f09c35702 100644
--- a/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/src/TrkExtrapolator.cxx
+++ b/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/src/TrkExtrapolator.cxx
@@ -15,7 +15,6 @@
 
 #include "TrkGeometry/TrackingGeometry.h"
 #include "TrkParameters/TrackParameters.h"
-#include "TrkParameters/TrackParameters.h"
 #include "TrkEventPrimitives/PdgToParticleHypothesis.h"
 
 
diff --git a/Simulation/SimuJobTransforms/share/CommonSkeletonJobOptions.py b/Simulation/SimuJobTransforms/share/CommonSkeletonJobOptions.py
index 791a3031c5bdcd11f52723c528cce137d27dd870..f25b14d8815e7ec66e3f89d3a62688d2373bfc18 100644
--- a/Simulation/SimuJobTransforms/share/CommonSkeletonJobOptions.py
+++ b/Simulation/SimuJobTransforms/share/CommonSkeletonJobOptions.py
@@ -37,6 +37,10 @@ if hasattr(runArgs,"beamType"):
 if hasattr(runArgs, "eventService") and runArgs.eventService:
     import AthenaMP.EventService
 
+# Disable this while MC still uses old alignment folders
+from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags
+InDetGeometryFlags.useDynamicAlignFolders=False
+
 ## autoConfiguration keywords triggering pre-defined functions
 ## if hasattr(runArgs,"autoConfiguration"):
 ##     for key in runArgs.autoConfiguration:
diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.cxx b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.cxx
index 44cd987084eafb3faf1119b71a79dfd2809ebde4..2149ffc37a16ec94fa396613bc3c4206f0c863fb 100644
--- a/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.cxx
+++ b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.cxx
@@ -44,8 +44,6 @@
 #include "LArG4RunControl/LArG4TBPosOptions.h"
 
 // Other useful tools for particle/event/beam info
-#include "EventInfo/EventInfo.h"
-#include "EventInfo/EventID.h"
 #include "GeneratorObjects/McEventCollection.h"
 #include "AtlasHepMC/GenEvent.h"
 #include "AtlasHepMC/GenVertex.h"
diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/src/LarEMSamplingFraction.cxx b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LarEMSamplingFraction.cxx
index 7e5fa4fb69bb2ccd2d6e78f66c89bcd0856d5e4b..5feaea9aa11208c687295b1d3a8eeab655cb92d6 100644
--- a/Simulation/Tools/CaloSamplingFractionAnalysis/src/LarEMSamplingFraction.cxx
+++ b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LarEMSamplingFraction.cxx
@@ -157,8 +157,12 @@ StatusCode LarEMSamplingFraction::execute()
 		msg(MSG::ERROR) << "No McEventCollection found"<< endmsg;
 		return StatusCode::FAILURE;
 	}
+#ifdef HEPMC3
+    HepMC::ConstGenParticlePtr   gen=truthEvent->at(0)->particles().front();
+#else
 	HepMC::GenEvent::particle_const_iterator pit  = truthEvent->at(0)->particles_begin();
 	HepMC::ConstGenParticlePtr   gen  = *pit;
+#endif
 	m_mc_pdg = gen->pdg_id();
 	m_mc_eta = gen->momentum().pseudoRapidity();
 	m_mc_phi = gen->momentum().phi();
diff --git a/Simulation/TruthJiveXML/src/TruthTrackRetriever.cxx b/Simulation/TruthJiveXML/src/TruthTrackRetriever.cxx
index 8e38bf3a4f5e471d6fa9852a4c9a1ce40f32aed7..a5750e978582519b3a3d372986b08cc701808c10 100755
--- a/Simulation/TruthJiveXML/src/TruthTrackRetriever.cxx
+++ b/Simulation/TruthJiveXML/src/TruthTrackRetriever.cxx
@@ -64,7 +64,11 @@ namespace JiveXML {
     long NParticles=0;
     McEventCollection::const_iterator McEvtCollItr = McEvtColl->begin(); 
     for ( ; McEvtCollItr != McEvtColl->end(); ++McEvtCollItr)
+#ifdef HEPMC3
+      NParticles +=  (*McEvtCollItr)->particles().size();
+#else
       NParticles +=  (*McEvtCollItr)->particles_size();
+#endif
 
     //Show in verbose mode
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "Total number of particles in McEventCollection \""
diff --git a/TestBeam/TBCnv/TBCnv/TBByteStreamCnvTool.h b/TestBeam/TBCnv/TBCnv/TBByteStreamCnvTool.h
index 40dae3e2a0a3eb05972886606316c8a171e5bdee..d798912bc2d37022ea00eb9f4e22f34596a0aeb5 100644
--- a/TestBeam/TBCnv/TBCnv/TBByteStreamCnvTool.h
+++ b/TestBeam/TBCnv/TBCnv/TBByteStreamCnvTool.h
@@ -14,7 +14,6 @@
 #include "ByteStreamData/RawEvent.h" 
 #include "EventInfo/EventInfo.h"
 #include "EventInfo/EventID.h"
-#include "ByteStreamData/RawEvent.h" 
 #include "ByteStreamCnvSvcBase/ByteStreamAddress.h" 
 #include "TBEvent/TBTDC.h"
 #include "TBEvent/TBBeamDetector.h"
diff --git a/TestBeam/TBRec/src/TBCellContainerFillerTool.cxx b/TestBeam/TBRec/src/TBCellContainerFillerTool.cxx
index 57162ef902ccb310e37512e5b20db845f1473800..e2047933fc524a7c0bb0b84da7437b1a08f3a701 100644
--- a/TestBeam/TBRec/src/TBCellContainerFillerTool.cxx
+++ b/TestBeam/TBRec/src/TBCellContainerFillerTool.cxx
@@ -7,7 +7,6 @@
 #include "CaloEvent/CaloCellContainer.h"
 #include "CaloIdentifier/CaloCell_ID.h"
 #include "CaloDetDescr/CaloDetDescrManager.h"
-#include "CaloIdentifier/CaloCell_ID.h"
 #include "LArIdentifier/LArOnlineID.h"
 
 
diff --git a/TestBeam/TBRec/src/TBEMECXTalkToyModel.cxx b/TestBeam/TBRec/src/TBEMECXTalkToyModel.cxx
index f2da3160ec06457abad6a427254beef4cf762e44..2f34d0d86ba875370294c450853dfdd76898a3a1 100644
--- a/TestBeam/TBRec/src/TBEMECXTalkToyModel.cxx
+++ b/TestBeam/TBRec/src/TBEMECXTalkToyModel.cxx
@@ -22,7 +22,6 @@ PURPOSE:  A simple toy model to simulate longitudinal cross-talk
 #include "CaloEvent/CaloCell.h"
 
 #include "CaloDetDescr/CaloDetDescrElement.h"
-#include "CaloEvent/CaloCell.h"
 #include "CaloIdentifier/CaloCell_ID.h"
 #include "CaloDetDescr/CaloDetDescrManager.h"
 
diff --git a/TestBeam/TBRec/src/TBTree_CaloClusterH6.cxx b/TestBeam/TBRec/src/TBTree_CaloClusterH6.cxx
index 57e59457ef72270ace4e04974840259181470ee6..842f7f104b46c264156014a10a7ff81eb4cce212 100644
--- a/TestBeam/TBRec/src/TBTree_CaloClusterH6.cxx
+++ b/TestBeam/TBRec/src/TBTree_CaloClusterH6.cxx
@@ -26,7 +26,6 @@
 #include "CaloEvent/CaloCellContainer.h"
 #include "CaloEvent/CaloCluster.h"
 #include "CaloEvent/CaloClusterContainer.h"
-#include "CaloIdentifier/CaloCell_ID.h"
 #include "CaloInterface/ICaloNoiseTool.h"
 
 #include "LArRawEvent/LArDigitContainer.h"
diff --git a/TileCalorimeter/TileTrackingGeometry/src/TileVolumeBuilder.cxx b/TileCalorimeter/TileTrackingGeometry/src/TileVolumeBuilder.cxx
index 87580b73a7718c511c89fa729d612d3b0363232d..ac5c69f10178e9f6882bdc3b4b51138522f1f1a2 100755
--- a/TileCalorimeter/TileTrackingGeometry/src/TileVolumeBuilder.cxx
+++ b/TileCalorimeter/TileTrackingGeometry/src/TileVolumeBuilder.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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -95,10 +95,6 @@ Tile::TileVolumeBuilder::~ TileVolumeBuilder()
 // initialize
 StatusCode Tile::TileVolumeBuilder::initialize()
 {
-  // Get the Calo geometry
-  StatusCode status = detStore()->retrieve(m_calo_dd);
-  if(status.isFailure()) return status;
-  
   // get Tile Detector Description Manager
   if (detStore()->retrieve(m_tileMgr, m_tileMgrLocation).isFailure()){  
     ATH_MSG_FATAL( "Could not get TileDetDescrManager! Tile TrackingVolumes will not be built" );
diff --git a/Tools/LWHists/src/FlexBinChunk.icc b/Tools/LWHists/src/FlexBinChunk.icc
index 1b046bfe81e829aedd5977e42346a8847ac098e8..b06694a7acbe5aa08446c7af902068949f246385 100644
--- a/Tools/LWHists/src/FlexBinChunk.icc
+++ b/Tools/LWHists/src/FlexBinChunk.icc
@@ -9,8 +9,6 @@
 #define FLEXBINCHUNK_ALLCHARSTAGE  (static_cast<uint32_t>(0x55555555))
 #define FLEXBINCHUNK_ALLSHORTSTAGE (static_cast<uint32_t>(0xAAAAAAAA))
 
-#include <cmath>
-
 template <class T> inline unsigned FlexBinChunk_stageByType() { return 0x3; }
 template <> inline unsigned FlexBinChunk_stageByType<uint8_t>() { return 0x1; }
 template <> inline unsigned FlexBinChunk_stageByType<uint16_t>() { return 0x2; }
diff --git a/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/CMakeLists.txt b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..0df7b32ae7f887db98e1f636ec1e884b6eac5df8
--- /dev/null
+++ b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/CMakeLists.txt
@@ -0,0 +1,43 @@
+################################################################################
+# Package: TrkTrackSummaryUpdater
+################################################################################
+
+# Declare the package name:
+atlas_subdir( TrkTrackSummaryUpdater )
+                
+# External dependencies:
+find_package( Boost COMPONENTS unit_test_framework )
+find_package( ROOT COMPONENTS Core )
+          
+# Component(s) in the package:
+atlas_add_library( TrkTrackSummaryUpdaterLib
+                   src/*.cxx
+                   test/PutTrackCollectionsInSG.cxx
+                   test/SummaryToolStub.cxx
+                   PUBLIC_HEADERS TrkTrackSummaryUpdater
+                   LINK_LIBRARIES AthenaBaseComps GaudiKernel StoreGateLib TrkTrack TrkEventUtils TrkToolInterfaces TrkTrackSummary
+                   PRIVATE_LINK_LIBRARIES TrkPrepRawData )
+                   
+atlas_add_library( TrkTrackSummaryUpdaterTestLib
+                   test/PutTrackCollectionsInSG.cxx
+                   test/SummaryToolStub.cxx
+                   NO_PUBLIC_HEADERS
+                   LINK_LIBRARIES TrkTrackSummaryUpdaterLib 
+                   PRIVATE_LINK_LIBRARIES TrkPrepRawData )
+
+# Component(s) in the package:
+atlas_add_component( TrkTrackSummaryUpdater
+                     src/components/*.cxx
+                     LINK_LIBRARIES TrkTrackSummaryUpdaterLib)
+
+atlas_add_test(TrackSummaryUpdater_test
+                SOURCES test/TrackSummaryUpdater_test.cxx 
+                INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} 
+                LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES}  TrkTrackSummaryUpdaterTestLib
+                POST_EXEC_SCRIPT "nopost.sh" )
+
+# Install files from the package:
+atlas_install_joboptions( share/*.txt )
+
+# Install files from the package:
+atlas_install_headers( TrkTrackSummaryUpdater )
diff --git a/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/TrkTrackSummaryUpdater/TrackSummaryUpdater.h b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/TrkTrackSummaryUpdater/TrackSummaryUpdater.h
new file mode 100644
index 0000000000000000000000000000000000000000..93967b3a40ea1a9c2d85fa8b0e2b30829a722265
--- /dev/null
+++ b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/TrkTrackSummaryUpdater/TrackSummaryUpdater.h
@@ -0,0 +1,48 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+
+#ifndef TrackSummaryUpdater_H
+#define TrackSummaryUpdater_H
+
+#include <string>
+#include <map>
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "GaudiKernel/ToolHandle.h"
+
+#include "TrkTrack/TrackCollection.h"
+
+#include "TrkToolInterfaces/IExtendedTrackSummaryTool.h"
+#include "TrkToolInterfaces/IPRDtoTrackMapTool.h"
+#include "TrkEventUtils/PRDtoTrackMap.h"
+
+#include "StoreGate/WriteHandleKey.h"
+#include "StoreGate/ReadHandleKeyArray.h"
+
+namespace Trk {
+
+  /** @brief Algorithm for updating the track summary of a track collection */
+  class TrackSummaryUpdater : public AthAlgorithm{
+    public:
+      TrackSummaryUpdater(const std::string &name, ISvcLocator *pSvcLocator);
+      virtual ~TrackSummaryUpdater() {}
+      StatusCode initialize() override;
+      StatusCode execute() override;
+      StatusCode finalize() override;
+      
+    protected:
+      SG::ReadHandleKey<TrackCollection>           m_inputTracksStoregateKey  ;  /** Input track collection.   */
+      SG::WriteHandleKey<TrackCollection>          m_updatedTracksStoregateKey  ;  /** Input track collection with updated summary.   */
+      SG::WriteHandleKey<Trk::PRDtoTrackMap>       m_assoMapName{this,"AssociationMapName",""};  ///< the key given to the newly created association map
+      ToolHandle<Trk::IPRDtoTrackMapTool>          m_assoTool{this, "AssociationTool", "InDet::InDetPRDtoTrackMapToolGangedPixels" };
+      ToolHandle< Trk::IExtendedTrackSummaryTool > m_trkSummaryTool    ;  /** summary tool with shared hits enabled */
+
+    private:
+      bool  m_createViewCollection;     //!< option to create a view collection and not deep-copy tracks
+      bool  m_updateSharedHits; //!< do not create the track summary again, but only update shared hits
+      bool  m_updateAdditionalInfo;     //!< do not create the track summary again, but only update necessary things
+    };
+}
+#endif // TrackSummaryUpdater_H
+
diff --git a/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/share/TrackSummaryUpdater_test.txt b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/share/TrackSummaryUpdater_test.txt
new file mode 100644
index 0000000000000000000000000000000000000000..2992965a1a99b3defab20fab393dfda25a9aaff4
--- /dev/null
+++ b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/share/TrackSummaryUpdater_test.txt
@@ -0,0 +1,8 @@
+EventDataSvc.ForceLeaves = true;
+EventDataSvc.RootCLID    = 1;
+ApplicationMgr.Dlls += { "AthenaServices" };
+ApplicationMgr.ExtSvc = {"StoreGateSvc"};
+ApplicationMgr.EvtMax = 1;
+ApplicationMgr.EvtSel = "TestEvtSelector";
+ApplicationMgr.HistogramPersistency = "NONE";
+MessageSvc.OutputLevel = 5;
\ No newline at end of file
diff --git a/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/src/TrackSummaryUpdater.cxx b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/src/TrackSummaryUpdater.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..098bee3bd0aa472b6a9aacef9295f2d6de48e343
--- /dev/null
+++ b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/src/TrackSummaryUpdater.cxx
@@ -0,0 +1,83 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+
+#include "GaudiKernel/MsgStream.h"
+#include "TrkPrepRawData/PrepRawData.h"
+#include "TrkTrackSummaryUpdater/TrackSummaryUpdater.h"
+
+///////////////////////////////////////////////////////////////////
+// Constructor
+///////////////////////////////////////////////////////////////////
+
+Trk::TrackSummaryUpdater::TrackSummaryUpdater
+(const std::string& name, ISvcLocator* pSvcLocator  ) :
+  AthAlgorithm(name, pSvcLocator ),
+  m_createViewCollection(true),
+  m_updateSharedHits(true),
+  m_updateAdditionalInfo(false){
+  m_inputTracksStoregateKey = "CombinedInDetTracks";
+  declareProperty("InputTracksKey",            m_inputTracksStoregateKey);
+  declareProperty("OutputTracksKey",           m_updatedTracksStoregateKey); 
+  declareProperty("SummaryTool" ,              m_trkSummaryTool);
+  declareProperty("UpdateSharedHits" ,         m_updateSharedHits);
+  declareProperty("UpdateAdditionalInfo" ,     m_updateAdditionalInfo);
+}
+
+///////////////////////////////////////////////////////////////////
+// Initialisation
+///////////////////////////////////////////////////////////////////
+
+StatusCode 
+Trk::TrackSummaryUpdater::initialize(){
+  ATH_MSG_DEBUG("Initializing TrackSummaryUpdater");
+  ATH_CHECK( m_inputTracksStoregateKey.initialize() );
+  ATH_CHECK( m_updatedTracksStoregateKey.initialize() );
+  ATH_CHECK( m_trkSummaryTool.retrieve() ); //..so needs at least a TrackSummaryTool to be configured
+  if (not m_assoTool.empty())  ATH_CHECK( m_assoTool.retrieve() );
+  ATH_CHECK( m_assoMapName.initialize( !m_assoMapName.key().empty() ));
+  return StatusCode::SUCCESS;
+}
+
+
+///////////////////////////////////////////////////////////////////
+// Execute
+///////////////////////////////////////////////////////////////////
+StatusCode 
+Trk::TrackSummaryUpdater::execute(){
+  std::unique_ptr<Trk::PRDtoTrackMap> prdToTrackMap (m_assoTool ? m_assoTool->createPRDtoTrackMap(): std::make_unique<Trk::PRDtoTrackMap>());
+  std::unique_ptr<TrackCollection> updatedCollection = std::make_unique<TrackCollection>(SG::VIEW_ELEMENTS);
+  SG::ReadHandle<TrackCollection> inputTrackCollection(m_inputTracksStoregateKey);
+  updatedCollection->reserve(inputTrackCollection->size());
+  ATH_MSG_DEBUG("Update summaries");  
+  const bool createNewSummary = (not m_updateAdditionalInfo) and (not m_updateSharedHits);
+  for (const auto pThisTrack : *inputTrackCollection) {
+    auto nonConstTrackPtr = const_cast<Trk::Track *>(pThisTrack);
+    if (m_updateAdditionalInfo)  m_trkSummaryTool->updateAdditionalInfo(*nonConstTrackPtr);
+    if (m_updateSharedHits) m_trkSummaryTool->updateSharedHitCount(*nonConstTrackPtr, prdToTrackMap.get());
+    if (createNewSummary) m_trkSummaryTool->computeAndReplaceTrackSummary(*nonConstTrackPtr, prdToTrackMap.get(), false /* DO NOT suppress hole search*/);
+    updatedCollection->push_back(nonConstTrackPtr);
+  }
+  SG::WriteHandle<TrackCollection> sgTargetWriteHandle(m_updatedTracksStoregateKey);
+  ATH_CHECK(sgTargetWriteHandle.record(std::move(updatedCollection)));	     
+  if (m_assoTool and (not m_assoMapName.key().empty())) {
+     SG::WriteHandle<Trk::PRDtoTrackMap> storegateWriter(m_assoMapName);
+     if (storegateWriter.record( m_assoTool->reduceToStorableMap(std::move(prdToTrackMap))).isFailure()) {
+        ATH_MSG_FATAL("Failed to add PRD to track association map.");
+     }
+  }
+  
+  ATH_MSG_DEBUG("Done !");  
+  return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////
+// Finalize
+///////////////////////////////////////////////////////////////////
+
+StatusCode 
+Trk::TrackSummaryUpdater::finalize(){
+   return StatusCode::SUCCESS;
+}
+
diff --git a/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/src/components/TrkTrackSummaryUpdater_entries.cxx b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/src/components/TrkTrackSummaryUpdater_entries.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..40c34fef6ad154109700e2cd43a0cc3863d565b7
--- /dev/null
+++ b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/src/components/TrkTrackSummaryUpdater_entries.cxx
@@ -0,0 +1,10 @@
+
+#include "TrkTrackSummaryUpdater/TrackSummaryUpdater.h"
+#include "test/SummaryToolStub.h"
+#include "test/PutTrackCollectionsInSG.h"
+
+DECLARE_COMPONENT( Trk::TrackSummaryUpdater )
+DECLARE_COMPONENT(SummaryToolStub)
+DECLARE_COMPONENT( PutTrackCollectionsInSG )
+
+
diff --git a/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/test/PutTrackCollectionsInSG.cxx b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/test/PutTrackCollectionsInSG.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..40790cc9b7dfe89ad4bcf0e3df612afaf24b6805
--- /dev/null
+++ b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/test/PutTrackCollectionsInSG.cxx
@@ -0,0 +1,63 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+ * @file PutTrackCollectionsInSG.cxx
+ *
+ * @brief Implementation file for the PutTrackCollectionsInSG class 
+ *
+ * @author Shaun Roe
+ **/
+
+#include "PutTrackCollectionsInSG.h"
+#include "TrkTrack/TrackCollection.h"
+#include <memory>
+
+
+PutTrackCollectionsInSG::PutTrackCollectionsInSG(const std::string& name, ISvcLocator* pSvcLocator) : 
+  AthAlgorithm(name, pSvcLocator)
+{
+  //nop
+}
+
+//Initialize
+StatusCode 
+PutTrackCollectionsInSG::initialize() {
+  ATH_MSG_INFO("Calling initialize");
+  return StatusCode::SUCCESS;
+}
+
+//Execute
+StatusCode 
+PutTrackCollectionsInSG::execute()  {
+  auto collection1 = std::make_unique<TrackCollection>(SG::VIEW_ELEMENTS);
+  //note that the default c'tor should normally *not* be used and results in an invalid Track
+  //however, it suffices for unit testing purposes
+  Trk::Track *t1 = new Trk::Track();
+  Trk::Track *t2 = new Trk::Track();
+  collection1->push_back(t1);
+  collection1->push_back(t2);
+  auto collection2 = std::make_unique<TrackCollection>(SG::VIEW_ELEMENTS);
+  Trk::Track *t3 =  new Trk::Track();
+  collection2->push_back(t3);
+  //
+  std::string collectionKey1("StoreGateSvc+TrackCollectionKey1");
+  SG::WriteHandle<TrackCollection> sgTrackCollectionWriter1(collectionKey1);
+  ATH_MSG_INFO("Record track collection1 in SG");
+  ATH_CHECK(sgTrackCollectionWriter1.record(std::move(collection1)));	
+  //
+  std::string collectionKey2("StoreGateSvc+TrackCollectionKey2");
+  SG::WriteHandle<TrackCollection> sgTrackCollectionWriter2(collectionKey2);
+  ATH_MSG_INFO("Record track collection2 in SG");
+  ATH_CHECK(sgTrackCollectionWriter2.record(std::move(collection2)));
+  //
+  return StatusCode::SUCCESS;
+}
+
+//Finalize
+StatusCode
+PutTrackCollectionsInSG::finalize() {
+  ATH_MSG_INFO("Calling finalize");
+  return StatusCode::SUCCESS;
+}
\ No newline at end of file
diff --git a/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/test/PutTrackCollectionsInSG.h b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/test/PutTrackCollectionsInSG.h
new file mode 100644
index 0000000000000000000000000000000000000000..47fe6a2a441a642e8a3252b3f5f6ecc8b2b0b8fb
--- /dev/null
+++ b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/test/PutTrackCollectionsInSG.h
@@ -0,0 +1,38 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+* @file PutTrackCollectionsInSG.h
+*
+* @brief Header file for the PutTrackCollectionsInSG class 
+*  for testing the TrkTrackCollectionMerger
+*
+* @author Shaun Roe
+**/
+
+#ifndef PutTrackCollectionsInSG_H
+#define PutTrackCollectionsInSG_H 
+
+//Athena
+#include "AthenaBaseComps/AthAlgorithm.h"
+
+//Gaudi
+
+//STL
+#include <string>
+
+///Example algorithm to show calling the SCT_ModuleVetoSvc to exclude bad components
+class PutTrackCollectionsInSG : public AthAlgorithm {
+ public:
+  PutTrackCollectionsInSG(const std::string &name,ISvcLocator *pSvcLocator) ;
+  virtual ~PutTrackCollectionsInSG() = default;
+  virtual StatusCode initialize() override;
+  virtual StatusCode execute() override;
+  virtual StatusCode finalize() override;
+  virtual bool isClonable() const override { return false; };
+
+ private:
+}; //end of class
+
+#endif // PutTrackCollectionsInSG_H
\ No newline at end of file
diff --git a/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/test/SummaryToolStub.cxx b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/test/SummaryToolStub.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..b56a5732a9b1ba9111486add6cb444e1d6856ba2
--- /dev/null
+++ b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/test/SummaryToolStub.cxx
@@ -0,0 +1,111 @@
+/*
+   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "SummaryToolStub.h"
+
+#include "TrkTrack/Track.h"
+#include "TrkTrackSummary/TrackSummary.h"
+#include <vector>
+#include <bitset>
+
+SummaryToolStub::SummaryToolStub(const std::string& t, const std::string& n, const IInterface*  p ):base_class(t,n,p){
+  declareInterface<ITrackSummaryTool>(this);
+  //just for fun, lets make a TrackSummary out of its components
+  //I'm using 19 components, which is not a full set, but encompasses the element which 
+  //would give SCT Shared Hits (which I use in the test)
+  std::vector<int> information{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18, -1};
+  std::vector<float> eProbability{0.1,0.1,0.1};
+  std::bitset<Trk::DetectorType::numberOfDetectorTypes> hitPattern{};
+  hitPattern.set(3);
+  float dedx=0.2;
+  int nhitsuseddedx=3;
+  int nhitsoverflowdedx=1;
+  m_pTrackSummaryRef = std::make_unique<Trk::TrackSummary>(information, eProbability, hitPattern, dedx, nhitsuseddedx, nhitsoverflowdedx);
+}
+
+StatusCode 
+SummaryToolStub::initialize() {
+  return StatusCode::SUCCESS;
+}
+
+StatusCode 
+SummaryToolStub::finalize() {
+  return StatusCode::SUCCESS;
+}
+//methods inherited from the IExtendedTrackSummaryTool and the ITrackSummaryTool.
+//
+void 
+SummaryToolStub::updateSharedHitCount(Trk::Track& ) const {}
+//
+void 
+SummaryToolStub::computeAndReplaceTrackSummary(const EventContext&  ,Trk::Track& track,const Trk::PRDtoTrackMap* , bool ) const {
+  //copy the reference summary
+  auto p = std::make_unique<Trk::TrackSummary>(*m_pTrackSummaryRef);
+  track.setTrackSummary(std::move(p));
+}
+//
+void 
+SummaryToolStub::updateTrackSummary(const EventContext&  ,Trk::Track&) const {
+
+}
+//
+void 
+SummaryToolStub::updateTrackSummary(const EventContext&  ,Trk::Track&, const Trk::PRDtoTrackMap* , bool) const {
+
+}
+//
+void 
+SummaryToolStub::updateTrack(const EventContext&  ,Trk::Track& ) const {
+
+}
+//
+std::unique_ptr<Trk::TrackSummary> 
+SummaryToolStub::summaryNoHoleSearch( const EventContext&  ,const Trk::Track& , const Trk::PRDtoTrackMap* ) const {
+ return std::make_unique<Trk::TrackSummary>();
+}
+//
+std::unique_ptr<Trk::TrackSummary> 
+SummaryToolStub::summaryNoHoleSearch(const EventContext&  ,const Trk::Track&)const {
+ return std::make_unique<Trk::TrackSummary>();
+}
+//
+std::unique_ptr<Trk::TrackSummary> 
+SummaryToolStub::summary(const EventContext&  ,const Trk::Track& ) const {
+ return std::make_unique<Trk::TrackSummary>();
+}
+//
+std::unique_ptr<Trk::TrackSummary> 
+SummaryToolStub::summary(const EventContext&  ,const Trk::Track&, const Trk::PRDtoTrackMap*) const {
+ return std::make_unique<Trk::TrackSummary>();
+}
+//
+void 
+SummaryToolStub::updateSharedHitCount(const Trk::Track& ,const Trk::PRDtoTrackMap* , Trk::TrackSummary& ) const {}
+//
+void 
+SummaryToolStub::updateSharedHitCount(Trk::Track& track,const Trk::PRDtoTrackMap* ) const  {
+  auto updatedSummary = *m_pTrackSummaryRef;
+  updatedSummary.update(Trk::SummaryType::numberOfSCTSharedHits, 20);
+  auto p = std::make_unique<Trk::TrackSummary>(updatedSummary);
+  track.setTrackSummary(std::move(p));
+}
+//
+void 
+SummaryToolStub::updateAdditionalInfo(const Trk::Track& , Trk::TrackSummary& ) const {
+  //
+}
+//
+void 
+SummaryToolStub::updateAdditionalInfo(Trk::Track& track) const {
+  //just for fun, lets make a TrackSummary out of its components
+  std::vector<int> information{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18, -1};
+  std::vector<float> eProbability{0.1,0.1,0.1};
+  std::bitset<Trk::DetectorType::numberOfDetectorTypes> hitPattern{};
+  hitPattern.set(3);
+  float dedx=0.2;
+  int nhitsuseddedx=4;
+  int nhitsoverflowdedx=1;
+  auto t = std::make_unique<Trk::TrackSummary>(information, eProbability, hitPattern, dedx, nhitsuseddedx, nhitsoverflowdedx);
+  track.setTrackSummary(std::move(t));
+}
\ No newline at end of file
diff --git a/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/test/SummaryToolStub.h b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/test/SummaryToolStub.h
new file mode 100644
index 0000000000000000000000000000000000000000..85e6a44997c4981a2c241f40fd812d2f09c9dadc
--- /dev/null
+++ b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/test/SummaryToolStub.h
@@ -0,0 +1,72 @@
+/*
+   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+#ifndef TRKSummaryToolStub_H
+#define TRKSummaryToolStub_H
+
+
+#include "AthenaBaseComps/AthAlgTool.h"
+#include "TrkToolInterfaces/IExtendedTrackSummaryTool.h" //baseclass
+
+#include <string>
+#include <memory> //unique_ptr
+
+namespace Trk{
+  class Track;
+  class PRDtoTrackMap;
+  class TrackSummary;
+}
+ 
+ class 
+ SummaryToolStub : public extends<AthAlgTool, Trk::IExtendedTrackSummaryTool>{
+   public:
+   SummaryToolStub(const std::string& t, const std::string& n, const IInterface*  p );
+   
+   ~SummaryToolStub(){}
+   StatusCode initialize() override;
+   StatusCode finalize() override;
+   //methods inherited from the IExtendedTrackSummaryTool and the ITrackSummaryTool.
+   //
+   void 
+   updateSharedHitCount(Trk::Track& ) const override;
+   //
+   void 
+   computeAndReplaceTrackSummary(const EventContext& ctx, Trk::Track& ,const Trk::PRDtoTrackMap* , bool ) const override;
+   //
+   void 
+   updateTrackSummary(const EventContext& ctx,Trk::Track&) const override;
+   //
+   void 
+   updateTrackSummary(const EventContext& ctx, Trk::Track&, const Trk::PRDtoTrackMap* , bool) const override;
+   //
+   void 
+   updateTrack(const EventContext& ctx,Trk::Track& ) const override;
+    //
+   std::unique_ptr<Trk::TrackSummary> 
+   summaryNoHoleSearch( const EventContext& ctx,const Trk::Track& , const Trk::PRDtoTrackMap* ) const override;
+   //
+   std::unique_ptr<Trk::TrackSummary> 
+   summaryNoHoleSearch(const EventContext& ctx, const Trk::Track&)const override;
+   //
+   std::unique_ptr<Trk::TrackSummary> 
+   summary(const EventContext& ctx,const Trk::Track& ) const override;
+   //
+   std::unique_ptr<Trk::TrackSummary> 
+   summary(const EventContext& ctx,const Trk::Track&, const Trk::PRDtoTrackMap*) const override;
+   //
+   void 
+   updateSharedHitCount(const Trk::Track& ,const Trk::PRDtoTrackMap* , Trk::TrackSummary& ) const override;
+   //
+   void 
+   updateSharedHitCount(Trk::Track& ,const Trk::PRDtoTrackMap* ) const  override;
+   //
+   void 
+   updateAdditionalInfo(const Trk::Track& , Trk::TrackSummary& ) const override;
+   //
+   void 
+   updateAdditionalInfo(Trk::Track& ) const override;
+   
+   private:
+   std::unique_ptr<Trk::TrackSummary> m_pTrackSummaryRef{};
+ };
+#endif
diff --git a/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/test/TrackSummaryUpdater_test.cxx b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/test/TrackSummaryUpdater_test.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..f0c29831a0e16a459e800490b2263098e1476813
--- /dev/null
+++ b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/test/TrackSummaryUpdater_test.cxx
@@ -0,0 +1,238 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+/*
+ */
+/**
+ * @file TrkTrackSummaryUpdater/test/TrackSummaryUpdater_test.cxx
+ * @author Shaun Roe
+ * @date Nov, 2020
+ * @brief Some tests for TrackSummaryUpdater algorithm in the Boost framework
+ */
+ 
+ 
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MAIN
+#define BOOST_TEST_MODULE TEST_TRKTRACKSUMMARYUPDATER
+//
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#include <boost/test/unit_test.hpp>
+
+#pragma GCC diagnostic pop
+
+//
+
+#include "GaudiKernel/ISvcLocator.h"
+#include "StoreGate/StoreGateSvc.h"
+#include "CxxUtils/checker_macros.h"
+#include "TInterpreter.h"
+//
+#include "GaudiKernel/IAppMgrUI.h"
+#include "GaudiKernel/SmartIF.h"
+#include "GaudiKernel/SystemOfUnits.h"
+#include "GaudiKernel/PhysicalConstants.h"
+#include "GaudiKernel/EventContext.h"
+#include "AthenaBaseComps/AthAlgTool.h"
+#include "CxxUtils/ubsan_suppress.h"
+#include "PutTrackCollectionsInSG.h"
+
+#include "TrkToolInterfaces/IExtendedTrackSummaryTool.h"
+#include "StoreGate/ReadHandleKey.h"
+#include "TrkTrack/TrackCollection.h"
+#include "../TrkTrackSummaryUpdater/TrackSummaryUpdater.h"
+#include "TrkTrackSummary/TrackSummary.h"
+#include <vector>
+#include "test/SummaryToolStub.h"
+
+ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // This test uses global svcLoc.
+
+// Gaudi fixture
+class GaudiFixture {
+ public:
+   ISvcLocator * 
+   svcLoc(){
+     return m_svcLoc;
+   }
+   
+   IToolSvc *
+   toolSvc(){
+     return m_toolSvc;
+   }
+   
+   StoreGateSvc* 
+   storeGateSvc(){
+    return m_sg;
+   }
+
+   GaudiFixture(const std::string & joPath = "TrkTrackSummaryUpdater/TrackSummaryUpdater_test.txt") {
+     setUpGaudi(joPath);
+   }
+ 
+   ~GaudiFixture() {
+     tearDownGaudi();
+   }
+   
+ private:
+   void 
+   setUpGaudi(const std::string & joPath) {
+     CxxUtils::ubsan_suppress ([]() { TInterpreter::Instance(); } );
+     m_appMgr = Gaudi::createApplicationMgr();
+     m_svcLoc = m_appMgr;
+     m_svcMgr = m_appMgr;
+     m_propMgr = m_appMgr;
+     m_propMgr->setProperty( "EvtSel",         "NONE" ).ignore() ;
+     m_propMgr->setProperty( "JobOptionsType", "FILE" ).ignore();
+     m_propMgr->setProperty( "JobOptionsPath", joPath ).ignore();
+     m_toolSvc = m_svcLoc->service("ToolSvc");
+     m_appMgr->configure().ignore();
+     m_appMgr->initialize().ignore();
+     m_sg = nullptr;
+     m_svcLoc->service ("StoreGateSvc", m_sg).ignore();
+   }
+ 
+   void 
+   tearDownGaudi() {
+     m_svcMgr->finalize().ignore();
+     m_appMgr->finalize().ignore();
+     m_appMgr->terminate().ignore();
+     m_svcLoc->release();
+     m_svcMgr->release();
+     Gaudi::setInstance( static_cast<IAppMgrUI*>(nullptr) );
+   }
+ 
+   StoreGateSvc* 
+   evtStore(){
+     return m_sg;
+   }
+ 
+   //member variables for Core Gaudi components
+   IAppMgrUI*               m_appMgr{nullptr};
+   SmartIF<ISvcLocator>     m_svcLoc;
+   SmartIF<ISvcManager>     m_svcMgr;
+   SmartIF<IToolSvc>        m_toolSvc;
+   SmartIF<IProperty>       m_propMgr;
+   StoreGateSvc*            m_sg{ nullptr };
+ };
+ 
+
+
+ 
+BOOST_AUTO_TEST_SUITE(TrackSummaryUpdaterTest)
+  
+  GaudiFixture g("TrkTrackSummaryUpdater/TrackSummaryUpdater_test.txt");
+  auto  pSvcLoc=g.svcLoc();
+  auto  pToolSvc=g.toolSvc();
+
+  BOOST_AUTO_TEST_CASE( sanityCheck ){
+    const bool svcLocatorIsOk=(pSvcLoc != nullptr);
+    BOOST_TEST(svcLocatorIsOk);
+    const bool toolSvcIsOk = ( pToolSvc != nullptr);
+    BOOST_TEST(toolSvcIsOk);
+  }
+  
+  BOOST_AUTO_TEST_CASE(execute){
+    auto pAlg = new PutTrackCollectionsInSG("PutCollectionsInSG",pSvcLoc);
+    pAlg->addRef();
+    BOOST_TEST(pAlg->execute().isSuccess());
+    std::string collectionKey1("StoreGateSvc+TrackCollectionKey1");
+    SG::ReadHandle<TrackCollection> thisTrackCollection1 (collectionKey1);
+    BOOST_TEST(thisTrackCollection1->size() == 2);
+    //
+    IAlgTool* toolInterface{};
+    //SummaryToolStub is in this package, it is a dummy SummaryTool with the appropriate
+    //interface (inheriting from IExtendedTrackSummaryTool)
+    BOOST_TEST(pToolSvc->retrieveTool("SummaryToolStub", toolInterface).isSuccess());
+    //Create TrackSummary in the output collection
+    auto pUpdateAlg = new Trk::TrackSummaryUpdater("Updater1",pSvcLoc);
+    pUpdateAlg->addRef();
+    BOOST_TEST_MESSAGE("Testing Summary Creation on the track");
+    BOOST_TEST(pUpdateAlg->setProperty("InputTracksKey","TrackCollectionKey1").isSuccess());
+    BOOST_TEST(pUpdateAlg->setProperty("OutputTracksKey","SummaryCreation").isSuccess());
+    BOOST_TEST(pUpdateAlg->setProperty("SummaryTool", "SummaryToolStub").isSuccess());
+    //The following means that "computeAndReplaceTrackSummary" should be called
+    BOOST_TEST(pUpdateAlg->setProperty("UpdateSharedHits", false).isSuccess());
+    //initialize() is necessary here
+    BOOST_TEST(pUpdateAlg->initialize().isSuccess());
+    BOOST_TEST(pUpdateAlg->execute().isSuccess());
+    std::vector<std::string> keysPresent{};
+    g.storeGateSvc()->keys<TrackCollection>(keysPresent);
+    BOOST_TEST_MESSAGE("StoreGate now contains the following entries: ");
+    for (auto & n: keysPresent){
+      BOOST_TEST_MESSAGE(n);
+    }
+    std::string createdCollectionKey("SummaryCreation");
+    SG::ReadHandle<TrackCollection> createdCollection (createdCollectionKey);
+    BOOST_TEST(createdCollection->size() == 2);
+    //
+    const std::vector<std::string> expectedKeys{"SummaryCreation","TrackCollectionKey1", "TrackCollectionKey2"};
+    g.storeGateSvc()->keys<TrackCollection>(keysPresent);
+    BOOST_TEST(keysPresent == expectedKeys, boost::test_tools::per_element());
+    //
+    const int valueSetForNHitsUsed{3};
+    for (const auto & aTrack: *createdCollection){
+      const auto & pThisSummary = aTrack->trackSummary();
+      const auto valueReadBackForNHitsUsed = pThisSummary->numberOfUsedHitsdEdx();
+      BOOST_TEST(valueReadBackForNHitsUsed == valueSetForNHitsUsed);
+    }
+    //Update the Additional Info on the existing track summary, using numberOfUsedHitsdEdx
+    //as an example of a value to update. The update values are hard coded in the 
+    //SummaryToolStub code in this package, which is a mock SummaryTool
+    BOOST_TEST_MESSAGE("Testing Summary UpdateAdditionalInfo on the track");
+    auto pUpdateAlg2 = new Trk::TrackSummaryUpdater("Updater2",pSvcLoc);
+    pUpdateAlg2->addRef();
+    pUpdateAlg2->setProperty("InputTracksKey","SummaryCreation").ignore();
+    pUpdateAlg2->setProperty("OutputTracksKey","AdditionalInfoUpdated").ignore();
+    pUpdateAlg2->setProperty("SummaryTool", "SummaryToolStub").ignore();
+    //The following means that "updateAdditionalInfo" should be called
+    BOOST_TEST(pUpdateAlg2->setProperty("UpdateSharedHits", false).isSuccess());
+    BOOST_TEST(pUpdateAlg2->setProperty("UpdateAdditionalInfo", true).isSuccess());
+    BOOST_TEST(pUpdateAlg2->initialize().isSuccess());
+    BOOST_TEST(pUpdateAlg2->execute().isSuccess());
+    keysPresent.clear();
+    g.storeGateSvc()->keys<TrackCollection>(keysPresent);
+    BOOST_TEST_MESSAGE("StoreGate now contains the following entries: ");
+    for (auto & n: keysPresent){
+      BOOST_TEST_MESSAGE(n);
+    }
+    std::string updatedCollectionKey("AdditionalInfoUpdated");
+    SG::ReadHandle<TrackCollection> updatedCollection(createdCollectionKey);
+    const int updatedValueForNHitsUsed{4};
+    for (const auto & aTrack: *updatedCollection){
+      const auto & pThisSummary = aTrack->trackSummary();
+      const auto valueReadBackForNHitsUsed = pThisSummary->numberOfUsedHitsdEdx();
+      BOOST_TEST(valueReadBackForNHitsUsed == updatedValueForNHitsUsed);
+    }
+    //Update Shared Hits on an existing track summary
+    BOOST_TEST_MESSAGE("Testing Summary UpdateSharedHits on the track");
+    auto pUpdateAlg3 = new Trk::TrackSummaryUpdater("Updater3",pSvcLoc);
+    pUpdateAlg3->addRef();
+    pUpdateAlg3->setProperty("InputTracksKey","SummaryCreation").ignore();
+    pUpdateAlg3->setProperty("OutputTracksKey","SharedInfoUpdated").ignore();
+    pUpdateAlg3->setProperty("SummaryTool", "SummaryToolStub").ignore();
+    //The following means that "UpdateSharedHits" should be called
+    BOOST_TEST(pUpdateAlg3->setProperty("UpdateSharedHits", true).isSuccess());
+    BOOST_TEST(pUpdateAlg3->setProperty("UpdateAdditionalInfo", false).isSuccess());
+    BOOST_TEST(pUpdateAlg3->initialize().isSuccess());
+    BOOST_TEST(pUpdateAlg3->execute().isSuccess());
+    keysPresent.clear();
+    g.storeGateSvc()->keys<TrackCollection>(keysPresent);
+    BOOST_TEST_MESSAGE("StoreGate now contains the following entries: ");
+    for (auto & n: keysPresent){
+      BOOST_TEST_MESSAGE(n);
+    }
+    std::string updatedSharedCollectionKey("SharedInfoUpdated");
+    SG::ReadHandle<TrackCollection> updatedSharedCollection(createdCollectionKey);
+    const int updatedSharedHitCount{20};
+    for (const auto & aTrack: *updatedCollection){
+      const auto & pThisSummary = aTrack->trackSummary();
+      const auto valueReadBackSharedHits = pThisSummary->get(Trk::SummaryType::numberOfSCTSharedHits);
+      const auto valueReadBackForNHitsUsed = pThisSummary->numberOfUsedHitsdEdx();
+      BOOST_TEST(valueReadBackForNHitsUsed == valueSetForNHitsUsed);
+      BOOST_TEST(valueReadBackSharedHits == updatedSharedHitCount);
+    }
+  }
+  
+BOOST_AUTO_TEST_SUITE_END()
+
+
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/AnnulusBounds.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/AnnulusBounds.h
index 65e7b4ba24d32ddf115133ccdb66dcefc11ab00e..fb82d09e564b1aa0ccc917282ccf4027dc02378f 100644
--- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/AnnulusBounds.h
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/AnnulusBounds.h
@@ -41,7 +41,7 @@ namespace Trk {
  @author Marcin.Wolter@cern.ch
  */
 
-class AnnulusBounds : public SurfaceBounds
+class AnnulusBounds final: public SurfaceBounds
 {
 
 public:
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscTrapezoidalBounds.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscTrapezoidalBounds.h
index a5a858435077d52b68a08f2e76561229c1613914..dc8bab54f2e995bc08f143e0758c7f5bc2f97d61 100644
--- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscTrapezoidalBounds.h
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscTrapezoidalBounds.h
@@ -38,7 +38,7 @@ namespace Trk {
    @author Noemi.Calace@cern.ch , Andreas.Salzburger@cern.ch
 */
 
-class DiscTrapezoidalBounds : public SurfaceBounds
+class DiscTrapezoidalBounds final : public SurfaceBounds
 {
 
 public:
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/NoBounds.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/NoBounds.h
index 19d82c451c054118757379b4496fb9b9c8c2294b..a30e1d443b56c3c7a07426518460fd8bafd9574b 100644
--- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/NoBounds.h
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/NoBounds.h
@@ -26,7 +26,7 @@ namespace Trk {
  @author Andreas.Salzburger@cern.ch
  */
 
-class NoBounds : public SurfaceBounds
+class NoBounds final : public SurfaceBounds
 {
 public:
   /**Default Constructor*/
@@ -36,7 +36,7 @@ public:
   ~NoBounds() = default;
 
   /**Equality operator */
-  virtual bool operator==(const SurfaceBounds& sbo) const override;
+  virtual bool operator==(const SurfaceBounds& sbo) const override final;
 
   /** Return SurfaceBounds for persistency */
   virtual SurfaceBounds::BoundsType type() const override { return SurfaceBounds::Other; }
@@ -67,71 +67,8 @@ public:
   /** Output Method for std::ostream */
   virtual std::ostream& dump(std::ostream& sl) const override final;
 
-private:
 };
-
-inline bool
-NoBounds::operator==(const SurfaceBounds&) const
-{
-  return true;
-}
-
-inline bool
-NoBounds::inside(const Amg::Vector2D&, double, double) const
-{
-  return true;
-}
-
-inline bool
-NoBounds::inside(const Amg::Vector2D&, const BoundaryCheck&) const
-{
-  return true;
-}
-
-inline bool
-NoBounds::insideLoc1(const Amg::Vector2D&, double) const
-{
-  return true;
-}
-
-inline bool
-NoBounds::insideLoc2(const Amg::Vector2D&, double) const
-{
-  return true;
-}
-
-inline double
-NoBounds::minDistance(const Amg::Vector2D&) const
-{
-  return 0.;
-}
-
-inline NoBounds*
-NoBounds::clone() const
-{
-  return new NoBounds();
-}
-
-inline double
-NoBounds::r() const
-{
-  return 0.;
-}
-
-inline MsgStream&
-NoBounds::dump(MsgStream& sl) const
-{
-  sl << "Trk::NoBounds ... boundless surface" << endmsg;
-  return sl;
-}
-
-inline std::ostream&
-NoBounds::dump(std::ostream& sl) const
-{
-  sl << "Trk::NoBounds ... boundless surface" << std::endl;
-  return sl;
-}
-
 } // end of namespace
 
+#include "TrkSurfaces/NoBounds.icc"
 #endif // TRKSURFACES_NOBOUNDS_H
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/NoBounds.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/NoBounds.icc
new file mode 100644
index 0000000000000000000000000000000000000000..406f6af93de586c6b7a5e4241178958d05c53fae
--- /dev/null
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/NoBounds.icc
@@ -0,0 +1,69 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+namespace Trk {
+
+inline bool
+NoBounds::operator==(const SurfaceBounds&) const
+{
+  return true;
+}
+
+inline bool
+NoBounds::inside(const Amg::Vector2D&, double, double) const
+{
+  return true;
+}
+
+inline bool
+NoBounds::inside(const Amg::Vector2D&, const BoundaryCheck&) const
+{
+  return true;
+}
+
+inline bool
+NoBounds::insideLoc1(const Amg::Vector2D&, double) const
+{
+  return true;
+}
+
+inline bool
+NoBounds::insideLoc2(const Amg::Vector2D&, double) const
+{
+  return true;
+}
+
+inline double
+NoBounds::minDistance(const Amg::Vector2D&) const
+{
+  return 0.;
+}
+
+inline NoBounds*
+NoBounds::clone() const
+{
+  return new NoBounds();
+}
+
+inline double
+NoBounds::r() const
+{
+  return 0.;
+}
+
+inline MsgStream&
+NoBounds::dump(MsgStream& sl) const
+{
+  sl << "Trk::NoBounds ... boundless surface" << endmsg;
+  return sl;
+}
+
+inline std::ostream&
+NoBounds::dump(std::ostream& sl) const
+{
+  sl << "Trk::NoBounds ... boundless surface" << std::endl;
+  return sl;
+}
+
+} // end of namespace
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RectangleBounds.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RectangleBounds.h
index 2165659c860c1adca4815e1f55d8e4a44abac0bc..3d13b6bd2c982a65c7d11bdcc2d9bec79d85b904 100644
--- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RectangleBounds.h
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RectangleBounds.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -34,7 +34,7 @@ namespace Trk {
 
  @author Andreas.Salzburger@cern.ch */
 
-class RectangleBounds : public SurfaceBounds
+class RectangleBounds final : public SurfaceBounds
 {
 
 public:
@@ -62,7 +62,7 @@ public:
   RectangleBounds& operator=(const RectangleBounds& recbo);
 
   /**Equality operator*/
-  virtual bool operator==(const SurfaceBounds& sbo) const override;
+  virtual bool operator==(const SurfaceBounds& sbo) const override final;
 
   /**Virtual constructor*/
   virtual RectangleBounds* clone() const override;
@@ -113,109 +113,6 @@ private:
   std::vector<TDD_real_t> m_boundValues;
 };
 
-inline RectangleBounds*
-RectangleBounds::clone() const
-{
-  return new RectangleBounds(*this);
-}
-
-inline bool
-RectangleBounds::inside(const Amg::Vector2D& locpo, double tol1, double tol2) const
-{
-  return ((fabs(locpo[locX]) < m_boundValues[RectangleBounds::bv_halfX] + tol1) &&
-          (fabs(locpo[locY]) < m_boundValues[RectangleBounds::bv_halfY] + tol2));
-}
-
-inline bool
-RectangleBounds::inside(const Amg::Vector2D& locpo, const BoundaryCheck& bchk) const
-{
-  if (bchk.bcType == 0)
-    return RectangleBounds::inside(locpo, bchk.toleranceLoc1, bchk.toleranceLoc2);
-
-  // a fast FALSE
-  double max_ell = bchk.lCovariance(0, 0) > bchk.lCovariance(1, 1) ? bchk.lCovariance(0, 0) : bchk.lCovariance(1, 1);
-  double limit = bchk.nSigmas * sqrt(max_ell);
-  if (!RectangleBounds::inside(locpo, limit, limit))
-    return false;
-  // a fast TRUE
-  double min_ell = bchk.lCovariance(0, 0) < bchk.lCovariance(1, 1) ? bchk.lCovariance(0, 0) : bchk.lCovariance(1, 1);
-  limit = bchk.nSigmas * sqrt(min_ell);
-  if (RectangleBounds::inside(locpo, limit, limit))
-    return true;
-
-  // compute KDOP and axes for surface polygon
-  std::vector<KDOP> elementKDOP(4);
-  std::vector<Amg::Vector2D> elementP(4);
-  float theta = (bchk.lCovariance(1, 0) != 0 && (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)) != 0)
-                  ? .5 * bchk.FastArcTan(2 * bchk.lCovariance(1, 0) / (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)))
-                  : 0.;
-  sincosCache scResult = bchk.FastSinCos(theta);
-  AmgMatrix(2, 2) rotMatrix;
-  rotMatrix << scResult.cosC, scResult.sinC, -scResult.sinC, scResult.cosC;
-  // ellipse is always at (0,0), surface is moved to ellipse position and then rotated
-  Amg::Vector2D p;
-  p << m_boundValues[RectangleBounds::bv_halfX], m_boundValues[RectangleBounds::bv_halfY];
-  elementP[0] = (rotMatrix * (p - locpo));
-  p << m_boundValues[RectangleBounds::bv_halfX], -m_boundValues[RectangleBounds::bv_halfY];
-  elementP[1] = (rotMatrix * (p - locpo));
-  p << -m_boundValues[RectangleBounds::bv_halfX], m_boundValues[RectangleBounds::bv_halfY];
-  elementP[2] = (rotMatrix * (p - locpo));
-  p << -m_boundValues[RectangleBounds::bv_halfX], -m_boundValues[RectangleBounds::bv_halfY];
-  elementP[3] = (rotMatrix * (p - locpo));
-  std::vector<Amg::Vector2D> axis = {
-    elementP[0] - elementP[1], elementP[0] - elementP[2], elementP[0] - elementP[3], elementP[1] - elementP[2]
-  };
-  bchk.ComputeKDOP(elementP, axis, elementKDOP);
-  // compute KDOP for error ellipse
-  std::vector<KDOP> errelipseKDOP(4);
-  bchk.ComputeKDOP(bchk.EllipseToPoly(3), axis, errelipseKDOP);
-  // check if KDOPs overlap and return result
-  return bchk.TestKDOPKDOP(elementKDOP, errelipseKDOP);
-}
-
-inline bool
-RectangleBounds::insideLoc1(const Amg::Vector2D& locpo, double tol1) const
-{
-  return (fabs(locpo[locX]) < m_boundValues[RectangleBounds::bv_halfX] + tol1);
-}
-
-inline bool
-RectangleBounds::insideLoc2(const Amg::Vector2D& locpo, double tol2) const
-{
-  return (fabs(locpo[locY]) < m_boundValues[RectangleBounds::bv_halfY] + tol2);
-}
-
-inline double
-RectangleBounds::halflengthPhi() const
-{
-  return this->halflengthX();
-}
-
-inline double
-RectangleBounds::halflengthEta() const
-{
-  return this->halflengthY();
-}
-
-inline double
-RectangleBounds::halflengthX() const
-{
-  return m_boundValues[RectangleBounds::bv_halfX];
-}
-
-inline double
-RectangleBounds::halflengthY() const
-{
-  return m_boundValues[RectangleBounds::bv_halfY];
-}
-
-inline double
-RectangleBounds::r() const
-{
-  return sqrt(m_boundValues[RectangleBounds::bv_halfX] * m_boundValues[RectangleBounds::bv_halfX] +
-              m_boundValues[RectangleBounds::bv_halfY] * m_boundValues[RectangleBounds::bv_halfY]);
-}
-
 } // end of namespace
-
+#include "TrkSurfaces/RectangleBounds.icc"
 #endif // TRKSURFACES_RECTANGLEBOUNDS_H
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RectangleBounds.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RectangleBounds.icc
new file mode 100644
index 0000000000000000000000000000000000000000..37e8827c59d8b9a4b6d0cea98a231749aab0ff34
--- /dev/null
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RectangleBounds.icc
@@ -0,0 +1,130 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+namespace Trk {
+inline RectangleBounds*
+RectangleBounds::clone() const
+{
+  return new RectangleBounds(*this);
+}
+
+inline bool
+RectangleBounds::inside(const Amg::Vector2D& locpo,
+                        double tol1,
+                        double tol2) const
+{
+  return (
+    (fabs(locpo[locX]) < m_boundValues[RectangleBounds::bv_halfX] + tol1) &&
+    (fabs(locpo[locY]) < m_boundValues[RectangleBounds::bv_halfY] + tol2));
+}
+
+inline bool
+RectangleBounds::inside(const Amg::Vector2D& locpo,
+                        const BoundaryCheck& bchk) const
+{
+  if (bchk.bcType == 0)
+    return RectangleBounds::inside(
+      locpo, bchk.toleranceLoc1, bchk.toleranceLoc2);
+
+  // a fast FALSE
+  double max_ell = bchk.lCovariance(0, 0) > bchk.lCovariance(1, 1)
+                     ? bchk.lCovariance(0, 0)
+                     : bchk.lCovariance(1, 1);
+  double limit = bchk.nSigmas * sqrt(max_ell);
+  if (!RectangleBounds::inside(locpo, limit, limit))
+    return false;
+  // a fast TRUE
+  double min_ell = bchk.lCovariance(0, 0) < bchk.lCovariance(1, 1)
+                     ? bchk.lCovariance(0, 0)
+                     : bchk.lCovariance(1, 1);
+  limit = bchk.nSigmas * sqrt(min_ell);
+  if (RectangleBounds::inside(locpo, limit, limit))
+    return true;
+
+  // compute KDOP and axes for surface polygon
+  std::vector<KDOP> elementKDOP(4);
+  std::vector<Amg::Vector2D> elementP(4);
+  float theta =
+    (bchk.lCovariance(1, 0) != 0 &&
+     (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)) != 0)
+      ? .5 * bchk.FastArcTan(2 * bchk.lCovariance(1, 0) /
+                             (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)))
+      : 0.;
+  sincosCache scResult = bchk.FastSinCos(theta);
+  AmgMatrix(2, 2) rotMatrix;
+  rotMatrix << scResult.cosC, scResult.sinC, -scResult.sinC, scResult.cosC;
+  // ellipse is always at (0,0), surface is moved to ellipse position and then
+  // rotated
+  Amg::Vector2D p;
+  p << m_boundValues[RectangleBounds::bv_halfX],
+    m_boundValues[RectangleBounds::bv_halfY];
+  elementP[0] = (rotMatrix * (p - locpo));
+  p << m_boundValues[RectangleBounds::bv_halfX],
+    -m_boundValues[RectangleBounds::bv_halfY];
+  elementP[1] = (rotMatrix * (p - locpo));
+  p << -m_boundValues[RectangleBounds::bv_halfX],
+    m_boundValues[RectangleBounds::bv_halfY];
+  elementP[2] = (rotMatrix * (p - locpo));
+  p << -m_boundValues[RectangleBounds::bv_halfX],
+    -m_boundValues[RectangleBounds::bv_halfY];
+  elementP[3] = (rotMatrix * (p - locpo));
+  std::vector<Amg::Vector2D> axis = { elementP[0] - elementP[1],
+                                      elementP[0] - elementP[2],
+                                      elementP[0] - elementP[3],
+                                      elementP[1] - elementP[2] };
+  bchk.ComputeKDOP(elementP, axis, elementKDOP);
+  // compute KDOP for error ellipse
+  std::vector<KDOP> errelipseKDOP(4);
+  bchk.ComputeKDOP(bchk.EllipseToPoly(3), axis, errelipseKDOP);
+  // check if KDOPs overlap and return result
+  return bchk.TestKDOPKDOP(elementKDOP, errelipseKDOP);
+}
+
+inline bool
+RectangleBounds::insideLoc1(const Amg::Vector2D& locpo, double tol1) const
+{
+  return (fabs(locpo[locX]) < m_boundValues[RectangleBounds::bv_halfX] + tol1);
+}
+
+inline bool
+RectangleBounds::insideLoc2(const Amg::Vector2D& locpo, double tol2) const
+{
+  return (fabs(locpo[locY]) < m_boundValues[RectangleBounds::bv_halfY] + tol2);
+}
+
+inline double
+RectangleBounds::halflengthPhi() const
+{
+  return this->halflengthX();
+}
+
+inline double
+RectangleBounds::halflengthEta() const
+{
+  return this->halflengthY();
+}
+
+inline double
+RectangleBounds::halflengthX() const
+{
+  return m_boundValues[RectangleBounds::bv_halfX];
+}
+
+inline double
+RectangleBounds::halflengthY() const
+{
+  return m_boundValues[RectangleBounds::bv_halfY];
+}
+
+inline double
+RectangleBounds::r() const
+{
+  return sqrt(m_boundValues[RectangleBounds::bv_halfX] *
+                m_boundValues[RectangleBounds::bv_halfX] +
+              m_boundValues[RectangleBounds::bv_halfY] *
+                m_boundValues[RectangleBounds::bv_halfY]);
+}
+
+} // end of namespace
+
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RotatedDiamondBounds.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RotatedDiamondBounds.h
index 9db6926a50647f0d3dc886e8f1a5c58da771b492..6956160a5a520f8ce15be3744792b81760e3a879 100644
--- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RotatedDiamondBounds.h
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RotatedDiamondBounds.h
@@ -38,7 +38,7 @@ in the constructor.)
 Michiel.Jan.Veen@cern.ch
 */
 
-class RotatedDiamondBounds : public SurfaceBounds
+class RotatedDiamondBounds final: public SurfaceBounds
 {
 
 public:
@@ -141,142 +141,7 @@ private:
   TDD_real_t m_alpha2;
 };
 
-inline RotatedDiamondBounds*
-RotatedDiamondBounds::clone() const
-{
-  return new RotatedDiamondBounds(*this);
-}
-
-inline double
-RotatedDiamondBounds::minHalflengthX() const
-{
-  return m_boundValues[RotatedDiamondBounds::bv_minHalfX];
-}
-
-inline double
-RotatedDiamondBounds::medHalflengthX() const
-{
-  return m_boundValues[RotatedDiamondBounds::bv_medHalfX];
-}
-
-inline double
-RotatedDiamondBounds::maxHalflengthX() const
-{
-  return m_boundValues[RotatedDiamondBounds::bv_maxHalfX];
-}
-
-inline double
-RotatedDiamondBounds::halflengthY1() const
-{
-  return m_boundValues[RotatedDiamondBounds::bv_halfY1];
-}
-
-inline double
-RotatedDiamondBounds::halflengthY2() const
-{
-  return m_boundValues[RotatedDiamondBounds::bv_halfY2];
-}
-
-inline double
-RotatedDiamondBounds::r() const
-{
-  return sqrt(m_boundValues[RotatedDiamondBounds::bv_medHalfX] * m_boundValues[RotatedDiamondBounds::bv_medHalfX] +
-              m_boundValues[RotatedDiamondBounds::bv_halfY1] * m_boundValues[RotatedDiamondBounds::bv_halfY1]);
-}
-
-inline bool
-RotatedDiamondBounds::inside(const Amg::Vector2D& locpo, const BoundaryCheck& bchk) const
-{
-  // locX and locY are interchanged wrt DiamondBounds
-  if (bchk.bcType == 0)
-    return RotatedDiamondBounds::inside(locpo, bchk.toleranceLoc1, bchk.toleranceLoc2);
-  // a fast FALSE
-  double max_ell = bchk.lCovariance(0, 0) > bchk.lCovariance(1, 1) ? bchk.lCovariance(0, 0) : bchk.lCovariance(1, 1);
-  double limit = bchk.nSigmas * sqrt(max_ell);
-  if (locpo[Trk::locX] < -2 * m_boundValues[RotatedDiamondBounds::bv_halfY1] - limit)
-    return false;
-  if (locpo[Trk::locX] > 2 * m_boundValues[RotatedDiamondBounds::bv_halfY2] + limit)
-    return false;
-  // a fast FALSE
-  double fabsX = fabs(locpo[Trk::locY]);
-  if (fabsX > (m_boundValues[RotatedDiamondBounds::bv_medHalfX] + limit))
-    return false;
-  // a fast TRUE
-  double min_ell = bchk.lCovariance(0, 0) < bchk.lCovariance(1, 1) ? bchk.lCovariance(0, 0) : bchk.lCovariance(1, 1);
-  limit = bchk.nSigmas * sqrt(min_ell);
-  if (fabsX <
-      (fmin(m_boundValues[RotatedDiamondBounds::bv_minHalfX], m_boundValues[RotatedDiamondBounds::bv_maxHalfX]) -
-       limit))
-    return true;
-  // a fast TRUE
-  if (fabs(locpo[Trk::locX]) <
-      (fmin(m_boundValues[RotatedDiamondBounds::bv_halfY1], m_boundValues[RotatedDiamondBounds::bv_halfY2]) - limit))
-    return true;
-
-  // compute KDOP and axes for surface polygon
-  std::vector<KDOP> elementKDOP(5);
-  std::vector<Amg::Vector2D> elementP(6);
-  float theta = (bchk.lCovariance(1, 0) != 0 && (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)) != 0)
-                  ? .5 * bchk.FastArcTan(2 * bchk.lCovariance(1, 0) / (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)))
-                  : 0.;
-  sincosCache scResult = bchk.FastSinCos(theta);
-  AmgMatrix(2, 2) rotMatrix;
-  rotMatrix << scResult.cosC, scResult.sinC, -scResult.sinC, scResult.cosC;
-  AmgMatrix(2, 2) normal;
-  normal << 0, -1, 1, 0;
-  // ellipse is always at (0,0), surface is moved to ellipse position and then rotated
-  // exchange locX and locY
-  Amg::Vector2D locpoF;
-  locpoF[0] = locpo[Trk::locY];
-  locpoF[1] = locpo[Trk::locX];
-  Amg::Vector2D p;
-  p << -m_boundValues[RotatedDiamondBounds::bv_minHalfX], -2. * m_boundValues[RotatedDiamondBounds::bv_halfY1];
-  elementP[0] = (rotMatrix * (p - locpoF));
-  p << -m_boundValues[RotatedDiamondBounds::bv_medHalfX], 0.;
-  elementP[1] = (rotMatrix * (p - locpoF));
-  p << -m_boundValues[RotatedDiamondBounds::bv_maxHalfX], 2. * m_boundValues[RotatedDiamondBounds::bv_halfY2];
-  elementP[2] = (rotMatrix * (p - locpoF));
-  p << m_boundValues[RotatedDiamondBounds::bv_maxHalfX], 2. * m_boundValues[RotatedDiamondBounds::bv_halfY2];
-  elementP[3] = (rotMatrix * (p - locpoF));
-  p << m_boundValues[RotatedDiamondBounds::bv_medHalfX], 0.;
-  elementP[4] = (rotMatrix * (p - locpoF));
-  p << m_boundValues[RotatedDiamondBounds::bv_minHalfX], -2. * m_boundValues[RotatedDiamondBounds::bv_halfY1];
-  elementP[5] = (rotMatrix * (p - locpoF));
-  std::vector<Amg::Vector2D> axis = { normal * (elementP[1] - elementP[0]),
-                                      normal * (elementP[2] - elementP[1]),
-                                      normal * (elementP[3] - elementP[2]),
-                                      normal * (elementP[4] - elementP[3]),
-                                      normal * (elementP[5] - elementP[4]) };
-  bchk.ComputeKDOP(elementP, axis, elementKDOP);
-  // compute KDOP for error ellipse
-  std::vector<KDOP> errelipseKDOP(5);
-  bchk.ComputeKDOP(bchk.EllipseToPoly(3), axis, errelipseKDOP);
-  // check if KDOPs overlap and return result
-  return bchk.TestKDOPKDOP(elementKDOP, errelipseKDOP);
-}
-
-inline bool
-RotatedDiamondBounds::insideLoc1(const Amg::Vector2D& locpo, double tol1) const
-{
-  return (fabs(locpo[locY]) < m_boundValues[RotatedDiamondBounds::bv_medHalfX] + tol1);
-}
-
-inline bool
-RotatedDiamondBounds::insideLoc2(const Amg::Vector2D& locpo, double tol2) const
-{
-  return ((locpo[locX] > -2. * m_boundValues[RotatedDiamondBounds::bv_halfY1] - tol2) &&
-          (locpo[locY] < 2. * m_boundValues[RotatedDiamondBounds::bv_halfY2] + tol2));
-}
-
-inline void
-RotatedDiamondBounds::initCache()
-{
-  m_alpha1 = atan2(m_boundValues[RotatedDiamondBounds::bv_medHalfX] - m_boundValues[RotatedDiamondBounds::bv_minHalfX],
-                   2. * m_boundValues[RotatedDiamondBounds::bv_halfY1]);
-  m_alpha2 = atan2(m_boundValues[RotatedDiamondBounds::bv_medHalfX] - m_boundValues[RotatedDiamondBounds::bv_maxHalfX],
-                   2. * m_boundValues[RotatedDiamondBounds::bv_halfY2]);
-}
-
 } // end of namespace
 
+#include "TrkSurfaces/RotatedDiamondBounds.icc"
 #endif // TRKSURFACES_DIAMONDBOUNDS_H
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RotatedDiamondBounds.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RotatedDiamondBounds.icc
new file mode 100644
index 0000000000000000000000000000000000000000..4352db7577d9066a4e504adb08d710fb13a3679d
--- /dev/null
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RotatedDiamondBounds.icc
@@ -0,0 +1,163 @@
+namespace Trk {
+
+inline RotatedDiamondBounds*
+RotatedDiamondBounds::clone() const
+{
+  return new RotatedDiamondBounds(*this);
+}
+
+inline double
+RotatedDiamondBounds::minHalflengthX() const
+{
+  return m_boundValues[RotatedDiamondBounds::bv_minHalfX];
+}
+
+inline double
+RotatedDiamondBounds::medHalflengthX() const
+{
+  return m_boundValues[RotatedDiamondBounds::bv_medHalfX];
+}
+
+inline double
+RotatedDiamondBounds::maxHalflengthX() const
+{
+  return m_boundValues[RotatedDiamondBounds::bv_maxHalfX];
+}
+
+inline double
+RotatedDiamondBounds::halflengthY1() const
+{
+  return m_boundValues[RotatedDiamondBounds::bv_halfY1];
+}
+
+inline double
+RotatedDiamondBounds::halflengthY2() const
+{
+  return m_boundValues[RotatedDiamondBounds::bv_halfY2];
+}
+
+inline double
+RotatedDiamondBounds::r() const
+{
+  return sqrt(m_boundValues[RotatedDiamondBounds::bv_medHalfX] *
+                m_boundValues[RotatedDiamondBounds::bv_medHalfX] +
+              m_boundValues[RotatedDiamondBounds::bv_halfY1] *
+                m_boundValues[RotatedDiamondBounds::bv_halfY1]);
+}
+
+inline bool
+RotatedDiamondBounds::inside(const Amg::Vector2D& locpo,
+                             const BoundaryCheck& bchk) const
+{
+  // locX and locY are interchanged wrt DiamondBounds
+  if (bchk.bcType == 0)
+    return RotatedDiamondBounds::inside(
+      locpo, bchk.toleranceLoc1, bchk.toleranceLoc2);
+  // a fast FALSE
+  double max_ell = bchk.lCovariance(0, 0) > bchk.lCovariance(1, 1)
+                     ? bchk.lCovariance(0, 0)
+                     : bchk.lCovariance(1, 1);
+  double limit = bchk.nSigmas * sqrt(max_ell);
+  if (locpo[Trk::locX] <
+      -2 * m_boundValues[RotatedDiamondBounds::bv_halfY1] - limit)
+    return false;
+  if (locpo[Trk::locX] >
+      2 * m_boundValues[RotatedDiamondBounds::bv_halfY2] + limit)
+    return false;
+  // a fast FALSE
+  double fabsX = fabs(locpo[Trk::locY]);
+  if (fabsX > (m_boundValues[RotatedDiamondBounds::bv_medHalfX] + limit))
+    return false;
+  // a fast TRUE
+  double min_ell = bchk.lCovariance(0, 0) < bchk.lCovariance(1, 1)
+                     ? bchk.lCovariance(0, 0)
+                     : bchk.lCovariance(1, 1);
+  limit = bchk.nSigmas * sqrt(min_ell);
+  if (fabsX < (fmin(m_boundValues[RotatedDiamondBounds::bv_minHalfX],
+                    m_boundValues[RotatedDiamondBounds::bv_maxHalfX]) -
+               limit))
+    return true;
+  // a fast TRUE
+  if (fabs(locpo[Trk::locX]) <
+      (fmin(m_boundValues[RotatedDiamondBounds::bv_halfY1],
+            m_boundValues[RotatedDiamondBounds::bv_halfY2]) -
+       limit))
+    return true;
+
+  // compute KDOP and axes for surface polygon
+  std::vector<KDOP> elementKDOP(5);
+  std::vector<Amg::Vector2D> elementP(6);
+  float theta =
+    (bchk.lCovariance(1, 0) != 0 &&
+     (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)) != 0)
+      ? .5 * bchk.FastArcTan(2 * bchk.lCovariance(1, 0) /
+                             (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)))
+      : 0.;
+  sincosCache scResult = bchk.FastSinCos(theta);
+  AmgMatrix(2, 2) rotMatrix;
+  rotMatrix << scResult.cosC, scResult.sinC, -scResult.sinC, scResult.cosC;
+  AmgMatrix(2, 2) normal;
+  normal << 0, -1, 1, 0;
+  // ellipse is always at (0,0), surface is moved to ellipse position and then
+  // rotated exchange locX and locY
+  Amg::Vector2D locpoF;
+  locpoF[0] = locpo[Trk::locY];
+  locpoF[1] = locpo[Trk::locX];
+  Amg::Vector2D p;
+  p << -m_boundValues[RotatedDiamondBounds::bv_minHalfX],
+    -2. * m_boundValues[RotatedDiamondBounds::bv_halfY1];
+  elementP[0] = (rotMatrix * (p - locpoF));
+  p << -m_boundValues[RotatedDiamondBounds::bv_medHalfX], 0.;
+  elementP[1] = (rotMatrix * (p - locpoF));
+  p << -m_boundValues[RotatedDiamondBounds::bv_maxHalfX],
+    2. * m_boundValues[RotatedDiamondBounds::bv_halfY2];
+  elementP[2] = (rotMatrix * (p - locpoF));
+  p << m_boundValues[RotatedDiamondBounds::bv_maxHalfX],
+    2. * m_boundValues[RotatedDiamondBounds::bv_halfY2];
+  elementP[3] = (rotMatrix * (p - locpoF));
+  p << m_boundValues[RotatedDiamondBounds::bv_medHalfX], 0.;
+  elementP[4] = (rotMatrix * (p - locpoF));
+  p << m_boundValues[RotatedDiamondBounds::bv_minHalfX],
+    -2. * m_boundValues[RotatedDiamondBounds::bv_halfY1];
+  elementP[5] = (rotMatrix * (p - locpoF));
+  std::vector<Amg::Vector2D> axis = { normal * (elementP[1] - elementP[0]),
+                                      normal * (elementP[2] - elementP[1]),
+                                      normal * (elementP[3] - elementP[2]),
+                                      normal * (elementP[4] - elementP[3]),
+                                      normal * (elementP[5] - elementP[4]) };
+  bchk.ComputeKDOP(elementP, axis, elementKDOP);
+  // compute KDOP for error ellipse
+  std::vector<KDOP> errelipseKDOP(5);
+  bchk.ComputeKDOP(bchk.EllipseToPoly(3), axis, errelipseKDOP);
+  // check if KDOPs overlap and return result
+  return bchk.TestKDOPKDOP(elementKDOP, errelipseKDOP);
+}
+
+inline bool
+RotatedDiamondBounds::insideLoc1(const Amg::Vector2D& locpo, double tol1) const
+{
+  return (fabs(locpo[locY]) <
+          m_boundValues[RotatedDiamondBounds::bv_medHalfX] + tol1);
+}
+
+inline bool
+RotatedDiamondBounds::insideLoc2(const Amg::Vector2D& locpo, double tol2) const
+{
+  return (
+    (locpo[locX] >
+     -2. * m_boundValues[RotatedDiamondBounds::bv_halfY1] - tol2) &&
+    (locpo[locY] < 2. * m_boundValues[RotatedDiamondBounds::bv_halfY2] + tol2));
+}
+
+inline void
+RotatedDiamondBounds::initCache()
+{
+  m_alpha1 = atan2(m_boundValues[RotatedDiamondBounds::bv_medHalfX] -
+                     m_boundValues[RotatedDiamondBounds::bv_minHalfX],
+                   2. * m_boundValues[RotatedDiamondBounds::bv_halfY1]);
+  m_alpha2 = atan2(m_boundValues[RotatedDiamondBounds::bv_medHalfX] -
+                     m_boundValues[RotatedDiamondBounds::bv_maxHalfX],
+                   2. * m_boundValues[RotatedDiamondBounds::bv_halfY2]);
+}
+
+} // end of namespace
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RotatedTrapezoidBounds.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RotatedTrapezoidBounds.h
index 76bba568e297e6825ac7b8cc882d9a665f62348e..0b91054b395a5f0daaac3ce96ff4c72cd9cf66f9 100644
--- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RotatedTrapezoidBounds.h
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RotatedTrapezoidBounds.h
@@ -41,7 +41,7 @@ namespace Trk {
  @author Andreas.Salzburger@cern.ch
  */
 
-class RotatedTrapezoidBounds : public SurfaceBounds
+class RotatedTrapezoidBounds final: public SurfaceBounds
 {
 
 public:
@@ -153,114 +153,7 @@ private:
   TDD_real_t m_kappa;
   TDD_real_t m_delta;
 };
-
-inline RotatedTrapezoidBounds*
-RotatedTrapezoidBounds::clone() const
-{
-  return new RotatedTrapezoidBounds(*this);
-}
-
-inline void
-RotatedTrapezoidBounds::initCache()
-{
-  m_kappa = 0.5 *
-            (m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY] - m_boundValues[RotatedTrapezoidBounds::bv_minHalfY]) /
-            m_boundValues[RotatedTrapezoidBounds::bv_halfX];
-  m_delta =
-    0.5 * (m_boundValues[RotatedTrapezoidBounds::bv_minHalfY] + m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY]);
-}
-
-inline double
-RotatedTrapezoidBounds::halflengthX() const
-{
-  return m_boundValues[RotatedTrapezoidBounds::bv_halfX];
-}
-
-inline double
-RotatedTrapezoidBounds::minHalflengthY() const
-{
-  return m_boundValues[RotatedTrapezoidBounds::bv_minHalfY];
-}
-
-inline double
-RotatedTrapezoidBounds::maxHalflengthY() const
-{
-  return m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY];
-}
-
-inline double
-RotatedTrapezoidBounds::r() const
-{
-  return sqrt(m_boundValues[RotatedTrapezoidBounds::bv_halfX] * m_boundValues[RotatedTrapezoidBounds::bv_halfX] +
-              m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY] * m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY]);
-}
-
-inline bool
-RotatedTrapezoidBounds::inside(const Amg::Vector2D& locpo, const BoundaryCheck& bchk) const
-{
-  if (bchk.bcType == 0)
-    return RotatedTrapezoidBounds::inside(locpo, bchk.toleranceLoc1, bchk.toleranceLoc2);
-
-  // a fast FALSE
-  double fabsX = fabs(locpo[Trk::locX]);
-  double max_ell = bchk.lCovariance(0, 0) > bchk.lCovariance(1, 1) ? bchk.lCovariance(0, 0) : bchk.lCovariance(1, 1);
-  double limit = bchk.nSigmas * sqrt(max_ell);
-  if (fabsX > (m_boundValues[RotatedTrapezoidBounds::bv_halfX] + limit))
-    return false;
-  // a fast FALSE
-  double fabsY = fabs(locpo[Trk::locY]);
-  if (fabsY > (m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY] + limit))
-    return false;
-  // a fast TRUE
-  double min_ell = bchk.lCovariance(0, 0) < bchk.lCovariance(1, 1) ? bchk.lCovariance(0, 0) : bchk.lCovariance(1, 1);
-  limit = bchk.nSigmas * sqrt(min_ell);
-  if (fabsY < (m_boundValues[RotatedTrapezoidBounds::bv_minHalfY] + limit) &&
-      fabsX < (m_boundValues[RotatedTrapezoidBounds::bv_halfX] + limit))
-    return true;
-
-  // compute KDOP and axes for surface polygon
-  std::vector<KDOP> elementKDOP(3);
-  std::vector<Amg::Vector2D> elementP(4);
-  float theta = (bchk.lCovariance(1, 0) != 0 && (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)) != 0)
-                  ? .5 * bchk.FastArcTan(2 * bchk.lCovariance(1, 0) / (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)))
-                  : 0.;
-  sincosCache scResult = bchk.FastSinCos(theta);
-  AmgMatrix(2, 2) rotMatrix;
-  rotMatrix << scResult.cosC, scResult.sinC, -scResult.sinC, scResult.cosC;
-  AmgMatrix(2, 2) normal;
-  normal << 0, -1, 1, 0;
-  // ellipse is always at (0,0), surface is moved to ellipse position and then rotated
-  Amg::Vector2D p;
-  p << -m_boundValues[RotatedTrapezoidBounds::bv_halfX], m_boundValues[RotatedTrapezoidBounds::bv_minHalfY];
-  elementP[0] = (rotMatrix * (p - locpo));
-  p << -m_boundValues[RotatedTrapezoidBounds::bv_halfX], -m_boundValues[RotatedTrapezoidBounds::bv_minHalfY];
-  elementP[1] = (rotMatrix * (p - locpo));
-  p << m_boundValues[RotatedTrapezoidBounds::bv_halfX], m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY];
-  elementP[2] = (rotMatrix * (p - locpo));
-  p << m_boundValues[RotatedTrapezoidBounds::bv_halfX], -m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY];
-  elementP[3] = (rotMatrix * (p - locpo));
-  std::vector<Amg::Vector2D> axis = { normal * (elementP[1] - elementP[0]),
-                                      normal * (elementP[3] - elementP[1]),
-                                      normal * (elementP[2] - elementP[0]) };
-  bchk.ComputeKDOP(elementP, axis, elementKDOP);
-  // compute KDOP for error ellipse
-  std::vector<KDOP> errelipseKDOP(3);
-  bchk.ComputeKDOP(bchk.EllipseToPoly(3), axis, errelipseKDOP);
-  // check if KDOPs overlap and return result
-  return bchk.TestKDOPKDOP(elementKDOP, errelipseKDOP);
-}
-
-inline bool
-RotatedTrapezoidBounds::insideLoc1(const Amg::Vector2D& locpo, double tol1) const
-{
-  return (fabs(locpo[locX]) < m_boundValues[RotatedTrapezoidBounds::bv_halfX] + tol1);
-}
-
-inline bool
-RotatedTrapezoidBounds::insideLoc2(const Amg::Vector2D& locpo, double tol2) const
-{
-  return (fabs(locpo[locY]) < m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY] + tol2);
-}
 } // end of namespace
 
+#include "TrkSurfaces/RotatedTrapezoidBounds.icc"
 #endif // TRKSURFACES_TRAPEZOIDBOUNDS_H
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RotatedTrapezoidBounds.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RotatedTrapezoidBounds.icc
new file mode 100644
index 0000000000000000000000000000000000000000..5ad28fa833b8ff3a8d925565526c2d388b44e58b
--- /dev/null
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/RotatedTrapezoidBounds.icc
@@ -0,0 +1,135 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+namespace Trk {
+inline RotatedTrapezoidBounds*
+RotatedTrapezoidBounds::clone() const
+{
+  return new RotatedTrapezoidBounds(*this);
+}
+
+inline void
+RotatedTrapezoidBounds::initCache()
+{
+  m_kappa = 0.5 *
+            (m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY] -
+             m_boundValues[RotatedTrapezoidBounds::bv_minHalfY]) /
+            m_boundValues[RotatedTrapezoidBounds::bv_halfX];
+  m_delta = 0.5 * (m_boundValues[RotatedTrapezoidBounds::bv_minHalfY] +
+                   m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY]);
+}
+
+inline double
+RotatedTrapezoidBounds::halflengthX() const
+{
+  return m_boundValues[RotatedTrapezoidBounds::bv_halfX];
+}
+
+inline double
+RotatedTrapezoidBounds::minHalflengthY() const
+{
+  return m_boundValues[RotatedTrapezoidBounds::bv_minHalfY];
+}
+
+inline double
+RotatedTrapezoidBounds::maxHalflengthY() const
+{
+  return m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY];
+}
+
+inline double
+RotatedTrapezoidBounds::r() const
+{
+  return sqrt(m_boundValues[RotatedTrapezoidBounds::bv_halfX] *
+                m_boundValues[RotatedTrapezoidBounds::bv_halfX] +
+              m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY] *
+                m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY]);
+}
+
+inline bool
+RotatedTrapezoidBounds::inside(const Amg::Vector2D& locpo,
+                               const BoundaryCheck& bchk) const
+{
+  if (bchk.bcType == 0)
+    return RotatedTrapezoidBounds::inside(
+      locpo, bchk.toleranceLoc1, bchk.toleranceLoc2);
+
+  // a fast FALSE
+  double fabsX = fabs(locpo[Trk::locX]);
+  double max_ell = bchk.lCovariance(0, 0) > bchk.lCovariance(1, 1)
+                     ? bchk.lCovariance(0, 0)
+                     : bchk.lCovariance(1, 1);
+  double limit = bchk.nSigmas * sqrt(max_ell);
+  if (fabsX > (m_boundValues[RotatedTrapezoidBounds::bv_halfX] + limit))
+    return false;
+  // a fast FALSE
+  double fabsY = fabs(locpo[Trk::locY]);
+  if (fabsY > (m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY] + limit))
+    return false;
+  // a fast TRUE
+  double min_ell = bchk.lCovariance(0, 0) < bchk.lCovariance(1, 1)
+                     ? bchk.lCovariance(0, 0)
+                     : bchk.lCovariance(1, 1);
+  limit = bchk.nSigmas * sqrt(min_ell);
+  if (fabsY < (m_boundValues[RotatedTrapezoidBounds::bv_minHalfY] + limit) &&
+      fabsX < (m_boundValues[RotatedTrapezoidBounds::bv_halfX] + limit))
+    return true;
+
+  // compute KDOP and axes for surface polygon
+  std::vector<KDOP> elementKDOP(3);
+  std::vector<Amg::Vector2D> elementP(4);
+  float theta =
+    (bchk.lCovariance(1, 0) != 0 &&
+     (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)) != 0)
+      ? .5 * bchk.FastArcTan(2 * bchk.lCovariance(1, 0) /
+                             (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)))
+      : 0.;
+  sincosCache scResult = bchk.FastSinCos(theta);
+  AmgMatrix(2, 2) rotMatrix;
+  rotMatrix << scResult.cosC, scResult.sinC, -scResult.sinC, scResult.cosC;
+  AmgMatrix(2, 2) normal;
+  normal << 0, -1, 1, 0;
+  // ellipse is always at (0,0), surface is moved to ellipse position and then
+  // rotated
+  Amg::Vector2D p;
+  p << -m_boundValues[RotatedTrapezoidBounds::bv_halfX],
+    m_boundValues[RotatedTrapezoidBounds::bv_minHalfY];
+  elementP[0] = (rotMatrix * (p - locpo));
+  p << -m_boundValues[RotatedTrapezoidBounds::bv_halfX],
+    -m_boundValues[RotatedTrapezoidBounds::bv_minHalfY];
+  elementP[1] = (rotMatrix * (p - locpo));
+  p << m_boundValues[RotatedTrapezoidBounds::bv_halfX],
+    m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY];
+  elementP[2] = (rotMatrix * (p - locpo));
+  p << m_boundValues[RotatedTrapezoidBounds::bv_halfX],
+    -m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY];
+  elementP[3] = (rotMatrix * (p - locpo));
+  std::vector<Amg::Vector2D> axis = { normal * (elementP[1] - elementP[0]),
+                                      normal * (elementP[3] - elementP[1]),
+                                      normal * (elementP[2] - elementP[0]) };
+  bchk.ComputeKDOP(elementP, axis, elementKDOP);
+  // compute KDOP for error ellipse
+  std::vector<KDOP> errelipseKDOP(3);
+  bchk.ComputeKDOP(bchk.EllipseToPoly(3), axis, errelipseKDOP);
+  // check if KDOPs overlap and return result
+  return bchk.TestKDOPKDOP(elementKDOP, errelipseKDOP);
+}
+
+inline bool
+RotatedTrapezoidBounds::insideLoc1(const Amg::Vector2D& locpo,
+                                   double tol1) const
+{
+  return (fabs(locpo[locX]) <
+          m_boundValues[RotatedTrapezoidBounds::bv_halfX] + tol1);
+}
+
+inline bool
+RotatedTrapezoidBounds::insideLoc2(const Amg::Vector2D& locpo,
+                                   double tol2) const
+{
+  return (fabs(locpo[locY]) <
+          m_boundValues[RotatedTrapezoidBounds::bv_maxHalfY] + tol2);
+}
+} // end of namespace
+
diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IPixelToTPIDTool.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IPixelToTPIDTool.h
index 3ff5cec8d4733faf174242d9ac1bab3fd43adfa4..3c680da4bf2a2dde193732dddde96e5661de570b 100644
--- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IPixelToTPIDTool.h
+++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IPixelToTPIDTool.h
@@ -8,6 +8,8 @@
 #ifndef TRK_IPIXELTOTPIDTOOL_H
 #define TRK_IPIXELTOTPIDTOOL_H
 
+#include "GaudiKernel/EventContext.h"
+#include "GaudiKernel/ThreadLocalContext.h"
 #include "GaudiKernel/IAlgTool.h"
 #include <vector>
 
@@ -29,11 +31,30 @@ namespace Trk {
        @param[in] track the track to be identified
        @returns   probability
      */
-    virtual float dEdx(const Trk::Track& track,
+    virtual float dEdx(const EventContext& ctx,
+                       const Trk::Track& track,
                        int& nUsedHits,
                        int& nUsedIBLOverflowHits) const = 0;
-    virtual std::vector<float> getLikelihoods(double dedx, double p, int nGoodPixels) const = 0;
-    virtual float getMass(double dedx, double p, int nGoodPixels) const = 0;
+
+    float dEdx(const Trk::Track& track,
+               int& nUsedHits,
+               int& nUsedIBLOverflowHits) const;
+
+    virtual std::vector<float> getLikelihoods(const EventContext& ctx,
+                                              double dedx,
+                                              double p,
+                                              int nGoodPixels) const = 0;
+
+    std::vector<float> getLikelihoods(double dedx,
+                                      double p,
+                                      int nGoodPixels) const;
+
+    virtual float getMass(const EventContext& ctx,
+                          double dedx,
+                          double p,
+                          int nGoodPixels) const = 0;
+
+    float getMass(double dedx, double p, int nGoodPixels) const;
   };
 
   inline const InterfaceID& Trk::IPixelToTPIDTool::interfaceID()
@@ -42,5 +63,6 @@ namespace Trk {
     }
 
 } // end of namespace
+#include "TrkToolInterfaces/IPixelToTPIDTool.icc"
 
 #endif 
diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IPixelToTPIDTool.icc b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IPixelToTPIDTool.icc
new file mode 100644
index 0000000000000000000000000000000000000000..9a85a7c6c46a5cdd780a439828682ab595ba6a0c
--- /dev/null
+++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IPixelToTPIDTool.icc
@@ -0,0 +1,28 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+namespace Trk {
+
+inline float
+IPixelToTPIDTool::dEdx(const Trk::Track& track,
+                       int& nUsedHits,
+                       int& nUsedIBLOverflowHits) const
+{
+
+  return dEdx(
+    Gaudi::Hive::currentContext(), track, nUsedHits, nUsedIBLOverflowHits);
+}
+
+inline std::vector<float>
+IPixelToTPIDTool::getLikelihoods(double dedx, double p, int nGoodPixels) const
+{
+
+  return getLikelihoods(Gaudi::Hive::currentContext(), dedx, p, nGoodPixels);
+}
+
+inline float
+IPixelToTPIDTool::getMass(double dedx, double p, int nGoodPixels) const
+{
+  return getMass(Gaudi::Hive::currentContext(), dedx, p, nGoodPixels);
+}
+}
diff --git a/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx b/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx
index 670208cdd279dd96ffbbbd783f0f912b7e0595f1..10719a22b0d06fa436c91f993534e5207d6452a1 100755
--- a/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx
+++ b/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx
@@ -198,7 +198,7 @@ Trk::TrackSummaryTool::fillSummary(const EventContext& ctx,
       };
       setTheseElements(information, atPixelIndices, toZero);
       if (track.info().trackFitter() != TrackInfo::Unknown && !m_dedxtool.empty()) {
-        dedx = m_dedxtool->dEdx(track, nHitsUsed_dEdx, nOverflowHits_dEdx);
+        dedx = m_dedxtool->dEdx(ctx,track, nHitsUsed_dEdx, nOverflowHits_dEdx);
       }
       information[Trk::numberOfDBMHits] = 0;
     }
diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/src/TruthTrackCreation.cxx b/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/src/TruthTrackCreation.cxx
index c5f3468e91aee1e8db42d62704d45b9d17d74f92..ad70752b16db18aa81ad9a4d254ac51de12a3e0c 100644
--- a/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/src/TruthTrackCreation.cxx
+++ b/Tracking/TrkTruthTracks/TrkTruthTrackAlgs/src/TruthTrackCreation.cxx
@@ -115,8 +115,8 @@ StatusCode Trk::TruthTrackCreation::execute()
     // some screen output
     ATH_MSG_VERBOSE("PRD_TruthTrajectoryBuilder delivered " << truthTraj.size() << " PRD truth trajectories, starting track creation.");
     // loop over truth trajectories and create track
-    std::map< const HepMC::GenParticle*, PRD_TruthTrajectory >::const_iterator ttIter  = truthTraj.begin();
-    std::map< const HepMC::GenParticle*, PRD_TruthTrajectory >::const_iterator ttIterE = truthTraj.end();
+    auto ttIter  = truthTraj.begin();
+    auto ttIterE = truthTraj.end();
     for ( ; ttIter != ttIterE; ++ttIter){
         // run through the selector chain
         if (m_prdTruthTrajectorySelectors.size()){
diff --git a/Tracking/TrkValidation/TrkValTools/src/JetTruthNtupleTool.cxx b/Tracking/TrkValidation/TrkValTools/src/JetTruthNtupleTool.cxx
index ea9d3bf46b14cac41e3d05006cff22f29bf84ee4..7b298f176c723816448e5e90372a7b98533f33b2 100644
--- a/Tracking/TrkValidation/TrkValTools/src/JetTruthNtupleTool.cxx
+++ b/Tracking/TrkValidation/TrkValTools/src/JetTruthNtupleTool.cxx
@@ -142,14 +142,14 @@ StatusCode Trk::JetTruthNtupleTool::writeJetTruthData (
     m_mc_jetSphericity   = itJet->getSphericity();
     m_mc_jetThrust       = itJet->getThrust();
 
-    std::vector<const HepMC::GenParticle*> particles = itJet->getParticles();
+    auto particles = itJet->getParticles();
     m_mc_trackToJetAngle->reserve(particles.size());
     m_genParticleLinkIndex->reserve(particles.size());
     std::vector<int> indices         = itJet->getIndicesInEvent();
     std::vector<int>::iterator itIdx = indices.begin();
     m_genParticleLinkIndex->clear();
     m_mc_trackToJetAngle->clear();
-    for (std::vector<const HepMC::GenParticle*>::iterator itPrt = particles.begin();
+    for (auto itPrt = particles.begin();
          itPrt < particles.end(); ++itPrt, ++itIdx) {
       
       HepGeom::Vector3D<double> tempMomentum((*itPrt)->momentum().px(),
diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/ImpactPoint3dEstimator_test.ref b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/ImpactPoint3dEstimator_test.ref
index 1f10c9c8f9880470c83d7437c43ddd68c5498b39..4f09e4c4fad29549978fe050fb4b4a42de610810 100644
--- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/ImpactPoint3dEstimator_test.ref
+++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/ImpactPoint3dEstimator_test.ref
@@ -23,7 +23,5 @@ ServiceManager      FATAL No Service factory for AtlasTrackingGeometrySvc availa
 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.AtlasMu...   INFO initialize() successful
 ClassIDSvc           INFO  getRegistryEntries: read 113 CLIDRegistry entries for module ALL
-ToolSvc.Trk::Ex...   INFO initialize() successful
 test1
diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/src/MCTrueSeedFinder.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/src/MCTrueSeedFinder.cxx
index e7371f4dc6d10933c9195d3552bd983bf7427e3e..c89f173cfde2ea7519fd38be9ded8019856ad7f2 100755
--- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/src/MCTrueSeedFinder.cxx
+++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/src/MCTrueSeedFinder.cxx
@@ -153,7 +153,11 @@ namespace Trk
       
       //get position of interaction from first non-zero vertex
       Amg::Vector3D vtxPosition;
+#ifdef HEPMC3
+      auto Vert = myEvent->vertices().begin();
+#else
       HepMC::GenEvent::vertex_const_iterator Vert = myEvent->vertices_begin();
+#endif
       msg(MSG::DEBUG) << "Retrieved position  x: " << (*Vert)->position().x()  << 
 	" y: " << (*Vert)->position().y() << 
 	" z: " << (*Vert)->position().z() << endmsg;
@@ -186,7 +190,11 @@ namespace Trk
     //we select in-time pile-up interactions and hard-scattering, if valid
 
 
+#ifdef HEPMC3
+    bool isEmpty = ( evt->particles().size() == 0 );
+#else
     bool isEmpty = ( evt->particles_size() == 0 );
+#endif
     bool isDummy = ( ( evt->event_number() == -1 ) &&
 		     ( HepMC::signal_process_id(evt) == 0 ) );
     if( isDummy ) isEmpty = false;
diff --git a/Tracking/TrkVertexFitter/TrkVertexTools/src/TruthVertexSelectionTool.cxx b/Tracking/TrkVertexFitter/TrkVertexTools/src/TruthVertexSelectionTool.cxx
index 2a87e468fce559fd5dec0a34ffa5c03d905cd50f..e8cefc9c10a509c5f7793f7f190cd921286485ae 100644
--- a/Tracking/TrkVertexFitter/TrkVertexTools/src/TruthVertexSelectionTool.cxx
+++ b/Tracking/TrkVertexFitter/TrkVertexTools/src/TruthVertexSelectionTool.cxx
@@ -55,8 +55,11 @@ namespace Trk{
 //protection   
     if(!evt) return 0;
    
+#ifdef HEPMC3
+    auto vitr = evt->vertices().begin();
+#else
     HepMC::GenEvent::vertex_const_iterator vitr = evt->vertices_begin();
-  
+#endif
 //another one  
     if(!*vitr) return 0;
   
diff --git a/Tracking/TrkVertexFitter/TrkVertexWeightCalculators/src/TrueVertexDistanceWeightCalculator.cxx b/Tracking/TrkVertexFitter/TrkVertexWeightCalculators/src/TrueVertexDistanceWeightCalculator.cxx
index 82f33e61661cc42291829b50679d9c62668d1273..6a232a5ccd8218555e6ff4efef6312ff5a2cbc97 100644
--- a/Tracking/TrkVertexFitter/TrkVertexWeightCalculators/src/TrueVertexDistanceWeightCalculator.cxx
+++ b/Tracking/TrkVertexFitter/TrkVertexWeightCalculators/src/TrueVertexDistanceWeightCalculator.cxx
@@ -60,7 +60,11 @@ TrueVertexDistanceWeightCalculator::mEstimateSignalCompatibility(
     return 0;
   }
 
+#ifdef HEPMC3
+  auto Vert = myEvent->vertices().begin();
+#else
   HepMC::GenEvent::vertex_const_iterator Vert = myEvent->vertices_begin();
+#endif
   ATH_MSG_DEBUG("Resulting MC seed:  x: " << (*Vert)->position().x()
                                           << " y: " << (*Vert)->position().y()
                                           << " z: " << (*Vert)->position().z());
diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx
index eed9ecfb69302bf228f362d9f3231b75ee211ad1..7d4a74efaee0ff69fd22308c4577c55ebb26317f 100644
--- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx
+++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx
@@ -123,7 +123,8 @@ TrigFastTrackFinder::TrigFastTrackFinder(const std::string& name, ISvcLocator* p
   declareProperty("Triplet_nMaxPhiSlice",     m_tcs.m_nMaxPhiSlice = 53);
   declareProperty("Triplet_MaxBufferLength",     m_tcs.m_maxTripletBufferLength = 3);
   declareProperty("TripletDoPSS",            m_tcs.m_tripletDoPSS = false);
-
+  declareProperty("TripletDoPPS",            m_tcs.m_tripletDoPPS = true);
+  
   declareProperty("Triplet_DtCut",            m_tcs.m_tripletDtCut      = 10.0);//i.e. 10*sigma_MS
 
   declareProperty( "VertexSeededMode",    m_vertexSeededMode = false);
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.cxx
index fd7e12adc02c4335a11ca6c2d420ca15a668dc55..99b63dcca6055267b7a5377e61a3683aa9ceeb7d 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.cxx
@@ -89,7 +89,7 @@ StatusCode TrigL2MuonSA::MuFastStationFitter::setMCFlag(BooleanProperty use_mcLU
 StatusCode TrigL2MuonSA::MuFastStationFitter::findSuperPoints(const LVL1::RecMuonRoI*    p_roi,
                                                               const TrigL2MuonSA::MuonRoad& muonRoad,
                                                               TrigL2MuonSA::RpcFitResult& rpcFitResult,
-                                                              std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns)
+                                                              std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns) const
 {
 
   //
@@ -120,7 +120,7 @@ StatusCode TrigL2MuonSA::MuFastStationFitter::findSuperPoints(const LVL1::RecMuo
 StatusCode TrigL2MuonSA::MuFastStationFitter::findSuperPointsSimple(const LVL1::RecMuonRoI*   p_roi,
 								    const TrigL2MuonSA::MuonRoad& muonRoad,
 								    TrigL2MuonSA::TgcFitResult& tgcFitResult,
-								    std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns)
+								    std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns) const
 {
 
   for (TrigL2MuonSA::TrackPattern& itTrack : v_trackPatterns) { // loop for track candidates
@@ -150,7 +150,7 @@ StatusCode TrigL2MuonSA::MuFastStationFitter::findSuperPointsSimple(const LVL1::
 StatusCode TrigL2MuonSA::MuFastStationFitter::findSuperPoints(const LVL1::RecMuonRoI*   p_roi,
                                                               const TrigL2MuonSA::MuonRoad& muonRoad,
                                                               TrigL2MuonSA::TgcFitResult& tgcFitResult,
-                                                              std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns)
+                                                              std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns) const
 {
 
   for (TrigL2MuonSA::TrackPattern& itTrack : v_trackPatterns) { // loop for track candidates
@@ -189,7 +189,7 @@ StatusCode TrigL2MuonSA::MuFastStationFitter::findSuperPoints(const LVL1::RecMuo
 
 // --------------------------------------------------------------------------------
 
-StatusCode TrigL2MuonSA::MuFastStationFitter::superPointFitter(TrigL2MuonSA::TrackPattern& trackPattern)
+StatusCode TrigL2MuonSA::MuFastStationFitter::superPointFitter(TrigL2MuonSA::TrackPattern& trackPattern) const
 {
    int   count;
    int   FitFlag;
@@ -343,7 +343,7 @@ StatusCode TrigL2MuonSA::MuFastStationFitter::superPointFitter(TrigL2MuonSA::Tra
 // --------------------------------------------------------------------------------
 //---------------------------------------------------------------------------------
 StatusCode TrigL2MuonSA::MuFastStationFitter::superPointFitter(TrigL2MuonSA::TrackPattern& trackPattern,
-                                                               const TrigL2MuonSA::MuonRoad&    muonRoad)
+                                                               const TrigL2MuonSA::MuonRoad&    muonRoad) const
 {
   const unsigned int MAX_STATION = 10;
   TrigL2MuonSA::MdtHits*    mdtSegment;
@@ -503,7 +503,7 @@ StatusCode TrigL2MuonSA::MuFastStationFitter::superPointFitter(TrigL2MuonSA::Tra
 // --------------------------------------------------------------------------------
 void TrigL2MuonSA::MuFastStationFitter::stationSPFit(TrigL2MuonSA::MdtHits*    mdtSegment, 
                                                      TrigL2MuonSA::SuperPoint* superPoint,
-                                                     TrigL2MuonSA::PBFitResult& pbFitResult,int s_address, int i_station,double aw, float phiDir){
+                                                     TrigL2MuonSA::PBFitResult& pbFitResult,int s_address, int i_station,double aw, float phiDir) const{
 
   TrigL2MuonSA::MdtHits::iterator itMdtHit;
 
@@ -1023,7 +1023,7 @@ void TrigL2MuonSA::MuFastStationFitter::stationSPFit(TrigL2MuonSA::MdtHits*    m
 // --------------------------------------------------------------------------------
 //-----------------------------------------------------------------------------------
 void TrigL2MuonSA::MuFastStationFitter::makeReferenceLine(TrigL2MuonSA::TrackPattern&   trackPattern,
-                                                          const TrigL2MuonSA::MuonRoad& muonRoad){
+                                                          const TrigL2MuonSA::MuonRoad& muonRoad)  const{
 
   TrigL2MuonSA::SuperPoint* superPoint;
   const unsigned int MAX_STATION = 8;
@@ -1170,7 +1170,7 @@ void TrigL2MuonSA::MuFastStationFitter::makeReferenceLine(TrigL2MuonSA::TrackPat
 //--------------------------------------------------------------------------------------
 
 double TrigL2MuonSA::MuFastStationFitter::fromAlphaPtToInn(TrigL2MuonSA::TgcFitResult& tgcFitResult,
-                                                           TrigL2MuonSA::TrackPattern& trackPattern)
+                                                           TrigL2MuonSA::TrackPattern& trackPattern) const
 {
 
   TrigL2MuonSA::SuperPoint* superPoint;
@@ -1253,7 +1253,7 @@ double TrigL2MuonSA::MuFastStationFitter::fromAlphaPtToInn(TrigL2MuonSA::TgcFitR
 void TrigL2MuonSA::MuFastStationFitter::updateInnSP(TrigL2MuonSA::TrackPattern& trackPattern,
                                                     double &aw,
                                                     double &tgc_aw,
-                                                    double &bw)
+                                                    double &bw) const
 {
 
   double nrWidth = m_rwidth_Endcapinn_first;
@@ -1324,7 +1324,7 @@ void TrigL2MuonSA::MuFastStationFitter::findLayerCombination(std::vector<unsigne
                                                              int n,
                                                              int r,
                                                              std::vector<std::vector<unsigned int> > &c,
-                                                             int &nr)
+                                                             int &nr) const
 {
   std::vector<unsigned int> b;
 
@@ -1345,7 +1345,7 @@ void TrigL2MuonSA::MuFastStationFitter::findSubLayerCombination(std::vector<unsi
                                                                 int index,
                                                                 int num,
                                                                 std::vector<std::vector<unsigned int> > &c,
-                                                                int &nr)
+                                                                int &nr) const
 {
   for (int i=index; i<n-num+1; i++) {
 
@@ -1372,7 +1372,8 @@ void TrigL2MuonSA::MuFastStationFitter::findSubLayerCombination(std::vector<unsi
 
 // --------------------------------------------------------------------------------
 
-float TrigL2MuonSA::MuFastStationFitter::SetDriftSpace(float tdr, float rad, float zeta, float phim, float phiDir) {
+float TrigL2MuonSA::MuFastStationFitter::SetDriftSpace(float tdr, float rad, float zeta, float phim, float phiDir) const
+{
   
   const float CSPEED = 2.99979e+10;    //     light speed (cm/s)
   const float MDT_RED = 0.7;
@@ -1410,7 +1411,8 @@ float TrigL2MuonSA::MuFastStationFitter::SetDriftSpace(float tdr, float rad, flo
 
 ==============================================================================*/
 
-int TrigL2MuonSA::MuFastStationFitter::Evlfit(int Ifla, TrigL2MuonSA::PBFitResult& pbFitResult) {
+int TrigL2MuonSA::MuFastStationFitter::Evlfit(int Ifla, TrigL2MuonSA::PBFitResult& pbFitResult) const
+{
 
   int i,j,k,Ifit,Ntry,IGcur,Jbad;
   float Xnor,rlin,Xbad,test;
@@ -1541,7 +1543,8 @@ int TrigL2MuonSA::MuFastStationFitter::Evlfit(int Ifla, TrigL2MuonSA::PBFitResul
 ==============================================================================*/
 
 void TrigL2MuonSA::MuFastStationFitter::Circles (int Nmeas,float *XI,float *YI,float *RI,float *WI,int *IG,
-                                                 float *A,float *B,float DAB[2][2],float *Chi2,float *Pchi2) {
+                                                 float *A,float *B,float DAB[2][2],float *Chi2,float *Pchi2) const
+{
 
   float RRi[NMEAMX],WIlim,CHbest,Abest,Bbest;
   float A0,B0,SAA,SBB,SAB,Square,Aj,Bj;
@@ -1659,7 +1662,8 @@ void TrigL2MuonSA::MuFastStationFitter::Circles (int Nmeas,float *XI,float *YI,f
 ==============================================================================*/
 
 void TrigL2MuonSA::MuFastStationFitter::Circfit (int Nmeas,float *XI,float *YI,float *RI,float *WI,int *IG,
-                                                 float *A,float *B,float DAB[2][2],float *Chi2) {
+                                                 float *A,float *B,float DAB[2][2],float *Chi2) const
+{
 
   float XX[NMEAMX],YY[NMEAMX],Test,Toll,Xnor,Aold,Bold,Epsi;
   float SAA,SAB,SBB,Square;
@@ -1723,7 +1727,8 @@ void TrigL2MuonSA::MuFastStationFitter::Circfit (int Nmeas,float *XI,float *YI,f
 ==============================================================================*/
 
 void TrigL2MuonSA::MuFastStationFitter::Xline (float *X,float *Y,float *W,int *IG,int NP,
-     float *A,float *B,float *SAA,float *SBB,float *SAB,float *Square) {
+     float *A,float *B,float *SAA,float *SBB,float *SAB,float *Square) const
+{
       
     int j;
     float S1,SX,SY,SXX,SXY,SYY,Deter,DY;
@@ -1771,7 +1776,7 @@ void TrigL2MuonSA::MuFastStationFitter::Xline (float *X,float *Y,float *W,int *I
 // --------------------------------------------------------------------------------
  void TrigL2MuonSA::MuFastStationFitter::Circles (int Nmeas,float *XI,float *YI,float *RI,float *WI,int *IG,
                                                   float *A,float *B,float DAB[2][2],float *Chi2,float *Pchi2,
-                                                  float *SlopeCand, float *InterceptCand, float *Chi2Cand) 
+                                                  float *SlopeCand, float *InterceptCand, float *Chi2Cand) const 
 {
   float RRi[NMEAMX],WIlim,CHbest,Abest,Bbest;
   float A0,B0,SAA,SBB,SAB,Square,Aj,Bj;
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.h
index 6cc69744fb6abfc0e50ec0d0e272af6a1310aa37..2a9c75f5fd31ecfbfbcdc56ccf2ace49dc364902 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.h
@@ -40,21 +40,21 @@ class MuFastStationFitter: public AthAlgTool
       StatusCode findSuperPoints(const LVL1::RecMuonRoI*    p_roi,
 				 const TrigL2MuonSA::MuonRoad& muonRoad,
 				 TrigL2MuonSA::RpcFitResult& rpcFitResult,
-				 std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns);
+				 std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns) const;
       StatusCode findSuperPointsSimple(const LVL1::RecMuonRoI*    p_roi,
 				       const TrigL2MuonSA::MuonRoad& muonRoad,
 				       TrigL2MuonSA::TgcFitResult& tgcFitResult,
-				       std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns);
+				       std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns) const;
 
       StatusCode findSuperPoints(const LVL1::RecMuonRoI*    p_roi,
                                  const TrigL2MuonSA::MuonRoad& muonRoad,
                                  TrigL2MuonSA::TgcFitResult& tgcFitResult,
-                                 std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns);
+                                 std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns) const;
 
-      StatusCode superPointFitter(TrigL2MuonSA::TrackPattern& trackPattern);
+      StatusCode superPointFitter(TrigL2MuonSA::TrackPattern& trackPattern) const;
 
       StatusCode superPointFitter(TrigL2MuonSA::TrackPattern& trackPattern,
-                                  const TrigL2MuonSA::MuonRoad&  muonRoad);
+                                  const TrigL2MuonSA::MuonRoad&  muonRoad) const;
 
       StatusCode setMCFlag(BooleanProperty use_mcLUT);
 
@@ -99,14 +99,14 @@ class MuFastStationFitter: public AthAlgTool
 	this, "BackExtrapolator", "TrigMuonBackExtrapolator", "public tool for back extrapolating the muon tracks to the IV"};
 
    private:
-      float SetDriftSpace(float tdr, float rad, float zeta, float phim, float phiDir);
+      float SetDriftSpace(float tdr, float rad, float zeta, float phim, float phiDir) const;
       void  Xline(float *, float *, float *, int *, int ,
-                  float *, float *, float *, float *, float *, float *);
+                  float *, float *, float *, float *, float *, float *) const;
       void  Circfit (int, float *, float *, float *, float *, int *,
-                     float *, float *, float DAB[2][2], float *);
+                     float *, float *, float DAB[2][2], float *)  const;
       void  Circles (int, float *, float *, float *, float *, int *,
-                     float *, float *, float DAB[2][2], float *, float *);
-      int   Evlfit (int, TrigL2MuonSA::PBFitResult& fitres);
+                     float *, float *, float DAB[2][2], float *, float *) const;
+      int   Evlfit (int, TrigL2MuonSA::PBFitResult& fitres) const;
 
       ToolHandle<AlphaBetaEstimate>          m_alphaBetaEstimate {
 	this, "AlphaBetaEstimate", "TrigL2MuonSA::AlphaBetaEstimate"};
@@ -114,17 +114,17 @@ class MuFastStationFitter: public AthAlgTool
 	this, "PtFromAlphaBeta", "TrigL2MuonSA::PtFromAlphaBeta", ""};
       ToolHandle<NswStationFitter> m_nswStationFitter {this, "NswStationFitter", "TrigL2MuonSA::NswStationFitter"};
 
-      void findLayerCombination(std::vector<unsigned int> &a, int n, int r,std::vector<std::vector<unsigned int> > &c, int &nr);
+      void findLayerCombination(std::vector<unsigned int> &a, int n, int r,std::vector<std::vector<unsigned int> > &c, int &nr) const;
       void findSubLayerCombination(std::vector<unsigned int> &a, int n,int r, std::vector<unsigned int> &b, int index ,int num,
-                                   std::vector<std::vector<unsigned int> > &c, int &nr);
-      void makeReferenceLine(TrigL2MuonSA::TrackPattern& trackPattern,const TrigL2MuonSA::MuonRoad&    muonRoad);
+                                   std::vector<std::vector<unsigned int> > &c, int &nr) const;
+      void makeReferenceLine(TrigL2MuonSA::TrackPattern& trackPattern,const TrigL2MuonSA::MuonRoad&    muonRoad) const;
       void Circles (int, float *, float *, float *, float *, int *,
-                     float *, float *, float DAB[2][2], float *, float *, float *, float *, float *);
+                     float *, float *, float DAB[2][2], float *, float *, float *, float *, float *) const;
 
-      double fromAlphaPtToInn(TrigL2MuonSA::TgcFitResult& tgcFitResult,TrigL2MuonSA::TrackPattern& trackPattern);
-      void updateInnSP(TrigL2MuonSA::TrackPattern& trackPattern, double &aw,double &tgc_aw, double &bw);
+      double fromAlphaPtToInn(TrigL2MuonSA::TgcFitResult& tgcFitResult,TrigL2MuonSA::TrackPattern& trackPattern) const;
+      void updateInnSP(TrigL2MuonSA::TrackPattern& trackPattern, double &aw,double &tgc_aw, double &bw) const;
       void stationSPFit(TrigL2MuonSA::MdtHits*    mdtSegment, TrigL2MuonSA::SuperPoint* superPoint,
-                        TrigL2MuonSA::PBFitResult& pbFitResult, int s_address, int i_station,double aw, float phiDir);
+                        TrigL2MuonSA::PBFitResult& pbFitResult, int s_address, int i_station,double aw, float phiDir) const;
 
 
 };
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/CMakeLists.txt b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/CMakeLists.txt
index 3d6d3226ba7eb59f1e3aae6a0bdd5bb4dd6b22ff..a0bcc2ad47607ed47dc789051d7689a37e94a5b0 100644
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/CMakeLists.txt
+++ b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/CMakeLists.txt
@@ -13,14 +13,13 @@ atlas_add_library( TrigEgammaAnalysisToolsLib
    PUBLIC_HEADERS TrigEgammaAnalysisTools
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
    PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-   LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools EgammaAnalysisInterfacesLib GaudiKernel LumiBlockCompsLib LumiBlockData PATCoreLib StoreGateLib TrigConfHLTData TrigDecisionToolLib TrigEgammaEmulationToolLib TrigEgammaMatchingToolLib TrigHLTMonitoringLib TrigNavigationLib xAODCaloEvent xAODCaloRings xAODEgamma xAODEventInfo xAODJet xAODMissingET xAODTracking xAODTrigCalo xAODTrigEgamma xAODTrigRinger xAODTrigger xAODTruth
+   LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools EgammaAnalysisInterfacesLib GaudiKernel LumiBlockCompsLib LumiBlockData PATCoreLib StoreGateLib TrigConfHLTData TrigDecisionToolLib TrigEgammaEmulationToolLib TrigEgammaMatchingToolLib TrigHLTMonitoringLib xAODCaloEvent xAODCaloRings xAODEgamma xAODEventInfo xAODJet xAODMissingET xAODTracking xAODTrigCalo xAODTrigEgamma xAODTrigRinger xAODTrigger xAODTruth
    PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} AthenaMonitoringLib TrigConfxAODLib TrigSteeringEvent )
 
 atlas_add_component( TrigEgammaAnalysisTools
-   src/*.h
    src/*.cxx
    src/components/*.cxx
-   LINK_LIBRARIES AthenaBaseComps AthenaMonitoringLib TrigEgammaAnalysisToolsLib )
+   LINK_LIBRARIES AsgTools AthenaBaseComps AthenaMonitoringLib TrigEgammaAnalysisToolsLib xAODEgamma )
 
 # Install files from the package:
 atlas_install_python_modules( python/TrigEgamma*.py )
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/CMakeLists.txt b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..46b2549a26376d64ba92f07a8a2c15ce7b2f43e1
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/CMakeLists.txt
@@ -0,0 +1,67 @@
+################################################################################
+# Package: TrigGlobalEfficiencyCorrection
+################################################################################
+
+atlas_subdir( TrigGlobalEfficiencyCorrection )
+
+set( athena_subdirs )
+if( NOT XAOD_STANDALONE )
+  set( athena_subdirs GaudiKernel PhysicsAnalysis/POOLRootAccess Control/AthAnalysisBaseComps )
+endif()
+
+find_package( Boost )
+find_package( ROOT COMPONENTS RIO )
+
+atlas_add_library( TrigGlobalEfficiencyCorrectionLib
+   TrigGlobalEfficiencyCorrection/*.h Root/*.cxx
+   #PUBLIC_HEADERS TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrectionTool.h
+   PUBLIC_HEADERS TrigGlobalEfficiencyCorrection
+   PRIVATE_INCLUDE_DIRS ${BOOST_INCLUDE_DIRS} TriggerAnalysisInterfaces
+   LINK_LIBRARIES AsgTools xAODEgamma xAODMuon TriggerAnalysisInterfaces AthAnalysisBaseCompsLib EgammaAnalysisInterfacesLib MuonAnalysisInterfacesLib xAODEventInfo PathResolver TriggerMatchingToolLib
+   PRIVATE_LINK_LIBRARIES ${BOOST_LIBRARIES}
+)
+
+if( NOT XAOD_STANDALONE )
+   atlas_add_component( TrigGlobalEfficiencyCorrection
+      src/*.h src/*.cxx src/components/*.cxx
+      LINK_LIBRARIES xAODEgamma xAODMuon EgammaAnalysisInterfacesLib MuonAnalysisInterfacesLib xAODEventInfo GaudiKernel TrigGlobalEfficiencyCorrectionLib
+   )
+endif()
+
+atlas_add_dictionary( TrigGlobalEfficiencyCorrectionDict
+   TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrectionDict.h
+   TrigGlobalEfficiencyCorrection/selection.xml
+   LINK_LIBRARIES TrigGlobalEfficiencyCorrectionLib
+)
+
+set( pool_lib )
+if( NOT XAOD_STANDALONE )
+  set( pool_lib POOLRootAccessLib )
+endif()
+
+foreach(example TrigGlobEffCorrExample0 TrigGlobEffCorrExample1
+TrigGlobEffCorrExample3a TrigGlobEffCorrExample3b TrigGlobEffCorrExample3c 
+TrigGlobEffCorrExample3d TrigGlobEffCorrExample3e
+TrigGlobEffCorrExample4 TrigGlobEffCorrExample5a TrigGlobEffCorrExample5b)
+   atlas_add_executable( ${example}
+      SOURCES examples/${example}.cxx
+	  INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+	  LINK_LIBRARIES TrigGlobalEfficiencyCorrectionLib ${pool_lib}
+   )
+endforeach()
+
+atlas_add_executable( TrigGlobEffCorrExample6
+   SOURCES examples/TrigGlobEffCorrExample6.cxx
+   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+   LINK_LIBRARIES TrigGlobalEfficiencyCorrectionLib ${pool_lib}
+)
+
+atlas_add_executable( TrigGlobEffCorrValidation
+   SOURCES util/TrigGlobEffCorrValidation.cxx
+   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+   LINK_LIBRARIES TrigGlobalEfficiencyCorrectionLib xAODRootAccess
+)
+
+atlas_add_test(UnitTests SCRIPT util/unit_tests.sh)
+
+atlas_install_data( data/*.cfg )
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/README b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/README
new file mode 100644
index 0000000000000000000000000000000000000000..4678583910e3ff45a398cfc6b2dff6ab33dcf79d
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/README
@@ -0,0 +1,28 @@
+The tool interface ITrigGlobalEfficiencyCorrectionTool.h is hosted in another package, 
+PhysicsAnalysis/Interfaces/TriggerAnalysisInterfaces. 
+
+
+Documentation:
+--------------
+o) https://twiki.cern.ch/twiki/bin/viewauth/Atlas/TrigGlobalEfficiencyCorrectionTool
+
+
+Formulas for the combinatorics:
+-------------------------------
+o) doc/formulas.pdf
+
+
+Examples of configuration of the tool:
+--------------------------------------
+o) Source files util/TrigGlobEffCorrExample*.cxx (dual-use (Ath)AnalysisBase executables)
+o) Usage: TrigGlobEffCorrExample0 [--debug] <input DxAOD file>.root
+o) Contents:
+ -- Example 0: minimal configuration
+ -- Example 1: singe+dilepton triggers combination
+ -- Example 2: [removed]
+ -- Examples 3a-3e: usage of lepton selection tags
+ -- Example 4: usage of the static helper method suggestElectronMapKeys()
+ -- Example 5a: photon triggers, simplest example (symmetric diphoton trigger)
+ -- Example 5b: photon triggers, more complex (asymmetric diphoton trigger)
+ -- Example 06: trigger matching
+o) More details in the comments of each source file
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/README.developers b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/README.developers
new file mode 100644
index 0000000000000000000000000000000000000000..3e3921c323b512a57ec539f4f42cacb1ee1f697a
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/README.developers
@@ -0,0 +1,3 @@
+The examples 0-3 should not be edited directly: the source files are produced 
+by running the script examples/generator/generateExamples.py.
+Modifications should therefore be made to the templates in the generator directory. 
\ No newline at end of file
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/Calculator.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/Calculator.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..5a6c6392425ec322412487c232f114f821e8ed7b
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/Calculator.cxx
@@ -0,0 +1,1404 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+// contact: jmaurer@cern.ch
+
+#include "TrigGlobalEfficiencyCorrection/Calculator.h"
+#include "TrigGlobalEfficiencyCorrection/ImportData.h"
+#include "TrigGlobalEfficiencyCorrection/Lepton.h"
+#include "TrigGlobalEfficiencyCorrection/Trigger.h"
+
+#include <random>
+#include <iterator>
+
+using namespace TrigGlobEffCorr;
+using std::placeholders::_1;
+using std::placeholders::_2;
+using std::placeholders::_3;
+using std::placeholders::_4;
+
+Calculator::Calculator(TrigGlobalEfficiencyCorrectionTool& parent, unsigned nPeriodsToReserve) :
+	asg::AsgMessaging(&parent),
+	m_parent(&parent)
+{
+	msg().setLevel(parent.msg().level());
+	m_periods.reserve(nPeriodsToReserve);
+}
+		
+bool Calculator::addPeriod(ImportData& data, const std::pair<unsigned,unsigned>& boundaries, const std::string& combination, 
+	bool useToys, std::size_t& uniqueElectronLeg, std::size_t& uniquePhotonLeg)
+{
+	bool success = true;
+	m_parent = data.getParent();
+	
+	auto triggers = data.parseTriggerString(combination, success);
+	if(!success) return false;
+	if(!triggers.size())
+	{
+		ATH_MSG_ERROR("The trigger combination is empty!");
+		return false;
+	}
+	
+	if(!findUniqueLeg(xAOD::Type::Electron, uniqueElectronLeg, triggers)) return false;
+	if(!findUniqueLeg(xAOD::Type::Photon, uniquePhotonLeg, triggers)) return false;
+	
+	/// Choose the appropriate function to compute efficiencies for this particular trigger combination
+	Helper helper(triggers);
+	if(helper.duplicates())
+	{
+		ATH_MSG_ERROR("The following combination of triggers contains duplicates: " << combination);
+		return false;
+	}
+	if(!useToys)
+	{	
+		success = helper.findAndBindFunction();
+		if(!helper.m_formula)
+		{
+			ATH_MSG_ERROR("This trigger combination is currently not supported with an explicit formula (you may use toys instead, slower): " << combination);
+			return false;
+		}
+	}
+	else
+	{
+		helper.m_formula = std::bind(&Calculator::globalEfficiency_Toys, ::_1, ::_2, ::_3, triggers, ::_4);
+	}
+	if(success)
+	{
+		if(data.adaptTriggerListForTriggerMatching(triggers))
+		{
+			m_periods.emplace_back(boundaries, std::move(helper.m_formula), std::move(triggers));
+		}
+		else
+		{
+			if(m_parent->m_validTrigMatchTool) return false;
+			m_periods.emplace_back(boundaries, std::move(helper.m_formula));
+		}
+	}
+	else
+	{
+		ATH_MSG_ERROR("Unspecified error occurred while trying to find the formula for the trigger combination " << combination);
+	}
+	return success;
+}
+
+bool Calculator::findUniqueLeg(xAOD::Type::ObjectType obj, std::size_t& uniqueLeg, const std::vector<TrigDef>& defs)
+{
+	if(uniqueLeg) return true; /// initial non-zero value means that ListOfLegsPerTool is filled
+	for(auto& def : defs)
+	{
+		TriggerProperties tp(def);
+		for(auto itr=tp.cbegin(obj);itr!=tp.cend(obj);++itr)
+		{
+			if(uniqueLeg && uniqueLeg!=*itr)
+			{
+				ATH_MSG_ERROR("The property 'ListOfLegsPerTool' needs to be filled as the specified trigger combination involves several electron (or photon) trigger legs");
+				return false;
+			}
+			uniqueLeg = *itr;
+		}
+	}
+	return true;
+}
+
+const Calculator::Period* Calculator::getPeriod(unsigned runNumber) const
+{
+	auto period = std::find_if(m_periods.cbegin(), m_periods.cend(),
+		[=](const Period& p) { return runNumber>=p.m_boundaries.first && runNumber<=p.m_boundaries.second; });
+	if(period == m_periods.end())
+	{
+		ATH_MSG_ERROR("No trigger combination has been specified for run " << runNumber);
+		return nullptr;
+	}
+	return &*period;
+}
+
+bool Calculator::compute(TrigGlobalEfficiencyCorrectionTool& parent, const LeptonList& leptons, unsigned runNumber, Efficiencies& efficiencies)
+{
+	m_parent = &parent;
+	auto period = getPeriod(runNumber);
+	if(!period) return false;
+	m_cachedEfficiencies.clear();
+	return period->m_formula && period->m_formula(this, leptons, runNumber, efficiencies);
+}
+
+bool Calculator::checkTriggerMatching(TrigGlobalEfficiencyCorrectionTool& parent, bool& matched, const LeptonList& leptons, unsigned runNumber)
+{
+	matched = false;
+	m_parent = &parent;
+	auto period = getPeriod(runNumber);
+	if(!period) return false;
+	if(!period->m_triggers.size())
+	{
+		ATH_MSG_ERROR("Empty list of triggers for run number " << runNumber);
+		return false;
+	}
+	auto& trigMatchTool = m_parent->m_trigMatchTool;
+	
+	/// First, for each lepton, list the trigger leg(s) it is allowed to fire (depends on pT and selection tags)
+	const unsigned nLep = leptons.size();
+	std::vector<flat_set<std::size_t> > validLegs(leptons.size());
+	for(unsigned i=0;i<nLep;++i)
+	{
+		if(!fillListOfLegsFor(leptons[i], period->m_triggers, validLegs[i])) return false;
+	}
+	
+	/// Then for each trigger, call trigger matching tool for all possible (valid) lepton combinations
+	std::vector<flat_set<std::size_t> > firedLegs;
+	std::vector<const xAOD::IParticle*> trigLeptons;
+	const std::size_t magicWordHLT = 0xf7b8b87ef2917d66;
+
+	for(auto& trig : period->m_triggers)
+	{
+		/// Get trigger chain name with a "HLT_" prefix
+		auto itr = m_parent->m_dictionary.find(trig.name ^ magicWordHLT);
+		if(itr == m_parent->m_dictionary.end())
+		{
+			itr = m_parent->m_dictionary.emplace(trig.name ^ magicWordHLT, "HLT_" + m_parent->m_dictionary.at(trig.name)).first;
+		}
+		const std::string& chain = itr->second;
+		
+		unsigned nLegs = 0;
+		if(trig.type & TT_SINGLELEPTON_FLAG) nLegs = 1;
+		else if(trig.type & TT_DILEPTON_FLAG) nLegs = 2;
+		else if(trig.type & TT_TRILEPTON_FLAG) nLegs = 3;
+		else
+		{
+			ATH_MSG_ERROR("Unsupported trigger (type = " << std::hex << trig.type << std::dec << ") " << chain );
+			return false;
+		}
+		firedLegs.resize(nLegs);
+		trigLeptons.resize(nLegs);
+		for(unsigned i0=0;i0<nLep;++i0)
+		{
+			firedLegs[0].swap(validLegs[i0]); /// borrow the set of legs that can be fired by that lepton
+			trigLeptons[0] = leptons[i0].particle();
+			if(nLegs == 1)
+			{
+				if(canTriggerBeFired(trig, firedLegs) /// enough lepton(s) on trigger plateau?
+					&& trigMatchTool->match(trigLeptons, chain)) return (matched = true);
+			}
+			else for(unsigned i1=i0+1;i1<nLep;++i1)
+			{
+				firedLegs[1].swap(validLegs[i1]);
+				trigLeptons[1] = leptons[i1].particle();
+				if(nLegs == 2)
+				{
+					if(canTriggerBeFired(trig, firedLegs)
+						&& trigMatchTool->match(trigLeptons, chain)) return (matched = true);
+				}
+				else for(unsigned i2=i1+1;i2<nLep;++i2)
+				{
+					firedLegs[2].swap(validLegs[i2]);
+					trigLeptons[2] = leptons[i2].particle();
+					if(canTriggerBeFired(trig, firedLegs)
+						&& trigMatchTool->match(trigLeptons, chain)) return (matched = true);
+					firedLegs[2].swap(validLegs[i2]);
+				}
+				firedLegs[1].swap(validLegs[i1]);
+			}
+			firedLegs[0].swap(validLegs[i0]); /// return the set of legs back to the main container
+		}
+	}
+	return true;
+}
+
+bool Calculator::getRelevantTriggersForUser(TrigGlobalEfficiencyCorrectionTool& parent, std::vector<std::string>& triggers, unsigned runNumber)
+{
+	triggers.clear();
+	m_parent = &parent;
+	auto period = getPeriod(runNumber);
+	if(!period) return false;
+	if(!period->m_triggers.size())
+	{
+		ATH_MSG_ERROR("Empty list of triggers for run number " << runNumber << " (was there a configuration issue? please check for warnings during initialization)");
+		return false;
+	}
+	bool success = true;
+	auto notfound = parent.m_dictionary.end();
+	for(auto& trig : period->m_triggers)
+	{
+		auto itr = parent.m_dictionary.find(trig.name);
+		if(itr == notfound)
+		{
+			ATH_MSG_ERROR("can't retrieve name of trigger with hash " << trig.name << " (shouldn't happen; contact tool developers!)");
+			success = false;
+		}
+		else triggers.push_back(itr->second);
+	}
+	if(!success) triggers.clear();
+	return success;
+}
+
+Efficiencies Calculator::getCachedTriggerLegEfficiencies(const Lepton& lepton, unsigned runNumber, std::size_t leg, bool& success)
+{
+	auto insertion = m_cachedEfficiencies.emplace(std::make_pair(&lepton, leg), Efficiencies());
+	Efficiencies& efficiencies = insertion.first->second;
+	if(insertion.second)
+	{
+		bool cpSuccess = false;
+		switch(lepton.type())
+		{
+		case xAOD::Type::Electron:
+			cpSuccess = m_parent->getTriggerLegEfficiencies(lepton.electron(), runNumber, leg, lepton.tag(), efficiencies);
+			break;
+		case xAOD::Type::Muon:
+			cpSuccess = m_parent->getTriggerLegEfficiencies(lepton.muon(), leg, lepton.tag(), efficiencies);
+			break;
+		case xAOD::Type::Photon:
+			cpSuccess = m_parent->getTriggerLegEfficiencies(lepton.photon(), runNumber, leg, lepton.tag(), efficiencies);
+			break;
+		default: ATH_MSG_ERROR("Unsupported particle type");
+		}
+		if(!cpSuccess)
+		{
+			efficiencies.data() = -777.;
+			efficiencies.mc() = -777.;
+			success = false;
+		}
+	}
+	if(efficiencies.mc()==-777.) success = false;
+	return efficiencies;
+}
+
+///
+/// One single-lepton trigger
+///
+template<typename Trig1L>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber, const Trig1L trig, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig1L::is1L(), bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_One1L() at line " << __LINE__);
+	if(!trig)
+	{
+		globalEfficiencies = {0.};
+		return true;
+	}
+	globalEfficiencies = {1.};
+	bool success = true;
+	for(auto& lepton : leptons)
+	{
+		if(trig.irrelevantFor(lepton) || !aboveThreshold(lepton, trig())) continue;
+		auto efficiencies = getCachedTriggerLegEfficiencies(lepton, runNumber, trig(), success);
+		globalEfficiencies *= ~efficiencies;
+	}
+	globalEfficiencies = ~globalEfficiencies;
+	return success;
+}
+
+///
+/// Two single-lepton triggers, two object types
+///
+template<typename Trig1L_obj1, typename Trig1L_obj2>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber, const Trig1L_obj1 trig1, const Trig1L_obj2 trig2, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig1L_obj1::is1L()
+						&& Trig1L_obj2::is1L()
+						&& Trig1L_obj1::object() != Trig1L_obj2::object(),
+		bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_Two1L() at line " << __LINE__);
+	if(!trig1) return globalEfficiency(leptons, runNumber, trig2, globalEfficiencies);
+	if(!trig2) return globalEfficiency(leptons, runNumber, trig1, globalEfficiencies);
+	globalEfficiencies = {1.};
+	bool success = true;
+	for(auto& lepton : leptons)
+	{
+		std::size_t leg;
+		if(trig1.relevantFor(lepton)) leg = trig1();
+		else if(trig2.relevantFor(lepton)) leg = trig2();
+		else continue;
+		if(!aboveThreshold(lepton, leg)) continue;
+		auto efficiencies = getCachedTriggerLegEfficiencies(lepton, runNumber, leg, success);
+		globalEfficiencies *= ~efficiencies;
+	}
+	globalEfficiencies = ~globalEfficiencies;
+	return success;
+}
+
+///
+/// Several single-lepton triggers, one object type
+///
+template<typename Trig1L>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber, const flat_set<Trig1L>& trigs, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig1L::is1L(), bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_Several1L() at line " << __LINE__);
+	if(trigs.size() == 1) return globalEfficiency(leptons, runNumber, *trigs.cbegin(), globalEfficiencies);
+	if(!trigs.size())
+	{
+		globalEfficiencies = {0.};
+		return true;
+	}
+	globalEfficiencies = {1.};
+	bool success = true;
+	for(auto& lepton : leptons)
+	{
+		if(Trig1L::irrelevantFor(lepton)) continue;
+		std::size_t loosestLeg = getLoosestLegAboveThreshold(lepton, trigs, success);
+		if(loosestLeg && success)
+		{
+			auto efficiencies = getCachedTriggerLegEfficiencies(lepton, runNumber, loosestLeg, success);
+			globalEfficiencies *= ~efficiencies;
+		}
+	}
+	globalEfficiencies = ~globalEfficiencies;
+	return success;
+}
+
+///
+/// Several single-lepton triggers, two object types
+///
+template<typename Trig1L_obj1, typename Trig1L_obj2>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber,
+			const flat_set<Trig1L_obj1>& trigs1, const flat_set<Trig1L_obj2>& trigs2, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig1L_obj1::is1L()
+						&& Trig1L_obj2::is1L()
+						&& Trig1L_obj1::object() != Trig1L_obj2::object(),
+		bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_Several1L() at line " << __LINE__);
+	if(trigs1.size()==1 && trigs2.size()==1)
+	{
+		return globalEfficiency(leptons, runNumber, *trigs1.cbegin(), *trigs2.cbegin(), globalEfficiencies);
+	}
+	if(!trigs1.size()) return globalEfficiency(leptons, runNumber, trigs2, globalEfficiencies);
+	if(!trigs2.size()) return globalEfficiency(leptons, runNumber, trigs1, globalEfficiencies);
+	globalEfficiencies = {1.};
+	bool success = true;
+	for(auto& lepton : leptons)
+	{
+		std::size_t loosestLeg;
+		if(Trig1L_obj1::relevantFor(lepton)) loosestLeg = getLoosestLegAboveThreshold(lepton, trigs1, success);
+		else if(Trig1L_obj2::relevantFor(lepton)) loosestLeg = getLoosestLegAboveThreshold(lepton, trigs2, success);
+		else continue;
+		if(loosestLeg && success)
+		{
+			auto efficiencies = getCachedTriggerLegEfficiencies(lepton, runNumber, loosestLeg, success);
+			globalEfficiencies *= ~efficiencies;
+		}
+	}
+	globalEfficiencies = ~globalEfficiencies;
+	return success;
+}
+
+///
+/// One mixed-flavour dilepton trigger
+///
+template<typename Trig2Lmix>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber, const Trig2Lmix trig, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig2Lmix::is2Lmix(), bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_One2L() at line " << __LINE__);
+	Efficiencies efficiencies[2];
+	bool success = globalEfficiency(leptons, runNumber, trig.side1(), efficiencies[0])
+		&& globalEfficiency(leptons, runNumber, trig.side2(), efficiencies[1]);
+	if(success) globalEfficiencies = efficiencies[0] * efficiencies[1];
+	else globalEfficiencies = {0.};
+	return success;
+}
+
+///
+/// One symmetric dilepton trigger
+///
+template<typename Trig2Lsym>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber, const Trig2Lsym trig , Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig2Lsym::is2Lsym(), bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_One2L() at line " << __LINE__);
+	globalEfficiencies = {0.};
+	if(!trig) return true;
+	Efficiencies singleInefficiencies(1.);
+	bool success = true;
+	int nt = 0;
+	for(auto& lepton : leptons)
+	{
+		if(trig.irrelevantFor(lepton) || !aboveThreshold(lepton, trig())) continue;
+		++nt;
+		auto efficiencies = getCachedTriggerLegEfficiencies(lepton, runNumber, trig(), success);
+		globalEfficiencies = ~efficiencies*globalEfficiencies + efficiencies*~singleInefficiencies;
+		singleInefficiencies *= ~efficiencies;
+	}
+	return success;
+}
+
+///
+/// One asymmetric dilepton trigger
+///
+template<typename Trig2Lasym>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber, const Trig2Lasym trig, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig2Lasym::is2Lasym(), bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_One2L() at line " << __LINE__);
+	if(trig.symmetric()) return globalEfficiency(leptons, runNumber, trig.to_symmetric(), globalEfficiencies);
+	globalEfficiencies = {0.};
+	if(!trig) return true;
+	Efficiencies singleInefficiencies[2] = {{1.},{1.}}, twoSingleInefficiencies = {1.};
+	bool success = true;
+	for(auto& lepton : leptons)
+	{
+		if(trig.irrelevantFor(lepton)) continue;
+		Efficiencies efficiencies[2] = {{0.}, {0.}};
+		int loosest = 0;
+		if(aboveThreshold(lepton, trig(0)))
+		{
+			efficiencies[0] = getCachedTriggerLegEfficiencies(lepton, runNumber, trig(0), success);
+			if(aboveThreshold(lepton, trig(1)))
+			{
+				efficiencies[1] = getCachedTriggerLegEfficiencies(lepton, runNumber, trig(1), success);
+				loosest = m_parent->getLoosestLeg(lepton, trig(0), trig(1), success)==trig(1);
+			}
+		}
+		else if(aboveThreshold(lepton, trig(1)))
+		{
+			efficiencies[1] = getCachedTriggerLegEfficiencies(lepton, runNumber, trig(1), success);
+			loosest = 1;
+		}
+		else continue;
+		const int tightest = 1 - loosest;
+		globalEfficiencies = ~efficiencies[loosest]*globalEfficiencies 
+			+ (efficiencies[loosest]-efficiencies[tightest])*~singleInefficiencies[tightest]
+			+ efficiencies[tightest]*~twoSingleInefficiencies;
+		twoSingleInefficiencies *= ~efficiencies[loosest];
+		for(int i=0;i<2;++i) singleInefficiencies[i] *= ~efficiencies[i];
+	}
+	return success;
+}
+
+///
+/// One mixed-flavour dilepton trigger + single-lepton triggers
+///
+template<typename Trig2Lmix, typename Trig1L_obj1, typename Trig1L_obj2>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber,
+		const Trig2Lmix trig2Lmix, const flat_set<Trig1L_obj1>& trigs1L1, const flat_set<Trig1L_obj2>& trigs1L2, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig2Lmix::is2Lmix()
+						&& Trig1L_obj1::is1L() && Trig2Lmix::object1()==Trig1L_obj1::object()
+						&& Trig1L_obj2::is1L() && Trig2Lmix::object2()==Trig1L_obj2::object(),
+		bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_One2LSeveral1L() at line " << __LINE__);
+	if(!(trigs1L1.size() + trigs1L2.size()))
+		return globalEfficiency(leptons, runNumber, trig2Lmix, globalEfficiencies);
+	if(trig2Lmix.hiddenBy(trigs1L1) || trig2Lmix.hiddenBy(trigs1L2))
+		return globalEfficiency(leptons, runNumber, trigs1L1, trigs1L2, globalEfficiencies);
+	Efficiencies efficiencies[4];
+	bool success = globalEfficiency(leptons, runNumber, trigs1L1, efficiencies[0])
+		&& globalEfficiency(leptons, runNumber, trigs1L2, efficiencies[1])
+		&& globalEfficiency(leptons, runNumber, trig2Lmix.addTo(trigs1L1), efficiencies[2])
+		&& globalEfficiency(leptons, runNumber, trig2Lmix.addTo(trigs1L2), efficiencies[3]);
+	if(success)
+	{
+		globalEfficiencies = Efficiencies(1.) - ~efficiencies[0]*~efficiencies[1]
+			+ (efficiencies[2]-efficiencies[0])*(efficiencies[3]-efficiencies[1]);
+	}
+	else globalEfficiencies = {0.};
+	return success;
+}
+
+///
+/// One dilepton trigger + one single-lepton trigger
+///
+template<typename Trig2L, typename Trig1L>
+inline auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber,
+			const Trig2L trig2L, const Trig1L trig1L, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig2L::is2Lnomix() 
+						&& Trig1L::is1L()
+						&& Trig2L::object()==Trig1L::object(),
+		bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_One2LSeveral1L() at line " << __LINE__);
+	return globalEfficiency(leptons, runNumber, trig2L, flat_set<Trig1L>{trig1L}, globalEfficiencies);
+}
+
+///
+/// One symmetric dilepton trigger + several single-lepton triggers
+///
+template<typename Trig2Lsym, typename Trig1L>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber,
+			const Trig2Lsym trig2L, const flat_set<Trig1L>& trigs1L, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig2Lsym::is2Lsym() 
+						&& Trig1L::is1L() 
+						&& Trig1L::object() == Trig2Lsym::object(), 
+		bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_One2LSeveral1L() at line " << __LINE__);
+	if(!trigs1L.size()) return globalEfficiency(leptons, runNumber, trig2L, globalEfficiencies);
+	if(!trig2L || trig2L.hiddenBy(trigs1L)) return globalEfficiency(leptons, runNumber, trigs1L, globalEfficiencies);
+	globalEfficiencies = {0.};
+	Efficiencies twoSingleInefficiencies = {1.};
+	bool success = true;
+	for(auto& lepton : leptons)
+	{
+		if(trig2L.irrelevantFor(lepton)) continue;
+		Efficiencies efficiencies1L(0.), efficiencies2L(0.);
+		const Efficiencies* loosestLegEfficiency;
+		std::size_t loosest1lepLeg = getLoosestLegAboveThreshold(lepton, trigs1L, success);
+		if(loosest1lepLeg)
+		{
+			efficiencies1L = getCachedTriggerLegEfficiencies(lepton, runNumber, loosest1lepLeg, success);
+			if(aboveThreshold(lepton, trig2L()))
+			{
+				efficiencies2L = getCachedTriggerLegEfficiencies(lepton, runNumber, trig2L(), success);
+				loosestLegEfficiency = (m_parent->getLoosestLeg(lepton, trig2L(), loosest1lepLeg , success)==trig2L())? &efficiencies2L : &efficiencies1L;
+			}
+			else loosestLegEfficiency = &efficiencies1L;
+		}
+		else if(aboveThreshold(lepton, trig2L()))
+		{
+			efficiencies2L = getCachedTriggerLegEfficiencies(lepton, runNumber, trig2L(), success);
+			loosestLegEfficiency = &efficiencies2L;
+		}
+		else continue;
+		globalEfficiencies = ~(*loosestLegEfficiency)*globalEfficiencies + efficiencies1L;
+		if(loosestLegEfficiency==&efficiencies2L) globalEfficiencies += ~twoSingleInefficiencies*(efficiencies2L - efficiencies1L);			
+		twoSingleInefficiencies *= ~(*loosestLegEfficiency);
+	}
+	return success;
+}
+
+///
+/// One asymmetric dilepton trigger + several single-lepton triggers
+///
+template<typename Trig2Lasym, typename Trig1L>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber,
+			const Trig2Lasym trig2L, const flat_set<Trig1L>& trigs1L, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig2Lasym::is2Lasym() 
+						&& Trig1L::is1L() 
+						&& Trig1L::object() == Trig2Lasym::object(), 
+		bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_One2LSeveral1L() at line " << __LINE__);
+	if(trig2L.symmetric()) return globalEfficiency(leptons, runNumber, trig2L.to_symmetric(), trigs1L, globalEfficiencies);
+	if(!trigs1L.size()) return globalEfficiency(leptons, runNumber, trig2L, globalEfficiencies);
+	if(!trig2L || trig2L.hiddenBy(trigs1L)) return globalEfficiency(leptons, runNumber, trigs1L, globalEfficiencies);
+	globalEfficiencies = {0.};
+	Efficiencies twoSingleInefficiencies[2] = {{1.}, {1.}}, threeSingleInefficiencies = {1.};
+	bool success = true;
+	for(auto& lepton : leptons)
+	{
+		if(trig2L.irrelevantFor(lepton)) continue;
+		flat_set<std::size_t> validLegs;
+		for(std::size_t leg : trig2L.legs) if(aboveThreshold(lepton, leg)) validLegs.insert(leg);
+		Efficiencies efficiencies1L = {0.};
+		std::size_t loosest1lepLeg = getLoosestLegAboveThreshold(lepton, trigs1L, success);
+		if(loosest1lepLeg)
+		{
+			efficiencies1L = getCachedTriggerLegEfficiencies(lepton, runNumber, loosest1lepLeg, success);
+			validLegs.insert(loosest1lepLeg);
+		}
+		if(!validLegs.size()) continue;
+		auto looseLegs = m_parent->getTwoLoosestLegs(lepton,validLegs,success);
+		auto efficienciesLoose = (looseLegs.first==loosest1lepLeg)? efficiencies1L : getCachedTriggerLegEfficiencies(lepton, runNumber, looseLegs.first, success);
+		Efficiencies efficienciesMedium = {0.};
+		if(validLegs.size()>=2)
+			efficienciesMedium = (looseLegs.second==loosest1lepLeg)? efficiencies1L : getCachedTriggerLegEfficiencies(lepton, runNumber, looseLegs.second, success);
+		globalEfficiencies = ~efficienciesLoose*globalEfficiencies + efficiencies1L;
+		if(loosest1lepLeg!=looseLegs.first)
+		{
+			globalEfficiencies += (efficienciesLoose-efficienciesMedium)*~twoSingleInefficiencies[looseLegs.first==trig2L.legs[0]];
+			if(loosest1lepLeg!=looseLegs.second) globalEfficiencies += (efficienciesMedium-efficiencies1L)*~threeSingleInefficiencies;
+		}
+		threeSingleInefficiencies *= ~efficienciesLoose;
+		twoSingleInefficiencies[0] *= (looseLegs.first!=trig2L.legs[1])?~efficienciesLoose:~efficienciesMedium; /// S1 v S3
+		twoSingleInefficiencies[1] *= (looseLegs.first!=trig2L.legs[0])?~efficienciesLoose:~efficienciesMedium; /// S2 v S3
+	}
+	return success;
+}
+
+///
+/// Two symmetric dilepton triggers + several single-lepton triggers
+///
+template<typename Trig2Lsym, typename Trig1L> 
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber,
+			const Trig2Lsym trig2L1, const Trig2Lsym trig2L2, const flat_set<Trig1L>& trigs1L, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig2Lsym::is2Lsym() 
+						&& Trig1L::is1L()
+						&& Trig1L::object() == Trig2Lsym::object(), 
+		bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_Two2LSeveral1L() at line " << __LINE__);
+	if(!trig2L1 || trig2L1==trig2L2 || trig2L1.hiddenBy(trigs1L)) return globalEfficiency(leptons, runNumber, trig2L2, trigs1L, globalEfficiencies);
+	if(!trig2L2 || trig2L2.hiddenBy(trigs1L)) return globalEfficiency(leptons, runNumber, trig2L1, trigs1L, globalEfficiencies);
+	globalEfficiencies = {0.};
+	Efficiencies singleInefficiencies{1.};
+	Efficiencies efficiencies2Lsym[2] = {{0.},{0.}};
+	
+	bool success = true;
+	for(auto& lepton : leptons)
+	{
+		if(trig2L1.irrelevantFor(lepton)) continue;
+		flat_set<std::size_t> validLegs;
+		std::map<std::size_t, Efficiencies> efficiencies{{0,0.}};
+		std::size_t loosest1lepLeg = getLoosestLegAboveThreshold(lepton, trigs1L, success);
+		for(std::size_t leg : {loosest1lepLeg, trig2L1(), trig2L2()})
+		{
+			if(leg && aboveThreshold(lepton, leg))
+			{
+				validLegs.insert(leg);
+				efficiencies.emplace(leg, getCachedTriggerLegEfficiencies(lepton, runNumber, leg, success));
+			}
+			else efficiencies.emplace(leg, 0.);
+		}
+		if(!validLegs.size()) continue;
+		auto looseLegs = m_parent->getTwoLoosestLegs(lepton, validLegs, success);
+		std::size_t lambda13 = (looseLegs.first!=trig2L2())? looseLegs.first : looseLegs.second;
+		std::size_t lambda23 = (looseLegs.first!=trig2L1())? looseLegs.first : looseLegs.second;
+		globalEfficiencies = globalEfficiencies*~efficiencies[looseLegs.first] + efficiencies[loosest1lepLeg];
+		if(looseLegs.first==trig2L1()) globalEfficiencies += efficiencies2Lsym[1]*(efficiencies[trig2L1()] - efficiencies[looseLegs.second]);
+		if(looseLegs.first==trig2L2()) globalEfficiencies += efficiencies2Lsym[0]*(efficiencies[trig2L2()] - efficiencies[looseLegs.second]);
+		if(looseLegs.first!=loosest1lepLeg) globalEfficiencies += ~singleInefficiencies*(efficiencies[looseLegs.second] - efficiencies[loosest1lepLeg]);
+		efficiencies2Lsym[0] = ~efficiencies[looseLegs.first]*efficiencies2Lsym[0] + efficiencies[lambda23];
+		efficiencies2Lsym[1] = ~efficiencies[looseLegs.first]*efficiencies2Lsym[1] + efficiencies[lambda13];
+		if(looseLegs.first==trig2L1()) efficiencies2Lsym[0] += (efficiencies[trig2L1()]-efficiencies[lambda23])*~singleInefficiencies;
+		if(looseLegs.first==trig2L2()) efficiencies2Lsym[1] += (efficiencies[trig2L2()]-efficiencies[lambda13])*~singleInefficiencies;
+		singleInefficiencies *= ~efficiencies[looseLegs.first];
+	}
+	return success;
+}
+
+///
+/// Two dilepton triggers (one asym., one sym.) + several single-lepton triggers
+///
+template<typename Trig2Lasym, typename Trig2Lsym, typename Trig1L>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber,
+			const Trig2Lasym trig2Lasym, const Trig2Lsym trig2Lsym, const flat_set<Trig1L>& trigs1L, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig2Lasym::is2Lasym() 
+						&& Trig2Lsym::is2Lsym() && Trig2Lsym::object()==Trig2Lasym::object()
+						&& Trig1L::is1L() && Trig1L::object()==Trig2Lasym::object(), 
+		bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_Two2LSeveral1L() at line " << __LINE__);
+	if(!trig2Lasym || trig2Lasym.hiddenBy(trigs1L)) return globalEfficiency(leptons, runNumber, trig2Lsym, trigs1L, globalEfficiencies);
+	if(!trig2Lsym || trig2Lsym.hiddenBy(trigs1L)) return globalEfficiency(leptons, runNumber, trig2Lasym, trigs1L, globalEfficiencies);
+	if(trig2Lasym(0)==trig2Lsym() || trig2Lasym(1)==trig2Lsym())
+	{
+		ATH_MSG_ERROR("implementation -- does this function work properly when the two 2L triggers have one leg in common? Must be checked");
+		return false;
+	}
+	if(trig2Lasym.symmetric()) return globalEfficiency(leptons, runNumber, trig2Lasym.to_symmetric(), trig2Lsym, trigs1L, globalEfficiencies);
+	globalEfficiencies = {0.};
+	Efficiencies singleInefficiencies[3] = {{1.}, {1.}, {1.}};
+	Efficiencies efficiencies2Lasym {0.}, efficiencies2Lsym[3] = {{0.},{0.},{0.}};
+	
+	bool success = true;
+	for(auto& lepton : leptons)
+	{
+		if(trig2Lasym.irrelevantFor(lepton)) continue;
+		flat_set<std::size_t> validLegs;
+		std::map<std::size_t, Efficiencies> efficiencies{{0,0.}};
+		std::size_t loosest1lepLeg = getLoosestLegAboveThreshold(lepton, trigs1L, success);
+		for(std::size_t leg : {trig2Lasym(0), trig2Lasym(1), trig2Lsym(), loosest1lepLeg})
+		{
+			if(leg && aboveThreshold(lepton, leg))
+			{
+				validLegs.insert(leg);
+				efficiencies.emplace(leg, getCachedTriggerLegEfficiencies(lepton, runNumber, leg, success));
+			}
+			else efficiencies.emplace(leg, 0.);
+		}
+		if(!validLegs.size()) continue;
+		
+		const auto sortedLegs = m_parent->getSortedLegs(lepton, validLegs, success);
+		if(!success) return false;
+		std::size_t loosestLeg = sortedLegs[0];
+		std::size_t secondLoosestLeg = validLegs.size()>=2 ? sortedLegs[1] : 0;
+		std::size_t secondTightestLeg = validLegs.size()>=3 ? sortedLegs[2] : 0;
+		std::size_t tightestLeg = validLegs.size()>=4 ? sortedLegs[3]: 0;
+		std::size_t lambda124 = (loosestLeg!=trig2Lasym(1))? loosestLeg : secondLoosestLeg;
+		std::size_t lambda134 = (loosestLeg!=trig2Lasym(0))? loosestLeg : secondLoosestLeg;
+		std::size_t lambda234 = (loosestLeg!=trig2Lsym())? loosestLeg : secondLoosestLeg;
+		std::size_t lambda14 = (lambda124!=trig2Lasym(0))? lambda124 : (lambda134!=trig2Lasym(1))? lambda134 : secondTightestLeg;
+		std::size_t lambda24 = (lambda124!=trig2Lsym())? lambda124 : (lambda234!=trig2Lasym(1))? lambda234 : secondTightestLeg;
+		std::size_t lambda34 = (lambda134!=trig2Lsym())? lambda134 : (lambda234!=trig2Lasym(0))? lambda234 : secondTightestLeg;
+		std::size_t tau13=0, tau12=0, tau23=0;
+		if(loosestLeg==trig2Lsym() || loosestLeg==trig2Lasym(0)) tau12 = (loosestLeg==trig2Lsym())? trig2Lasym(0) : trig2Lsym();
+		else if(secondLoosestLeg==trig2Lsym() || secondLoosestLeg==trig2Lasym(0)) tau12 = (secondLoosestLeg==trig2Lsym())? trig2Lasym(0) : trig2Lsym();
+		else if(secondTightestLeg==trig2Lsym() || secondTightestLeg==trig2Lasym(0)) tau12 = (secondTightestLeg==trig2Lsym())? trig2Lasym(0) : trig2Lsym();
+		else if(tightestLeg==trig2Lsym() || tightestLeg==trig2Lasym(0)) tau12 = (tightestLeg==trig2Lsym())? trig2Lasym(0) : trig2Lsym();
+		if(loosestLeg==trig2Lsym() || loosestLeg==trig2Lasym(1)) tau13 = (loosestLeg==trig2Lsym())? trig2Lasym(1) : trig2Lsym();
+		else if(secondLoosestLeg==trig2Lsym() || secondLoosestLeg==trig2Lasym(1)) tau13 = (secondLoosestLeg==trig2Lsym())? trig2Lasym(1) : trig2Lsym();
+		else if(secondTightestLeg==trig2Lsym() || secondTightestLeg==trig2Lasym(1)) tau13 = (secondTightestLeg==trig2Lsym())? trig2Lasym(1) : trig2Lsym();
+		else if(tightestLeg==trig2Lsym() || tightestLeg==trig2Lasym(1)) tau13 = (tightestLeg==trig2Lsym())? trig2Lasym(1) : trig2Lsym();
+		if(loosestLeg==trig2Lasym(0) || loosestLeg==trig2Lasym(1)) tau23 = (loosestLeg==trig2Lasym(0))? trig2Lasym(1) : trig2Lasym(0);
+		else if(secondLoosestLeg==trig2Lasym(0) || secondLoosestLeg==trig2Lasym(1)) tau23 = (secondLoosestLeg==trig2Lasym(0))? trig2Lasym(1) : trig2Lasym(0);
+		else if(secondTightestLeg==trig2Lasym(0) || secondTightestLeg==trig2Lasym(1)) tau23 = (secondTightestLeg==trig2Lasym(0))? trig2Lasym(1) : trig2Lasym(0);
+		else if(tightestLeg==trig2Lasym(0) || tightestLeg==trig2Lasym(1)) tau23 = (tightestLeg==trig2Lasym(0))? trig2Lasym(1) : trig2Lasym(0);
+
+		/// can't use tightestLeg==trig2Lsym because it might also be 0
+		globalEfficiencies = globalEfficiencies*~efficiencies[loosestLeg] + efficiencies[loosest1lepLeg]
+			+ (efficiencies[tau13] - efficiencies[secondTightestLeg])*~singleInefficiencies[0]
+			+ (efficiencies[tau12] - efficiencies[secondTightestLeg])*~singleInefficiencies[1]
+			+ (efficiencies[tau23] - efficiencies[secondTightestLeg])*efficiencies2Lsym[2];
+		if(loosestLeg==trig2Lsym()) globalEfficiencies += (efficiencies[trig2Lsym()]-efficiencies[secondLoosestLeg])*efficiencies2Lasym;
+		else if(loosestLeg==trig2Lasym(1)) globalEfficiencies += (efficiencies[trig2Lasym(1)]-efficiencies[secondLoosestLeg])*efficiencies2Lsym[0];
+		else if(loosestLeg==trig2Lasym(0)) globalEfficiencies += (efficiencies[trig2Lasym(0)]-efficiencies[secondLoosestLeg])*efficiencies2Lsym[1];
+		if(secondTightestLeg && tightestLeg==loosest1lepLeg) /// this works because loosest1lepLeg is 0 if not on plateau...
+			globalEfficiencies += (efficiencies[secondTightestLeg]-efficiencies[tightestLeg])*~singleInefficiencies[2];
+
+		efficiencies2Lasym = ~efficiencies[loosestLeg]*efficiencies2Lasym + efficiencies[lambda14];
+		if(loosestLeg==trig2Lasym(0) || loosestLeg==trig2Lasym(1))
+		{
+			/// note: secondLoosestLeg is valid because the loosest leg is either trig2Lasym(0) or trig2Lasym(1)
+			efficiencies2Lasym += (efficiencies[loosestLeg]-efficiencies[secondLoosestLeg])*~singleInefficiencies[loosestLeg==trig2Lasym(0)]
+				+ (efficiencies[secondLoosestLeg]-efficiencies[lambda14])*~singleInefficiencies[2];
+		}
+		efficiencies2Lsym[0] = ~efficiencies[lambda124]*efficiencies2Lsym[0] + efficiencies[lambda24];
+		efficiencies2Lsym[1] = ~efficiencies[lambda134]*efficiencies2Lsym[1] + efficiencies[lambda34];
+		efficiencies2Lsym[2] = ~efficiencies[loosestLeg]*efficiencies2Lsym[2] + efficiencies[lambda234];
+		if(lambda124==trig2Lsym()) efficiencies2Lsym[0] += (efficiencies[trig2Lsym()]-efficiencies[lambda24])*~singleInefficiencies[0];
+		if(lambda134==trig2Lsym()) efficiencies2Lsym[1] += (efficiencies[trig2Lsym()]-efficiencies[lambda34])*~singleInefficiencies[1];
+		if(loosestLeg==trig2Lsym()) efficiencies2Lsym[2] += (efficiencies[trig2Lsym()]-efficiencies[lambda234])*~singleInefficiencies[2];
+		singleInefficiencies[0] *= ~efficiencies[lambda124];
+		singleInefficiencies[1] *= ~efficiencies[lambda134];
+		singleInefficiencies[2] *= ~efficiencies[loosestLeg];
+	}
+	return success;
+}
+
+///
+/// One symmetric trilepton trigger
+///
+template<typename Trig3Lsym>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber, const Trig3Lsym trig, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig3Lsym::is3Lsym(), bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_One3L() at line " << __LINE__);
+	globalEfficiencies = {0.};
+	Efficiencies singleInefficiencies{1.}, efficiencies2L{0.};
+	bool success = true;
+	for(auto& lepton : leptons)
+	{
+		if(trig.irrelevantFor(lepton) || !aboveThreshold(lepton, trig())) continue;
+		auto efficiencies = getCachedTriggerLegEfficiencies(lepton, runNumber, trig(), success);
+		globalEfficiencies = ~efficiencies*globalEfficiencies + efficiencies*efficiencies2L;
+		efficiencies2L = ~efficiencies*efficiencies2L + efficiencies*~singleInefficiencies;
+		singleInefficiencies *= ~efficiencies;
+	}
+	return success;
+}
+
+///
+/// One half-symmetric trilepton trigger
+///
+template<typename Trig3Lhalfsym>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber, const Trig3Lhalfsym trig, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig3Lhalfsym::is3Lhalfsym(), bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_One3L() at line " << __LINE__);
+	if(trig.symmetric()) return globalEfficiency(leptons, runNumber, trig.to_symmetric(), globalEfficiencies);
+	globalEfficiencies = {0.};
+	Efficiencies singleInefficiencies[2] = {{1.}, {1.}}, twoSingleInefficiencies{1.};
+	Efficiencies efficiencies2Lsym{0.}, efficiencies2Lasym{0.}, efficiencies2L2L{0.};
+	bool success = true;
+	for(auto& lepton : leptons)
+	{
+		if(trig.irrelevantFor(lepton)) continue;
+		Efficiencies efficiencies[2] = {{0.}, {0.}};
+		const int asym = 0, sym = 1;
+		int loosestLeg;
+		if(aboveThreshold(lepton, trig.asymLeg()))
+		{
+			efficiencies[asym] = getCachedTriggerLegEfficiencies(lepton, runNumber, trig.asymLeg(), success);
+			if(aboveThreshold(lepton, trig.symLeg()))
+			{
+				efficiencies[sym] = getCachedTriggerLegEfficiencies(lepton, runNumber, trig.symLeg(), success);
+				loosestLeg = m_parent->getLoosestLeg(lepton, trig.asymLeg(), trig.symLeg(), success)==trig.asymLeg()? asym : sym;
+			}
+			else loosestLeg = asym;
+		}
+		else if(aboveThreshold(lepton, trig.symLeg()))
+		{
+			efficiencies[sym] = getCachedTriggerLegEfficiencies(lepton, runNumber, trig.symLeg(), success);
+			loosestLeg = sym;
+		}
+		else continue;
+		Efficiencies delta = efficiencies[asym] - efficiencies[sym];
+		if(loosestLeg == asym)
+		{
+			globalEfficiencies = ~efficiencies[asym]*globalEfficiencies + efficiencies[sym]*efficiencies2L2L + delta*efficiencies2Lsym;
+			efficiencies2L2L = ~efficiencies[asym]*efficiencies2L2L + efficiencies[sym]*~twoSingleInefficiencies + delta*~singleInefficiencies[sym];
+			efficiencies2Lasym = ~efficiencies[asym]*efficiencies2Lasym + efficiencies[sym]*~twoSingleInefficiencies + delta*~singleInefficiencies[sym];
+		}
+		else
+		{
+			globalEfficiencies = ~efficiencies[sym]*globalEfficiencies + efficiencies[asym]*efficiencies2L2L - delta*efficiencies2Lasym;
+			efficiencies2L2L = ~efficiencies[sym]*efficiencies2L2L + efficiencies[sym]*~twoSingleInefficiencies;
+			efficiencies2Lasym = ~efficiencies[sym]*efficiencies2Lasym + efficiencies[asym]*~twoSingleInefficiencies - delta*~singleInefficiencies[asym];
+		}
+		efficiencies2Lsym = ~efficiencies[sym]*efficiencies2Lsym + efficiencies[sym]*~singleInefficiencies[sym];
+		twoSingleInefficiencies *= ~efficiencies[loosestLeg];
+		singleInefficiencies[sym] *= ~efficiencies[sym];
+		singleInefficiencies[asym] *= ~efficiencies[asym];
+	}
+	return success;
+}
+
+///
+/// One dilepton trigger + one mixed-flavour dilepton trigger
+///
+template<typename Trig2L, typename Trig2Lmix>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber, const Trig2L trig2L, const Trig2Lmix trig2Lmix, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig2L::is2Lnomix()
+						&& Trig2Lmix::is2Lmix()
+						&& (Trig2Lmix::object1()==Trig2L::object() || Trig2Lmix::object2()==Trig2L::object()),
+		bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_Two2L() at line " << __LINE__);
+	Efficiencies efficiencies1L, efficiencies2L, efficiencies2Lor1L;
+	bool success = globalEfficiency(leptons, runNumber, trig2Lmix.template antiside<Trig2L>(), efficiencies1L);
+	success = success && globalEfficiency(leptons, runNumber, trig2L, efficiencies2L);
+	success = success && globalEfficiency(leptons, runNumber, trig2L, trig2Lmix.template side<Trig2L>(), efficiencies2Lor1L);
+	globalEfficiencies = efficiencies2L*~efficiencies1L + efficiencies1L*efficiencies2Lor1L;
+	return success;
+}
+
+///
+/// Combinaisons with 3 dilepton triggers including one mixed-flavour, and one sym./asym. dilepton for each flavour
+///
+template<typename Trig2L_obj1, typename Trig2L_obj2, typename Trig2Lmix>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber,
+		const Trig2L_obj1 trig2L_obj1, const Trig2L_obj2 trig2L_obj2, const Trig2Lmix trig2Lmix, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig2Lmix::is2Lmix()
+						&& Trig2L_obj1::is2Lnomix() && Trig2L_obj1::object() == Trig2Lmix::object1()
+						&& Trig2L_obj2::is2Lnomix() && Trig2L_obj2::object() == Trig2Lmix::object2(),
+						
+		bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_Three2L() at line " << __LINE__);
+	Efficiencies efficiencies2L[2] = {{0.}, {0.}}, efficiencies2Lor1L[2] = {{0.}, {0.}};
+	bool success = true;
+	if(trig2L_obj1)
+	{
+		success = success && globalEfficiency(leptons, runNumber, trig2L_obj1, efficiencies2L[0]);
+		if(trig2Lmix) success = success && globalEfficiency(leptons, runNumber, trig2L_obj1, trig2Lmix.template side<Trig2L_obj1>(), efficiencies2Lor1L[0]);
+		else efficiencies2Lor1L[0] = efficiencies2L[0];
+	}
+	else if(trig2Lmix) success = success && globalEfficiency(leptons, runNumber, trig2Lmix.template side<Trig2L_obj1>(), efficiencies2Lor1L[0]);
+	if(trig2L_obj2)
+	{
+		success = success && globalEfficiency(leptons, runNumber, trig2L_obj2, efficiencies2L[1]);
+		if(trig2Lmix) success = success && globalEfficiency(leptons, runNumber, trig2L_obj2, trig2Lmix.template side<Trig2L_obj2>(), efficiencies2Lor1L[1]);
+		else efficiencies2Lor1L[1] = efficiencies2L[1];
+	}
+	else if(trig2Lmix) success = success && globalEfficiency(leptons, runNumber, trig2Lmix.template side<Trig2L_obj2>(), efficiencies2Lor1L[1]);
+	globalEfficiencies = efficiencies2L[0]*~efficiencies2Lor1L[1] +  efficiencies2L[1]*~efficiencies2Lor1L[0] + efficiencies2Lor1L[0]*efficiencies2Lor1L[1];
+	return success;
+}
+
+///
+/// Same combinaisons with 3 dilepton triggers, + single-lepton triggers
+///
+template<typename Trig2L_obj1, typename Trig2L_obj2, typename Trig2Lmix, typename Trig1L_obj1, typename Trig1L_obj2>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber, const Trig2L_obj1 trig2L_obj1, const Trig2L_obj2 trig2L_obj2,
+		const Trig2Lmix trig2Lmix, const flat_set<Trig1L_obj1>& trigs1L_obj1, const flat_set<Trig1L_obj2>& trigs1L_obj2, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig2Lmix::is2Lmix()
+						&& Trig2L_obj1::is2Lnomix() && Trig2L_obj1::object()==Trig2Lmix::object1()
+						&& Trig2L_obj2::is2Lnomix() && Trig2L_obj2::object()==Trig2Lmix::object2()
+						&& Trig1L_obj1::is1L() && Trig1L_obj1::object()==Trig2Lmix::object1()
+						&& Trig1L_obj2::is1L() && Trig1L_obj2::object()==Trig2Lmix::object2(),
+						
+		bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_Three2LSeveral1L() at line " << __LINE__);
+	Efficiencies efficiencies[4];
+	bool success = true;
+	if(trig2L_obj1) success = success && globalEfficiency(leptons, runNumber, trig2L_obj1, trigs1L_obj1, efficiencies[0]);
+	else success = success && globalEfficiency(leptons, runNumber, trigs1L_obj1, efficiencies[0]);
+	if(trig2L_obj2) success = success && globalEfficiency(leptons, runNumber, trig2L_obj2, trigs1L_obj2, efficiencies[1]);
+	else success = success && globalEfficiency(leptons, runNumber, trigs1L_obj2, efficiencies[1]);
+	if(trig2Lmix && !trig2Lmix.hiddenBy(trigs1L_obj1))
+	{
+		auto t = trig2Lmix.addTo(trigs1L_obj1);
+		if(trig2L_obj1) success = success && globalEfficiency(leptons, runNumber, trig2L_obj1, t, efficiencies[2]);
+		else success = success && globalEfficiency(leptons, runNumber, t, efficiencies[2]);
+	}
+	else efficiencies[2] = efficiencies[0];
+	if(trig2Lmix && !trig2Lmix.hiddenBy(trigs1L_obj2))
+	{
+		auto t = trig2Lmix.addTo(trigs1L_obj2);
+		if(trig2L_obj2) success = success && globalEfficiency(leptons, runNumber, trig2L_obj2, t, efficiencies[3]);
+		else success = success && globalEfficiency(leptons, runNumber, t, efficiencies[3]);
+	}
+	else efficiencies[3] = efficiencies[1];
+	globalEfficiencies = Efficiencies(1.) - ~efficiencies[0]*~efficiencies[1] + (efficiencies[2]-efficiencies[0])*(efficiencies[3]-efficiencies[1]);
+	return success;
+}
+
+///
+/// Six dilepton triggers (two mixed-flavour, two sym., two asym./sym.) for two object types
+///
+template<typename Trig2L_obj1, typename Trig2Lsym_obj1, typename Trig2L_obj2, typename Trig2Lsym_obj2,
+	typename Trig2Lmix, typename Trig1L_obj1, typename Trig1L_obj2>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber,
+		const Trig2L_obj1 trig2L_obj1, const Trig2Lsym_obj1 trig2Lsym_obj1, const Trig2L_obj2 trig2L_obj2, const Trig2Lsym_obj2 trig2Lsym_obj2,
+		const Trig2Lmix trig2Lmix1, const Trig2Lmix trig2Lmix2, 
+		const flat_set<Trig1L_obj1>& trigs1L_obj1, const flat_set<Trig1L_obj2>& trigs1L_obj2, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig2Lmix::is2Lmix()
+						&& Trig2L_obj1::is2Lnomix() && Trig2L_obj1::object()==Trig2Lmix::object1()
+						&& Trig2L_obj2::is2Lnomix() && Trig2L_obj2::object()==Trig2Lmix::object2()
+						&& Trig2Lsym_obj1::is2Lsym() && Trig2Lsym_obj1::object()==Trig2Lmix::object1()
+						&& Trig2Lsym_obj2::is2Lsym() && Trig2Lsym_obj2::object()==Trig2Lmix::object2()
+						&& Trig1L_obj1::is1L() && Trig1L_obj1::object()==Trig2Lmix::object1()
+						&& Trig1L_obj2::is1L() && Trig1L_obj2::object()==Trig2Lmix::object2(),
+		bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_Six2LSeveral1L() at line " << __LINE__);
+	
+	auto singleObjectFactor = [=](auto trig2L, auto trig2Lsym, auto& trigs1L, Efficiencies (&efficiencies)[4]) -> bool
+	{
+		auto eval_for = [=](const auto& trigs1L_extended, Efficiencies& eff) -> bool
+		{
+			if(trig2L && trig2Lsym) return this->globalEfficiency(leptons, runNumber, trig2L, trig2Lsym, trigs1L_extended, eff);
+			else if(trig2L) return this->globalEfficiency(leptons, runNumber, trig2L, trigs1L_extended, eff);
+			else if(trig2Lsym) return this->globalEfficiency(leptons, runNumber, trig2Lsym, trigs1L_extended, eff);
+			else return this->globalEfficiency(leptons, runNumber, trigs1L_extended, eff);
+		};
+	
+		bool success = eval_for(trigs1L, efficiencies[0]);
+		if(trig2Lmix1) success = success && eval_for(trig2Lmix1.addTo(trigs1L), efficiencies[1]);
+		else efficiencies[1] = efficiencies[0];
+		if(trig2Lmix2)
+		{
+			auto t = trig2Lmix2.addTo(trigs1L);
+			success = success && eval_for(t, efficiencies[2]);
+			if(trig2Lmix1) success && eval_for(trig2Lmix1.addTo(t), efficiencies[3]);
+			else efficiencies[3] = efficiencies[2];
+		}
+		else
+		{
+			efficiencies[2] = efficiencies[0];
+			efficiencies[3] = efficiencies[1];
+		}
+		return success;
+	};
+	
+	Efficiencies efficiencies1[4], efficiencies2[4];
+	bool success = singleObjectFactor(trig2L_obj1, trig2Lsym_obj1, trigs1L_obj1, efficiencies1)
+		&& singleObjectFactor(trig2L_obj2, trig2Lsym_obj2, trigs1L_obj2, efficiencies2);
+	globalEfficiencies = Efficiencies(1.) - ~efficiencies1[0]*~efficiencies2[0] + (efficiencies1[1]-efficiencies1[0])*(efficiencies2[1]-efficiencies2[0])
+		+ (efficiencies1[2]-efficiencies1[0])*(efficiencies2[2]-efficiencies2[0]) 
+		- (efficiencies1[0]-efficiencies1[1]-efficiencies1[2]+efficiencies1[3])*(efficiencies2[0]-efficiencies2[1]-efficiencies2[2]+efficiencies2[3]);
+	return success;
+}
+
+///
+/// One mixed-flavour trilepton trigger
+///
+template<typename Trig3Lmix>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber, const Trig3Lmix trig, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig3Lmix::is3Lmix(), bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_One3L() at line " << __LINE__);
+	Efficiencies efficiencies[2] = {{0.}, {0.}};
+	bool success = globalEfficiency(leptons, runNumber, trig.template side<Trig3Lmix::object1()>(), efficiencies[0])
+		&& globalEfficiency(leptons, runNumber, trig.template side<Trig3Lmix::object2()>(), efficiencies[1]);
+	globalEfficiencies = efficiencies[0]*efficiencies[1];
+	return success;
+}
+
+///
+/// Two complementary mixed-flavour trilepton triggers
+///
+template<typename Trig3Lmix1, typename Trig3Lmix2>
+auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber, const Trig3Lmix1 trig1, const Trig3Lmix2 trig2, Efficiencies& globalEfficiencies)
+	-> std::enable_if_t<Trig3Lmix1::is3Lmix() 
+					&& Trig3Lmix2::is3Lmix() 
+					&& Trig3Lmix1::object1() == Trig3Lmix2::object2()
+					&& Trig3Lmix1::object2() == Trig3Lmix2::object1(), 
+		bool>
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_Two3L() at line " << __LINE__);
+	Efficiencies efficiencies[6] = {{0.}, {0.}, {0.}, {0.}, {0.}, {0.}};
+	auto trig2La = trig1.template side<Trig3Lmix1::object1()>();
+	auto trig1La = trig2.template side<Trig3Lmix2::object2()>();
+	bool success = globalEfficiency(leptons, runNumber, trig1La, efficiencies[0])
+		&& globalEfficiency(leptons, runNumber, trig2La, efficiencies[1]);
+	if(!trig2La.hiddenBy(trig1La)) success = success && globalEfficiency(leptons, runNumber, trig2La, trig1La, efficiencies[2]);
+	else efficiencies[2] = efficiencies[0];
+	auto trig2Lb = trig2.template side<Trig3Lmix2::object1()>();
+	auto trig1Lb = trig1.template side<Trig3Lmix1::object2()>();
+	success = success && globalEfficiency(leptons, runNumber, trig1Lb, efficiencies[3])
+		&& globalEfficiency(leptons, runNumber, trig2Lb, efficiencies[4]);
+	if(!trig2Lb.hiddenBy(trig1Lb)) success = success && globalEfficiency(leptons, runNumber, trig2Lb, trig1Lb, efficiencies[5]);
+	else efficiencies[5] = efficiencies[3];
+	globalEfficiencies = efficiencies[0]*efficiencies[4] + efficiencies[3]*efficiencies[1] 
+		+ (efficiencies[2]-efficiencies[0]-efficiencies[1])*(efficiencies[3]+efficiencies[4]-efficiencies[5]);
+	return success;
+}
+
+bool Calculator::globalEfficiency_Factorized2(const LeptonList& leptons, unsigned runNumber, GlobEffFunc func1, GlobEffFunc func2, Efficiencies& globalEfficiencies)
+{
+	Efficiencies efficiencies[2];
+	if(!func1(this, leptons, runNumber, efficiencies[0])) return false;
+	if(!func2(this, leptons, runNumber, efficiencies[1])) return false;
+	globalEfficiencies = ~(~efficiencies[0] * ~efficiencies[1]);
+	return true;
+}
+
+bool Calculator::globalEfficiency_Factorized3(const LeptonList& leptons, unsigned runNumber, GlobEffFunc func1, GlobEffFunc func2, GlobEffFunc func3, Efficiencies& globalEfficiencies)
+{
+	Efficiencies efficiencies[3];
+	if(!func1(this, leptons, runNumber, efficiencies[0])) return false;
+	if(!func2(this, leptons, runNumber, efficiencies[1])) return false;
+	if(!func3(this, leptons, runNumber, efficiencies[2])) return false;
+	globalEfficiencies = ~(~efficiencies[0] * ~efficiencies[1]* ~efficiencies[2]);
+	return true;
+}
+
+bool Calculator::fillListOfLegsFor(const Lepton& lepton, const std::vector<TrigDef>& triggers, flat_set<std::size_t>& validLegs) const
+{
+	validLegs.clear();
+	for(auto& trig : triggers)
+	{
+		TriggerProperties tp(trig);
+		if(!tp.valid())
+		{
+			ATH_MSG_ERROR("Unrecognized trigger type " << trig.type);
+			return false;
+		}
+		auto end = tp.cend(lepton.type());
+		for(auto itr=tp.cbegin(lepton.type()); itr!=end; ++itr)if(aboveThreshold(lepton, *itr)) validLegs.emplace(*itr);
+	}
+	return true;
+}
+
+bool Calculator::canTriggerBeFired(const TrigDef& trig, const std::vector<flat_set<std::size_t> >& firedLegs) const
+{
+	static_assert(std::tuple_size<decltype(trig.leg)>::value == 3, "extend Calculator::canTriggerBeFired() implementation to support triggers with >= 4 legs");
+	int n0=0, n1=0, n0min = 1 + (trig.leg[1]!=0)*(trig.leg[0]!=trig.leg[1]?-5:1) + (trig.leg[2]!=0)*(trig.leg[0]!=trig.leg[2]?-9:1);
+	if(n0min>0 || !trig.leg[2])
+	{
+		for(auto& legs : firedLegs)
+		{
+			bool fire0 = legs.count(trig.leg[0]);
+			if(n0min <= 0) /// Asymmetric dilepton triggers
+			{
+				if(n1 && fire0) return true;
+				if(legs.count(trig.leg[1]))
+				{
+					if(n0) return true;
+					++n1;
+				}
+				if(fire0) ++n0;
+			}
+			else if(fire0 && ++n0>=n0min) return true; /// Single-lepton and symmetric di/trilepton triggers 
+		}
+	}
+	else /// Trilepton triggers (except fully-symmetric ones that are addressed above)
+	{
+		auto end = firedLegs.end();
+		for(auto legs0=firedLegs.begin();legs0!=end;++legs0)
+		{
+			for(int i=0;i<3;++i)
+			{
+				if(!legs0->count(trig.leg[i])) continue;
+				for(auto legs1=legs0+1;legs1!=end;++legs1)
+				{
+					for(int j=1;j<3;++j)
+					{
+						if(!legs1->count(trig.leg[(i+j)%3])) continue;
+						for(auto legs2=legs1+1;legs2!=end;++legs2)
+						{
+							if(legs2->count(trig.leg[(i+3-j)%3])) return true;
+						}
+					}
+				}
+			}
+		}
+	}
+	return false;
+}
+
+bool Calculator::globalEfficiency_Toys(const LeptonList& leptons, unsigned runNumber,
+	const std::vector<TrigDef>& triggers, Efficiencies& globalEfficiencies)
+{
+	ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_Toys() at line " << __LINE__);
+	globalEfficiencies = {0.};
+	if(m_parent->m_numberOfToys <= 0)
+	{
+		ATH_MSG_ERROR("The specified number of toys is <= 0");
+		return false;
+	}
+	std::map<const Lepton*, std::vector<std::pair<std::size_t, Efficiencies> > > leptonEfficiencies;
+	for(auto& lepton : leptons)
+	{
+		flat_set<std::size_t> validLegs;
+		if(!fillListOfLegsFor(lepton, triggers, validLegs)) return false;
+		auto& efficiencies = leptonEfficiencies[&lepton];
+		const int nLegs = validLegs.size();
+		if(nLegs)
+		{
+			bool success = true;
+			for(std::size_t leg : m_parent->getSortedLegs(lepton, validLegs, success))
+			{
+				efficiencies.emplace_back(leg, getCachedTriggerLegEfficiencies(lepton, runNumber, leg, success));
+			}
+			if(!success) return false;
+		}
+	}
+	unsigned long seed;
+	if(!m_parent->m_useInternalSeed)
+	{
+		if(!m_parent->retrieveEventNumber(seed))
+		{
+			ATH_MSG_WARNING("Will use internal seed instead of event number");
+			seed = m_parent->m_seed++;
+		}
+	}
+	else seed = m_parent->m_seed++;
+	std::mt19937_64 randomEngine(seed);
+	std::uniform_real_distribution<double> uniformPdf(0., 1.);
+	std::vector<flat_set<std::size_t> > firedLegs(leptonEfficiencies.size());
+	unsigned long nPassed[2] = {0, 0};
+	for(unsigned long toy=0;toy<m_parent->m_numberOfToys;++toy)
+	{
+		for(int step=0;step<2;++step) /// 0 = data, 1 = MC
+		{
+			auto legs = firedLegs.begin();
+			for(auto& kv : leptonEfficiencies)
+			{
+				legs->clear();
+				double x = uniformPdf(randomEngine);
+				for(auto& p : kv.second)
+				{
+					if(x < (step? p.second.mc(): p.second.data())) legs->emplace(p.first);
+				}
+				++legs;
+			}
+			for(auto& trig : triggers)
+			{
+				if(!canTriggerBeFired(trig, firedLegs)) continue;
+				++nPassed[step];
+				break;
+			}
+		}
+	}
+	globalEfficiencies.data() = double(nPassed[0]) / double(m_parent->m_numberOfToys);
+	globalEfficiencies.mc() = double(nPassed[1]) / double(m_parent->m_numberOfToys);
+	return true;
+}
+
+Calculator::Helper::Helper(const std::vector<TrigDef>& defs) :
+	m_formula(nullptr), m_defs(defs)
+{
+}
+
+bool Calculator::Helper::duplicates() const
+{
+	for(auto itr1=m_defs.cbegin(); itr1!=m_defs.cend(); ++itr1)
+		for(auto itr2=itr1+1; itr2!=m_defs.cend(); ++itr2)
+			if(itr1->type==itr2->type && itr1->leg==itr2->leg) return true;
+	return false;
+}
+
+namespace TrigGlobEffCorr /// the template specializations below must be enclosed in this namespace
+{
+	template<typename T>
+	struct TrigGlobEffCorr::Calculator::Helper::BindPackedParam
+	{
+		using TrigType = T;
+		using ArgType = std::add_const_t<T>;
+		static constexpr bool multiple() { return false; }
+		static constexpr bool optional() { return false; }
+		static void add(T& arg, ImportData::TrigDef& def) { arg.setDefinition(def); }
+		static constexpr bool valid(const T& arg) { return bool(arg); }
+	};
+
+	template<typename T>
+	struct TrigGlobEffCorr::Calculator::Helper::BindPackedParam<flat_set<T>>
+	{
+		using TrigType = T;
+		using ArgType = const flat_set<T>&;
+		static constexpr bool multiple() { return true; }
+		static constexpr bool optional() { return false; }
+		static void add(flat_set<T>& arg, ImportData::TrigDef& def) { arg.emplace().first->setDefinition(def); }
+		static constexpr bool valid(const flat_set<T>& arg) { return arg.size(); }
+	};
+
+	template<typename T>
+	struct TrigGlobEffCorr::Calculator::Helper::BindPackedParam<Calculator::Helper::Optional<T>>
+	{
+		using TrigType = typename BindPackedParam<T>::TrigType;
+		using ArgType = typename BindPackedParam<T>::ArgType;
+		static constexpr bool multiple() { return BindPackedParam<T>::multiple(); }
+		static constexpr bool optional() { return true; }
+		static void add(std::remove_cv_t<std::remove_reference_t<ArgType>>& arg, ImportData::TrigDef def) { BindPackedParam<T>::add(arg, def); }
+		static constexpr bool valid(ArgType& arg) { return BindPackedParam<T>::valid(arg); }
+	};
+}
+
+template<typename Param>
+auto Calculator::Helper::extract() 
+{
+	std::remove_cv_t<std::remove_reference_t<typename Param::ArgType>> trigs;
+	for(auto& def : m_defs)
+	{
+		if(def.used || def.type!=Param::TrigType::type()) continue;
+		def.used = true;
+		Param::add(trigs, def);
+		if(!Param::multiple()) break;
+	}
+	if(!Param::optional() && !Param::valid(trigs)) throw NoSuchTrigger();
+	return trigs;
+}
+
+template<typename... Trigs>
+bool Calculator::Helper::bindFunction()
+{
+	for(auto& def : m_defs) def.used = false;
+	using fnptr = bool(Calculator::*)(const LeptonList&, unsigned, typename BindPackedParam<Trigs>::ArgType..., Efficiencies&);
+	try
+	{
+		m_formula = std::bind<fnptr>(&Calculator::globalEfficiency, ::_1, ::_2, ::_3, extract<BindPackedParam<Trigs>>()..., ::_4);
+		if(std::all_of(m_defs.cbegin(), m_defs.cend(), [](auto& def){return def.used;})) return true;
+	}
+	catch(NoSuchTrigger){}
+	m_formula = nullptr;
+	return false;
+}
+
+template<TriggerType object_flag>
+bool Calculator::Helper::findAndBindFunction() /// for combinations with a single flavour present
+{
+	using A = TriggerClass<object_flag>;
+	using A1L = flat_set<typename A::T_1>;
+	using A_2sym = typename A::T_2sym;
+	using A_2asym = typename A::T_2asym;
+	if(!m_n2L && !m_n3L)
+	{
+		return bindFunction<typename A::T_1>() || bindFunction<A1L>();
+	}
+	else if(m_n2L==1 && !m_n3L)
+	{
+		return bindFunction<A_2sym>() || bindFunction<A_2asym>()
+			|| bindFunction<A_2sym, A1L>() || bindFunction<A_2asym, A1L>();
+	}
+	else if(m_n2L==2 && !m_n3L)
+	{
+		return bindFunction<A_2sym, A_2sym, Optional<A1L>>() || bindFunction<A_2asym, A_2sym, Optional<A1L>>();
+	}
+	else if(m_n3L==1 && !m_n1L && !m_n2L)
+	{
+		return bindFunction<typename A::T_3sym>() || bindFunction<typename A::T_3halfsym>();
+	}
+	return false;
+}
+
+template<TriggerType object_flag1, TriggerType object_flag2>
+bool Calculator::Helper::findAndBindFunction() /// for combinations with two flavours present
+{
+	/// this only deals with the presence of mixed triggers
+	using A = TriggerClass<object_flag1>;
+	using B = TriggerClass<object_flag2>;
+	using AB = TriggerClass<object_flag1, object_flag2>;
+	using A_1 = typename A::T_1;
+	using B_1 = typename B::T_1;		
+	using OA1L = Optional<flat_set<A_1>>;
+	using OB1L = Optional<flat_set<B_1>>;
+	using A_2sym = typename A::T_2sym;
+	using B_2sym = typename B::T_2sym;
+	using A_2asym = typename A::T_2asym;
+	using B_2asym = typename B::T_2asym;
+	using AB_1_1 = typename AB::T_1_1;
+	
+	/// checked if triggers can be factorized = no mixed trigger in the combination.
+	if(m_n1L>0 && !m_n2L && !m_n3L)
+	{
+		return bindFunction<A_1, B_1>() || bindFunction<flat_set<A_1>, flat_set<B_1>>();
+	}
+	else if(m_n2L==1 && !m_n3L) /// one dilepton trigger (+ single-lepton triggers)
+	{
+		return bindFunction<AB_1_1>() || bindFunction<AB_1_1, flat_set<A_1>, flat_set<B_1>>();
+	}
+	else if(m_n2L>=2 && m_n2L<=6 && !m_n3L) /// several dilepton triggers (+ single-lepton triggers)
+	{
+		return 
+			/// 2 dilepton triggers
+			   bindFunction<A_2sym, AB_1_1>() || bindFunction<A_2asym, AB_1_1>()
+			|| bindFunction<B_2sym, AB_1_1>() || bindFunction<B_2asym, AB_1_1>()
+			/// 3 dilepton triggers
+			|| bindFunction<Optional<A_2sym>, Optional<B_2sym>, Optional<AB_1_1>, OA1L, OB1L>()
+			|| bindFunction<Optional<A_2asym>, Optional<B_2sym>, Optional<AB_1_1>, OA1L, OB1L>()
+			|| bindFunction<Optional<A_2sym>, Optional<B_2asym>, Optional<AB_1_1>, OA1L, OB1L>()
+			|| bindFunction<Optional<A_2asym>, Optional<B_2asym>, Optional<AB_1_1>, OA1L, OB1L>()
+			/// 6 dilepton triggers
+			|| bindFunction<Optional<A_2sym>, Optional<A_2sym>, Optional<B_2sym>, Optional<B_2sym>, Optional<AB_1_1>, Optional<AB_1_1>, OA1L, OB1L>()
+			|| bindFunction<Optional<A_2asym>, Optional<A_2sym>, Optional<B_2sym>, Optional<B_2sym>, Optional<AB_1_1>, Optional<AB_1_1>, OA1L, OB1L>()
+			|| bindFunction<Optional<A_2sym>, Optional<A_2sym>, Optional<B_2asym>, Optional<B_2sym>, Optional<AB_1_1>, Optional<AB_1_1>, OA1L, OB1L>()
+			|| bindFunction<Optional<A_2asym>, Optional<A_2sym>, Optional<B_2asym>, Optional<B_2sym>, Optional<AB_1_1>, Optional<AB_1_1>, OA1L, OB1L>();
+	}
+	else if(m_n3L==1 && !m_n2L && !m_n1L) /// one mixed trilepton trigger
+	{
+		return bindFunction<typename AB::T_2sym_1>() || bindFunction<typename AB::T_1_2sym>()
+			||  bindFunction<typename AB::T_2asym_1>() || bindFunction<typename AB::T_1_2asym>();
+	}
+	else if(m_n3L==2 && !m_n2L && !m_n1L) /// two mixed trilepton triggers
+	{
+		return bindFunction<typename AB::T_2sym_1, typename AB::T_1_2sym>() 
+			|| bindFunction<typename AB::T_2asym_1, typename AB::T_1_2sym>()
+			|| bindFunction<typename AB::T_2sym_1, typename AB::T_1_2asym>() 
+			|| bindFunction<typename AB::T_2asym_1, typename AB::T_1_2asym>();
+	}
+	return false;
+}
+
+bool Calculator::Helper::findAndBindFunction() /// top-level function
+{
+	auto countTriggers = [&](auto nlep_flag) { return std::count_if(m_defs.cbegin(), m_defs.cend(), [=](auto& def){return def.type&nlep_flag;}); };
+	m_n1L = countTriggers(TT_SINGLELEPTON_FLAG);
+	m_n2L = countTriggers(TT_DILEPTON_FLAG);
+	m_n3L = countTriggers(TT_TRILEPTON_FLAG);
+	auto exclusively = [&](auto obj_flags) { return std::none_of(m_defs.cbegin(), m_defs.cend(), [=](auto& def){return def.type&TT_MASK_FLAVOUR&~obj_flags;}); };
+
+	/// First check if the trigger combination refers to a single object type
+	if(exclusively(TT_ELECTRON_FLAG)) return findAndBindFunction<TT_ELECTRON_FLAG>();
+	if(exclusively(TT_MUON_FLAG)) return findAndBindFunction<TT_MUON_FLAG>();
+	if(exclusively(TT_PHOTON_FLAG)) return findAndBindFunction<TT_PHOTON_FLAG>();
+
+	/// Then try to rely on available formulas for combinations with two object types
+	bool success = false;
+	if(exclusively(TT_ELECTRON_FLAG|TT_MUON_FLAG)) success = findAndBindFunction<TT_ELECTRON_FLAG,TT_MUON_FLAG>();
+	else if(exclusively(TT_ELECTRON_FLAG|TT_PHOTON_FLAG)) success = findAndBindFunction<TT_ELECTRON_FLAG,TT_PHOTON_FLAG>();
+	else if(exclusively(TT_MUON_FLAG|TT_PHOTON_FLAG)) success = findAndBindFunction<TT_MUON_FLAG,TT_PHOTON_FLAG>();
+	if(success) return true;
+	
+	/// As a last resort, maybe factorizing helps
+	std::vector<Helper> helpers;
+	for(auto obj_flag : {TT_ELECTRON_FLAG, TT_MUON_FLAG, TT_PHOTON_FLAG})
+	{
+		if(std::any_of(m_defs.cbegin(), m_defs.cend(), /// check there's no mixed-flavour trigger involving 'obj_flag'
+			[&](auto& def){ return (def.type&obj_flag) && TriggerProperties(def.type).mixed();})) continue;
+		std::vector<ImportData::TrigDef> trigs1, trigs2;
+		std::partition_copy(m_defs.begin(), m_defs.end(), std::back_inserter(trigs1), std::back_inserter(trigs2), [&](auto& def){ return (def.type&obj_flag); });
+		m_defs.swap(trigs2);
+		if(!trigs1.size()) continue;
+		helpers.emplace_back(trigs1);
+		if(!helpers.back().findAndBindFunction()) return false;
+	}
+	if(helpers.size())
+	{
+		if(m_defs.size())
+		{
+			if(!findAndBindFunction()) return false;
+			if(helpers.size() == 1) m_formula = std::bind(&Calculator::globalEfficiency_Factorized2, ::_1, ::_2, ::_3, 
+				std::move(m_formula), std::move(helpers[0].m_formula), ::_4);
+			else if(helpers.size()==2) m_formula = std::bind(&Calculator::globalEfficiency_Factorized3, ::_1, ::_2, ::_3, 
+				std::move(m_formula), std::move(helpers[0].m_formula), std::move(helpers[1].m_formula), ::_4);
+			else
+			{
+				m_formula = nullptr;
+				return false;
+			}
+		}
+		else	
+		{
+			if(helpers.size() == 2) m_formula = std::bind(&Calculator::globalEfficiency_Factorized2, ::_1, ::_2, ::_3, 
+				std::move(helpers[0].m_formula), std::move(helpers[1].m_formula), ::_4);
+			else if(helpers.size() == 3) m_formula = std::bind(&Calculator::globalEfficiency_Factorized3, ::_1, ::_2, ::_3, 
+				std::move(helpers[0].m_formula), std::move(helpers[1].m_formula), std::move(helpers[2].m_formula), ::_4);
+			else return false;
+		}
+		return true;
+	}
+
+	return false;
+}
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/CheckConfig.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/CheckConfig.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..64750ee19ea87d41a13008719589252df513647a
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/CheckConfig.cxx
@@ -0,0 +1,294 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+// contact: jmaurer@cern.ch
+
+#include "TrigGlobalEfficiencyCorrection/CheckConfig.h"
+#include "TrigGlobalEfficiencyCorrection/ImportData.h"
+#include "TrigGlobalEfficiencyCorrection/Calculator.h"
+#include <boost/container/flat_set.hpp>
+template<typename Key> using flat_set = boost::container::flat_set<Key>;
+
+#include <cctype>
+
+using CheckConfig = TrigGlobEffCorr::CheckConfig;
+using ImportData = TrigGlobEffCorr::ImportData;
+
+
+CheckConfig::CheckConfig(TrigGlobalEfficiencyCorrectionTool& parent) :
+	asg::AsgMessaging(&parent), m_parent(parent)
+{
+	msg().setLevel(parent.msg().level());
+}
+
+
+template<class CPTool>
+ToolHandle<CPTool>* CheckConfig::findToolByName(ToolHandleArray<CPTool>& suppliedTools, const std::string& name)
+{
+	for(auto& tool : suppliedTools)
+	{
+		if(tool.name()==name || tool->name()==name) // athena: not always the same
+		{
+			return &tool;
+		}
+	}
+	return nullptr;
+}
+
+bool CheckConfig::basicConfigChecks()
+{
+	bool success = true;
+	
+	if(m_parent.m_suppliedElectronEfficiencyTools.size() != m_parent.m_suppliedElectronScaleFactorTools.size())
+	{
+		ATH_MSG_ERROR("The numbers of electron tools supplied via the 'ElectronEfficiencyTools' and 'ElectronScaleFactorTools' properties should be identical");
+		return false;
+	}
+	
+	if(m_parent.m_suppliedPhotonEfficiencyTools.size() != m_parent.m_suppliedPhotonScaleFactorTools.size())
+	{
+		ATH_MSG_ERROR("The numbers of photon tools supplied via the 'PhotonEfficiencyTools' and 'PhotonScaleFactorTools' properties should be identical");
+		return false;
+	}
+	
+	/// All tools mentioned in 'ListOfLegsPerTool' must be in 'ElectronEfficiencyTools' or 'ElectronScaleFactorTools' (or equivalent photon tools)
+	for(auto& kv : m_parent.m_legsPerTool)
+	{
+		auto& name = kv.first;
+		if(findToolByName(m_parent.m_suppliedElectronEfficiencyTools, name)
+			|| findToolByName(m_parent.m_suppliedElectronScaleFactorTools, name)
+			|| findToolByName(m_parent.m_suppliedPhotonEfficiencyTools, name)
+			|| findToolByName(m_parent.m_suppliedPhotonScaleFactorTools, name)
+			) continue;
+		success = false;
+		if(findToolByName(m_parent.m_suppliedMuonTools, name))
+		{
+			ATH_MSG_ERROR("Muon tool " << name << " mentioned in property 'ListOfLegsPerTool', which is only aimed at electron and photon tools");
+		}
+		else
+		{
+			std::string known_tools = "; the known tools are";
+			for(auto& tool : m_parent.m_suppliedElectronEfficiencyTools) known_tools += " " + tool.name();
+			for(auto& tool : m_parent.m_suppliedElectronScaleFactorTools) known_tools += " " + tool.name();
+			for(auto& tool : m_parent.m_suppliedPhotonEfficiencyTools) known_tools += " " + tool.name();
+			for(auto& tool : m_parent.m_suppliedPhotonScaleFactorTools) known_tools += " " + tool.name();
+			ATH_MSG_ERROR("Unknown tool " << name << " mentioned in property 'ListOfLegsPerTool'" << known_tools);
+		}
+	}
+	if(!success) return false;
+	
+	/// All electron/photon tools must be associated to trigger legs (except when there's only one tool)
+	auto toolsHaveLegInfo = [this](auto& effTools, auto& sfTools, const char* type)
+	{
+		if(effTools.size() < 2) return true;
+		bool success = true;
+		for(int i=0;i<2;++i)
+		{
+			for(auto& tool : (i? effTools: sfTools))
+			{
+				const std::string& name = tool.name();
+				if(m_parent.m_legsPerTool.find(name) == m_parent.m_legsPerTool.end())
+				{
+					ATH_MSG_ERROR(type << " tool " << name << " associated trigger legs are not indicated in 'ListOfLegsPerTool', "
+						"doing so is mandatory when several tools are used");
+					success = false;
+				}
+			}
+		}
+		return success;
+	};
+	success &= toolsHaveLegInfo(m_parent.m_suppliedElectronEfficiencyTools, m_parent.m_suppliedElectronScaleFactorTools, "Electron");
+	success &= toolsHaveLegInfo(m_parent.m_suppliedPhotonEfficiencyTools, m_parent.m_suppliedPhotonScaleFactorTools, "Photon");
+	if(!success) return false;
+	
+	/// 
+	/// Additional checks when tags are used
+	///
+	
+	if(m_parent.m_leptonTagDecorations == "")
+	{
+		if(m_parent.m_muonLegsPerTag.size() || m_parent.m_electronLegsPerTag.size()
+			|| m_parent.m_legsPerTag.size() || m_parent.m_tagsPerTool.size())
+		{
+			ATH_MSG_ERROR("the property 'LeptonTagDecorations' must be filled when any of 'ListOfTagsPerTool'"
+				" / 'ListOfLegsPerTag' / 'MuonLegsPerTag' / 'ElectronLegsPerTag' is.");
+			return false;
+		}
+		return true;
+	}
+	
+	/// All tools mentioned in 'ListOfTagsPerTool' must be known
+	unsigned nElectronToolsWithTags = 0, nMuonToolsWithTags = 0, nPhotonToolsWithTags = 0;
+	for(auto& kv : m_parent.m_tagsPerTool)
+	{
+		auto& name = kv.first;
+		if(findToolByName(m_parent.m_suppliedElectronEfficiencyTools, name)
+			|| findToolByName(m_parent.m_suppliedElectronScaleFactorTools, name)) ++nElectronToolsWithTags;
+		else if(findToolByName(m_parent.m_suppliedMuonTools, name)) ++nMuonToolsWithTags;
+		else if(findToolByName(m_parent.m_suppliedPhotonEfficiencyTools, name)
+			|| findToolByName(m_parent.m_suppliedPhotonScaleFactorTools, name)) ++nPhotonToolsWithTags;
+		else
+		{
+			success = false;
+			std::string all_tools = "; the known tools are";
+			for(auto& tool : m_parent.m_suppliedElectronEfficiencyTools) all_tools += " " + tool.name();
+			for(auto& tool : m_parent.m_suppliedElectronScaleFactorTools) all_tools += " " + tool.name();
+			for(auto& tool : m_parent.m_suppliedPhotonEfficiencyTools) all_tools += " " + tool.name();
+			for(auto& tool : m_parent.m_suppliedPhotonScaleFactorTools) all_tools += " " + tool.name();
+			ATH_MSG_ERROR("Unknown tool " << name << " mentioned in property 'ListOfTagsPerTool'");
+		}
+	}
+	/// Either all muon tools are associated to tags, either none
+	if(nMuonToolsWithTags && (nMuonToolsWithTags != m_parent.m_suppliedMuonTools.size()))
+	{
+		ATH_MSG_ERROR("Not all muon tools have been associated with tags in the 'ListOfTagsPerTool' property");
+		success = false;
+	}
+	/// Either all electron tools are associated to tags, either none
+	unsigned nSupplied = m_parent.m_suppliedElectronEfficiencyTools.size() + m_parent.m_suppliedElectronScaleFactorTools.size();
+	if(nElectronToolsWithTags && (nElectronToolsWithTags!=nSupplied))
+	{
+		ATH_MSG_ERROR("Not all electron tools have been associated with tags in the 'ListOfTagsPerTool' property");
+		success = false;
+	}
+	if(!success) return false;
+	/// Either all photon tools are associated to tags, either none
+	nSupplied = m_parent.m_suppliedPhotonEfficiencyTools.size() + m_parent.m_suppliedPhotonScaleFactorTools.size();
+	if(nPhotonToolsWithTags && (nPhotonToolsWithTags!=nSupplied))
+	{
+		ATH_MSG_ERROR("Not all photon tools have been associated with tags in the 'ListOfTagsPerTool' property");
+		success = false;
+	}
+	if(!success) return false;
+
+	/*
+	 *  More checks that are done in other places (or still need to be implemented!):
+	 *
+	 * - [advancedConfigChecks()] for each entry in ListOfLegsPerTag there must be a suitable tool for that tag and leg(s)
+	 * - [enumerateTools()] no two electron/photon tools share the same {leg,tag} combination
+	 * - [enumerateTools()] no two muon tools share the same tag
+	 * - [advancedConfigChecks()] electron efficiency and scale factors have identical configurations: for each eff. tool leg/tag we must find a SF tool, and the other leg/tag pairs associated to those tools must be identical.
+	 * - [UNCHECKED] if tags are used with electron (resp. muon, photon) tools, then all electron (muon, photon) tools must have an entry in ListOfTagsPerTool. Done partially in this function, but the case where no tools are tagged (yet tags are used, according to ListOfLegsPerTag or LeptonTagDecorations) escapes detection. 
+	 * - [loadTagsConfiguration()] each entry of ListOfLegsPerTag can be matched to a suitable tool
+	 * - [UNCHECKED] suffixed tag read from a lepton must correspond to a know tag
+	 * - [enumerateTools()] list of legs associated to each tool contains only known legs
+	 * - [UNCHECKED TrigGlobEffCorrImportData import* functions] various consistency checks of the configuration files
+	 * - [advancedConfigChecks()] user-specified periods are orthogonal
+	 * - [ImportData::parseTriggerString()] no duplicated triggers in the combination
+	 * - [UNCHECKED] for each configured electron/photon tool there is at least one associated tag^leg pair in 'ListOfLegsPerTag' (unless no electron/photon tags used)
+	 * - [UNCHECKED] for each configured muon tool there is at least one associated tag in 'MuonLegsPerTag' (unless empty)
+	 * - [enumerateTools()] electron tools can't be associated to photon legs; and reciprocally
+	 */
+	
+	return success;
+}
+
+bool CheckConfig::advancedConfigChecks()
+{
+	/// This method requires all (most) of TrigGlobalEfficiencyCorrectionTool internal variables to have been properly initialized already
+	/// -> to be called as the last step of TrigGlobalEfficiencyCorrectionTool::initialize()
+	bool success = true;
+
+	using ToolKey = TrigGlobalEfficiencyCorrectionTool::ToolKey;
+	
+	/// Check that for each electron/photon efficiency tool there is an associated scale factor tool
+	/// with the same associated legs and tags. And vice versa. 
+	auto checkConsistency = [this](auto& effToolIndex, auto& sfToolIndex, const char* type)
+	{
+		bool mismatch = (effToolIndex.size() != sfToolIndex.size());
+		if(!mismatch)
+		{
+			for(auto& kv : sfToolIndex)
+			{
+				auto itr = effToolIndex.find(kv.first);
+				if(itr != effToolIndex.end())
+				{
+					std::size_t index1 = kv.second, index2 = itr->second;
+					flat_set<ToolKey> pairs1, pairs2;
+					for(auto& kv : sfToolIndex) if(kv.second==index1) pairs1.insert(kv.first);
+					for(auto& kv : effToolIndex) if(kv.second==index2) pairs2.insert(kv.first);
+					if(pairs1 != pairs2) mismatch = true;
+				}
+				else mismatch = true;
+			}
+		}
+		if(mismatch)
+		{
+			ATH_MSG_ERROR("There must be a one-to-one correspondence between the " << type << " efficiency and scale factor tools "
+				"(including their associated trigger legs and selection tags)");
+			return false;
+		}
+		return true;
+	};
+	if(!checkConsistency(m_parent.m_electronEffToolIndex, m_parent.m_electronSfToolIndex, "electron")) return false;
+	if(!checkConsistency(m_parent.m_photonEffToolIndex, m_parent.m_photonSfToolIndex, "photon")) return false;
+	
+	/// A suitable CP tool must be available for each entry of 'ListOfLegsPerTag'
+	for(auto& kv : m_parent.m_legsPerTag)
+	{
+		std::size_t tag = (kv.first!="*")? m_parent.m_hasher(kv.first) : 0;
+		for(std::size_t leg : m_parent.listNonOrderedCSValues(kv.second,success))
+		{
+			auto type = ImportData::associatedLeptonFlavour(m_parent.m_dictionary[leg],success);
+			if(type == xAOD::Type::Electron)
+			{
+				if(m_parent.m_electronEffToolIndex.find(ToolKey(leg, tag)) == m_parent.m_electronEffToolIndex.end())
+				{
+					ATH_MSG_ERROR("No electron tool provided for the combination of trigger leg '" << m_parent.m_dictionary[leg]
+						<< "' and selection tag '" << kv.first << "' mentioned in the property 'ListOfLegsPerTag'");
+					success = false;
+				}
+			}
+			else if(type == xAOD::Type::Muon)
+			{
+				if(m_parent.m_muonToolIndex.find(ToolKey(0, tag)) == m_parent.m_muonToolIndex.end())
+				{
+					ATH_MSG_ERROR("No muon tool provided for the combination of trigger leg '" << m_parent.m_dictionary[leg]
+						<< "' and selection tag '" << kv.first << "' mentioned in the property 'ListOfLegsPerTag'");
+					success = false;
+				}
+			}
+			else if(type == xAOD::Type::Photon)
+			{
+				if(m_parent.m_photonEffToolIndex.find(ToolKey(leg, tag)) == m_parent.m_photonEffToolIndex.end())
+				{
+					ATH_MSG_ERROR("No photon tool provided for the combination of trigger leg '" << m_parent.m_dictionary[leg]
+						<< "' and selection tag '" << kv.first << "' mentioned in the property 'ListOfLegsPerTag'");
+					success = false;
+				}
+			}
+			else
+			{					
+				ATH_MSG_ERROR("Unable to determine which lepton flavour is associated to the trigger leg '" << m_parent.m_dictionary[leg] << "' in the property 'ListOfLegsPerTag'");
+				success = false;
+			}
+		}
+	}
+	if(!success) return false;
+	
+	/// Periods don't overlap
+	auto periods = m_parent.m_calculator->m_periods;	
+	const auto periods_end =  periods.end();
+	for(auto itr1=periods.begin(); itr1!=periods_end; ++itr1)
+	{
+		auto& x = itr1->m_boundaries;
+		if(x.second < x.first)
+		{
+			ATH_MSG_ERROR("One of the periods specified in TriggerCombination has runMin (" << x.first << ") > runMax ("  << x.second << ")");
+			success = false;
+		}
+		for(auto itr2=itr1+1; itr2!=periods_end; ++itr2)
+		{
+			auto& y = itr2->m_boundaries;
+			if((x.first>=y.first && x.first<=y.second) || (x.second>=y.first && x.second<=y.second))
+			{
+				ATH_MSG_ERROR("The periods specified in TriggerCombination overlap");
+				success = false;
+			}
+		}
+	}
+	if(!success) return false;
+	
+	return success;
+}
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/ImportData.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/ImportData.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..4b4e6378b5ca0dd302cbfa8cf4efc2c7eb286646
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/ImportData.cxx
@@ -0,0 +1,727 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+// contact: jmaurer@cern.ch
+
+#include "TrigGlobalEfficiencyCorrection/ImportData.h"
+#include "PathResolver/PathResolver.h"
+
+#include <fstream>
+#include <functional>
+#include <algorithm>
+
+using ImportData = TrigGlobEffCorr::ImportData;
+
+ImportData::ImportData() :
+	/// the following two variables are owned by this tool and released in the destructor
+	asg::AsgMessaging("TrigGlobalEfficiencyCorrectionTool"),
+	m_parent(nullptr),
+	m_dictionary(*new std::map<std::size_t,std::string>),
+	m_hasher(*new std::hash<std::string>)
+{
+}
+
+ImportData::ImportData(TrigGlobalEfficiencyCorrectionTool& parent) :
+	asg::AsgMessaging(&parent),
+	m_parent(&parent),
+	m_dictionary(parent.m_dictionary),
+	m_hasher(parent.m_hasher)
+{
+	msg().setLevel(parent.msg().level());
+}
+
+ImportData::~ImportData()
+{
+	if(!m_parent)
+	{
+		delete &m_dictionary;
+		delete &m_hasher;
+	}
+}
+
+bool ImportData::importAll(const std::map<std::string, std::string>& overridenThresholds)
+{
+	return importPeriods()
+		&& importThresholds(overridenThresholds)
+		&& importTriggers()
+		&& importHierarchies();
+}
+
+bool ImportData::readDataFile(const char* filename, std::vector<std::string>& contents)
+{
+	contents.clear();
+	bool success = true;
+	auto name = PathResolverFindCalibFile(filename);
+	if(name.length())
+	{
+		std::ifstream f(name.c_str(),std::ios_base::in);
+		if(f.is_open())
+		{
+			std::string line;
+			while(f.good())
+			{
+				if(std::getline(f,line))
+				{
+					auto i = line.find('#');
+					if(i != std::string::npos) line = line.substr(0,i);
+					if(line.length() >= 3) contents.emplace_back(std::move(line));
+				}
+			}
+			if(!f.eof())
+			{
+				ATH_MSG_ERROR("Issue encountered while reading configuration file " << filename);
+				success = false;
+			}
+			f.close();
+			return true;
+		}
+		else
+		{
+		ATH_MSG_ERROR("Unable to open configuration file " << filename);
+			success = false;
+		}
+	}
+	else
+	{
+		ATH_MSG_ERROR("Unable to find configuration file " << filename);
+		success = false;
+	}
+	return success;
+}
+
+void ImportData::setNonMixed3LType(TrigDef& def, TriggerType flavourFlag)
+{
+	if(def.leg[0]==def.leg[1] && def.leg[1]==def.leg[2]) def.type = static_cast<TriggerType>(TT_TRILEPTON_SYM | flavourFlag);
+	else if(def.leg[0]!=def.leg[1] && def.leg[1]!=def.leg[2] && def.leg[0]!=def.leg[2]) def.type = static_cast<TriggerType>(TT_TRILEPTON_ASYM | flavourFlag);
+	else /// swap legs so that the last two are identical, for later convenience
+	{
+		if(def.leg[1]!=def.leg[0] && def.leg[1]!=def.leg[2]) std::swap(def.leg[0],def.leg[1]);
+		else if(def.leg[2]!=def.leg[0] && def.leg[2]!=def.leg[1]) std::swap(def.leg[0],def.leg[2]);
+		def.type = static_cast<TriggerType>(TT_TRILEPTON_HALFSYM | flavourFlag);
+	}
+}
+
+bool ImportData::importTriggers()
+{
+	if(!m_triggerThresholds.size() && !importThresholds()) return false;
+	m_triggerDefs.clear();
+	std::vector<std::string> config;
+	if(!readDataFile("TrigGlobalEfficiencyCorrection/Triggers.cfg", config)) return false;
+	std::stringstream ss;
+	std::string triggerName, token;
+	bool success = true;
+	for(auto& line : config)
+	{
+                ATH_MSG_DEBUG(line);
+		ss.clear();
+		ss.str(line);
+		ss >> triggerName;
+		std::size_t h = m_hasher(triggerName);
+		m_dictionary[h] = triggerName;
+		ATH_MSG_DEBUG(std::to_string(h) << " " << triggerName );
+		auto& def = m_triggerDefs[h];
+		def.name = h;
+		for(std::size_t& leg : def.leg)
+		{
+			if(!(ss >> token)) break;
+			h = m_hasher(token);
+			m_dictionary.emplace(h,token);
+			leg = h;
+			if(m_triggerThresholds.find(h) == m_triggerThresholds.end())
+			{
+				ATH_MSG_ERROR("Unknown trigger leg '" << token << "' found in Triggers.cfg");
+				success = false;
+			}
+		}
+		if(!def.leg[0])
+		{
+			def.leg[0] = h; /// default: assume the leg's name is the same as the full trigger name
+			if(m_triggerThresholds.find(h) == m_triggerThresholds.end())
+			{
+				ATH_MSG_ERROR("Unknown trigger leg '" << triggerName << "' (inferred from trigger name) found in Triggers.cfg");
+				success = false;
+			}
+		}
+		if(!success) continue;
+		
+		/// Classify trigger and re-arrange legs (if needed) so that all electron legs come before muon legs, and muon legs before photon legs
+		def.type = TT_UNKNOWN;		
+		auto flavour0 = associatedLeptonFlavour(def.leg[0], success);
+		int ne = (flavour0 == xAOD::Type::Electron)*1;
+		int nm = (flavour0 == xAOD::Type::Muon)*1;
+		if(def.leg[1])
+		{
+			auto flavour1 = associatedLeptonFlavour(def.leg[1], success);
+			if(flavour1 == xAOD::Type::Electron)
+			{
+				if(!ne) std::swap(def.leg[0],def.leg[1]);
+				++ne;
+			}
+			else if(flavour1 == xAOD::Type::Muon)
+			{
+				if(!(ne+nm)) std::swap(def.leg[0],def.leg[1]);
+				++nm;
+			}
+			else if(flavour1 != xAOD::Type::Photon) success = false;
+			if(def.leg[2])
+			{
+				auto flavour2 = associatedLeptonFlavour(def.leg[2], success);
+				if(flavour2 == xAOD::Type::Electron)
+				{
+					if(!ne) std::swap(def.leg[0], def.leg[2]);
+					else if(ne==1) std::swap(def.leg[1], def.leg[2]);
+					++ne;
+				}
+				else if(flavour2 == xAOD::Type::Muon)
+				{
+					if(!(ne+nm)) std::swap(def.leg[0], def.leg[2]);
+					else if((ne+nm)==1) std::swap(def.leg[1], def.leg[2]);
+					++nm;
+				}
+				else if(flavour2 != xAOD::Type::Photon) success = false;
+				if(ne+nm==0 || ne==3 || nm==3) /// single-flavour trilepton triggers
+				{
+					setNonMixed3LType(def, (ne? TT_ELECTRON_FLAG : nm? TT_MUON_FLAG : TT_PHOTON_FLAG));
+				}
+				else /// mixed-flavour trilepton triggers
+				{
+					bool sym = (def.leg[0]==def.leg[1] || def.leg[1]==def.leg[2]);
+					if(ne==2) def.type = nm? (sym? TT_2E_MU_SYM : TT_2E_MU_ASYM) : (sym? TT_2E_G_SYM : TT_2E_G_ASYM);
+					else if(nm==2) def.type = ne? (sym? TT_E_2MU_SYM : TT_E_2MU_ASYM) : (sym? TT_2MU_G_SYM : TT_2MU_G_ASYM);
+					else if(ne+nm==1) def.type = ne? (sym? TT_E_2G_SYM : TT_E_2G_ASYM) : (sym? TT_MU_2G_SYM : TT_MU_2G_ASYM);
+					else success = false;
+				}
+			}
+			else /// dilepton triggers
+			{
+				if(ne==2) def.type = (def.leg[0]==def.leg[1])? TT_2E_SYM : TT_2E_ASYM;
+				else if(nm==2) def.type = (def.leg[0]==def.leg[1])? TT_2MU_SYM : TT_2MU_ASYM;
+				else if(ne+nm==0) def.type = (def.leg[0]==def.leg[1])? TT_2G_SYM : TT_2G_ASYM;
+				else if(ne==1 && nm==1) def.type = TT_E_MU;
+				else if(ne==1) def.type = TT_E_G;
+				else if(nm==1) def.type = TT_MU_G;
+			}
+		}
+		else /// single lepton triggers
+		{
+			def.type = ne? TT_SINGLE_E : nm? TT_SINGLE_MU : TT_SINGLE_G;
+		}
+		if(!success || def.type==TT_UNKNOWN)
+		{
+			success = false;
+			// ATH_MSG_ERROR("Configuration issue for trigger " << triggerName);
+		}
+	}
+	return success;
+}
+
+bool ImportData::importThresholds(const std::map<std::string, std::string>& overridenThresholds)
+{
+	m_triggerThresholds.clear();
+	std::vector<std::string> config;
+	if(!readDataFile("TrigGlobalEfficiencyCorrection/Thresholds.cfg", config)) return false;
+	std::stringstream ss;
+	std::string leg, unit;
+	float pt;
+	bool success = true;
+	for(auto& line : config)
+	{
+		ss.clear();
+		ss.str(line);
+		if(ss >> leg >> pt >> unit)
+		{
+			std::size_t h = m_hasher(leg);
+			m_dictionary.emplace(h,leg);
+			if(unit == "GeV") pt *= 1e3f;
+			else if(unit != "MeV")
+			{
+				ATH_MSG_ERROR("Unable to import pT threshold for leg \"" << leg << "\" (missing unit)");
+				success = false;
+			}
+			m_triggerThresholds[h] = pt;
+		}
+		else
+		{
+			ATH_MSG_ERROR("Unable to import pT threshold for leg \"" << leg << '"');
+			success = false;
+		}
+	}
+	if(!success)
+	{
+		m_triggerThresholds.clear();
+		return false;
+	}
+
+	/// Override thresholds if requested
+	bool belowRecommended = false;
+	for(auto& kv : overridenThresholds)
+	{
+		auto itr = m_triggerThresholds.find(m_hasher(kv.first));
+		if(itr != m_triggerThresholds.end())
+		{
+			float pt = 0.f;
+			try { pt = std::stof(kv.second); }
+			catch(...)
+			{
+				ATH_MSG_ERROR("Unable to convert threshold argument \""<<kv.second<<"\" to floating-point value");
+				success = false;
+				continue;
+			}
+			if(pt<1e3f)
+			{
+				ATH_MSG_WARNING("Suspiciously low threshold (" << pt << " MeV) set for trigger leg " << kv.first
+					<< ", please make sure you provided the threshold in MeV and not in GeV!");
+			}
+			if(pt < itr->second) belowRecommended = true;
+			itr->second = pt;
+		}
+		else
+		{
+			ATH_MSG_ERROR("Can't override threshold for unknown trigger leg " << kv.first);
+			success = false;
+		}
+	}
+	if(belowRecommended)
+	{
+		ATH_MSG_WARNING("Tool configured to use trigger thresholds below those recommended!");
+	}
+	return success;
+}
+
+bool ImportData::importPeriods()
+{
+	m_dataPeriods.clear();
+	std::vector<std::string> config;
+	if(!readDataFile("TrigGlobalEfficiencyCorrection/DataPeriods.cfg", config)) return false;
+	std::stringstream ss;
+	std::string key;
+	std::pair<unsigned,unsigned> runs;
+	for(auto& line : config)
+	{
+		ss.clear();
+		ss.str(line);
+		ss >> key >> runs.first >> runs.second;
+		if(ss.fail())
+		{
+			m_dataPeriods.clear();
+			return false;
+		}
+		m_dataPeriods.emplace(key,runs);
+	}
+	return true;
+}
+
+bool ImportData::importHierarchies()
+{
+	if(!m_triggerThresholds.size() && !importThresholds()) return false;
+	m_hierarchyMeta.clear();
+	m_hierarchyData.clear();
+	std::vector<std::string> config;
+	if(!readDataFile("TrigGlobalEfficiencyCorrection/Hierarchies.cfg", config)) return false;
+	std::stringstream ss;
+	std::string token, unit;
+	std::map<std::size_t, std::vector<std::size_t> > aliases;
+	for(auto& line : config)
+	{
+		bool success = true;
+		ss.clear();
+		ss.str(line);
+		if(line[0]=='[')
+		{
+			auto& meta = *m_hierarchyMeta.emplace(m_hierarchyMeta.end(), Hierarchy{(short)m_hierarchyData.size(),0,0.f,1e12f});
+			if(line[1]=='-' && line[2]==']') ss.ignore(3);
+			else
+			{
+				char sep = '-';
+				if(line[1]=='>') ss.ignore(2) >> meta.minPt >> unit;
+				else if(line[1]=='<') ss.ignore(2) >> meta.maxPt >> unit;
+				else ss.ignore(1) >> meta.minPt >> sep >> meta.maxPt >> unit;
+				if(!ss || sep!='-' || (unit!="GeV]" && unit!="MeV]"))
+				{
+					ATH_MSG_ERROR("Unable to parse pT restrictions in Hierarchies.cfg");
+					success = false;
+				}
+				if(unit == "GeV]")
+				{
+					meta.minPt *= 1e3f;
+					if(meta.maxPt < 1e12f) meta.maxPt *= 1e3f;
+				}
+			}
+			while(ss >> token)
+			{
+				std::size_t h = m_hasher(token);
+				auto itr = aliases.find(h);
+				if(itr == aliases.end())
+				{
+					if(m_triggerThresholds.find(h) == m_triggerThresholds.end())
+					{
+						ATH_MSG_ERROR("Unknown trigger leg '" << token << "' found in Hierarchies.cfg");
+						success = false;
+					}
+					m_dictionary.emplace(h,token);
+					m_hierarchyData.push_back(h);
+				}
+				else m_hierarchyData.insert(m_hierarchyData.end(),itr->second.begin(),itr->second.end());
+				if(ss >> token && token!='>') success = false;
+			}
+			meta.nLegs = m_hierarchyData.size() - meta.offset;
+			success = success && meta.nLegs;
+		}
+		else
+		{
+			ss >> token;
+			auto& legs = aliases[m_hasher(token)];
+			if(ss >> token && token==":=")
+			{
+				legs.clear();
+				while(ss >> token)
+				{
+					std::size_t h = m_hasher(token);
+					m_dictionary.emplace(h,token);
+					legs.push_back(h);
+					if(m_triggerThresholds.find(h) == m_triggerThresholds.end())
+					{
+						ATH_MSG_ERROR("Unknown trigger leg '" << token << "' found in Hierarchies.cfg");
+						success = false;
+					}
+					if(ss >> token && token!='>') success = false;
+				}
+				success = success && legs.size();
+			}
+			else success = false;
+		}
+		if(!success)
+		{
+			ATH_MSG_ERROR("Failed parsing line from Hierarchies.cfg:\n" << line);
+			m_hierarchyMeta.clear();
+			m_hierarchyData.clear();
+			return false;
+		}
+	}
+	return true;
+}
+
+bool ImportData::importMapKeys(const std::string& version, std::map<std::size_t,std::map<std::size_t,int> >& keysPerLeg)
+{
+	keysPerLeg.clear();
+	std::vector<std::string> config;
+	if(!readDataFile("TrigGlobalEfficiencyCorrection/MapKeys.cfg", config)) return false;
+	std::stringstream ss;
+	std::string token;
+	bool reading = false;
+	for(auto& line : config)
+	{
+		std::size_t pos = line.find("[VERSION]");
+		if(pos != std::string::npos)
+		{
+			reading = false;
+			ss.clear();
+			ss.str(TrigGlobEffCorr::removeWhitespaces(line.substr(pos+9)));
+			while(std::getline(ss, token, ','))
+			{
+				if(token == version)
+				{
+					reading = true;
+					break;
+				}
+			}
+			continue;
+		}
+		if(!reading) continue;
+		ss.clear();
+		ss.str(line);
+		int year;
+		ss >> year >> token;
+		year = 1<<(year-2015);
+		std::size_t leg = m_hasher(token);
+		auto& keys = keysPerLeg[leg];
+		while(ss >> token)
+		{
+			std::size_t h = m_hasher(token);
+			auto insertion = keys.emplace(h, year);
+			if(insertion.second) m_dictionary.emplace(h, token);
+			else insertion.first->second |= year;
+		}
+	}
+	if(!keysPerLeg.size())
+	{
+		ATH_MSG_ERROR("Unable to import the available map keys for the version " << version);
+		return false;
+	}
+	return true;
+}
+
+bool ImportData::getPeriodBoundaries(const std::string& period, std::pair<unsigned,unsigned>& boundaries)
+{
+	// First possibility: a defined period keyword
+	auto itr = m_dataPeriods.find(period);
+	if(itr!=m_dataPeriods.end())
+	{
+		boundaries = itr->second;
+		return true;
+	}
+	// Otherwise it's a '-'-separated range
+	auto sep = period.find_first_of('-');
+	if(sep!=std::string::npos)
+	{
+		std::string kwMin = period.substr(0,sep);
+		std::string kwMax = period.substr(sep+1);
+		// Second possibility: a range of defined period keywords
+		auto itrMin = m_dataPeriods.find(kwMin);
+		auto itrMax = m_dataPeriods.find(kwMax);
+		if(itrMin!=m_dataPeriods.end() && itrMax!=m_dataPeriods.end())
+		{
+			boundaries = std::minmax({itrMin->second.first, itrMax->second.first, itrMin->second.second, itrMax->second.second});
+			return true;
+		}
+		// Third possibility: a range of run numbers
+		try
+		{
+			boundaries = std::minmax(std::stoi(kwMin), std::stoi(kwMax));
+			return true;
+		}
+		catch(...) {}
+	}
+	ATH_MSG_ERROR("Unable to understand the period/range " << period);
+	return false;
+}
+
+xAOD::Type::ObjectType ImportData::associatedLeptonFlavour(const std::string& leg, bool& success)
+{
+	// note: 'success' is not set to 'true', only downgraded to 'false' if needed
+	if(leg.length()>=2 && leg[0]=='e' && leg[1]>='1' && leg[1]<='9') return xAOD::Type::Electron;
+	else if(leg.length()>=3 && leg[0]=='m' && leg[1]=='u' && leg[2]>='1' && leg[2]<='9') return xAOD::Type::Muon;
+	else if(leg.length()>=3 && leg[0]=='g' && leg[1]>='1' && leg[1]<='9') return xAOD::Type::Photon;
+	success = false;
+	return xAOD::Type::Other;
+}
+
+xAOD::Type::ObjectType ImportData::associatedLeptonFlavour(std::size_t leg, bool& success)
+{
+	// note: 'success' is not set to 'true', only downgraded to 'false' if needed
+	auto itr = m_dictionary.find(leg);
+	if(itr != m_dictionary.end())
+	{
+		return associatedLeptonFlavour(itr->second,success);
+	}
+	success = false;
+	return xAOD::Type::Other;
+}
+
+std::vector<ImportData::TrigDef> ImportData::parseTriggerString(const std::string& triggerString, bool& success)
+{
+	std::string s = TrigGlobEffCorr::removeWhitespaces(triggerString);
+	if(s.find("|||") != std::string::npos)
+	{
+		ATH_MSG_ERROR("Invalid format for the trigger combination '" << triggerString <<"'");
+		success = false;
+		return {};
+	}
+	/// Replace all || by |
+	while(true)
+	{
+		auto i = s.find("||");
+		if(i == std::string::npos) break;
+		s.replace(i, 1, "");
+	}
+	if(s=="" || s=="|")
+	{
+		ATH_MSG_ERROR("Invalid format for the trigger combination '" << triggerString <<"'");
+		success = false;
+		return {};
+	}
+	std::vector<TrigDef> triggers;
+	std::set<std::size_t> hashes;
+	std::stringstream ss(s);
+	while(std::getline(ss,s,'|'))
+	{
+		std::size_t trig = m_hasher(s);
+		ATH_MSG_DEBUG(std::to_string(trig) << " --> " << s );
+		auto itr = m_triggerDefs.find(trig);
+		if(itr == m_triggerDefs.end())
+		{
+			ATH_MSG_ERROR("Unknown trigger '" << s << "' found while parsing trigger combination");
+			success = false;
+			return {};	
+		}
+		if(!hashes.insert(trig).second)
+		{
+			ATH_MSG_ERROR("The trigger '" << s << "' is present more than once in the combination");
+			success = false;
+			return {};
+		}
+		triggers.push_back(itr->second);
+	}
+	success = success && triggers.size();
+	return triggers;
+}
+
+bool ImportData::suggestElectronMapKeys(const std::map<std::string,std::string>& triggerCombination,
+		const std::string& version, std::map<std::string,std::string>& legsPerKey)
+{
+	legsPerKey.clear();
+	if(!importAll()) return false;
+	
+	bool success = true;
+	std::map<std::size_t,int> legs;
+	
+	for(auto& kv : triggerCombination)
+	{
+		auto itrPeriod = m_dataPeriods.find(kv.first);
+		if(itrPeriod == m_dataPeriods.end())
+		{
+			ATH_MSG_ERROR("Unknown period " << kv.first);
+			success = false;
+			continue;
+		}
+		int years = 0;
+		for(int k=0;k<32;++k)
+		{
+			auto itr = m_dataPeriods.find(std::to_string(2015+k));
+			if(itr != m_dataPeriods.end() && itrPeriod->second.first <= itr->second.second 
+				&& itrPeriod->second.second >= itr->second.first)
+			{
+				years |= (1<<k);
+			}
+		}
+		auto triggers = parseTriggerString(kv.second,success);
+		if(!success) continue;
+		for(auto& trig : triggers)
+		{
+			for(std::size_t leg : trig.leg)
+			{
+				if(leg && associatedLeptonFlavour(leg, success)==xAOD::Type::Electron)
+				{
+					auto insertion = legs.emplace(leg,years);
+					if(!insertion.second) insertion.first->second |= years;
+				}
+			}
+		}
+	}
+	if(!success) return false;
+
+	if(version != "")
+	{
+		std::map<std::size_t,std::map<std::size_t,int> > allKeys;
+		if(!importMapKeys(version, allKeys)) return false;
+		std::map<std::size_t,std::vector<std::size_t> > allLegsPerKey;
+		std::set<std::size_t> legsWithMultipleKeys;
+		bool sameKeyForAllyears = true;
+		while(legs.size())
+		{
+			allLegsPerKey.clear();
+			for(auto& kvLegs : legs) // loop on remaining legs
+			{
+				std::size_t leg = kvLegs.first;
+				int years = kvLegs.second;
+				auto itrKeys = allKeys.find(leg); // list of keys for that leg
+				if(itrKeys != allKeys.end())
+				{
+					for(auto& kvKeys : itrKeys->second) // loop on those keys
+					{
+						auto y = (kvKeys.second & years);
+						if((y==years) || (!sameKeyForAllyears && y!=0)) // key must support all years needed for that leg -- until no longer possible
+						{
+							auto insertion = allLegsPerKey.emplace(kvKeys.first,std::vector<std::size_t>{leg});
+							if(!insertion.second) insertion.first->second.push_back(leg); 
+						}
+					}
+				}
+				else
+				{
+					ATH_MSG_ERROR("Sorry, no idea what the map key should be for the trigger leg '" 
+							<< m_dictionary.at(leg) << "', manual configuration is needed");
+					success = false;
+				}
+			}
+			if(!success) break;
+
+			if(!allLegsPerKey.size())
+			{
+				if(sameKeyForAllyears)
+				{
+					sameKeyForAllyears = false;
+					continue;
+				}
+				success = false;
+				break;
+			}
+			
+			using T = decltype(allLegsPerKey)::value_type;
+			auto itrKey = std::max_element(allLegsPerKey.begin(), allLegsPerKey.end(),
+				[](T& x,T& y){return x.second.size()<y.second.size();});
+			std::string& strLegs = legsPerKey[m_dictionary.at(itrKey->first)];
+			for(std::size_t leg : itrKey->second)
+			{
+				int& wantedYears = legs.at(leg);
+				int supportedYears = (allKeys.at(leg).at(itrKey->first)) & wantedYears;
+				if(supportedYears!=wantedYears || legsWithMultipleKeys.count(leg))
+				{
+					legsWithMultipleKeys.insert(leg);
+					for(int i=0;i<32;++i)
+					{
+						if(supportedYears & (1<<i))
+						{
+							if(strLegs.length() && strLegs.back()!=',') strLegs += ',';
+							strLegs += m_dictionary.at(leg) + "[" + std::to_string(2015 + i) + "]";
+						}
+					}
+				}
+				else
+				{
+					if(strLegs.length() && strLegs.back()!=',') strLegs += ',';
+					strLegs += m_dictionary.at(leg);
+				}
+				if(supportedYears == wantedYears) legs.erase(leg);
+				else wantedYears &= ~supportedYears;
+			}
+		}
+	}
+	else
+	{
+		/// If no version is specified, the list of trigger legs is returned
+		for(auto& kv : legs)
+		{
+			legsPerKey.emplace(std::to_string(legsPerKey.size()), m_dictionary.at(kv.first));
+		}
+	}
+	
+	if(!success) legsPerKey.clear();
+	return success;
+}
+
+bool ImportData::adaptTriggerListForTriggerMatching(std::vector<ImportData::TrigDef>& triggers)
+{
+	/// This essentially splits _OR_ single lepton triggers into independent items
+	std::set<std::size_t> extraItems; /// to prevent duplicates
+	std::vector<ImportData::TrigDef> updatedTriggers;
+	for(auto& trig : triggers)
+	{
+		auto& name = m_dictionary.at(trig.name);
+		std::size_t pos = 0, len = name.find("_OR_");
+		if(len == std::string::npos)
+		{
+			updatedTriggers.emplace_back(trig);
+			continue;
+		}
+		while(true)
+		{
+			std::string item = name.substr(pos, len);
+			auto h = m_hasher(item);
+			auto def = m_triggerDefs.find(h);
+			if(def == m_triggerDefs.end())
+			{
+				ATH_MSG_ERROR("while listing triggers for trigger matching; trigger \"" << item << "\" extracted from \"" << name << "\" is not recognized");
+				return false;
+			}
+			if(extraItems.emplace(h).second) updatedTriggers.emplace_back(def->second);
+			if(len == std::string::npos) break;
+			pos += len + 4;
+			len = name.find("_OR_", pos);
+			if(len != std::string::npos) len -= pos;
+		}
+	}
+	triggers.swap(updatedTriggers);
+	return true;
+}
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/TrigGlobalEfficiencyCorrectionTool.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/TrigGlobalEfficiencyCorrectionTool.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..d76de401b996c69f90fbfab47c690c9234cfd475
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/TrigGlobalEfficiencyCorrectionTool.cxx
@@ -0,0 +1,1074 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+// contact: jmaurer@cern.ch
+
+#include "TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrectionTool.h"
+#include "TrigGlobalEfficiencyCorrection/ImportData.h"
+#include "TrigGlobalEfficiencyCorrection/CheckConfig.h"
+#include "TrigGlobalEfficiencyCorrection/Calculator.h"
+#include "TrigGlobalEfficiencyCorrection/Efficiencies.h"
+#include "TrigGlobalEfficiencyCorrection/Lepton.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODEgamma/Electron.h"
+#include "xAODEgamma/Photon.h"
+
+#include <array>
+#include <boost/container/flat_set.hpp>
+#include <sstream>
+#include <algorithm>
+#include <cctype>
+#include <iterator>
+#include <type_traits>
+#include <limits>
+#include <regex>
+
+using CheckConfig = TrigGlobEffCorr::CheckConfig;
+using Calculator = TrigGlobEffCorr::Calculator;
+using ImportData = TrigGlobEffCorr::ImportData;
+using Efficiencies = TrigGlobEffCorr::Efficiencies;
+using Lepton = TrigGlobEffCorr::Lepton;
+
+
+TrigGlobalEfficiencyCorrectionTool::TrigGlobalEfficiencyCorrectionTool(const std::string& name)
+	: asg::AsgTool(name), m_trigMatchTool("", nullptr), m_checkElectronLegTag(false), m_checkMuonLegTag(false), m_seed(1), m_validTrigMatchTool(false),
+	m_runNumberDecorator("RandomRunNumber"), m_calculator()
+{
+	declareProperty("ElectronEfficiencyTools", m_suppliedElectronEfficiencyTools, "electron MC efficiency tools (one for each kind of electron trigger leg)");
+	declareProperty("ElectronScaleFactorTools", m_suppliedElectronScaleFactorTools, "electron scale factor tools (one for each kind of electron trigger leg)");
+	declareProperty("PhotonEfficiencyTools", m_suppliedPhotonEfficiencyTools, "photon MC efficiency tools (one for each kind of photon trigger leg)");
+	declareProperty("PhotonScaleFactorTools", m_suppliedPhotonScaleFactorTools, "photon scale factor tools (one for each kind of photon trigger leg)");	
+	declareProperty("MuonTools", m_suppliedMuonTools, "muon efficiency/scale factor tool (one per year)");
+	declareProperty("ListOfLegsPerTool", m_legsPerTool, "comma-separated list of trigger legs supported by each electron or photon tool");
+	declareProperty("TriggerCombination", m_triggerCb, "map of trigger combination per period and/or range of runs");
+	declareProperty("TriggerCombination2015", m_triggerCbPerYear["2015"] = "", "trigger combination \"trigger1 || trigger2 || ...\"");
+	declareProperty("TriggerCombination2016", m_triggerCbPerYear["2016"] = "", "trigger combination \"trigger1 || trigger2 || ...\"");
+	declareProperty("TriggerCombination2017", m_triggerCbPerYear["2017"] = "", "trigger combination \"trigger1 || trigger2 || ...\"");
+	declareProperty("TriggerCombination2018", m_triggerCbPerYear["2018"] = "", "trigger combination \"trigger1 || trigger2 || ...\"");
+	declareProperty("LeptonTagDecorations", m_leptonTagDecorations = "", 
+		"comma-separated list of decorations for the lepton selection tags, ordered by increasing tightness. "
+		"If a name ends with =, the tag is the decorated value, otherwise it is the decoration name");
+	declareProperty("ListOfTagsPerTool", m_tagsPerTool, "comma-separated list of lepton selection tags associated to each tool");
+	declareProperty("ElectronLegsPerTag", m_electronLegsPerTag, "DEPRECATED, use ListOfLegsPerTag instead");
+	declareProperty("MuonLegsPerTag", m_muonLegsPerTag, "DEPRECATED, use ListOfLegsPerTag instead");
+	declareProperty("ListOfLegsPerTag", m_legsPerTag, "map of allowed trigger legs for each tag");
+	declareProperty("NumberOfToys", m_numberOfToys = 0, "if different from 0, use toy experiments instead of explicit formulas");
+	declareProperty("OverrideThresholds", m_overrideThresholds, "new thresholds (in MeV) for the plateaux of the indicated trigger legs -- use at your own risk!");
+	declareProperty("UseInternalSeed", m_useInternalSeed = false, "do not use event number as random number generation seed");
+	declareProperty("TriggerMatchingTool", m_trigMatchTool, "handle to an IMatchingTool instance");
+	
+	m_cpCode.ignore();
+}
+
+TrigGlobalEfficiencyCorrectionTool::~TrigGlobalEfficiencyCorrectionTool()
+{
+	m_cpCode.ignore();
+}
+
+StatusCode TrigGlobalEfficiencyCorrectionTool::initialize()
+{
+	if(m_initialized)
+	{
+		ATH_MSG_ERROR("Tool has already been initialized");
+		return StatusCode::FAILURE;
+	}
+	ATH_MSG_INFO ("Initializing " << name() << "...");
+	
+	m_dictionary.emplace(0, "");
+	
+	if(!processDeprecatedProperties()) return StatusCode::FAILURE;
+	
+	ATH_MSG_DEBUG("Importing data from configuration files");
+	ImportData data(*this);
+	if(!data.importAll(m_overrideThresholds)) return StatusCode::FAILURE;
+	/// Copy the following variables from data as the latter is short-lived
+	m_hierarchyMeta = data.getHierarchyMeta();
+	m_hierarchyData = data.getHierarchyData();
+	m_thresholds = data.getTriggerThresholds();
+	
+	ATH_MSG_DEBUG("Retrieving tools"); 
+	if(m_suppliedElectronEfficiencyTools.retrieve() != StatusCode::SUCCESS
+		|| m_suppliedElectronScaleFactorTools.retrieve() != StatusCode::SUCCESS
+		|| m_suppliedMuonTools.retrieve() != StatusCode::SUCCESS
+		|| m_suppliedPhotonEfficiencyTools.retrieve() != StatusCode::SUCCESS
+		|| m_suppliedPhotonScaleFactorTools.retrieve() != StatusCode::SUCCESS)
+	{
+		ATH_MSG_ERROR("Unable to retrieve CP tools");
+		return StatusCode::FAILURE;
+	}
+	
+	ATH_MSG_DEBUG("Retrieving trigger matching tool (if provided)");
+	m_validTrigMatchTool = false;
+	if(m_trigMatchTool.name() != "")
+	{
+		if(m_trigMatchTool.retrieve() != StatusCode::SUCCESS)
+		{
+			ATH_MSG_ERROR("Unable to retrieve trigger matching tool");
+			return StatusCode::FAILURE;
+		}
+		ATH_MSG_DEBUG("Trigger matching support enabled");
+		m_validTrigMatchTool = true;
+	}
+	
+	ATH_MSG_DEBUG("Basic checks");
+	CheckConfig checks(*this);
+	if(!checks.basicConfigChecks()) return StatusCode::FAILURE;
+
+	ATH_MSG_DEBUG("Enumerating tools");
+	flat_set<std::size_t> collectedElectronTags, collectedMuonTags, collectedPhotonTags;
+	if(!enumerateTools(data, m_suppliedElectronEfficiencyTools, m_electronEffToolIndex, collectedElectronTags)
+		|| !enumerateTools(data, m_suppliedElectronScaleFactorTools, m_electronSfToolIndex, collectedElectronTags)
+		|| !enumerateTools(data, m_suppliedMuonTools, m_muonToolIndex, collectedMuonTags)
+		|| !enumerateTools(data, m_suppliedPhotonEfficiencyTools, m_photonEffToolIndex, collectedPhotonTags)
+		|| !enumerateTools(data, m_suppliedPhotonScaleFactorTools, m_photonSfToolIndex, collectedPhotonTags))
+	{
+		return StatusCode::FAILURE;
+	}
+	
+	ATH_MSG_DEBUG("Loading user-defined trigger combination"); 
+	bool useDefaultElectronTools = (m_suppliedElectronEfficiencyTools.size()==1) && (m_suppliedElectronScaleFactorTools.size()==1) && (m_legsPerTool.size()==0);
+	bool useDefaultPhotonTools = (m_suppliedPhotonEfficiencyTools.size()==1) && (m_suppliedPhotonScaleFactorTools.size()==1) && (m_legsPerTool.size()==0);
+	if(!loadTriggerCombination(data, useDefaultElectronTools, useDefaultPhotonTools)) return StatusCode::FAILURE;
+	
+	ATH_MSG_DEBUG("Loading lepton selection tags decorators"); 
+	if(!loadTagDecorators(collectedElectronTags, collectedMuonTags, collectedPhotonTags)) return StatusCode::FAILURE;
+
+	ATH_MSG_DEBUG("Loading list of legs allowed for each tag"); 
+	if(!loadListOfLegsPerTag(collectedElectronTags, collectedMuonTags, collectedPhotonTags)) return StatusCode::FAILURE;
+	
+	ATH_MSG_DEBUG("Advanced checks");
+	if(!checks.advancedConfigChecks()) return StatusCode::FAILURE;
+	
+	ATH_MSG_INFO("Initialization successful"); 
+	m_initialized = true;
+	return StatusCode::SUCCESS;
+}
+
+bool TrigGlobalEfficiencyCorrectionTool::processDeprecatedProperties()
+{
+	if(m_electronLegsPerTag.size())
+	{
+		ATH_MSG_WARNING("The property 'ElectronLegsPerTag' is deprecated, please eventually use 'ListOfLegsPerTag' instead");
+		for(auto& kv : m_electronLegsPerTag)
+		{
+			auto insert = m_legsPerTag.insert(kv);
+			if(!insert.second) insert.first->second += "," + kv.second;
+		}
+	}
+	if(m_muonLegsPerTag.size())
+	{
+		ATH_MSG_WARNING("The property 'MuonLegsPerTag' is deprecated, please eventually use 'ListOfLegsPerTag' instead");
+		for(auto& kv : m_muonLegsPerTag)
+		{
+			auto insert = m_legsPerTag.insert(kv);
+			if(!insert.second) insert.first->second += "," + kv.second;
+		}
+	}
+	return true;
+}
+
+bool TrigGlobalEfficiencyCorrectionTool::parseTagString(const std::string& tagstring, flat_set<std::size_t>& allTags)
+{
+	bool success = true;
+	const std::size_t star = m_hasher("*");
+	for(std::size_t tag : listNonOrderedCSValues(tagstring,success))
+	{
+		allTags.insert((tag!=star)? tag : 0);
+	}
+	if(!success)
+	{
+		ATH_MSG_ERROR("List of tags \"" << tagstring << "\" is not provided in a valid format");
+	}
+	return success;
+}
+
+template<class CPTool>
+bool TrigGlobalEfficiencyCorrectionTool::enumerateTools(ImportData& data, ToolHandleArray<CPTool>& suppliedTools, 
+	std::map<ToolKey, std::size_t>& toolIndex, flat_set<std::size_t>& collectedTags)
+{
+	bool success = true;
+	for(unsigned index=0;index<suppliedTools.size();++index)
+	{
+		auto& handle = suppliedTools[index];
+		const std::string& name = handle.name(), altname = handle->name(); // athena: not always the same
+		flat_set<ToolKey> listOfLegs;
+		/// Find the legs associated to this tool ("ListOfLegsPerTool" property)
+		if(suppliedTools.size()!=1 || m_legsPerTool.size()!=0)
+		{
+			auto itrLegs = m_legsPerTool.find(name);
+			if(itrLegs == m_legsPerTool.end()) itrLegs = m_legsPerTool.find(altname);
+			if(itrLegs != m_legsPerTool.end())
+			{
+				listOfLegs = parseListOfLegs(data, itrLegs->second, success);
+				if(!success)
+				{
+					ATH_MSG_ERROR("The 'ListOfLegsPerTool' property has an invalid entry for the tool'" << name << "'");
+					continue;
+				}
+			}
+			else if(std::is_same<CPTool,IAsgElectronEfficiencyCorrectionTool>::value 
+				|| std::is_same<CPTool,IAsgPhotonEfficiencyCorrectionTool>::value)
+			{
+				ATH_MSG_ERROR("Property 'ListOfLegsPerTool' empty for tool '" << name << "'");
+				success = false;
+				continue;
+			}
+			else
+			{
+				listOfLegs.emplace();
+			}
+		}
+		else listOfLegs.emplace();
+		/// Find the tags associated to this tool ("ListOfTagsPerTool" property)
+		flat_set<std::size_t> tags;
+		auto itrTags = m_tagsPerTool.find(name);
+		if(itrTags == m_tagsPerTool.end()) itrTags = m_tagsPerTool.find(altname);
+		if(itrTags != m_tagsPerTool.end())
+		{
+			success = success && parseTagString(itrTags->second, tags);
+			collectedTags.insert(tags.begin(), tags.end());
+		}
+		else tags.emplace(0);
+
+		/// Store
+		unsigned short nUncheckedLegs = 0;
+		for(auto& key : listOfLegs)
+		{
+			std::size_t leg = key.hash;
+			if(leg)
+			{
+				auto flavour = data.associatedLeptonFlavour(leg, success);
+				if(!(flavour==xAOD::Type::Electron && std::is_same<CPTool,IAsgElectronEfficiencyCorrectionTool>::value)
+					&& !(flavour==xAOD::Type::Photon && std::is_same<CPTool,IAsgPhotonEfficiencyCorrectionTool>::value))
+				{
+					ATH_MSG_ERROR("Unexpected association of trigger leg '" << m_dictionary[leg] << "' to tool '" << name << "'");
+					success = false;
+				}
+			}
+			for(std::size_t tag : tags)
+			{
+				if(!toolIndex.emplace(ToolKey(leg, tag, key.boundaries), index).second)
+				{
+					if(leg && tag) ATH_MSG_ERROR("Multiple tools associated to the selection tag '" <<  m_dictionary[tag] << "' for the trigger leg '" << m_dictionary[leg] << "'");
+					else if(leg) ATH_MSG_ERROR("Multiple tools associated to the trigger leg '" <<  m_dictionary[leg] << "'");
+					else if(tag) ATH_MSG_ERROR("Multiple tools associated to the selection tag '" <<  m_dictionary[tag] << "'");
+					else ATH_MSG_ERROR("Multiple tools not associated to any trigger leg / selection tag");
+					success  = false;
+				}
+			}
+			++nUncheckedLegs;
+		}
+		if(!nUncheckedLegs)
+		{
+			ATH_MSG_ERROR("Tool " << name << " hasn't been associated to any trigger leg");
+			success = false;
+		}
+	}
+	return success;
+}
+
+auto TrigGlobalEfficiencyCorrectionTool::parseListOfLegs(ImportData& data, const std::string& inputList, bool& success) -> flat_set<ToolKey> 
+{
+	if(!inputList.length()) return {};
+	std::regex rx("\\s*([[:alnum:]_]+)\\s*(?:\\[\\s*([^,\\[\\]]+)\\s*\\]\\s*)?(?:,|$)");
+	flat_set<ToolKey> keys;
+	std::smatch sm;
+	auto itr=inputList.cbegin();
+	do
+	{
+		if(sm.ready()) itr += sm.length();
+		if(!std::regex_search(itr, inputList.cend(), sm ,rx) || sm.prefix().length())
+		{
+			ATH_MSG_ERROR("Invalid format for the property \"ListOfLegsPerTool\"");
+			success = false;
+			break;
+		}
+		std::size_t leg = m_hasher(sm[1].str());
+		if(m_thresholds.find(leg) == m_thresholds.end())
+		{
+			ATH_MSG_ERROR("Unknown trigger leg '" << sm[1].str() << "' found in 'ListOfLegsPerTool'");
+			success = false;
+			continue;
+		}
+		ToolKey key(leg, 0);
+		if(sm.length(2))
+		{
+			if(!data.getPeriodBoundaries(sm[2].str(), key.boundaries))
+			{
+				ATH_MSG_ERROR("Invalid period \"" << sm[2].str() << "\"found in the property \"ListOfLegsPerTool\"");
+				success = false;
+				continue;
+			}
+		}
+		if(!keys.emplace(key).second)
+		{
+			ATH_MSG_ERROR("Trigger leg '" << sm[1].str() << "' mentioned several times with overlapping time periods in the property 'ListOfLegsPerTool'");
+			success = false;
+			continue;
+		}
+	} while(sm.suffix().length());
+	return keys;
+}
+
+bool TrigGlobalEfficiencyCorrectionTool::loadTriggerCombination(ImportData& data, bool useDefaultElectronTools, bool useDefaultPhotonTools)
+{
+	bool success = true, mustBeEmpty = m_triggerCb.size();
+	for(auto& kv : m_triggerCbPerYear)
+	{
+		if(!kv.second.size()) continue;
+		if(mustBeEmpty)
+		{
+			ATH_MSG_ERROR ("You're not allowed to use simultaneously the 'TriggerCombination' and 'TriggerCombination" << kv.first << "' properties.");
+			return false;
+		}
+		m_triggerCb.insert(kv);
+	}
+	
+	m_calculator = std::unique_ptr<Calculator>(new Calculator(*this, m_triggerCb.size()));
+	std::set<std::size_t> allUniqueElectronLegs, allUniquePhotonLegs;
+	for(auto& kv : m_triggerCb)
+	{
+		std::pair<unsigned, unsigned> boundaries;
+		if(!data.getPeriodBoundaries(kv.first, boundaries))
+		{
+			success = false;
+			continue;
+		}
+		std::size_t uniqueElectronLeg = !useDefaultElectronTools, uniquePhotonLeg = !useDefaultPhotonTools;
+		if(!m_calculator->addPeriod(data, boundaries, kv.second, m_numberOfToys, uniqueElectronLeg, uniquePhotonLeg))
+		{
+			success = false;
+			continue;
+		}
+		if(uniqueElectronLeg && useDefaultElectronTools) allUniqueElectronLegs.insert(uniqueElectronLeg);
+		if(uniquePhotonLeg && useDefaultPhotonTools) allUniquePhotonLegs.insert(uniquePhotonLeg);
+	}
+	if(!success) return false;
+	
+	auto remapTools = [](auto& toolIndex, auto& allUniqueLegs) {
+		typename std::remove_reference<decltype(toolIndex)>::type remappedToolIndex;
+		for(std::size_t leg : allUniqueLegs)
+		{
+			if(!leg) continue;
+			for(auto& kv : toolIndex)
+			{
+				/// tools have not been associated with legs so far so the key hash is only the tag
+				const ToolKey& key = kv.first;
+				remappedToolIndex.emplace(ToolKey(leg, key.hash, key.boundaries), kv.second);
+			}
+		}
+		toolIndex.swap(remappedToolIndex);
+	};
+	
+	if(useDefaultElectronTools && allUniqueElectronLegs.size())
+	{
+		remapTools(m_electronSfToolIndex, allUniqueElectronLegs);
+		remapTools(m_electronEffToolIndex, allUniqueElectronLegs);
+	}
+	if(useDefaultPhotonTools && allUniquePhotonLegs.size())
+	{
+		remapTools(m_photonSfToolIndex, allUniquePhotonLegs);
+		remapTools(m_photonEffToolIndex, allUniquePhotonLegs);
+	}
+	return success;
+}
+
+bool TrigGlobalEfficiencyCorrectionTool::loadTagDecorators(const flat_set<std::size_t>& collectedElectronTags,
+	const flat_set<std::size_t>& collectedMuonTags, const flat_set<std::size_t>& collectedPhotonTags)
+{
+	bool success = true;
+	
+	flat_set<std::size_t> collectedTags(collectedElectronTags);
+	collectedTags.insert(collectedMuonTags.begin(), collectedMuonTags.end());
+	collectedTags.insert(collectedPhotonTags.begin(), collectedPhotonTags.end());
+	flat_set<std::size_t> allTags = collectedTags;
+	
+	/// Initialize decorators
+	/// Note: can't use listNonOrderedCSValues() as the order in which decorations are listed must be preserved
+	std::stringstream ss(TrigGlobEffCorr::removeWhitespaces(m_leptonTagDecorations));
+	std::string decoration;
+	flat_set<std::size_t> allDecorations;
+	while(std::getline(ss,decoration,','))
+	{
+		if(!decoration.length() || decoration=="?")
+		{
+			ATH_MSG_ERROR("Found an empty string in the 'LeptonTagDecorations' property");
+			success = false;
+			break;
+		}
+		
+		bool found = false, suffixed = false;
+		std::size_t h;
+		if(decoration.back() != '?')
+		{
+			/// tag = decorator name (considered tagged if decorated value != 0)
+			h = m_hasher(decoration);
+			found = (allTags.find(h) != allTags.end());
+		}
+		else
+		{
+			/// tag = decorator name (without '?') + decorated value
+			decoration.pop_back();
+			suffixed = true;
+			for(std::size_t tag : allTags) /// find a tag of the form <name><integer suffix>
+			{
+				auto& s = m_dictionary[tag];
+				if(s.find(decoration) != 0) continue;
+				if(std::all_of(s.begin() + decoration.length(),s.end(),[](char c){ return std::isdigit(c); }))
+				{
+					found = true;
+					break;
+				}
+			}
+			h = m_hasher(decoration);
+		}
+		if(!allDecorations.insert(h).second)	
+		{
+			ATH_MSG_ERROR("The selection tag '" << decoration << "' is listed twice in the property 'LeptonTagDecorations'");
+			success = false;
+			continue;
+		}
+		if(!found)
+		{
+			ATH_MSG_ERROR("the selection tag '" << decoration << "' is only referred to in the property 'LeptonTagDecorations'");
+			success = false;
+			continue;
+		}
+		m_leptonTagDecorators.emplace_back(decoration,h,suffixed);
+		m_dictionary.emplace(h,decoration);
+	}
+	std::reverse(m_leptonTagDecorators.begin(),m_leptonTagDecorators.end());
+	if(!success) return false;
+	
+	/// Check there's a suitable decorator for all tags associated to CP tools via ListOfTagsPerTool
+	for(std::size_t tag : collectedTags)
+	{
+		if(!tag) continue;
+		auto itr = std::find_if(m_leptonTagDecorators.begin(),m_leptonTagDecorators.end(),
+			[tag](const TagDecorator& ltd){ return (!ltd.suffixed) && (ltd.hash==tag); });
+		if(itr != m_leptonTagDecorators.end()) continue; /// ok, there's a direct match
+		bool found = false;
+		auto& s= m_dictionary[tag];
+		for(auto& ltd : m_leptonTagDecorators)
+		{
+			auto& name = m_dictionary[ltd.hash];
+			if(s.find(name)!=0) continue;
+			if(std::all_of(s.begin()+name.length(),s.end(),[](char c){ return std::isdigit(c); }))
+			{
+				found = true;
+				break;
+			}
+		}
+		if(!found)
+		{
+			ATH_MSG_ERROR("the selection tag '" << m_dictionary[tag] << "' hasn't been found in in 'LeptonTagDecorations'");
+			success = false;
+			continue;
+		}
+	}
+	if(!success) return false;
+
+	return success;
+}
+
+bool TrigGlobalEfficiencyCorrectionTool::loadListOfLegsPerTag(const flat_set<std::size_t>& /*collectedElectronTags*/, const flat_set<std::size_t>& /*collectedMuonTags*/, const flat_set<std::size_t>& /*collectedPhotonTags*/)
+{
+	bool success = true;
+	
+	/// For safety...
+	/*
+	if(!m_muonLegsPerTag.size() && m_leptonTagDecorators.size())
+	{
+		ATH_MSG_INFO("Lepton selection tag decorators have been configured, but the property 'MuonLegsPerTag' is empty. "
+			"Muons will be considered suitable for any trigger leg regardless of their tag.");
+	}
+	if(!m_electronLegsPerTag.size() && m_leptonTagDecorators.size())
+	{
+		ATH_MSG_INFO("Lepton selection tag decorators have been configured, but the property 'ElectronLegsPerTag' is empty. "
+			"Electrons will be considered suitable for any trigger leg that has an associated SF tool for that tag.");
+	}
+	*/
+	
+	/// Create the hash list of legs allowed for each tag; check that a CP tool is available for each combination
+	for(auto& kv : m_legsPerTag)
+	{
+		std::size_t tag;
+		if(!kv.first.size() || kv.first=="*") tag = 0;
+		else tag = m_hasher(kv.first);
+		auto listOfLegs = listNonOrderedCSValues(kv.second,success);
+		if(!success)
+		{
+			ATH_MSG_ERROR("The property 'ListOfLegsPerTag' has an invalid entry for the tag '" << kv.first << "'");
+			break;
+		}
+		for(std::size_t leg : listOfLegs)
+		{
+			auto type = ImportData::associatedLeptonFlavour(m_dictionary[leg], success);
+			if(type==xAOD::Type::Electron && m_electronSfToolIndex.find(ToolKey(leg, tag))==m_electronSfToolIndex.end())
+			{
+				ATH_MSG_ERROR("No electron tool has been provided for trigger leg '" << m_dictionary[leg] << "' and selection tag " << kv.first
+					<< " mentioned in the property 'ListOfLegsPerTag'");
+				success = false;
+			}
+			else if(type==xAOD::Type::Muon && m_muonToolIndex.find(ToolKey(0, tag))==m_muonToolIndex.end())
+			{
+				ATH_MSG_ERROR("No muon tool has been provided for selection tag " << kv.first
+					<< " mentioned in the property 'ListOfLegsPerTag'");
+				success = false;
+			}
+			else if(type==xAOD::Type::Photon && m_photonSfToolIndex.find(ToolKey(leg, tag))==m_photonSfToolIndex.end())
+			{
+				ATH_MSG_ERROR("No photon tool has been provided for trigger leg '" << m_dictionary[leg] << "' and selection tag " << kv.first
+					<< " mentioned in the property 'ListOfLegsPerTag'");
+				success = false;
+			}
+			if(m_validLegTagPairs.insert(leg ^ tag).second)
+			{
+				if(type==xAOD::Type::Electron) m_checkElectronLegTag = true;
+				if(type==xAOD::Type::Muon) m_checkMuonLegTag = true;
+				if(type==xAOD::Type::Photon) m_checkPhotonLegTag = true;
+			}
+			else
+			{
+				ATH_MSG_ERROR("The combination of trigger leg '" << m_dictionary[leg] << "' and selection tag " << kv.first
+					<< " is mentioned more than once in the property 'ListOfLegsPerTag'");
+				success = false;
+			}
+		}
+	}
+	if(!success) return false;
+	
+	return success;
+}
+
+inline bool TrigGlobalEfficiencyCorrectionTool::checkAndRecord(CP::CorrectionCode&& cc)
+{
+   cc.setChecked();
+   if(cc > m_cpCode) m_cpCode = cc;
+   return cc==CP::CorrectionCode::Ok;
+}
+
+/// Parses the input string (comma-separated list) and returns a set of hashes
+/// Watch out: since a flat_set is returned, the order of the entries in the input list is not preserved, as hinted by the name of the function
+auto TrigGlobalEfficiencyCorrectionTool::listNonOrderedCSValues(const std::string& s, bool& success) -> flat_set<std::size_t>
+{
+	std::stringstream ss(TrigGlobEffCorr::removeWhitespaces(s));
+	flat_set<std::size_t> hashes;
+	std::string token;
+	while(std::getline(ss, token, ','))
+	{
+		if(token.length())
+		{
+			std::size_t h = m_hasher(token);
+			if(hashes.insert(h).second)
+			{
+				m_dictionary.emplace(h, std::move(token));
+			}
+			else
+			{
+				success = false;
+				ATH_MSG_ERROR("Found duplicate entry while parsing comma-separated list '" << s << "'");
+			}
+		}
+		else
+		{
+			success = false;
+			ATH_MSG_ERROR("Found null-length entry while parsing comma-separated list '" << s << "'");
+		}
+	}
+	if(!success) hashes.clear();
+	return hashes;
+}
+
+template<class ParticleType>
+bool TrigGlobalEfficiencyCorrectionTool::getEgammaTriggerLegEfficiencies(const ParticleType* p, unsigned runNumber, std::size_t leg, std::size_t tag, Efficiencies& efficiencies)
+{
+	/// Common implementation for electrons and photons
+	auto ptype = []() { return std::is_same<ParticleType, xAOD::Electron>::value? "electron" : std::is_same<ParticleType, xAOD::Photon>::value? "photon" : "<unknown type>"; };
+	auto pp = static_cast<const xAOD::IParticle*>(p);
+	ATH_MSG_DEBUG("Retrieving efficiencies for " << ptype() << ' ' << p << " (pt=" << pp->pt() << ", eta=" << pp->eta() 
+		<< ", tag='" << m_dictionary[tag] << "') for trigger leg " << m_dictionary[leg]);
+	auto itrSf = GetScaleFactorToolIndex(p).find(ToolKey(leg, tag, runNumber));
+	auto itrEff = GetEfficiencyToolIndex(p).find(ToolKey(leg, tag, runNumber));
+	if(itrSf==GetScaleFactorToolIndex(p).end() || itrEff==GetEfficiencyToolIndex(p).end())
+	{
+		if(!tag) ATH_MSG_ERROR("Unable to find " << ptype() << " tools needed for trigger leg " << m_dictionary[leg] << " (run number = " << runNumber << ")");
+		else ATH_MSG_ERROR("Unable to find " << ptype() << " tools needed for trigger leg " << m_dictionary[leg] << " and selection tag " << m_dictionary[tag] 
+			<< " (run number = " << runNumber << ")");
+		return false;
+	}
+	double sf;
+	bool success = checkAndRecord(GetScaleFactorTool(p, itrSf->second).getEfficiencyScaleFactor(*p, sf))
+		&& checkAndRecord(GetEfficiencyTool(p, itrEff->second).getEfficiencyScaleFactor(*p, efficiencies.mc()));
+	efficiencies.data() = sf * efficiencies.mc();
+	ATH_MSG_DEBUG("found for that " << ptype() << " eff(data) = " << efficiencies.data()<<" and eff(MC) = "<<efficiencies.mc());
+	return success;
+}
+
+bool TrigGlobalEfficiencyCorrectionTool::getTriggerLegEfficiencies(const xAOD::Electron* p, unsigned runNumber, std::size_t leg, std::size_t tag, Efficiencies& efficiencies)
+{
+	return getEgammaTriggerLegEfficiencies(p, runNumber, leg, tag, efficiencies);
+}
+
+bool TrigGlobalEfficiencyCorrectionTool::getTriggerLegEfficiencies(const xAOD::Photon* p, unsigned runNumber, std::size_t leg, std::size_t tag, Efficiencies& efficiencies)
+{
+	return getEgammaTriggerLegEfficiencies(p, runNumber, leg, tag, efficiencies);
+}
+
+bool TrigGlobalEfficiencyCorrectionTool::getTriggerLegEfficiencies(const xAOD::Muon* p, std::size_t leg, std::size_t tag, Efficiencies& efficiencies)
+{
+	ATH_MSG_DEBUG("Retrieving efficiencies for muon " <<p << " (pt=" << p->pt() << ", eta=" << p->eta() 
+		<< ", tag='" << m_dictionary[tag] << "') for trigger leg " << m_dictionary[leg]);
+	auto itr = m_muonToolIndex.find(ToolKey(0, tag, 0));
+	if(itr==m_muonToolIndex.end())
+	{
+		if(!tag) ATH_MSG_ERROR("Unable to find muon tool");
+		else ATH_MSG_ERROR("Unable to find muon tool needed for selection tag " << m_dictionary[tag]);
+		m_cpCode = CP::CorrectionCode::Error;
+		return false;
+	}
+	auto& tool = *m_suppliedMuonTools[itr->second];
+	auto& hltTrig = m_dictionary[leg ^ 0xB0DDD56fF8E3250D];
+	if(!hltTrig.size())
+	{
+		hltTrig = "HLT_" + m_dictionary[leg];
+		while(true)
+		{
+			std::size_t i = hltTrig.find("_OR_m");
+			if(i == std::string::npos) break;
+			hltTrig.insert(i+4, "HLT_", 4);
+		}
+	}
+	bool success = checkAndRecord(tool.getTriggerEfficiency(*p, efficiencies.mc(), hltTrig, kFALSE))
+		&& checkAndRecord(tool.getTriggerEfficiency(*p, efficiencies.data(), hltTrig, kTRUE));
+	ATH_MSG_DEBUG("found for that muon eff(data) = " << efficiencies.data()<<" and eff(MC) = "<<efficiencies.mc());
+	return success;
+}
+
+bool TrigGlobalEfficiencyCorrectionTool::retrieveRunNumber(unsigned& runNumber)
+{
+	runNumber = 0;
+	auto eventInfo = evtStore()->retrieve<const xAOD::EventInfo>("EventInfo");
+	if(!eventInfo)
+	{
+		ATH_MSG_ERROR("Can't retrieve 'EventInfo' from evtStore()");
+		return false;
+	}
+	if(eventInfo->eventType(xAOD::EventInfo::IS_SIMULATION))
+	{
+		if(!m_runNumberDecorator.isAvailable(*eventInfo))
+		{
+			ATH_MSG_ERROR("Can't retrieve 'RandomRunNumber' from EventInfo");
+			return false;
+		}
+		runNumber = m_runNumberDecorator(*eventInfo);
+	}
+	else runNumber = eventInfo->runNumber();
+	return true;
+}
+
+bool TrigGlobalEfficiencyCorrectionTool::retrieveEventNumber(unsigned long& eventNumber)
+{
+	auto eventInfo = evtStore()->retrieve<const xAOD::EventInfo>("EventInfo");
+	if(!eventInfo)
+	{
+		ATH_MSG_WARNING("Can't retrieve event number from evtStore()");
+		eventNumber = 0;
+		return false;
+	}
+	eventNumber = eventInfo->eventNumber();
+	return true;
+}
+
+template<class Particle>
+bool TrigGlobalEfficiencyCorrectionTool::updateLeptonList(LeptonList& leptons, const std::vector<const Particle*>& particles)
+{
+	for(auto lep : particles)
+	{
+		std::size_t tag = 0;
+		for(auto& ltd: m_leptonTagDecorators)
+		{
+			if(ltd.decorator.isAvailable(*lep))
+			{
+				char v = ltd.decorator(*lep);
+				if(v)
+				{
+					if(ltd.suffixed) /// tag = <name>+<value>
+					{
+						std::string s = m_dictionary.at(ltd.hash) + std::to_string(v); 
+						tag = m_hasher(s);
+						m_dictionary.emplace(tag, s);
+					}
+					else tag = ltd.hash;
+				}
+			}
+		}
+		leptons.emplace_back(lep, tag);
+	}
+	return true;
+}
+
+CP::CorrectionCode TrigGlobalEfficiencyCorrectionTool::getEfficiencyScaleFactor(const std::vector<const xAOD::IParticle*>& leptons, double& efficiencyScaleFactor)
+{
+	unsigned runNumber;
+	if(!retrieveRunNumber(runNumber)) return CP::CorrectionCode::Error;
+	return getEfficiencyScaleFactor(runNumber, leptons, efficiencyScaleFactor);
+}
+
+CP::CorrectionCode TrigGlobalEfficiencyCorrectionTool::getEfficiency(const std::vector<const xAOD::IParticle*>& leptons, double& efficiencyData, double& efficiencyMc)
+{
+	unsigned runNumber;
+	if(!retrieveRunNumber(runNumber)) return CP::CorrectionCode::Error;
+	return getEfficiency(runNumber, leptons, efficiencyData, efficiencyMc);
+}
+
+CP::CorrectionCode TrigGlobalEfficiencyCorrectionTool::getEfficiencyScaleFactor(unsigned runNumber, const std::vector<const xAOD::IParticle*>& particles, double& efficiencyScaleFactor)
+{
+	m_cpCode = CP::CorrectionCode::Ok; /// ignores silently previous state + clears "checked" flag
+	efficiencyScaleFactor = 1.;
+	
+	Efficiencies efficiencies;
+	auto cc = getEfficiency(runNumber, particles, efficiencies.data(), efficiencies.mc());
+	if(cc == CP::CorrectionCode::Ok)
+	{
+		if(efficiencies.data()>0. && efficiencies.mc()>0.)
+		{
+			efficiencyScaleFactor = efficiencies.data() / efficiencies.mc();
+			return CP::CorrectionCode::Ok;
+		}
+		else
+		{
+			efficiencyScaleFactor = 1.;
+			ATH_MSG_WARNING("Efficiencies do not seem valid, forcing the scale factor to 1.");
+			return CP::CorrectionCode::OutOfValidityRange;
+		}
+	}
+	efficiencyScaleFactor = 1.;
+	return cc;
+}
+
+CP::CorrectionCode TrigGlobalEfficiencyCorrectionTool::getEfficiency(unsigned runNumber, const std::vector<const xAOD::IParticle*>& particles, double& efficiencyData, double& efficiencyMc)
+{
+	m_cpCode = CP::CorrectionCode::Ok; /// ignores silently previous state + clears "checked" flag
+	efficiencyData = 0.;
+	efficiencyMc = 0.;
+	
+	ATH_MSG_DEBUG("Computing global trigger efficiency for this event with  " << particles.size() << " lepton(s) as input; run number = " << runNumber);
+	
+	if(runNumber<266904 || runNumber>364292)
+	{
+		ATH_MSG_WARNING("Suspicious run number provided " << runNumber << ", continuing anyway");
+	}
+	
+	#ifdef XAOD_STANDALONE
+	if(!m_initialized)
+	{
+		ATH_MSG_WARNING("Tool hasn't been initialized, trying now");
+		if(initialize() != StatusCode::SUCCESS)
+		{
+			ATH_MSG_ERROR("Giving up.");
+			m_cpCode.ignore();
+			return CP::CorrectionCode::Error;
+		}
+	}
+	#endif
+	
+	LeptonList leptons;
+	updateLeptonList(leptons, particles);
+	
+	Efficiencies efficiencies;
+	if(m_calculator->compute(*this, leptons, runNumber, efficiencies))
+	{
+		efficiencyData = efficiencies.data();
+		efficiencyMc = efficiencies.mc();
+		if(efficiencies.data()<=0. || efficiencies.mc()<=0.)
+		{
+			ATH_MSG_WARNING("Efficiencies do not seem valid");
+			m_cpCode.ignore();
+			m_cpCode = CP::CorrectionCode::OutOfValidityRange;
+		}
+	}
+	else
+	{
+		m_cpCode.ignore();
+		m_cpCode = CP::CorrectionCode::Error;
+	}
+	return m_cpCode;
+}
+
+CP::CorrectionCode TrigGlobalEfficiencyCorrectionTool::checkTriggerMatching(bool& matched, const std::vector<const xAOD::IParticle*>& particles)
+{
+	unsigned runNumber;
+	if(!retrieveRunNumber(runNumber))
+	{
+		ATH_MSG_ERROR("Unable to retrieve run number, aborting checkTriggerMatching()");
+		return CP::CorrectionCode::Error;
+	}
+	if(!m_validTrigMatchTool)
+	{
+		ATH_MSG_ERROR("A valid IMatchingTool instance should be provided via the property 'TriggerMatchingTool'");
+		return CP::CorrectionCode::Error;
+	}
+	LeptonList leptons;
+	updateLeptonList(leptons, particles);
+	return m_calculator->checkTriggerMatching(*this, matched, leptons, runNumber)? CP::CorrectionCode::Ok : CP::CorrectionCode::Error;
+}
+
+CP::CorrectionCode TrigGlobalEfficiencyCorrectionTool::getRelevantTriggers(std::vector<std::string>& triggers)
+{
+	unsigned runNumber;
+	if(!retrieveRunNumber(runNumber))
+	{
+		ATH_MSG_ERROR("Unable to retrieve run number, aborting getRelevantTriggers()");
+		return CP::CorrectionCode::Error;
+	}
+	return m_calculator->getRelevantTriggersForUser(*this, triggers, runNumber)? CP::CorrectionCode::Ok : CP::CorrectionCode::Error;
+}
+
+CP::CorrectionCode TrigGlobalEfficiencyCorrectionTool::countTriggerLegs(const std::string& trigger, std::size_t& numberOfLegs)
+{
+	numberOfLegs = 0;
+	/// this abuses a little the role of the dictionary to act as a cache: 
+	/// for the key chosen as the trigger name hash XORed with the magic number,
+	/// the mapped value is not the name of the trigger, but a meaningless string whose size equals the number of legs
+	constexpr std::size_t magic = 0xa3bad03e613527c9;
+	const std::size_t name = m_hasher(trigger), key = name^magic;
+	std::string& value = m_dictionary[key];
+	if(!value.length())
+	{
+		ImportData data;
+		if(!data.importTriggers()) return CP::CorrectionCode::Error;
+		auto itr = data.getTriggerDefs().find(name);
+		if(itr == data.getTriggerDefs().end())
+		{
+			m_dictionary.erase(key);
+			ATH_MSG_ERROR("The trigger " << trigger << " is not recognized");
+			return CP::CorrectionCode::Error;
+		}
+		auto type = itr->second.type;
+		using TrigGlobEffCorr::TriggerType;
+		if(type & TriggerType::TT_SINGLELEPTON_FLAG) value = "~";
+		else if(type & TriggerType::TT_DILEPTON_FLAG) value = "~~";
+		else if(type & TriggerType::TT_TRILEPTON_FLAG) value = "~~~";
+		else
+		{
+			m_dictionary.erase(key);
+			ATH_MSG_ERROR("Unrecognized trigger type, implementation must be fixed!");
+			return CP::CorrectionCode::Error;
+		}
+	}
+	numberOfLegs = value.length();
+	return CP::CorrectionCode::Ok;
+}
+
+bool TrigGlobalEfficiencyCorrectionTool::aboveThreshold(const Lepton& lepton, std::size_t leg) const
+{
+	bool decision = (lepton.pt() >= m_thresholds.at(leg));
+	if(m_validLegTagPairs.size())
+	{
+		if((lepton.type()==xAOD::Type::Electron && m_checkElectronLegTag)
+			|| (lepton.type()==xAOD::Type::Muon && m_checkMuonLegTag)
+			|| (lepton.type()==xAOD::Type::Photon && m_checkPhotonLegTag))
+		{
+			decision = decision && (m_validLegTagPairs.find(leg ^ lepton.tag()) != m_validLegTagPairs.end());
+		}
+	}
+	ATH_MSG_DEBUG("Lepton " << lepton.particle() << " (pt=" << lepton.pt() << ") is " 
+		<< (decision?"":"not ") << "considered suitable for firing trigger leg " << m_dictionary.at(leg));
+	return decision;
+}
+
+std::size_t TrigGlobalEfficiencyCorrectionTool::getCombinedHash(const flat_set<std::size_t>& legs)
+{
+	if(legs.size() < 2) return 0;
+	std::size_t combinedHash = 0;
+	for(auto& leg : legs) combinedHash ^= leg;
+	return combinedHash;
+}
+
+std::size_t TrigGlobalEfficiencyCorrectionTool::getCombinedHash(std::size_t leg1, std::size_t leg2)
+{
+	return leg1 ^ leg2; /// returns 0 if leg1 == leg2, which is the correct behaviour
+}
+
+inline constexpr auto TrigGlobalEfficiencyCorrectionTool::forwardLegs(const flat_set<std::size_t>& legs) -> const flat_set<std::size_t>&
+{
+	return legs;
+}
+
+inline constexpr std::array<std::size_t,2> TrigGlobalEfficiencyCorrectionTool::forwardLegs(std::size_t leg1, std::size_t leg2)
+{
+	if(leg1<leg2) return {leg1, leg2};
+	else return {leg2, leg1};
+}
+
+template<class... ListOfLegs>
+unsigned long TrigGlobalEfficiencyCorrectionTool::getCachedTriggerLegsRanking(const Lepton& lepton, ListOfLegs... legs)
+{
+	auto combinedHash = getCombinedHash(legs...);
+	if(!combinedHash) return 0xFEDCBA9876543210; // only one (distinct) leg
+	auto cachedRankings = m_cachedLegRankings.equal_range(combinedHash);
+	auto rankingItr = cachedRankings.first;
+	float pt = lepton.pt();
+	while(rankingItr!=cachedRankings.second && (pt<rankingItr->second.minPt || pt>=rankingItr->second.maxPt)) ++rankingItr;
+	if(rankingItr == cachedRankings.second)
+	{
+		CachedRanking r = rankTriggerLegs(pt, forwardLegs(legs...));
+		if(r) m_cachedLegRankings.emplace(combinedHash, r);
+		return r.ranking;
+	}
+	return rankingItr->second.ranking;
+}
+
+template<class Container>
+auto TrigGlobalEfficiencyCorrectionTool::rankTriggerLegs(float pt, const Container& legs) -> CachedRanking
+{
+	const std::size_t nLegs = legs.size();
+	CachedRanking r;
+	r.ranking = std::numeric_limits<decltype(r.ranking)>::max();
+	r.minPt = 0.f;
+	r.maxPt = 1e12f;
+	if(nLegs >= 2*sizeof(r.ranking))
+	{
+		ATH_MSG_ERROR("Implementation currently doesn't support ranking of more than " << 2*sizeof(r.ranking) << " trigger legs");
+		return r;
+	}
+	std::vector<uint8_t> counts(nLegs);
+	
+	/// need not only to sort, but also to verify consistency for all pairs of legs (in case of configuration issue)
+	/// for that, use a O(n^2) algorithm and count for each leg the number of legs tighter than itself
+	auto legI = legs.begin();
+	for(unsigned i=0;i<nLegs;++i)
+	{
+		auto legJ = legI;
+		for(unsigned j=i+1;j<nLegs;++j)
+		{
+			++legJ;
+			bool found = false;
+			for(auto& meta : m_hierarchyMeta)
+			{
+				if(pt<meta.minPt || pt>=meta.maxPt) continue;
+				auto data = m_hierarchyData.begin() + meta.offset;
+				auto end = data + meta.nLegs;
+				auto a = std::find(data,end,*legI);
+				if(a==end) continue;
+				auto b = std::find(data,end,*legJ);
+				if(b==end) continue;
+				r.minPt = std::max(r.minPt, meta.minPt);
+				r.maxPt = std::min(r.maxPt, meta.maxPt);
+				++(counts[(a>b)? i : j]);
+				found = true;
+				break;
+			}
+			if(!found)
+			{
+				/// future: might search recursively whether some order can be found via transitivity through an intermediate leg
+				ATH_MSG_ERROR("Unable to rank trigger legs " << m_dictionary[*legI] << " and " << m_dictionary[*legJ]);
+				return r;
+			}
+		}
+		++legI;
+	}
+	decltype(r.ranking) ranking = 0;
+	for(unsigned i=0;i<nLegs;++i)
+	{
+		unsigned char index = std::find(counts.begin(), counts.end(), i) - counts.begin();
+		if(index >= nLegs)
+		{
+			ATH_MSG_ERROR("Inconsistency found while trying to rank " << nLegs << " trigger legs");
+			return r;
+		}
+		ranking = (ranking<<4 | index);
+	}
+	r.ranking = ranking;
+	return r;
+}
+
+std::size_t TrigGlobalEfficiencyCorrectionTool::getLoosestLeg(const Lepton& lepton, std::size_t leg1, std::size_t leg2, bool& success)
+{
+	auto ranking = getCachedTriggerLegsRanking(lepton, leg1, leg2);
+	if(CachedRanking::invalid(ranking))
+	{
+		success = false;
+		return -1;
+	}
+	return forwardLegs(leg1, leg2)[ranking&0xF];
+}
+
+std::pair<std::size_t,std::size_t> TrigGlobalEfficiencyCorrectionTool::getTwoLoosestLegs(const Lepton& lepton, const flat_set<std::size_t>& legs, bool& success)
+{
+	auto ranking = getCachedTriggerLegsRanking(lepton, legs);
+	if(CachedRanking::invalid(ranking))
+	{
+		success = false;
+		return {0, 0};
+	}
+	std::pair<std::size_t,std::size_t> looseLegs{0, 0};
+	looseLegs.first = *legs.nth(ranking&0xF);
+	if(legs.size() >= 2) looseLegs.second = *legs.nth((ranking>>4)&0xF);
+	return looseLegs;
+}
+
+std::size_t TrigGlobalEfficiencyCorrectionTool::getLoosestLegAboveThreshold(const Lepton& lepton, const flat_set<std::size_t>& legs, bool& success)
+{
+	flat_set<std::size_t> validLegs;
+	for(auto leg : legs)
+		if(aboveThreshold(lepton,leg)) validLegs.insert(leg);
+	if(validLegs.size()==0) return 0;
+	if(validLegs.size()==1) return *validLegs.begin();
+	auto ranking = getCachedTriggerLegsRanking(lepton, legs);
+	if(CachedRanking::invalid(ranking))
+	{
+		success = false;
+		return 0;
+	}
+	return *legs.nth(ranking&0xF);
+}
+
+std::vector<std::size_t> TrigGlobalEfficiencyCorrectionTool::getSortedLegs(const Lepton& lepton, const flat_set<std::size_t>& legs, bool& success)
+{
+	const int nLegs = legs.size();
+	unsigned long ranking = getCachedTriggerLegsRanking(lepton, legs);
+	if(CachedRanking::invalid(ranking))
+	{
+		success = false;
+		ranking = 0xFEDCBA9876543210;
+	}
+	std::vector<std::size_t> sorted_legs(nLegs);
+	for(int i=0; i<nLegs; ++i)
+	{
+		sorted_legs[i] = *legs.nth(ranking&0xF);
+		ranking >>= 4;
+	}
+	return sorted_legs;
+}
+
+CP::CorrectionCode TrigGlobalEfficiencyCorrectionTool::suggestElectronMapKeys(const std::map<std::string,std::string>& triggerCombination, 
+	const std::string& version, std::map<std::string,std::string>& legsPerKey)
+{
+	ImportData data;
+	bool success = data.suggestElectronMapKeys(triggerCombination, version, legsPerKey);
+	return success? CP::CorrectionCode::Ok : CP::CorrectionCode::Error;
+}
+
+bool TrigGlobalEfficiencyCorrectionTool::isAffectedBySystematic(const CP::SystematicVariation& systematic) const
+{
+	auto sys = affectingSystematics();
+	return !systematic.empty() && sys.find(systematic)!=sys.end();
+}
+
+CP::SystematicSet TrigGlobalEfficiencyCorrectionTool::affectingSystematics() const
+{
+	return CP::SystematicSet();
+}
+
+CP::SystematicSet TrigGlobalEfficiencyCorrectionTool::recommendedSystematics() const
+{
+	return {};
+}
+
+StatusCode TrigGlobalEfficiencyCorrectionTool::applySystematicVariation(const CP::SystematicSet&)
+{
+	return StatusCode::SUCCESS;
+}
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Calculator.h b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Calculator.h
new file mode 100644
index 0000000000000000000000000000000000000000..df75a5562711721ca93728dfb7bf74214f7f886a
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Calculator.h
@@ -0,0 +1,235 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+// contact: jmaurer@cern.ch
+
+#ifndef TRIGGLOBALEFFICIENCYCORRECTION_CALCULATOR_H
+#define TRIGGLOBALEFFICIENCYCORRECTION_CALCULATOR_H 1
+
+#include "TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrectionTool.h"
+#include "TrigGlobalEfficiencyCorrection/ImportData.h"
+#include "TrigGlobalEfficiencyCorrection/Efficiencies.h"
+
+#include <map>
+#include <algorithm>
+#include <functional>
+#include <boost/container/flat_set.hpp>
+template<typename Key> using flat_set = boost::container::flat_set<Key>;
+
+namespace TrigGlobEffCorr
+{
+
+class Lepton;
+
+class Calculator : public asg::AsgMessaging
+{
+	using LeptonList = TrigGlobalEfficiencyCorrectionTool::LeptonList;
+	using TrigDef = TrigGlobEffCorr::ImportData::TrigDef;
+	using GlobEffFunc = std::function<bool(Calculator*,const LeptonList&,unsigned,Efficiencies&)>;
+
+public:
+	Calculator(TrigGlobalEfficiencyCorrectionTool& parent, unsigned nPeriodsToReserve);
+	bool addPeriod(ImportData& data, const std::pair<unsigned,unsigned>& boundaries, const std::string& combination, 
+			bool useToys, std::size_t& uniqueElectronLeg, std::size_t& uniquePhotonLeg);
+	bool compute(TrigGlobalEfficiencyCorrectionTool& parent, const LeptonList& leptons, unsigned runNumber, Efficiencies& efficiencies);
+	bool checkTriggerMatching(TrigGlobalEfficiencyCorrectionTool& parent, bool& matched, const LeptonList& leptons, unsigned runNumber);
+	bool getRelevantTriggersForUser(TrigGlobalEfficiencyCorrectionTool& parent, std::vector<std::string>& triggers, unsigned runNumber);
+	
+	struct Period
+	{
+		const std::pair<unsigned,unsigned> m_boundaries;
+		GlobEffFunc m_formula;
+		std::vector<TrigDef> m_triggers; /// only used for trigger matching; not filled otherwise. Also, single-lepton _OR_ triggers are split!
+		Period(const decltype(m_boundaries)& b, decltype(m_formula)&& f, decltype(m_triggers)&& t = {}) : m_boundaries(b), m_formula(f), m_triggers(t) {}
+	};
+	
+private:
+	TrigGlobalEfficiencyCorrectionTool* m_parent; /// pointer updated at each call to compute() because the parent tool might have been moved in-between
+	
+	std::vector<Period> m_periods;
+	std::map<std::pair<const Lepton*, std::size_t>, Efficiencies> m_cachedEfficiencies;
+	
+	bool aboveThreshold(const Lepton& p,std::size_t leg) const { return m_parent->aboveThreshold(p, leg); }
+	template<typename Trig1L> auto getLoosestLegAboveThreshold(const Lepton& lepton, const flat_set<Trig1L>& trigs, bool& success)
+			-> std::enable_if_t<Trig1L::is1L(), std::size_t>
+		{ return m_parent->getLoosestLegAboveThreshold(lepton, Trig1L::anonymize(trigs), success); }
+	Efficiencies getCachedTriggerLegEfficiencies(const Lepton& lepton, unsigned runNumber, std::size_t leg, bool& success);
+	bool fillListOfLegsFor(const Lepton& lepton, const std::vector<TrigDef>& triggers, flat_set<std::size_t>& validLegs) const;
+	bool canTriggerBeFired(const TrigDef& trig, const std::vector<flat_set<std::size_t> >& firedLegs) const;
+	const Period* getPeriod(unsigned runNumber) const;
+	bool findUniqueLeg(xAOD::Type::ObjectType obj, std::size_t& uniqueLeg, const std::vector<TrigDef>& defs);
+	
+	/// One single-lepton trigger
+	template<typename Trig1L>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig1L, Efficiencies&)
+		-> std::enable_if_t<Trig1L::is1L(), bool>;
+	/// Two single-lepton triggers, two object types
+	template<typename Trig1L_obj1, typename Trig1L_obj2>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig1L_obj1 trig1, const Trig1L_obj2 trig2, Efficiencies&)
+		-> std::enable_if_t<Trig1L_obj1::is1L()
+							&& Trig1L_obj2::is1L()
+							&& Trig1L_obj1::object() != Trig1L_obj2::object(),
+			bool>;
+	/// Several single-lepton triggers, one object type
+	template<typename Trig1L>
+	auto globalEfficiency(const LeptonList&, unsigned, const flat_set<Trig1L>&, Efficiencies&)
+		-> std::enable_if_t<Trig1L::is1L(), bool>;
+	/// Several single-lepton triggers, two object types
+	template<typename Trig1L_obj1, typename Trig1L_obj2>
+	auto globalEfficiency(const LeptonList&, unsigned, const flat_set<Trig1L_obj1>& trigs1, const flat_set<Trig1L_obj2>& trigs2, Efficiencies&)
+		-> std::enable_if_t<Trig1L_obj1::is1L()
+							&& Trig1L_obj2::is1L()
+							&& Trig1L_obj1::object() != Trig1L_obj2::object(),
+			bool>;
+	/// One mixed-flavour dilepton trigger
+	template<typename Trig2Lmix>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig2Lmix, Efficiencies&)
+		-> std::enable_if_t<Trig2Lmix::is2Lmix(), bool>;
+	/// One symmetric dilepton trigger
+	template<typename Trig2Lsym>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig2Lsym , Efficiencies&)
+		-> std::enable_if_t<Trig2Lsym::is2Lsym(), bool>;
+	/// One asymmetric dilepton trigger
+	template<typename Trig2Lasym>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig2Lasym, Efficiencies&) 
+		-> std::enable_if_t<Trig2Lasym::is2Lasym(), bool>;
+	/// One mixed-flavour dilepton trigger + single-lepton triggers
+	template<typename Trig2Lmix, typename Trig1L_obj1, typename Trig1L_obj2>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig2Lmix, const flat_set<Trig1L_obj1>&, const flat_set<Trig1L_obj2>&, Efficiencies&)
+		-> std::enable_if_t<Trig2Lmix::is2Lmix()
+							&& Trig1L_obj1::is1L() && Trig2Lmix::object1()==Trig1L_obj1::object()
+							&& Trig1L_obj2::is1L() && Trig2Lmix::object2()==Trig1L_obj2::object(),
+			bool>;
+	/// One dilepton trigger + one single-lepton trigger
+	template<typename Trig2L, typename Trig1L>
+	inline auto globalEfficiency(const LeptonList&, unsigned, const Trig2L, const Trig1L, Efficiencies&)
+		-> std::enable_if_t<Trig2L::is2Lnomix() 
+							&& Trig1L::is1L()
+							&& Trig2L::object()==Trig1L::object(),
+			bool>;
+	/// One symmetric dilepton trigger + several single-lepton triggers
+	template<typename Trig2Lsym, typename Trig1L>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig2Lsym, const flat_set<Trig1L>&, Efficiencies&)
+		-> std::enable_if_t<Trig2Lsym::is2Lsym() 
+							&& Trig1L::is1L() 
+							&& Trig1L::object() == Trig2Lsym::object(), 
+			bool>;
+	/// One asymmetric dilepton trigger + several single-lepton triggers
+	template<typename Trig2Lasym, typename Trig1L>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig2Lasym, const flat_set<Trig1L>&, Efficiencies&)
+		-> std::enable_if_t<Trig2Lasym::is2Lasym() 
+							&& Trig1L::is1L() 
+							&& Trig1L::object() == Trig2Lasym::object(), 
+			bool>;
+	/// Two symmetric dilepton triggers + several single-lepton triggers
+	template<typename Trig2Lsym, typename Trig1L> 
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig2Lsym, const Trig2Lsym, const flat_set<Trig1L>&, Efficiencies&)
+		-> std::enable_if_t<Trig2Lsym::is2Lsym() 
+							&& Trig1L::is1L()
+							&& Trig1L::object() == Trig2Lsym::object(), 
+			bool>;
+	/// Two dilepton triggers (one asym., one sym.) + several single-lepton triggers
+	template<typename Trig2Lasym, typename Trig2Lsym, typename Trig1L>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig2Lasym, const Trig2Lsym, const flat_set<Trig1L>&, Efficiencies&)
+		-> std::enable_if_t<Trig2Lasym::is2Lasym() 
+							&& Trig2Lsym::is2Lsym() && Trig2Lsym::object()==Trig2Lasym::object()
+							&& Trig1L::is1L() && Trig1L::object()==Trig2Lasym::object(), 
+			bool>;
+	/// One symmetric trilepton trigger
+	template<typename Trig3Lsym>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig3Lsym, Efficiencies&)
+		-> std::enable_if_t<Trig3Lsym::is3Lsym(), bool>;
+	/// One half-symmetric trilepton trigger
+	template<typename Trig3Lhalfsym>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig3Lhalfsym, Efficiencies&)
+		-> std::enable_if_t<Trig3Lhalfsym::is3Lhalfsym(), bool>;
+	/// One dilepton trigger + one mixed-flavour dilepton trigger
+	template<typename Trig2L, typename Trig2Lmix>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig2L, const Trig2Lmix, Efficiencies&)
+		-> std::enable_if_t<Trig2L::is2Lnomix()
+							&& Trig2Lmix::is2Lmix()
+							&& (Trig2Lmix::object1()==Trig2L::object() || Trig2Lmix::object2()==Trig2L::object()),
+			bool>;
+	/// Combinaisons with 3 dilepton triggers including one mixed-flavour, and one sym./asym. dilepton for each flavour
+	template<typename Trig2L_obj1, typename Trig2L_obj2, typename Trig2Lmix>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig2L_obj1, const Trig2L_obj2, const Trig2Lmix, Efficiencies&)
+		-> std::enable_if_t<Trig2Lmix::is2Lmix()
+							&& Trig2L_obj1::is2Lnomix() && Trig2L_obj1::object() == Trig2Lmix::object1()
+							&& Trig2L_obj2::is2Lnomix() && Trig2L_obj2::object() == Trig2Lmix::object2(),
+							
+			bool>;
+	/// Same combinaisons with 3 dilepton triggers, + single-lepton triggers
+	template<typename Trig2L_obj1, typename Trig2L_obj2, typename Trig2Lmix, typename Trig1L_obj1, typename Trig1L_obj2>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig2L_obj1, const Trig2L_obj2, const Trig2Lmix, 
+			const flat_set<Trig1L_obj1>&, const flat_set<Trig1L_obj2>&, Efficiencies&)
+		-> std::enable_if_t<Trig2Lmix::is2Lmix()
+							&& Trig2L_obj1::is2Lnomix() && Trig2L_obj1::object()==Trig2Lmix::object1()
+							&& Trig2L_obj2::is2Lnomix() && Trig2L_obj2::object()==Trig2Lmix::object2()
+							&& Trig1L_obj1::is1L() && Trig1L_obj1::object()==Trig2Lmix::object1()
+							&& Trig1L_obj2::is1L() && Trig1L_obj2::object()==Trig2Lmix::object2(),
+							
+			bool>;
+	/// Six dilepton triggers (two mixed-flavour, two sym., two asym./sym.) for two object types
+	template<typename Trig2L_obj1, typename Trig2Lsym_obj1, typename Trig2L_obj2, typename Trig2Lsym_obj2,
+		typename Trig2Lmix, typename Trig1L_obj1, typename Trig1L_obj2>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig2L_obj1, const Trig2Lsym_obj1, const Trig2L_obj2, const Trig2Lsym_obj2,
+			const Trig2Lmix, const Trig2Lmix, const flat_set<Trig1L_obj1>&, const flat_set<Trig1L_obj2>&, Efficiencies&)
+		-> std::enable_if_t<Trig2Lmix::is2Lmix()
+							&& Trig2L_obj1::is2Lnomix() && Trig2L_obj1::object()==Trig2Lmix::object1()
+							&& Trig2L_obj2::is2Lnomix() && Trig2L_obj2::object()==Trig2Lmix::object2()
+							&& Trig2Lsym_obj1::is2Lsym() && Trig2Lsym_obj1::object()==Trig2Lmix::object1()
+							&& Trig2Lsym_obj2::is2Lsym() && Trig2Lsym_obj2::object()==Trig2Lmix::object2()
+							&& Trig1L_obj1::is1L() && Trig1L_obj1::object()==Trig2Lmix::object1()
+							&& Trig1L_obj2::is1L() && Trig1L_obj2::object()==Trig2Lmix::object2(),
+			bool>;
+	/// One mixed-flavour trilepton trigger
+	template<typename Trig3Lmix>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig3Lmix, Efficiencies&)
+		-> std::enable_if_t<Trig3Lmix::is3Lmix(), bool>;
+	/// Two complementary mixed-flavour trilepton triggers
+	template<typename Trig3Lmix1, typename Trig3Lmix2>
+	auto globalEfficiency(const LeptonList&, unsigned, const Trig3Lmix1, const Trig3Lmix2, Efficiencies&)
+		-> std::enable_if_t<Trig3Lmix1::is3Lmix() 
+						&& Trig3Lmix2::is3Lmix() 
+						&& Trig3Lmix1::object1() == Trig3Lmix2::object2()
+						&& Trig3Lmix1::object2() == Trig3Lmix2::object1(), 
+			bool>;
+	
+	bool globalEfficiency_Factorized2(const LeptonList& leptons, unsigned runNumber, GlobEffFunc func1, GlobEffFunc func2, Efficiencies& globalEfficiencies);
+	bool globalEfficiency_Factorized3(const LeptonList& leptons, unsigned runNumber, GlobEffFunc func1, GlobEffFunc func2, GlobEffFunc func3, Efficiencies& globalEfficiencies);
+
+	bool globalEfficiency_Toys(const LeptonList&, unsigned, const std::vector<TrigDef>& triggers, Efficiencies&);
+	
+private:
+	class Helper
+	{
+	public:
+		Helper(const std::vector<TrigDef>& defs);
+		Helper(Helper&&) = default;
+
+		bool duplicates() const;
+		std::function<bool(Calculator*,const LeptonList&,unsigned,Efficiencies&)> m_formula;
+		
+		bool findAndBindFunction();
+
+	protected:
+		std::vector<TrigDef> m_defs;
+		unsigned m_n1L = 0, m_n2L = 0, m_n3L = 0;
+	
+		template<TriggerType object_flag> bool findAndBindFunction();
+		template<TriggerType object1_flag, TriggerType object2_flag> bool findAndBindFunction();
+		template<typename... Trigs> bool bindFunction();
+		
+		template<typename Param> auto extract();
+		struct NoSuchTrigger {};
+		template<typename T> struct Optional{}; /// to decorate the parameters of the findAndBind() function(s)
+		template<typename T> struct BindPackedParam;
+
+	};
+
+	friend class CheckConfig;
+};
+
+}
+#endif
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/CheckConfig.h b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/CheckConfig.h
new file mode 100644
index 0000000000000000000000000000000000000000..75c96514871e75eb1f458754cb68c33357b21f02
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/CheckConfig.h
@@ -0,0 +1,35 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+// contact: jmaurer@cern.ch
+
+#ifndef TRIGGLOBALEFFICIENCYCORRECTION_CHECKCONFIG_H
+#define TRIGGLOBALEFFICIENCYCORRECTION_CHECKCONFIG_H 1
+
+#include "TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrectionTool.h"
+#include "AsgMessaging/AsgMessaging.h"
+
+#include <functional>
+#include <vector>
+
+namespace TrigGlobEffCorr
+{
+	
+class CheckConfig : public asg::AsgMessaging
+{	
+public:
+	CheckConfig(TrigGlobalEfficiencyCorrectionTool& parent);
+	
+	bool basicConfigChecks();
+	bool advancedConfigChecks();
+	
+private:
+	TrigGlobalEfficiencyCorrectionTool& m_parent;
+
+	template<class CPTool> static ToolHandle<CPTool>* findToolByName(ToolHandleArray<CPTool>& suppliedTools, const std::string& name);
+};
+
+}
+
+#endif
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Efficiencies.h b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Efficiencies.h
new file mode 100644
index 0000000000000000000000000000000000000000..237159493a06292097c17fdcd4e8b76589d629e2
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Efficiencies.h
@@ -0,0 +1,42 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+// contact: jmaurer@cern.ch
+
+#ifndef TRIGGLOBALEFFICIENCYCORRECTION_EFFICIENCIES_H
+#define TRIGGLOBALEFFICIENCYCORRECTION_EFFICIENCIES_H 1
+
+#include <utility>
+
+namespace TrigGlobEffCorr
+{
+
+class Efficiencies
+{
+public:
+	Efficiencies() = default;
+	Efficiencies(double e) : m_effs(e,e) {}
+	Efficiencies(const Efficiencies&) = default;
+	Efficiencies(Efficiencies&&) = default;
+	Efficiencies& operator=(const Efficiencies&) = default;
+	Efficiencies& operator=(Efficiencies&&) = default;
+	~Efficiencies() = default;
+	double& data() { return m_effs.first; }
+	double& mc() { return m_effs.second; }
+	double data() const { return m_effs.first; }
+	double mc() const { return m_effs.second; }	
+	Efficiencies operator~() const { return Efficiencies(1. - m_effs.first, 1. - m_effs.second); }
+	Efficiencies operator+(const Efficiencies& rhs) const { return Efficiencies(m_effs.first+rhs.m_effs.first, m_effs.second+rhs.m_effs.second); }
+	Efficiencies operator-(const Efficiencies& rhs) const { return Efficiencies(m_effs.first-rhs.m_effs.first, m_effs.second-rhs.m_effs.second); }
+	Efficiencies operator*(const Efficiencies& rhs) const { return Efficiencies(m_effs.first*rhs.m_effs.first, m_effs.second*rhs.m_effs.second); }
+	Efficiencies& operator+=(const Efficiencies& rhs) { m_effs.first+=rhs.m_effs.first; m_effs.second+=rhs.m_effs.second; return *this; }
+	Efficiencies& operator*=(const Efficiencies& rhs) { m_effs.first*=rhs.m_effs.first; m_effs.second*=rhs.m_effs.second; return *this; }
+protected:
+	Efficiencies(double vd, double vm) : m_effs(vd,vm) {}
+	std::pair<double,double> m_effs;
+};
+
+}
+
+#endif
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/ImportData.h b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/ImportData.h
new file mode 100644
index 0000000000000000000000000000000000000000..73e8bb084acf408fdc53003918be18764beeb4f8
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/ImportData.h
@@ -0,0 +1,148 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+// contact: jmaurer@cern.ch
+
+#ifndef TRIGGLOBALEFFICIENCYCORRECTION_IMPORTDATA_H
+#define TRIGGLOBALEFFICIENCYCORRECTION_IMPORTDATA_H 1
+
+#include "TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrectionTool.h"
+#include "AsgMessaging/AsgMessaging.h"
+#include <functional>
+#include <algorithm>
+#include <cctype>
+#include <vector>
+#include <map>
+#include <array>
+
+namespace TrigGlobEffCorr
+{
+
+enum TriggerType
+{
+	TT_UNKNOWN = 0x0,
+	TT_X2Y_FLAG = 0x1, // used to distinguish X_2Y from 2X_Y triggers
+	TT_ELECTRON_FLAG = 0x10,
+	TT_MUON_FLAG = 0x20,
+	TT_PHOTON_FLAG = 0x40,
+	TT_MASK_FLAVOUR = TT_ELECTRON_FLAG | TT_MUON_FLAG | TT_PHOTON_FLAG,
+	TT_SYM = 0x100,
+	TT_HALFSYM = 0x200,
+	TT_ASYM = 0x300,
+	TT_MASK_SYMMETRY = TT_SYM | TT_HALFSYM | TT_ASYM,
+	TT_MASK_TYPE = ~TT_MASK_FLAVOUR,
+	// single lepton triggers
+	TT_SINGLELEPTON_FLAG = 0x1000,
+	TT_SINGLE_E = TT_SINGLELEPTON_FLAG| TT_ELECTRON_FLAG,
+	TT_SINGLE_MU = TT_SINGLELEPTON_FLAG | TT_MUON_FLAG,
+	TT_SINGLE_G = TT_SINGLELEPTON_FLAG | TT_PHOTON_FLAG,
+	// dilepton triggers
+	TT_DILEPTON_FLAG = 0x2000,
+	TT_DILEPTON_SYM = TT_DILEPTON_FLAG | TT_SYM,
+	TT_DILEPTON_ASYM = TT_DILEPTON_FLAG | TT_ASYM,
+	TT_2E_SYM = TT_DILEPTON_SYM | TT_ELECTRON_FLAG,
+	TT_2E_ASYM = TT_DILEPTON_ASYM | TT_ELECTRON_FLAG,
+	TT_2MU_SYM = TT_DILEPTON_SYM | TT_MUON_FLAG,
+	TT_2MU_ASYM = TT_DILEPTON_ASYM | TT_MUON_FLAG,
+	TT_E_MU = TT_DILEPTON_FLAG | TT_ELECTRON_FLAG | TT_MUON_FLAG,
+	TT_2G_SYM = TT_DILEPTON_SYM | TT_PHOTON_FLAG,
+	TT_2G_ASYM = TT_DILEPTON_ASYM | TT_PHOTON_FLAG,
+	TT_E_G = TT_DILEPTON_FLAG | TT_ELECTRON_FLAG | TT_PHOTON_FLAG,
+	TT_MU_G = TT_DILEPTON_FLAG | TT_MUON_FLAG | TT_PHOTON_FLAG,
+	// trilepton triggers
+	TT_TRILEPTON_FLAG = 0x4000,
+	TT_TRILEPTON_SYM = TT_TRILEPTON_FLAG | TT_SYM,
+	TT_TRILEPTON_HALFSYM = TT_TRILEPTON_FLAG | TT_HALFSYM,
+	TT_TRILEPTON_ASYM = TT_TRILEPTON_FLAG | TT_ASYM,
+	TT_3E_SYM = TT_TRILEPTON_SYM | TT_ELECTRON_FLAG,
+	TT_3E_HALFSYM = TT_TRILEPTON_HALFSYM | TT_ELECTRON_FLAG,
+	TT_3E_ASYM = TT_TRILEPTON_ASYM | TT_ELECTRON_FLAG,
+	TT_3MU_SYM = TT_TRILEPTON_SYM | TT_MUON_FLAG,
+	TT_3MU_HALFSYM = TT_TRILEPTON_HALFSYM | TT_MUON_FLAG,
+	TT_3MU_ASYM = TT_TRILEPTON_ASYM | TT_MUON_FLAG,
+	TT_2E_MU_SYM = TT_TRILEPTON_SYM | TT_ELECTRON_FLAG | TT_MUON_FLAG,
+	TT_E_2MU_SYM = TT_2E_MU_SYM | TT_X2Y_FLAG,
+	TT_2E_MU_ASYM = TT_TRILEPTON_ASYM | TT_ELECTRON_FLAG | TT_MUON_FLAG,
+	TT_E_2MU_ASYM = TT_2E_MU_ASYM | TT_X2Y_FLAG,
+	TT_3G_SYM = TT_TRILEPTON_SYM | TT_PHOTON_FLAG,
+	TT_3G_HALFSYM = TT_TRILEPTON_HALFSYM | TT_PHOTON_FLAG,
+	TT_3G_ASYM = TT_TRILEPTON_ASYM | TT_PHOTON_FLAG,
+	TT_2E_G_SYM = TT_TRILEPTON_SYM | TT_ELECTRON_FLAG | TT_PHOTON_FLAG,
+	TT_E_2G_SYM = TT_2E_G_SYM | TT_X2Y_FLAG,
+	TT_2E_G_ASYM = TT_TRILEPTON_ASYM | TT_ELECTRON_FLAG | TT_PHOTON_FLAG,
+	TT_E_2G_ASYM = TT_2E_G_ASYM | TT_X2Y_FLAG,
+	TT_2MU_G_SYM = TT_TRILEPTON_SYM | TT_MUON_FLAG | TT_PHOTON_FLAG,
+	TT_MU_2G_SYM = TT_2MU_G_SYM | TT_X2Y_FLAG,
+	TT_2MU_G_ASYM = TT_TRILEPTON_ASYM | TT_MUON_FLAG | TT_PHOTON_FLAG,
+	TT_MU_2G_ASYM = TT_2MU_G_ASYM | TT_X2Y_FLAG,
+};
+
+class ImportData : public asg::AsgMessaging
+{
+	using Hierarchy = TrigGlobalEfficiencyCorrectionTool::Hierarchy;
+	
+public:
+	struct TrigDef
+	{ 
+		TriggerType type;
+		std::size_t name;
+		std::array<std::size_t,3> leg;
+		bool used = false; /// auxiliary variable used by Calculator::Helper::extra() and bindFunction()
+		TrigDef(TriggerType type=TT_UNKNOWN, std::size_t name=0, std::size_t leg0=0, std::size_t leg1=0, std::size_t leg2=0) : type(type), name(name), leg{leg0,leg1,leg2} {}
+	};	
+
+	ImportData();
+	ImportData(TrigGlobalEfficiencyCorrectionTool& parent);
+	~ImportData();
+	
+	bool importHierarchies();
+	bool importTriggers();
+	bool importThresholds(const std::map<std::string, std::string>& overridenThresholds = {});
+	bool importPeriods();
+	bool importMapKeys(const std::string& tag, std::map<std::size_t,std::map<std::size_t,int> >& keysPerLeg);
+	// NB: the following function calls all import*() functions except importMapKeys()
+	bool importAll(const std::map<std::string, std::string>& overridenThresholds = {});
+	
+	bool getPeriodBoundaries(const std::string& period, std::pair<unsigned,unsigned>& boundaries);
+	bool suggestElectronMapKeys(const std::map<std::string,std::string>& triggerCombination,
+		const std::string& version, std::map<std::string,std::string>& legsPerKey);
+		
+	const std::map<std::size_t,TrigDef>& getTriggerDefs() const { return m_triggerDefs; }
+	const std::map<std::size_t,float>& getTriggerThresholds() const { return m_triggerThresholds; }
+	const std::map<std::string, std::pair<unsigned,unsigned>>& getDataPeriods() const { return m_dataPeriods; }
+	const std::vector<Hierarchy> getHierarchyMeta() const { return m_hierarchyMeta; }
+	const std::vector<std::size_t> getHierarchyData() const { return m_hierarchyData; }
+	const std::map<std::size_t,std::string>& getDictionary() const { return m_dictionary; }
+	xAOD::Type::ObjectType associatedLeptonFlavour(std::size_t leg, bool& success);
+	static xAOD::Type::ObjectType associatedLeptonFlavour(const std::string& leg, bool& success);
+	std::vector<TrigDef> parseTriggerString(const std::string& triggerString, bool& success);
+	TrigGlobalEfficiencyCorrectionTool* getParent() { return m_parent; }
+	bool adaptTriggerListForTriggerMatching(std::vector<ImportData::TrigDef>& triggers);
+	
+protected:
+	bool readDataFile(const char* filename, std::vector<std::string>& contents);
+	void setNonMixed3LType(TrigDef& def, TriggerType flavourFlag);
+	
+	TrigGlobalEfficiencyCorrectionTool* m_parent;
+	std::map<std::size_t,std::string>& m_dictionary;
+	std::hash<std::string>& m_hasher;
+	
+	std::map<std::size_t,TrigDef> m_triggerDefs;
+	std::map<std::size_t,float> m_triggerThresholds;
+	std::map<std::string, std::pair<unsigned,unsigned>> m_dataPeriods;
+	std::vector<Hierarchy> m_hierarchyMeta;
+	std::vector<std::size_t> m_hierarchyData;
+};
+
+inline std::string removeWhitespaces(const std::string& s)
+{
+	std::string t(s);
+	t.erase(std::remove_if(t.begin(), t.end(),
+			[](char c){ return std::isspace(c); }), t.end());
+	return t;
+}
+
+}
+
+#endif
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Lepton.h b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Lepton.h
new file mode 100644
index 0000000000000000000000000000000000000000..bf974c2174ee450ba87da0c817ba1e214a36d47f
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Lepton.h
@@ -0,0 +1,42 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+// contact: jmaurer@cern.ch
+
+#ifndef TRIGGLOBALEFFICIENCYCORRECTION_LEPTON_H
+#define TRIGGLOBALEFFICIENCYCORRECTION_LEPTON_H 1
+
+#include "xAODEgamma/Electron.h"
+#include "xAODEgamma/Photon.h"
+
+namespace TrigGlobEffCorr
+{
+
+class Lepton
+{
+public:
+	Lepton(const xAOD::IParticle* ptr, std::size_t tag=0) : m_obj(ptr), m_tag(tag) {}
+	Lepton(const xAOD::Electron* ptr, std::size_t tag=0) : m_obj(ptr), m_tag(tag) {}
+	Lepton(const xAOD::Photon* ptr, std::size_t tag=0) : m_obj(ptr), m_tag(tag) {}
+	Lepton(const Lepton&) = default;
+	Lepton& operator=(const Lepton&) = default;
+	Lepton(Lepton&&) = default;
+	Lepton& operator=(Lepton&&) = default;
+	float pt() const { return m_obj->pt(); }
+	xAOD::Type::ObjectType type() const { return m_obj->type(); }
+	std::size_t tag() const { return m_tag; }
+	const xAOD::Electron* electron() const { return static_cast<const xAOD::Electron*>(m_obj); }
+	const xAOD::Muon* muon() const { return static_cast<const xAOD::Muon*>(m_obj); }
+	const xAOD::Photon* photon() const { return static_cast<const xAOD::Photon*>(m_obj); }
+	const xAOD::IParticle* particle() const { return m_obj; }
+	bool operator<(const Lepton& rhs) const { return m_obj<rhs.m_obj; }
+protected:
+	const xAOD::IParticle* m_obj = nullptr;
+	mutable std::size_t m_tag = 0; // 0 = no tag
+};
+
+}
+
+
+#endif
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrectionDict.h b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrectionDict.h
new file mode 100644
index 0000000000000000000000000000000000000000..f422d67bbf510b420aa5a941c9ecdf118ba9f3a3
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrectionDict.h
@@ -0,0 +1,10 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TOOLPROTOTYPES_TRIGGLOBALEFFICIENCYCORRECTIONDICT_H
+#define TOOLPROTOTYPES_TRIGGLOBALEFFICIENCYCORRECTIONDICT_H
+
+#include "TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrectionTool.h"
+
+#endif
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrectionTool.h b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrectionTool.h
new file mode 100644
index 0000000000000000000000000000000000000000..0bd10db0c889686f8bd4583d04607fa685b8add9
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrectionTool.h
@@ -0,0 +1,199 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+// contact: jmaurer@cern.ch
+
+#ifndef TRIGGLOBALEFFICIENCYCORRECTION_TRIGGLOBALEFFICIENCYCORRECTIONTOOL_H
+#define TRIGGLOBALEFFICIENCYCORRECTION_TRIGGLOBALEFFICIENCYCORRECTIONTOOL_H 1
+
+#include "TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h"
+
+#include "AsgTools/ToolHandleArray.h"
+#include "AsgTools/AsgTool.h"
+#include "EgammaAnalysisInterfaces/IAsgElectronEfficiencyCorrectionTool.h"
+#include "MuonAnalysisInterfaces/IMuonTriggerScaleFactors.h"
+#include "EgammaAnalysisInterfaces/IAsgPhotonEfficiencyCorrectionTool.h"
+#include "AthContainers/AuxElement.h"
+#include "TriggerMatchingTool/IMatchingTool.h"
+#include "xAODEgamma/PhotonFwd.h"
+
+#include <string>
+#include <vector>
+#include <map>
+#include <set>
+#include <boost/container/container_fwd.hpp>
+#include <memory>
+
+
+namespace TrigGlobEffCorr
+{
+	class ImportData;
+	class Calculator;
+	class CheckConfig;
+	class Efficiencies;
+	class Lepton;
+}
+
+class TrigGlobalEfficiencyCorrectionTool: public asg::AsgTool, public virtual ITrigGlobalEfficiencyCorrectionTool
+{
+public: 
+	ASG_TOOL_CLASS(TrigGlobalEfficiencyCorrectionTool,ITrigGlobalEfficiencyCorrectionTool)
+
+	TrigGlobalEfficiencyCorrectionTool(const std::string& name);
+	virtual ~TrigGlobalEfficiencyCorrectionTool();
+
+	virtual StatusCode  initialize() override;
+
+	virtual CP::CorrectionCode getEfficiencyScaleFactor(const std::vector<const xAOD::IParticle*>& particles, double& efficiencyScaleFactor) override;
+	virtual CP::CorrectionCode getEfficiencyScaleFactor(unsigned runNumber, const std::vector<const xAOD::IParticle*>& particles, double& efficiencyScaleFactor) override;
+	virtual CP::CorrectionCode getEfficiency(const std::vector<const xAOD::IParticle*>& particles, double& efficiencyData, double& efficiencyMc) override;
+	virtual CP::CorrectionCode getEfficiency(unsigned runNumber, const std::vector<const xAOD::IParticle*>& particles, double& efficiencyData, double& efficiencyMc) override;	
+	
+	virtual bool isAffectedBySystematic(const CP::SystematicVariation& systematic) const override;
+	virtual CP::SystematicSet affectingSystematics() const override;
+	virtual CP::SystematicSet recommendedSystematics() const override;
+	virtual StatusCode applySystematicVariation(const CP::SystematicSet& systConfig) override;
+
+	virtual CP::CorrectionCode checkTriggerMatching(bool& matched, const std::vector<const xAOD::IParticle*>& particles) override;
+	virtual CP::CorrectionCode getRelevantTriggers(std::vector<std::string>& triggers) override;
+	virtual CP::CorrectionCode countTriggerLegs(const std::string& trigger, std::size_t& numberOfLegs) override;
+	
+	static CP::CorrectionCode suggestElectronMapKeys(const std::map<std::string,std::string>& triggerCombination,
+		const std::string& version, std::map<std::string,std::string>& legsPerKey);
+	
+private: 
+
+	struct Hierarchy
+	{
+		short offset, nLegs;
+		float minPt, maxPt;
+	};
+	struct TagDecorator
+	{
+		SG::AuxElement::ConstAccessor<char> decorator;
+		std::size_t hash;
+		bool suffixed;
+		TagDecorator(const std::string& name, std::size_t hash, bool suffixed) : decorator(name), hash(hash), suffixed(suffixed) {}
+	};
+	struct CachedRanking
+	{
+		float minPt, maxPt;
+		unsigned long ranking;
+		operator bool() const { return ranking+1; }
+		static bool invalid(unsigned long ranking) { return !(ranking+1); }
+	};
+	struct ToolKey
+	{
+		std::size_t hash;
+		std::pair<unsigned,unsigned> boundaries;
+		bool operator<(const ToolKey& rhs) const { return hash<rhs.hash || (hash==rhs.hash && boundaries.second<rhs.boundaries.first); }
+		bool operator==(const ToolKey& rhs) const { return hash==rhs.hash && boundaries.second>=rhs.boundaries.first && rhs.boundaries.second>=boundaries.first; }
+		ToolKey(std::size_t leg, std::size_t tag, unsigned runNumber) : hash(leg^tag), boundaries(runNumber, runNumber) {}
+		ToolKey(std::size_t leg, std::size_t tag, std::pair<unsigned,unsigned> bounds) : hash(leg^tag), boundaries(bounds) {}
+		ToolKey(std::size_t leg = 0, std::size_t tag = 0) : hash(leg^tag), boundaries(0, 999999) {}
+	};
+	using LeptonList = std::vector<TrigGlobEffCorr::Lepton>;
+	
+	/// Properties:
+	ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> m_suppliedElectronEfficiencyTools;
+	ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> m_suppliedElectronScaleFactorTools;
+	ToolHandleArray<IAsgPhotonEfficiencyCorrectionTool> m_suppliedPhotonEfficiencyTools;
+	ToolHandleArray<IAsgPhotonEfficiencyCorrectionTool> m_suppliedPhotonScaleFactorTools;
+	ToolHandleArray<CP::IMuonTriggerScaleFactors> m_suppliedMuonTools;
+	std::map<std::string, std::string> m_legsPerTool;
+	std::map<std::string, std::string> m_triggerCb;
+	std::map<std::string, std::string> m_triggerCbPerYear;
+	std::string m_leptonTagDecorations;
+	std::map<std::string, std::string> m_tagsPerTool;
+	std::map<std::string, std::string> m_electronLegsPerTag; /// deprecated
+	std::map<std::string, std::string> m_muonLegsPerTag; /// deprecated
+	std::map<std::string, std::string> m_legsPerTag;
+	std::map<std::string, std::string> m_overrideThresholds;
+	unsigned long m_numberOfToys;
+	bool m_useInternalSeed;
+	ToolHandle<Trig::IMatchingTool> m_trigMatchTool;
+
+	std::hash<std::string> m_hasher; //!
+	std::map<std::size_t,float > m_thresholds; //!
+	std::multimap<std::size_t, CachedRanking> m_cachedLegRankings; //!
+	std::map<ToolKey, std::size_t > m_electronSfToolIndex; //!
+	std::map<ToolKey, std::size_t > m_electronEffToolIndex; //!
+	std::map<ToolKey, std::size_t > m_photonSfToolIndex; //!
+	std::map<ToolKey, std::size_t > m_photonEffToolIndex; //!
+	std::map<ToolKey, std::size_t > m_muonToolIndex; //!
+	std::set<std::size_t> m_validLegTagPairs; //!
+	bool m_checkElectronLegTag; //!
+	bool m_checkMuonLegTag; //!
+	bool m_checkPhotonLegTag; //!
+	std::map<std::size_t, std::string> m_dictionary; //!
+	
+	std::vector<Hierarchy> m_hierarchyMeta; //!
+	std::vector<std::size_t> m_hierarchyData; //!
+	
+	bool m_initialized = false; //!
+	CP::CorrectionCode m_cpCode = CP::CorrectionCode::Ok; //!
+	unsigned long m_seed;
+	bool m_validTrigMatchTool; //!
+	
+	std::vector<TagDecorator> m_leptonTagDecorators; //!
+	SG::AuxElement::ConstAccessor<unsigned int> m_runNumberDecorator; //!
+	std::unique_ptr<TrigGlobEffCorr::Calculator> m_calculator; //!
+	
+	template<typename Key> using flat_set = boost::container::flat_set<Key>;
+
+	/// Internal methods (I) -- initialization of the tool
+	bool loadHierarchies();
+	template<class CPTool> bool enumerateTools(TrigGlobEffCorr::ImportData& data, ToolHandleArray<CPTool>& suppliedTools,
+		std::map<ToolKey, std::size_t>& toolIndex, flat_set<std::size_t>& collectedTags);
+	flat_set<ToolKey> parseListOfLegs(TrigGlobEffCorr::ImportData& data, const std::string& inputList, bool& success);
+	bool parseTagString(const std::string& tagstring, flat_set<std::size_t>& tags);
+	bool loadTriggerCombination(TrigGlobEffCorr::ImportData& data, bool useDefaultElectronTools, bool useDefaultPhotonTools);
+	bool loadTagDecorators(const flat_set<std::size_t>& collectedElectronTags, const flat_set<std::size_t>& collectedMuonTags, const flat_set<std::size_t>& collectedPhotonTags);
+	bool loadListOfLegsPerTag(const flat_set<std::size_t>& collectedElectronTags, const flat_set<std::size_t>& collectedMuonTags, const flat_set<std::size_t>& collectedPhotonTags);
+	bool processDeprecatedProperties();
+	
+	/// Internal methods (II) -- core task
+	bool retrieveRunNumber(unsigned& runNumber);
+	bool retrieveEventNumber(unsigned long& eventNumber);
+	bool aboveThreshold(const TrigGlobEffCorr::Lepton& p,std::size_t leg) const;
+	template<class... ListOfLegs> unsigned long getCachedTriggerLegsRanking(const TrigGlobEffCorr::Lepton& lepton, ListOfLegs... legs);
+	std::size_t getLoosestLegAboveThreshold(const TrigGlobEffCorr::Lepton& lepton, const flat_set<std::size_t>& legs, bool& success);
+	std::size_t getLoosestLeg(const TrigGlobEffCorr::Lepton& lepton, std::size_t leg1, std::size_t leg2, bool& success);
+	std::pair<std::size_t,std::size_t> getTwoLoosestLegs(const TrigGlobEffCorr::Lepton& lepton, const flat_set<std::size_t>& legs, bool& success);
+	std::vector<std::size_t> getSortedLegs(const TrigGlobEffCorr::Lepton& lepton, const flat_set<std::size_t>& legs, bool& success);
+	template<class Container> CachedRanking rankTriggerLegs(float pt, const Container& legs);
+	template<class Particle> bool updateLeptonList(LeptonList& leptons, const std::vector<const Particle*>& particles);
+	void updateMuonTriggerNames(std::size_t leg, const std::string& name);
+	bool getTriggerLegEfficiencies(const xAOD::Electron* p, unsigned runNumber, std::size_t leg, std::size_t tag, TrigGlobEffCorr::Efficiencies& efficiencies);
+	bool getTriggerLegEfficiencies(const xAOD::Muon* p, std::size_t leg, std::size_t tag, TrigGlobEffCorr::Efficiencies& efficiencies);
+	bool getTriggerLegEfficiencies(const xAOD::Photon* p, unsigned runNumber, std::size_t leg, std::size_t tag, TrigGlobEffCorr::Efficiencies& efficiencies);
+	template<class ParticleType>
+	bool getEgammaTriggerLegEfficiencies(const ParticleType* p, unsigned runNumber, std::size_t leg, std::size_t tag, TrigGlobEffCorr::Efficiencies& efficiencies);
+	decltype(m_electronSfToolIndex)& GetScaleFactorToolIndex(const xAOD::Electron*) { return m_electronSfToolIndex; }
+	decltype(m_photonSfToolIndex)& GetScaleFactorToolIndex(const xAOD::Photon*) { return m_photonSfToolIndex; }
+	decltype(m_electronEffToolIndex)& GetEfficiencyToolIndex(const xAOD::Electron*) { return m_electronEffToolIndex; }
+	decltype(m_photonEffToolIndex)& GetEfficiencyToolIndex(const xAOD::Photon*) { return m_photonEffToolIndex; }
+	IAsgElectronEfficiencyCorrectionTool& GetScaleFactorTool(const xAOD::Electron*, std::size_t index)
+		{ return *m_suppliedElectronScaleFactorTools[index]; }
+	IAsgPhotonEfficiencyCorrectionTool& GetScaleFactorTool(const xAOD::Photon*, std::size_t index)
+		{ return *m_suppliedPhotonScaleFactorTools[index]; }
+	IAsgElectronEfficiencyCorrectionTool& GetEfficiencyTool(const xAOD::Electron*, std::size_t index)
+		{ return *m_suppliedElectronEfficiencyTools[index]; }
+	IAsgPhotonEfficiencyCorrectionTool& GetEfficiencyTool(const xAOD::Photon*, std::size_t index)
+		{ return *m_suppliedPhotonEfficiencyTools[index]; }
+	std::size_t getCombinedHash(const flat_set<std::size_t>& legs);
+	std::size_t getCombinedHash(std::size_t leg1, std::size_t leg2);
+	static inline constexpr const flat_set<std::size_t>& forwardLegs(const flat_set<std::size_t>& legs);
+	static inline constexpr std::array<std::size_t, 2> forwardLegs(std::size_t leg1, std::size_t leg2);
+	
+	/// Internal methods (III) -- misc. helpers
+	inline bool checkAndRecord(CP::CorrectionCode&& cc);
+	flat_set<std::size_t> listNonOrderedCSValues(const std::string& s, bool& success);
+
+	friend class TrigGlobEffCorr::ImportData;
+	friend class TrigGlobEffCorr::CheckConfig;
+	friend class TrigGlobEffCorr::Calculator;
+};
+
+#endif
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Trigger.h b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Trigger.h
new file mode 100644
index 0000000000000000000000000000000000000000..9e80931ef55763ce624d4debb23b93e086b76f53
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Trigger.h
@@ -0,0 +1,346 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+// contact: jmaurer@cern.ch
+
+#ifndef TRIGGLOBALEFFICIENCYCORRECTION_TRIGGER_H
+#define TRIGGLOBALEFFICIENCYCORRECTION_TRIGGER_H 1
+
+#include "TrigGlobalEfficiencyCorrection/ImportData.h"
+#include "xAODBase/ObjectType.h"
+
+#include <array>
+#include <algorithm>
+#include <type_traits>
+#include <boost/container/flat_set.hpp>
+template<typename Key> using flat_set = boost::container::flat_set<Key>;
+
+namespace TrigGlobEffCorr
+{
+
+class UnusedArg { public: static constexpr xAOD::Type::ObjectType object() { return xAOD::Type::Other; } };
+
+class TriggerProperties
+{
+public:
+	explicit constexpr TriggerProperties(TriggerType tt) : m_type(tt), m_legs{} {}
+	explicit TriggerProperties(const ImportData::TrigDef& def) : m_type(def.type) { loadLegs(def, m_legs); }
+	constexpr TriggerType type() const { return m_type; }
+	constexpr bool valid() const
+	{
+		return !((m_type&TT_MASK_FLAVOUR)&~(TT_ELECTRON_FLAG|TT_MUON_FLAG|TT_PHOTON_FLAG)); /// validity of mixed() function
+	}
+	constexpr bool mixed() const
+	{
+		auto x = m_type&TT_MASK_FLAVOUR;
+		return (x!=TT_ELECTRON_FLAG) && (x!=TT_MUON_FLAG) && (x!=TT_PHOTON_FLAG);
+	}
+	constexpr unsigned nDistinctLegs() const
+	{
+		auto x = m_type&TT_MASK_SYMMETRY;
+		if(m_type&TT_SINGLELEPTON_FLAG) return 1;
+		else if(m_type&TT_DILEPTON_FLAG) return 2 - 1*(x==TT_SYM);
+		else if(m_type&TT_TRILEPTON_FLAG) return (x==TT_ASYM)? 3 : 1 + 1*(mixed()||(x!=TT_SYM));
+		return 0;
+	}
+	constexpr unsigned nDistinctLegs(xAOD::Type::ObjectType obj) const
+	{
+		bool firstPos = true;
+		switch(obj)
+		{
+			case xAOD::Type::Electron:
+				if(!(m_type&TT_ELECTRON_FLAG)) return 0;
+				break;
+			case xAOD::Type::Muon:
+				if(!(m_type&TT_MUON_FLAG)) return 0;
+				firstPos = (m_type&TT_PHOTON_FLAG);
+				break;
+			case xAOD::Type::Photon:
+				if(!(m_type&TT_PHOTON_FLAG)) return 0;
+				firstPos = false;
+				break;
+			default: return 0;
+		}
+		if(!mixed()) return nDistinctLegs();
+		return (firstPos == (m_type&TT_X2Y_FLAG))? 1 : nDistinctLegs()-1;
+	}
+	template<typename Array>
+	void loadLegs(const ImportData::TrigDef& src, Array& dest)
+	{
+		if(src.type != m_type) throw; /// can't be thrown due to bad user action -- only in case of a bug in the Calculator class
+		std::fill(dest.begin(), dest.end(), 0);
+		if(m_type==TT_2E_MU_SYM || m_type==TT_2E_G_SYM || m_type==TT_2MU_G_SYM) /// special case needed to skip the duplicated leg for 2X_Y triggers
+		{
+			dest[0] = src.leg[0];
+			dest[1] = src.leg[2];
+		}
+		else /// Works as well for non-mixed trilepton triggers since the asymmetric leg is always stored first
+		{
+			std::copy_n(src.leg.cbegin(), nDistinctLegs(), dest.begin());
+		}
+	}
+	
+	constexpr int cbegin_offset(xAOD::Type::ObjectType obj) const
+	{
+		return (obj!=xAOD::Type::Electron) *(nDistinctLegs(xAOD::Type::Electron)  
+			+ (obj!=xAOD::Type::Muon)*nDistinctLegs(xAOD::Type::Muon));
+	}
+	
+	auto cbegin(xAOD::Type::ObjectType obj) const
+	{
+		return m_legs.cbegin() + cbegin_offset(obj);
+	}
+	
+	constexpr int cend_offset(xAOD::Type::ObjectType obj) const
+	{
+		return -((obj!=xAOD::Type::Photon) *(nDistinctLegs(xAOD::Type::Photon)  
+			+ (obj!=xAOD::Type::Muon)*nDistinctLegs(xAOD::Type::Muon)));
+	}
+	
+	auto cend(xAOD::Type::ObjectType obj) const
+	{
+		return m_legs.cbegin() + nDistinctLegs() + cend_offset(obj);
+	}
+	
+protected:
+	TriggerType m_type;
+	std::array<std::size_t, 3> m_legs;
+};
+
+template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
+class Trigger
+{
+	static_assert(TriggerProperties(tt).valid(), "trigger type not supported");
+private:
+	static constexpr bool extraCheck(xAOD::Type::ObjectType obj) { return (object()==obj || obj==xAOD::Type::Other); }
+	template<typename T> struct Optional {};
+public:
+	
+	static constexpr TriggerType type() { return tt; }
+	
+	static constexpr bool mixed()
+	{
+		return TriggerProperties(tt).mixed();
+	}
+	
+	static constexpr unsigned nDistinctLegs() { return TriggerProperties(tt).nDistinctLegs(); }
+	
+	static constexpr unsigned nDistinctLegs(xAOD::Type::ObjectType obj) { return TriggerProperties(tt).nDistinctLegs(obj); }
+
+	static constexpr xAOD::Type::ObjectType object1()
+	{
+		if(!is3Lmix())
+		{
+			if(tt&TT_ELECTRON_FLAG) return xAOD::Type::Electron;
+			if(tt&TT_MUON_FLAG) return xAOD::Type::Muon;
+			if(tt&TT_PHOTON_FLAG) return xAOD::Type::Photon;
+			return xAOD::Type::Other;
+		}
+		if((tt&TT_ELECTRON_FLAG) && !(tt&TT_X2Y_FLAG)) return xAOD::Type::Electron;
+		if((tt&TT_PHOTON_FLAG) && (tt&TT_X2Y_FLAG)) return xAOD::Type::Photon;
+		return (tt&TT_MUON_FLAG)? xAOD::Type::Muon : xAOD::Type::Other;
+	}
+	
+	static constexpr xAOD::Type::ObjectType object2()
+	{
+		if(is2Lmix())
+		{
+			if((tt&TT_ELECTRON_FLAG) && (tt&TT_MUON_FLAG)) return xAOD::Type::Muon;
+			if((tt&(TT_ELECTRON_FLAG|TT_MUON_FLAG)) && (tt&TT_PHOTON_FLAG)) return xAOD::Type::Photon;
+			return xAOD::Type::Other;
+		}
+		else if(!is3Lmix()) return xAOD::Type::Other;	
+		if((tt&TT_ELECTRON_FLAG) && (tt&TT_X2Y_FLAG)) return xAOD::Type::Electron;
+		if((tt&TT_PHOTON_FLAG) && !(tt&TT_X2Y_FLAG)) return xAOD::Type::Photon;
+		return (tt&TT_MUON_FLAG)? xAOD::Type::Muon : xAOD::Type::Other;
+	}
+	
+	static constexpr xAOD::Type::ObjectType object()
+	{
+		if(mixed()) return xAOD::Type::Other;
+		return object1();
+	}
+	
+	static bool relevantFor(const Lepton& lepton) { return lepton.type()==object(); }
+	static bool irrelevantFor(const Lepton& lepton) { return !relevantFor(lepton); }
+	
+	static constexpr bool is1L() { return (tt&TT_SINGLELEPTON_FLAG); }
+	static constexpr bool is2Lnomix() { return (tt&TT_DILEPTON_FLAG) && !mixed(); }
+	static constexpr bool is2Lasym() { return ((tt&TT_MASK_TYPE)==TT_DILEPTON_ASYM); }
+	static constexpr bool is2Lsym() { return ((tt&TT_MASK_TYPE)==TT_DILEPTON_SYM); }
+	static constexpr bool is3Lsym() { return ((tt&TT_MASK_TYPE)==TT_TRILEPTON_SYM) && !mixed(); }
+	static constexpr bool is3Lhalfsym() { return ((tt&TT_MASK_TYPE)==TT_TRILEPTON_HALFSYM) && !mixed(); }
+	static constexpr bool is2Lmix() { return (tt&TT_DILEPTON_FLAG) && mixed(); }
+	static constexpr bool is3Lmix() { return (tt&TT_TRILEPTON_FLAG) && mixed(); }
+
+	
+	std::array<std::size_t, nDistinctLegs()> legs;
+	
+	explicit Trigger()
+	{
+		std::fill(legs.begin(), legs.end(), 0);
+	}
+	
+	void setDefinition(const ImportData::TrigDef& def)
+	{
+		TriggerProperties(tt).loadLegs(def, legs);
+	}
+	
+	template<bool=true> std::size_t operator()(void) const
+	{
+		static_assert(nDistinctLegs()==1, "this function is not meaningful for this type of trigger, hence should not be used.");
+		return legs[0];
+	}
+	
+	std::size_t operator()(unsigned index) const
+	{
+		return legs[index];
+	}
+	
+	template<bool=true> std::size_t operator<(const Trigger& rhs) const
+	{
+		static_assert(is1L(), "this function is not meaningful for this type of trigger, hence should not be used.");
+		return legs[0] < rhs.legs[0];
+	}
+	
+	explicit operator bool() const
+	{
+		return std::all_of(legs.cbegin(), legs.cend(), [](std::size_t x)->bool{ return x; });
+	}
+	
+	bool operator==(const Trigger& rhs) const
+	{
+		return legs == rhs.legs;
+	}
+	
+	template<xAOD::Type::ObjectType obj = object()> auto cbegin() const
+	{
+		return legs.cbegin() + TriggerProperties(tt).cbegin_offset(obj);
+	}
+	
+	template<xAOD::Type::ObjectType obj = object()> auto cend() const
+	{
+		return legs.cend() + TriggerProperties(tt).cend_offset(obj);
+	}
+
+	template<typename Trig1L> auto hiddenBy(const Trig1L trig) const
+		-> typename std::enable_if<Trig1L::is1L(), bool>::type
+	{
+		static_assert(Trig1L::is1L(), "this function is not meaningful for this type of trigger, hence should not be used.");
+		constexpr auto obj = Trig1L::object();
+		return std::find(cbegin<obj>(), cend<obj>(), trig()) != cend<obj>();
+	}
+	
+	template<typename Trig1L> auto hiddenBy(const flat_set<Trig1L>& trigs) const
+		-> typename std::enable_if<Trig1L::is1L(), bool>::type
+	{
+		static_assert(Trig1L::is1L(), "this function is not meaningful for this type of trigger, hence should not be used.");
+		return std::any_of(trigs.cbegin(), trigs.cend(), [&](Trig1L t)->bool{ return hiddenBy(t); });
+	}
+	
+	/// Returns a pseudo trigger built only from the legs of flavour 'obj'
+	/// If anti==true, uses instead only legs with flavours other than 'obj'
+	template<xAOD::Type::ObjectType obj, bool anti=false> auto side() const
+		-> std::conditional_t<anti ^ (CastType1::object()==obj), CastType1, CastType2>
+	{
+		static_assert(mixed(), "this function is not meaningful for this type of trigger, hence should not be used.");
+		static_assert(obj != xAOD::Type::Other, "implementation incomplete");
+		using CastType = decltype(side<obj, anti>());
+		CastType trig;
+		std::copy(this->cbegin<CastType::object()>(), this->cend<CastType::object()>(), trig.legs.begin());
+		return trig;
+	}
+	/// Returns a pseudo trigger built only from the legs of the same flavour as the trigger 'TrigX'
+	template<typename TrigX> auto side() const -> decltype(side<TrigX::object()>()) { return side<TrigX::object()>(); }
+	/// Complement to the previous function
+	template<typename TrigX> auto antiside() const -> decltype(side<TrigX::object(),true>()) { return side<TrigX::object(),true>(); }
+	/// Returns a pseudo trigger of type CastType1/2
+	CastType1 side1() const { return side<CastType1::object()>(); }
+	CastType2 side2() const { return side<CastType2::object()>(); }
+
+	template<typename Trig1L> auto addTo(const flat_set<Trig1L>& trigs1L) const
+		-> std::enable_if_t<Trig1L::is1L() && nDistinctLegs(Trig1L::object())==1, flat_set<Trig1L>> 
+	{
+		static_assert(mixed(), "this function is not meaningful for this type of trigger, hence should not be used.");
+		flat_set<Trig1L> trigs(trigs1L);
+		trigs.insert(side<Trig1L>());
+		return trigs;
+	}
+	
+	template<typename Trig1L> static auto anonymize(const flat_set<Trig1L>& triggers)
+		-> std::enable_if_t<is1L() && tt==Trig1L::type(), const flat_set<std::size_t>&>
+	{
+		static_assert(sizeof(Trig1L)==sizeof(std::size_t), "invalid cast if the key sizes differ");
+		return reinterpret_cast<const flat_set<std::size_t>&>(triggers);
+	}
+	
+	template<bool=true> bool symmetric() const
+	{
+		static_assert(!std::is_same<CastType1, UnusedArg>::value, "this function is not meaningful for this type of trigger, hence should not be used.");
+		return std::all_of(legs.cbegin()+1, legs.cend(), [&](std::size_t l)->bool{ return l==legs[0]; });
+	}
+
+	template<bool=true> CastType1 to_symmetric() const
+	{
+		static_assert(!std::is_same<CastType1, UnusedArg>::value, "this function is not meaningful for this type of trigger, hence should not be used.");
+		CastType1 trig;
+		trig.legs[0] = this->legs[0];
+		return trig;
+	}
+	
+	template<bool=true> std::size_t asymLeg() const
+	{
+		static_assert((tt&TT_MASK_SYMMETRY)==TT_HALFSYM, "this function is not meaningful for this type of trigger, hence should not be used.");
+		return legs[0];
+	}
+	
+	template<bool=true> std::size_t symLeg() const
+	{
+		static_assert((tt&TT_MASK_SYMMETRY)==TT_HALFSYM, "this function is not meaningful for this type of trigger, hence should not be used.");
+		return legs[1];
+	}
+};
+
+template<TriggerType, TriggerType=TT_UNKNOWN> struct TriggerClass;
+
+template<TriggerType object_flag>
+struct TriggerClass<object_flag, TT_UNKNOWN>
+{
+	static constexpr auto addObjFlag(int tt) { return static_cast<TriggerType>(tt|object_flag); }
+	
+	/// single-lepton trigger (e24_lhmedium_L1EM20VH, mu24_imedium_OR_mu40...)
+	struct T_1 : public Trigger<addObjFlag(TT_SINGLELEPTON_FLAG)> {};
+	/// symmetric dilepton trigger (2e17_lhvloose_nod0, 2mu14...)
+	struct T_2sym : public Trigger<addObjFlag(TT_DILEPTON_SYM)> {};
+	/// asymmetric dilepton trigger (mu18_mu8noL1, g35_loose_g25_loose, ...):
+	struct T_2asym : public Trigger<addObjFlag(TT_DILEPTON_ASYM), T_2sym> {};
+	/// symmetric trilepton trigger (3mu6, ...):
+	struct T_3sym : public Trigger<addObjFlag(TT_TRILEPTON_SYM)> {};
+	/// half-symmetric trilepton trigger (e17_lhloose_2e9_lhloose, mu6_2mu4, ...):
+	struct T_3halfsym : public Trigger<addObjFlag(TT_TRILEPTON_HALFSYM), T_3sym> {};
+};
+
+template<TriggerType object1_flag, TriggerType object2_flag>
+struct TriggerClass
+{
+	using A = TriggerClass<object1_flag>;
+	using B = TriggerClass<object2_flag>;
+	static constexpr auto addObjFlags(int tt) { return static_cast<TriggerType>(tt|object1_flag|object2_flag); }
+	
+	/// mixed-flavour dilepton trigger (e17_lhloose_nod0_mu14, e7_lhmedium_mu24, ...):
+	struct T_1_1 : public Trigger<addObjFlags(TT_DILEPTON_FLAG), typename A::T_1, typename B::T_1> {};
+	/// mixed-flavour trilepton trigger type 2x_y (2e12_lhloose_mu10, ...)
+	struct T_2sym_1 : public Trigger<addObjFlags(TT_TRILEPTON_SYM), typename A::T_2sym, typename B::T_1> {};
+	/// mixed-flavour trilepton trigger type x_x_y
+	struct T_2asym_1: public Trigger<addObjFlags(TT_TRILEPTON_ASYM), typename A::T_2asym, typename B::T_1> {};
+	/// mixed-flavour trilepton trigger type x_2y (e12_lhloose_2mu10, ...)
+	struct T_1_2sym: public Trigger<addObjFlags(TT_TRILEPTON_SYM|TT_X2Y_FLAG), typename A::T_1, typename B::T_2sym> {};
+	/// mixed-flavour trilepton trigger type x_y_y
+	struct T_1_2asym: public Trigger<addObjFlags(TT_TRILEPTON_SYM|TT_X2Y_FLAG), typename A::T_1, typename B::T_2asym> {};
+};
+
+}
+
+
+#endif
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/selection.xml b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/selection.xml
new file mode 100644
index 0000000000000000000000000000000000000000..109952f5d697812daa83a32887efa970d06ea8f0
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/selection.xml
@@ -0,0 +1,4 @@
+
+<lcgdict>
+   <class name="TrigGlobalEfficiencyCorrectionTool" />
+</lcgdict>
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/DataPeriods.cfg b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/DataPeriods.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..716bbdede6296d30f961502b4755927a030960a3
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/DataPeriods.cfg
@@ -0,0 +1,55 @@
+###
+# List of data periods
+# contact: jmaurer@cern.ch
+###
+
+all		0		999999
+2015	266904	284484
+2015:A	266904	267639
+2015:B	267358	267599
+2015:C	270441	272531
+2015:D	276073	276954
+2015:E	278727	279928
+2015:F	279932	280422
+2015:G	280423	281075
+2015:H	281130	281411
+2015:I	281662	282482
+2015:J	282625	284484
+2016	296939	311481
+2016:A	296939	300287
+2016:B	300345	300908
+2016:C	301912	302393
+2016:D	302737	303560
+2016:E	303638	303892
+2016:F	303943	304494
+2016:G	305291	306714
+2016:I	307124	308084
+2016:K	309311	309759
+2016:L	310015	311481
+2017	325713	341649
+2017:B	325713	328393
+2017:C	329385	330470
+2017:D	330857	332304
+2017:E	332720	334779
+2017:F	334842	335290
+2017:H	336497	336782
+2017:I	336832	337833
+2017:K	338183	340453
+2017:N	341257	341649
+2018	348197	364292
+2018:A	348197	348836
+2018:B	348885	349533
+2018:C	349534	350220
+2018:D	350310	352107
+2018:E	352123	352137
+2018:F	352274	352514
+2018:G	354107	354494
+2018:H	354826	355224
+2018:I	355261	355273
+2018:J	355331	355468
+2018:K	355529	356259
+2018:L	357050	359171
+2018:M	359191	360414
+2018:N	361635	361696
+2018:O	361738	363400
+2018:Q	363664	364292
\ No newline at end of file
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Hierarchies.cfg b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Hierarchies.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..165207a5198c892b2bd31a5db1868258bdcef057
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Hierarchies.cfg
@@ -0,0 +1,46 @@
+#-------- Format ------------------------------------------------------------------------
+# First column = pT interval of validity;  omitted numerical value -> 0/infinity assumed
+# Trigger legs must be separated with ' > ' tokens (including spaces)
+# Aliases can be (re)defined with ':='
+# Comments indicated by '#'
+# pT in MeV or GeV (explicit mention required)
+#---------------------------------------------------------------------------------------
+
+## muon triggers
+multi := mu24 > mu22 > mu20 > mu18 > mu14 > mu10 > mu6 > mu4 > mu8noL1
+[-]   mu50 > mu40 > multi
+# only single-muon triggers have been using isolation so far,
+# so we assume there's no need of being able to compare two legs with isolation since in principle
+# only the lowest-unprescaled chain is used
+[-] mu20_iloose_L1MU15 > mu20_iloose_L1MU15_OR_mu50 > mu50 > mu20_iloose_L1MU15_OR_mu40 > mu40 > multi
+[-] mu26_imedium > mu26_imedium_OR_mu50 > mu50 > mu26_imedium_OR_mu40 > mu40 > multi
+[-] mu26_ivarmedium > mu26_ivarmedium_OR_mu50 > mu50 > mu26_ivarmedium_OR_mu40 > mu40 > multi
+[-] mu24_iloose_L1MU15 > mu24_iloose_L1MU15_OR_mu50 > mu50 > mu24_iloose_L1MU15_OR_mu40 > mu40 > multi
+[-] mu24_iloose_L1MU15_OR_mu24_iloose > mu24_iloose_L1MU15_OR_mu24_iloose_OR_mu50 > mu50 > mu24_iloose_L1MU15_OR_mu24_iloose_OR_mu40 > mu40 > multi
+[-] mu24_imedium > mu24_imedium_OR_mu50 > mu50 > mu24_imedium_OR_mu40 > mu40 > multi
+[-] mu24_ivarmedium > mu24_ivarmedium_OR_mu50 > mu50 > mu24_ivarmedium_OR_mu40 > mu40 > multi
+
+## 2015 electron trigger legs (no '_nod0' suffix)
+loose1 := e12_lhloose_L1EM10VH > e120_lhloose
+loose2 := e17_lhloose > e12_lhloose > e9_lhloose
+[-]          e24_lhmedium_L1EM20VHI > e24_lhmedium_L1EM20VH > e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose
+[-]          e24_lhmedium_L1EM20VHI > e24_lhmedium_L1EM20VH > e60_lhmedium > e24_lhmedium_L1EM15VH > e20_lhmedium > e7_lhmedium > loose1 > loose2
+[<61 GeV]    e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose > e60_lhmedium > e24_lhmedium_L1EM15VH > e20_lhmedium > e7_lhmedium > loose1 > loose2
+[61-121 GeV] e60_lhmedium > e24_lhmedium_L1EM15VH > e20_lhmedium > e7_lhmedium > e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose > loose1 > loose2
+[>121 GeV]   e60_lhmedium > e24_lhmedium_L1EM15VH > e20_lhmedium > e7_lhmedium > loose1 > e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose > loose2
+
+## 2016+2017 electron trigger legs (always '_nod0' suffix)
+medium := e26_lhmedium_nod0_L1EM22VHI > e24_lhmedium_nod0_L1EM20VHI > e26_lhmedium_nod0 > e24_lhmedium_nod0_L1EM20VH > e60_lhmedium_nod0 > e24_lhmedium_nod0_L1EM15VH > e20_lhmedium_nod0 > e7_lhmedium_nod0
+loose1 := e17_lhloose_nod0_L1EM15VH > e10_lhloose_nod0_L1EM8VH  > e140_lhloose_nod0
+loose2 := e17_lhloose_nod0 > e12_lhloose_nod0 > e9_lhloose_nod0 > e17_lhvloose_nod0_L1EM15VHI > e24_lhvloose_nod0_L1EM20VH > e15_lhvloose_nod0_L1EM13VH > e12_lhvloose_nod0_L1EM10VH > e17_lhvloose_nod0
+[-]          e26_lhtight_nod0_ivarloose > e24_lhtight_nod0_ivarloose > medium > loose1 > loose2
+[<61 GeV]    e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 > e24_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 > medium > loose1 > loose2
+[61-141 GeV] medium > e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 > e24_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 > loose1 > loose2
+[>141 GeV]   medium > loose1 > e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 > e24_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 > loose2
+
+## photon triggers
+[-] g35_tight_icalotight_L1EM24VHI > g20_tight_icalovloose_L1EM15VHI > g22_tight_L1EM15VHI > g22_tight > g20_tight > g35_medium_L1EM20VH > g25_medium_L1EM20VH > g35_loose_L1EM24VHI > g35_loose_L1EM22VHI > g50_loose_L1EM20VH > g140_loose > g120_loose > g35_loose > g25_loose > g20_loose > g15_loose > g12_loose > g10_loose > g35_loose_L1EM15 > g25_loose_L1EM15
+
+
+
+
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/MapKeys.cfg b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/MapKeys.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..b56288131dc666bb4c0c4727060fb3a7443708e7
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/MapKeys.cfg
@@ -0,0 +1,101 @@
+###
+# List of trigger legs supported by each map key; only used by suggestElectronMapKeys()
+# contact: jmaurer@cern.ch
+###
+
+
+###
+[VERSION] 2015_2016/rel20.7/Moriond_February2017_v2, 2015_2016/rel20.7/Moriond_February2017_v3
+###
+2015  e12_lhloose_L1EM10VH  2015_e12_lhloose_L1EM10VH   DI_E_2015_e12_lhloose_L1EM10VH_2016_e15_lhvloose_nod0_L1EM13VH  DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0
+2015  e15_lhloose_L1EM13VH  2015_e15_lhloose_L1EM13VH
+2015  e17_lhloose_L1EM15  2015_e17_lhloose_L1EM15
+2015  e17_lhloose  2015_e17_lhloose     DI_E_2015_e17_lhloose_2016_e17_lhloose  MULTI_L_2015_e17_lhloose_2016_e17_lhloose_nod0  TRI_E_2015_e17_lhloose_2016_e17_lhloose_nod0  TRI_E_2015_e17_lhloose_2016_e17_lhmedium_nod0
+2015  e17_lhmedium  2015_e17_lhmedium
+2015  e20_lhmedium  2015_e20_lhmedium
+2015  e24_lhmedium_L1EM15VH  2015_e24_lhmedium_L1EM15VH
+2015  e24_lhmedium_L1EM20VHI  2015_e24_lhmedium_L1EM20VHI       MULTI_L_2015_e24_lhmedium_L1EM20VHI_2016_e24_lhmedium_nod0_L1EM20VHI    MULTI_L_2015_e24_lhmedium_L1EM20VHI_2016_e26_lhmedium_nod0_L1EM22VHI
+2015  e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose  2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_e24_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+2015  e24_medium_L1EM20VHI  2015_e24_medium_L1EM20VHI
+2015  e26_lhtight_nod0_iloose  2015_e26_lhtight_nod0_iloose
+2015  e7_lhmedium  2015_e7_lhmedium     MULTI_L_2015_e7_lhmedium_2016_e7_lhmedium_nod0
+2015  e9_lhloose  2015_e9_lhloose       TRI_E_2015_e9_lhloose_2016_e9_lhloose_nod0      TRI_E_2015_e9_lhloose_2016_e9_lhmedium_nod0
+2015  e17_lhloose  2015_e17_lhloose     DI_E_2015_e17_lhloose_2016_e17_lhloose  MULTI_L_2015_e17_lhloose_2016_e17_lhloose_nod0  TRI_E_2015_e17_lhloose_2016_e17_lhloose_nod0  TRI_E_2015_e17_lhloose_2016_e17_lhmedium_nod0
+2016  e17_lhloose  2016_e17_lhloose     DI_E_2015_e17_lhloose_2016_e17_lhloose  MULTI_L_2015_e17_lhloose_2016_e17_lhloose_nod0  TRI_E_2015_e17_lhloose_2016_e17_lhloose_nod0
+2016  e7_lhmedium  MULTI_L_2015_e7_lhmedium_2016_e7_lhmedium_nod0
+2016  e9_lhloose  TRI_E_2015_e9_lhloose_2016_e9_lhloose_nod0
+2016  e12_lhloose_nod0  2016_e12_lhloose_nod0   MULTI_L_2015_e12_lhloose_2016_e12_lhloose_nod0
+2016  e15_lhvloose_nod0_L1EM13VH  2016_e15_lhvloose_nod0_L1EM13VH       DI_E_2015_e12_lhloose_L1EM10VH_2016_e15_lhvloose_nod0_L1EM13VH
+2016  e17_lhloose  2016_e17_lhloose     DI_E_2015_e17_lhloose_2016_e17_lhloose  MULTI_L_2015_e17_lhloose_2016_e17_lhloose_nod0  TRI_E_2015_e17_lhloose_2016_e17_lhloose_nod0
+2016  e17_lhloose_nod0  2016_e17_lhloose_nod0   MULTI_L_2015_e17_lhloose_2016_e17_lhloose_nod0  TRI_E_2015_e17_lhloose_2016_e17_lhloose_nod0
+2016  e17_lhmedium_nod0_L1EM15HI  2016_e17_lhmedium_nod0_L1EM15HI
+2016  e17_lhmedium_nod0  2016_e17_lhmedium_nod0 TRI_E_2015_e17_lhloose_2016_e17_lhmedium_nod0
+2016  e17_lhmedium_nod0_ivarloose_L1EM15HI  2016_e17_lhmedium_nod0_ivarloose_L1EM15HI
+2016  e17_lhvloose_nod0  2016_e17_lhvloose_nod0 DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0
+2016  e20_lhmedium_nod0  2016_e20_lhmedium_nod0
+2016  e24_lhmedium_nod0_L1EM15VH  2016_e24_lhmedium_nod0_L1EM15VH
+2016  e24_lhmedium_nod0_L1EM20VHI  2016_e24_lhmedium_nod0_L1EM20VHI     MULTI_L_2015_e24_lhmedium_L1EM20VHI_2016_e24_lhmedium_nod0_L1EM20VHI
+2016  e24_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0  2016_e24_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0   SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_e24_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+2016  e26_lhmedium_nod0_L1EM22VHI  2016_e26_lhmedium_nod0_L1EM22VHI     MULTI_L_2015_e24_lhmedium_L1EM20VHI_2016_e26_lhmedium_nod0_L1EM22VHI
+2016  e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0  2016_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0   SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+2016  e7_lhmedium_nod0  2016_e7_lhmedium_nod0   MULTI_L_2015_e7_lhmedium_2016_e7_lhmedium_nod0
+2016  e9_lhloose_nod0  2016_e9_lhloose_nod0     TRI_E_2015_e9_lhloose_2016_e9_lhloose_nod0
+2016  e9_lhmedium_nod0  2016_e9_lhmedium_nod0   TRI_E_2015_e9_lhloose_2016_e9_lhmedium_nod0
+
+###
+[VERSION] 2015_2017/rel21.2/Moriond_February2018_v2
+###
+2015    e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose   2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose      MULTI_L_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_e26_lhmedium_nod0_L1EM22VHI_2017_e26_lhmedium_nod0      SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2017_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+2015    e7_lhmedium     2015_e7_lhmedium        MULTI_L_2015_e7_lhmedium_2016_e7_lhmedium_nod0_2017_e7_lhmedium_nod0
+2015    e17_lhloose     2015_e17_lhloose        MULTI_L_2015_e17_lhloose_2016_e17_lhloose_nod0_2017_e17_lhloose_nod0
+TRI_E_2015_e17_lhloose_2016_e17_lhloose_nod0_2017_e24_lhvloose_nod0_L1EM20VH
+2015    e12_lhloose     MULTI_L_2015_e12_lhloose_2016_e12_lhloose_nod0_2017_e12_lhloose_nod0
+2015    e12_lhloose_L1EM10VH    2015_e12_lhloose_L1EM10VH       DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_e24_lhvloose_nod0_L1EM20VH
+2015    e9_lhloose      2015_e9_lhloose TRI_E_2015_e9_lhloose_2016_e9_lhloose_nod0_2017_e12_lhvloose_nod0_L1EM10VH
+2016    e12_lhloose_nod0        2016_e12_lhloose_nod0   MULTI_L_2015_e12_lhloose_2016_e12_lhloose_nod0_2017_e12_lhloose_nod0
+2016    e17_lhloose_nod0        2016_e17_lhloose_nod0   MULTI_L_2015_e17_lhloose_2016_e17_lhloose_nod0_2017_e17_lhloose_nod0    TRI_E_2015_e17_lhloose_2016_e17_lhloose_nod0_2017_e24_lhvloose_nod0_L1EM20VH
+2016    e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0    2016_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0       SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2017_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+2016    e7_lhmedium_nod0        2016_e7_lhmedium_nod0   MULTI_L_2015_e7_lhmedium_2016_e7_lhmedium_nod0_2017_e7_lhmedium_nod0
+2016    e26_lhmedium_nod0_L1EM22VHI     2016_e26_lhmedium_nod0_L1EM22VHI        MULTI_L_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_e26_lhmedium_nod0_L1EM22VHI_2017_e26_lhmedium_nod0
+2016    e17_lhvloose_nod0       2016_e17_lhvloose_nod0  DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_e24_lhvloose_nod0_L1EM20VH
+2016    e9_lhloose_nod0 2016_e9_lhloose_nod0    TRI_E_2015_e9_lhloose_2016_e9_lhloose_nod0_2017_e12_lhvloose_nod0_L1EM10VH
+2017    e12_lhloose_nod0        2017_e12_lhloose_nod0   MULTI_L_2015_e12_lhloose_2016_e12_lhloose_nod0_2017_e12_lhloose_nod0
+2017    e17_lhloose_nod0        2017_e17_lhloose_nod0   MULTI_L_2015_e17_lhloose_2016_e17_lhloose_nod0_2017_e17_lhloose_nod0
+2017    e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0    2017_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0       SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2017_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+2017    e7_lhmedium_nod0        2017_e7_lhmedium_nod0   MULTI_L_2015_e7_lhmedium_2016_e7_lhmedium_nod0_2017_e7_lhmedium_nod0
+2017    e26_lhmedium_nod0       2017_e26_lhmedium_nod0  MULTI_L_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_e26_lhmedium_nod0_L1EM22VHI_2017_e26_lhmedium_nod0
+2017    e12_lhvloose_nod0_L1EM10VH      2017_e12_lhvloose_nod0_L1EM10VH TRI_E_2015_e9_lhloose_2016_e9_lhloose_nod0_2017_e12_lhvloose_nod0_L1EM10VH
+2017    e24_lhvloose_nod0_L1EM20VH      2017_e24_lhvloose_nod0_L1EM20VH DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_e24_lhvloose_nod0_L1EM20VH   TRI_E_2015_e17_lhloose_2016_e17_lhloose_nod0_2017_e24_lhvloose_nod0_L1EM20VH
+
+###
+[VERSION] 2015_2017/rel21.2/Consolidation_September2018_v1
+###
+2015  e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose  2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose  SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2018_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0  MULTI_L_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_e26_lhmedium_nod0_L1EM22VHI_2017_2018_e26_lhmedium_nod0
+2015  e7_lhmedium  2015_e7_lhmedium  MULTI_L_2015_e7_lhmedium_2016_2018_e7_lhmedium_nod0
+2015  e17_lhloose  2015_e17_lhloose  MULTI_L_2015_e17_lhloose_2016_2018_e17_lhloose_nod0  TRI_E_2015_e17_lhloose_2016_e17_lhloose_nod0_2017_2018_e24_lhvloose_nod0_L1EM20VH
+2015  e12_lhloose  MULTI_L_2015_e12_lhloose_2016_2018_e12_lhloose_nod0
+2015  e12_lhloose_L1EM10VH  2015_e12_lhloose_L1EM10VH  DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_2018_e24_lhvloose_nod0_L1EM20VH  DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_2018_e17_lhvloose_nod0_L1EM15VHI
+2015  e9_lhloose  2015_e9_lhloose  TRI_E_2015_e9_lhloose_2016_e9_lhloose_nod0_2017_2018_e12_lhvloose_nod0_L1EM10VH
+2016  e12_lhloose_nod0  2016_e12_lhloose_nod0  MULTI_L_2015_e12_lhloose_2016_2018_e12_lhloose_nod0
+2016  e17_lhloose_nod0  2016_e17_lhloose_nod0  MULTI_L_2015_e17_lhloose_2016_2018_e17_lhloose_nod0  TRI_E_2015_e17_lhloose_2016_e17_lhloose_nod0_2017_2018_e24_lhvloose_nod0_L1EM20VH
+2016  e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0  2016_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0  SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2018_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+2016  e7_lhmedium_nod0  2016_e7_lhmedium_nod0  MULTI_L_2015_e7_lhmedium_2016_2018_e7_lhmedium_nod0
+2016  e26_lhmedium_nod0_L1EM22VHI  2016_e26_lhmedium_nod0_L1EM22VHI  MULTI_L_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_e26_lhmedium_nod0_L1EM22VHI_2017_2018_e26_lhmedium_nod0
+2016  e17_lhvloose_nod0  2016_e17_lhvloose_nod0  DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_2018_e24_lhvloose_nod0_L1EM20VH  DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_2018_e17_lhvloose_nod0_L1EM15VHI
+2016  e9_lhloose_nod0  2016_e9_lhloose_nod0  TRI_E_2015_e9_lhloose_2016_e9_lhloose_nod0_2017_2018_e12_lhvloose_nod0_L1EM10VH
+2017  e26_lhmedium_nod0  2017_e26_lhmedium_nod0  MULTI_L_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_e26_lhmedium_nod0_L1EM22VHI_2017_2018_e26_lhmedium_nod0
+2017  e12_lhloose_nod0  2017_e12_lhloose_nod0  MULTI_L_2015_e12_lhloose_2016_2018_e12_lhloose_nod0
+2017  e17_lhloose_nod0  2017_e17_lhloose_nod0  MULTI_L_2015_e17_lhloose_2016_2018_e17_lhloose_nod0
+2017  e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0  2017_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0  SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2018_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+2017  e7_lhmedium_nod0  2017_e7_lhmedium_nod0  MULTI_L_2015_e7_lhmedium_2016_2018_e7_lhmedium_nod0
+2017  e17_lhvloose_nod0_L1EM15VHI  2017_e17_lhvloose_nod0_L1EM15VHI  DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_2018_e17_lhvloose_nod0_L1EM15VHI
+2017  e24_lhvloose_nod0_L1EM20VH  2017_e24_lhvloose_nod0_L1EM20VH  DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_2018_e24_lhvloose_nod0_L1EM20VH  TRI_E_2015_e17_lhloose_2016_e17_lhloose_nod0_2017_2018_e24_lhvloose_nod0_L1EM20VH
+2017  e12_lhvloose_nod0_L1EM10VH  2017_e12_lhvloose_nod0_L1EM10VH  TRI_E_2015_e9_lhloose_2016_e9_lhloose_nod0_2017_2018_e12_lhvloose_nod0_L1EM10VH
+2018  e26_lhmedium_nod0  2018_e26_lhmedium_nod0  MULTI_L_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_e26_lhmedium_nod0_L1EM22VHI_2017_2018_e26_lhmedium_nod0
+2018  e12_lhloose_nod0  2018_e12_lhloose_nod0  MULTI_L_2015_e12_lhloose_2016_2018_e12_lhloose_nod0
+2018  e17_lhloose_nod0  2018_e17_lhloose_nod0  MULTI_L_2015_e17_lhloose_2016_2018_e17_lhloose_nod0
+2018  e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0  2018_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0  SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2018_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+2018  e7_lhmedium_nod0  2018_e7_lhmedium_nod0  MULTI_L_2015_e7_lhmedium_2016_2018_e7_lhmedium_nod0
+2018  e17_lhvloose_nod0_L1EM15VHI  2018_e17_lhvloose_nod0_L1EM15VHI  DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_2018_e17_lhvloose_nod0_L1EM15VHI
+2018  e24_lhvloose_nod0_L1EM20VH  2018_e24_lhvloose_nod0_L1EM20VH  DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_2018_e24_lhvloose_nod0_L1EM20VH  TRI_E_2015_e17_lhloose_2016_e17_lhloose_nod0_2017_2018_e24_lhvloose_nod0_L1EM20VH
+2018  e12_lhvloose_nod0_L1EM10VH  2018_e12_lhvloose_nod0_L1EM10VH  TRI_E_2015_e9_lhloose_2016_e9_lhloose_nod0_2017_2018_e12_lhvloose_nod0_L1EM10VH
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Thresholds.cfg b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Thresholds.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..5772af543277a438baf161fb1eecefaf92df0459
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Thresholds.cfg
@@ -0,0 +1,101 @@
+###
+# List of pT thresholds for the various trigger legs
+# pT in MeV or GeV (explicit mention required)
+# contact: jmaurer@cern.ch
+###
+
+mu50	52500 MeV
+mu40	42000 MeV
+mu26_imedium			27300 MeV
+mu26_imedium_OR_mu40	27300 MeV
+mu26_imedium_OR_mu50	27300 MeV
+mu26_ivarmedium			27300 MeV
+mu26_ivarmedium_OR_mu40	27300 MeV
+mu26_ivarmedium_OR_mu50	27300 MeV
+mu24_iloose_L1MU15			25200 MeV
+mu24_iloose_L1MU15_OR_mu40	25200 MeV
+mu24_iloose_L1MU15_OR_mu50	25200 MeV
+mu24_iloose_L1MU15_OR_mu24_iloose			25200 MeV
+mu24_iloose_L1MU15_OR_mu24_iloose_OR_mu40	25200 MeV
+mu24_iloose_L1MU15_OR_mu24_iloose_OR_mu50	25200 MeV
+mu24_imedium			25200 MeV
+mu24_imedium_OR_mu40	25200 MeV
+mu24_imedium_OR_mu50	25200 MeV
+mu24_ivarmedium			25200 MeV
+mu24_ivarmedium_OR_mu40	25200 MeV
+mu24_ivarmedium_OR_mu50	25200 MeV
+mu26		27000 MeV
+mu24		25000 MeV
+mu22		23000 MeV
+mu20_iloose_L1MU15_OR_mu50		21000 MeV
+mu20_iloose_L1MU15_OR_mu40		21000 MeV
+mu20_iloose_L1MU15				21000 MeV
+mu20		21000 MeV
+mu18		19000 MeV
+mu18noL1	18000 MeV
+mu15		15000 MeV
+mu15noL1	15000 MeV
+mu14		15000 MeV
+mu10		11000 MeV
+mu8noL1		10000 MeV
+mu6			7000 MeV
+mu4			5000 MeV
+mu4noL1		4000 MeV
+mu2noL1		2000 MeV
+
+e140_lhloose_nod0			141 GeV
+e120_lhloose				121 GeV
+e60_lhmedium				61 GeV
+e60_lhmedium_nod0			61 GeV
+e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0	27 GeV
+e26_lhtight_nod0_ivarloose	27 GeV
+e26_lhmedium_nod0			27 GeV
+e26_lhmedium_nod0_L1EM22VHI	27 GeV
+e24_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0	25 GeV
+e24_lhtight_nod0_ivarloose 	25 GeV
+e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose	25 GeV
+e24_lhmedium_L1EM20VH		25 GeV
+e24_lhmedium_nod0_L1EM20VH	25 GeV
+e24_lhmedium_L1EM15VH		25 GeV
+e24_lhmedium_L1EM20VHI		25 GeV
+e24_lhmedium_nod0_L1EM20VHI	25 GeV
+e24_lhmedium_nod0_L1EM15VH	25 GeV
+e24_lhvloose_nod0_L1EM20VH	25 GeV
+e20_lhmedium_nod0			21 GeV
+e20_lhmedium				21 GeV
+e17_lhloose					18 GeV
+e17_lhloose_nod0			18 GeV
+e17_lhvloose_nod0			18 GeV
+e17_lhvloose_nod0_L1EM15VHI	18 GeV
+e17_lhloose_nod0_L1EM15VH	18 GeV
+e15_lhvloose_nod0_L1EM13VH	16 GeV
+e12_lhloose					13 GeV
+e12_lhloose_nod0			13 GeV
+e12_lhloose_L1EM10VH		13 GeV
+e12_lhvloose_nod0_L1EM10VH	13 GeV
+e10_lhloose_nod0_L1EM8VH	11 GeV
+e9_lhloose					10 GeV
+e9_lhloose_nod0				10 GeV
+e7_lhmedium_nod0			8 GeV
+e7_lhmedium					8 GeV
+
+g140_loose					141 GeV
+g120_loose					121 GeV
+g50_loose_L1EM20VH			51 GeV
+g35_tight_icalotight_L1EM24VHI	36 GeV
+g35_medium_L1EM20VH			36 GeV
+g35_loose_L1EM24VHI			36 GeV
+g35_loose_L1EM22VHI			36 GeV
+g35_loose					36 GeV
+g35_loose_L1EM15			36 GeV
+g25_medium_L1EM20VH			26 GeV
+g25_loose					26 GeV
+g25_loose_L1EM15			26 GeV
+g22_tight_L1EM15VHI			23 GeV
+g22_tight					23 GeV
+g20_tight_icalovloose_L1EM15VHI	21 GeV
+g20_tight		21 GeV
+g20_loose		21 GeV
+g15_loose		16 GeV
+g12_loose		13 GeV
+g10_loose		11 GeV
\ No newline at end of file
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Triggers.cfg b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Triggers.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..0d6d1483660e582bd88dd82668f114bafbc824f5
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Triggers.cfg
@@ -0,0 +1,124 @@
+###
+# List of triggers and associated legs
+# If no leg is specified, the assumption is that it is a single-lepton trigger and that the name of the leg is the same
+# contact: jmaurer@cern.ch
+###
+
+## Single muon triggers
+mu20_iloose_L1MU15
+mu20_iloose_L1MU15_OR_mu40
+mu20_iloose_L1MU15_OR_mu50
+mu24_iloose_L1MU15
+mu24_iloose_L1MU15_OR_mu40
+mu24_iloose_L1MU15_OR_mu50
+mu24_iloose_L1MU15_OR_mu24_iloose
+mu24_iloose_L1MU15_OR_mu24_iloose_OR_mu40
+mu24_iloose_L1MU15_OR_mu24_iloose_OR_mu50
+mu24_imedium
+mu24_imedium_OR_mu40
+mu24_imedium_OR_mu50
+mu24_ivarmedium
+mu24_ivarmedium_OR_mu40
+mu24_ivarmedium_OR_mu50
+mu26_imedium
+mu26_imedium_OR_mu40
+mu26_imedium_OR_mu50
+mu26_ivarmedium
+mu26_ivarmedium_OR_mu40
+mu26_ivarmedium_OR_mu50
+mu40
+mu50
+
+## Dimuon triggers
+2mu10			mu10	mu10
+2mu14			mu14	mu14
+mu18_mu8noL1	mu18	mu8noL1
+mu20_mu8noL1	mu20	mu8noL1
+mu22_mu8noL1	mu22	mu8noL1
+	
+## Trimuon triggers
+3mu4		mu4		mu4		mu4
+3mu6		mu6		mu6		mu6
+mu6_2mu4	mu6		mu4		mu4
+mu18_2mu4noL1	mu18	mu4noL1		mu4noL1
+mu20_2mu4noL1	mu20	mu4noL1		mu4noL1
+
+## Single electron triggers
+e15_lhvloose_nod0_L1EM13VH
+e24_lhmedium_L1EM20VH
+e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose
+e24_lhtight_nod0_ivarloose
+e24_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+e26_lhtight_nod0_ivarloose
+e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+e120_lhloose
+e60_lhmedium
+e60_lhmedium_nod0
+e140_lhloose_nod0
+
+## Dielectron triggers
+2e12_lhloose_L12EM10VH			e12_lhloose_L1EM10VH			e12_lhloose_L1EM10VH
+2e15_lhvloose_nod0_L12EM13VH	e15_lhvloose_nod0_L1EM13VH		e15_lhvloose_nod0_L1EM13VH
+2e17_lhvloose_nod0				e17_lhvloose_nod0				e17_lhvloose_nod0
+2e17_lhvloose_nod0_L12EM15VHI	e17_lhvloose_nod0_L1EM15VHI		e17_lhvloose_nod0_L1EM15VHI
+2e24_lhvloose_nod0				e24_lhvloose_nod0_L1EM20VH		e24_lhvloose_nod0_L1EM20VH
+
+## Trielectron triggers
+e17_lhloose_2e9_lhloose				e17_lhloose			e9_lhloose			e9_lhloose
+e17_lhloose_nod0_2e9_lhloose_nod0	e17_lhloose_nod0	e9_lhloose_nod0		e9_lhloose_nod0
+e17_lhloose_nod0_2e10_lhloose_nod0_L1EM15VH_3EM8VH		e17_lhloose_nod0_L1EM15VH	e10_lhloose_nod0_L1EM8VH	e10_lhloose_nod0_L1EM8VH
+e24_lhvloose_nod0_2e12_lhvloose_nod0_L1EM20VH_3EM10VH	e24_lhvloose_nod0_L1EM20VH	e12_lhvloose_nod0_L1EM10VH	e12_lhvloose_nod0_L1EM10VH
+
+## Electron-muon triggers
+e17_lhloose_nod0_mu14	e17_lhloose_nod0	mu14
+e7_lhmedium_nod0_mu24	e7_lhmedium_nod0	mu24
+e17_lhloose_mu14		e17_lhloose			mu14
+e7_lhmedium_mu24		e7_lhmedium			mu24
+e24_lhmedium_L1EM20VHI_mu8noL1			e24_lhmedium_L1EM20VHI			mu8noL1
+e24_lhmedium_nod0_L1EM20VHI_mu8noL1		e24_lhmedium_nod0_L1EM20VHI		mu8noL1
+e26_lhmedium_nod0_mu8noL1				e26_lhmedium_nod0				mu8noL1
+e26_lhmedium_nod0_L1EM22VHI_mu8noL1		e26_lhmedium_nod0_L1EM22VHI		mu8noL1
+e12_lhloose_2mu10		e12_lhloose			mu10				mu10
+e12_lhloose_nod0_2mu10	e12_lhloose_nod0	mu10				mu10
+2e12_lhloose_mu10		e12_lhloose			e12_lhloose			mu10
+2e12_lhloose_nod0_mu10	e12_lhloose_nod0	e12_lhloose_nod0	mu10
+
+## Single photon triggers
+g140_loose
+g120_loose
+
+## Diphoton triggers
+2g50_loose_L12EM20VH				g50_loose_L1EM20VH					g50_loose_L1EM20VH
+g35_medium_g25_medium_L12EM20VH		g35_medium_L1EM20VH					g25_medium_L1EM20VH
+g35_loose_g25_loose					g35_loose							g25_loose
+g35_loose_L1EM15_g25_loose_L1EM15	g35_loose_L1EM15					g25_loose_L1EM15
+2g20_tight_icalovloose_L12EM15VHI	g20_tight_icalovloose_L1EM15VHI		g20_tight_icalovloose_L1EM15VHI
+2g22_tight_L12EM15VHI				g22_tight_L1EM15VHI					g22_tight_L1EM15VHI
+2g22_tight							g22_tight							g22_tight
+2g20_tight							g20_tight							g20_tight
+
+## Triphoton triggers
+2g25_loose_g15_loose	g25_loose	g25_loose	g15_loose
+2g20_loose_g15_loose	g20_loose	g20_loose	g15_loose
+3g20_loose				g20_loose	g20_loose	g20_loose
+3g15_loose				g15_loose	g15_loose	g15_loose
+
+## Electron-photon triggers
+e24_lhmedium_nod0_L1EM20VH_g25_medium	e24_lhmedium_nod0_L1EM20VH		g25_medium_L1EM20VH
+e24_lhmedium_nod0_L1EM15VH_g25_medium	e24_lhmedium_nod0_L1EM15VH		g25_medium_L1EM20VH
+e24_lhmedium_L1EM15VH_g25_medium		e24_lhmedium_L1EM15VH			g25_medium_L1EM20VH
+e20_lhmedium_nod0_g35_loose		e20_lhmedium_nod0		g35_loose
+e20_lhmedium_g35_loose			e20_lhmedium			g35_loose
+e24_lhmedium_nod0_2g12_loose	e24_lhmedium_nod0_L1EM20VH		g12_loose		g12_loose
+e20_lhmedium_nod0_2g10_loose	e24_lhmedium_nod0_L1EM20VH		g10_loose		g10_loose
+e20_lhmedium_2g10_loose			e20_lhmedium					g10_loose		g10_loose
+
+## Muon-photon triggers
+g35_tight_icalotight_L1EM24VHI_mu18noL1		g35_tight_icalotight_L1EM24VHI		mu18noL1
+g35_loose_L1EM22VHI_mu18noL1				g35_loose_L1EM22VHI					mu18noL1
+g35_loose_L1EM24VHI_mu18					g35_loose_L1EM24VHI					mu18
+g25_medium_mu24								g25_medium_L1EM20VH					mu24
+g35_tight_icalotight_L1EM24VHI_mu15noL1_mu2noL1 	g35_tight_icalotight_L1EM24VHI		mu15noL1		mu2noL1
+g35_loose_L1EM24VHI_mu15_mu2noL1					g35_loose_L1EM24VHI					mu15			mu2noL1	
+g35_loose_L1EM22VHI_mu15noL1_mu2noL1				g35_loose_L1EM22VHI					mu15noL1		mu2noL1
+2g10_loose_mu20										g10_loose							g10_loose		mu20
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/doc/formulas.pdf b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/doc/formulas.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..dbaae17f399d512767a3536b11308c9bf22bae6d
Binary files /dev/null and b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/doc/formulas.pdf differ
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/doc/formulas.tex b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/doc/formulas.tex
new file mode 100644
index 0000000000000000000000000000000000000000..78b8cf1e9fd973be5fe5c58ac3add69d2407498c
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/doc/formulas.tex
@@ -0,0 +1,519 @@
+\documentclass{article}
+\usepackage{mathtools}
+\usepackage{amsmath}
+\usepackage{amssymb}
+\usepackage{subfigure}
+\usepackage{graphicx}
+\usepackage{color}
+\usepackage[labelformat=empty]{caption}
+%\usepackage{url}
+\usepackage{hyperref}
+\newcommand{\link}[2]{\textcolor{blue}{\underline{\smash{\href{#1}{#2}}}}}
+\newcommand{\pt}{\ensuremath{p_\mathrm{T}}}
+\newcommand{\met}{\ensuremath{E_\mathrm{T}^\mathrm{miss}}}
+\newcommand{\meff}{\ensuremath{m_\mathrm{eff}}}
+\newcommand{\amu}{\ensuremath{\langle\mu\rangle}}
+\newcommand{\BYes}{\textcolor{green}{$\bullet$}}
+\newcommand{\BNeutr}{\textcolor{orange}{$\bullet$}}
+\newcommand{\BNo}{\textcolor{red}{$\bullet$}}
+%\newcommand{\pro}{\ensuremath{\mathbb{P}}}
+\newcommand{\pro}{\ensuremath{\mathbb{P}}}
+
+\usepackage{pbox}
+\usepackage{multirow}
+
+\definecolor{col0}{RGB}{0,0,0}
+
+
+\begin{document}
+
+\section*{Definitions}
+
+Making generous use of the formulas to expand probabilities of unions or intersections of $n$ events 
+(RHS sums have $2^n-1$ terms in total):
+\begin{align*}
+\pro(A_1\vee \ldots \vee A_n)  &= \pro(A_1) + \ldots - \pro(A_1\wedge A_2) - \ldots + (-1)^{n+1} \pro(A_1\wedge\ldots\wedge A_n)\\
+\pro(A_1\wedge \ldots \wedge A_n)  &= \pro(A_1) + \ldots - \pro(A_1\vee A_2) - \ldots + (-1)^{n+1} \pro(A_1\vee\ldots\vee A_n)
+\end{align*}
+
+\tableofcontents
+
+\section{Single lepton triggers}
+\subsection{One $e/\mu$ trigger, $n$ leptons}
+\begin{align}
+\pro(T_n) & =\pro(\ell_1\vee\ldots\vee\ell_n)\notag\\
+&= 1 - \pro(\bar\ell_1\wedge\ldots\wedge\bar\ell_n)\notag\\
+&= 1- \prod_{1\leq k\leq n} (1-\pro(\ell_k))
+\label{e:1}
+\end{align}
+
+This is the formula implemented in the muon trigger scale factor tool. 
+
+\subsection{One $e$ + one $\mu$ trigger, $n_e+n_\mu$ leptons}
+\label{s:eOm}
+
+\begin{align}
+\pro(T_{n_e+n_\mu})&=\pro(E_{n_e}\vee M_{n_\mu})\notag\\
+& =1 - \pro(\bar E_{n_e})\pro(\bar M_{n_\mu})\notag\\
+&= 1- \prod_{1\leq k\leq n_e} (1-\pro(e_k))\prod_{1\leq k\leq n_\mu} (1-\pro(\mu_k))
+\label{e:eOm}
+\end{align}
+
+This is the same formula as the previous case. Note however that the total efficiency can't be factorized into separate contributions for electrons and muons (because of this leading ``1 -'' term breaking linearity), so the scale factor has to be evaluated at once considering both lepton flavours. 
+
+\subsection{Several $e/\mu$ triggers, $n$ leptons}
+\label{s:x1e}
+
+If there are $k$ triggers in the combination: 
+
+\begin{align}
+\pro(T_n)&=\pro(T^{1}_n\vee\ldots\vee T^{k}_n) \notag\\
+&= 1 - \pro(\bar T^1_n\wedge\ldots\wedge\bar T_n^k) \notag\\
+&= \pro(\bar \ell_1^1\vee\ldots\bar\ell_1^k)\times\ldots\times\pro(\bar \ell_n^1\vee\ldots\bar\ell_n^k)\notag\\
+& = 1- \prod_{1\leq j\leq n} (1-\pro(\ell_j^{\lambda_j}))
+\end{align}
+
+This is, conveniently, the same expression as for a single trigger~\ref{e:1}, except that for each lepton 
+one needs to consider the probability of triggering the loosest trigger leg according to the established hierarchy, 
+The index of this loosest leg is indicated by $\lambda_j\in [0,k-1]$. 
+As indicated by the subscript $j$, this index may vary from one lepton 
+to the other since a given lepton might not be on plateau for all $k$ legs; 
+also, the hierarchy itself is sometimes $p_\mathrm{T}$-dependent. 
+
+\subsection{Several $e$ + $\mu$ triggers, $n_e+n_\mu$ leptons}
+\label{s:x1l}
+
+Straightforward combination of sections~\ref{s:eOm} and~\ref{s:x1e}:
+\begin{align}
+\pro(T_n)&=
+1- \prod_{1\leq j\leq n_e} (1-\pro(e_j^{\lambda_j}))\prod_{1\leq j\leq n_\mu} (1-\pro(\mu_j^{\lambda_j}))
+\label{e:x1l}
+\end{align}
+
+
+\section{Dilepton triggers, simple cases}
+
+\subsection{One $e\mu$ trigger, $n_e+n_\mu$ leptons}
+
+Need to fire both the electron and the muon legs, things factorize nicely: 
+\begin{align}
+\pro(T_{n_e+n_\mu})&=\pro(E_{n_e}\wedge M_{n_\mu}) \notag\\
+&= \pro(E_{n_e})\times\pro(M_{n_\mu})\notag\\
+&=\left(1- \prod_{1\leq k\leq n_e} (1-\pro(e_k))\right)\times\left(1- \prod_{1\leq k\leq n_\mu} (1-\pro(\mu_k))\right)
+\end{align}
+
+\subsection{One symmetric $ee/\mu\mu$ trigger, $n$ leptons}
+
+For example \textrm{2e12\_lhloose}. 
+The efficiency is computed by induction over the number of leptons $n$. 
+Let's define $S_{n-1}=\ell_1\vee\ldots\vee\ell_{n-1}$, i.e. when at least one leg was fired by one of the first $n-1$ leptons. 
+Then: 
+
+\begin{align}
+\pro(T_n) &= \pro(T_{n-1}  \vee (\ell_n\wedge S_{n-1}))\notag\\
+&= \pro(T_{n-1}) + \pro(\ell_n\wedge S_{n-1}) - \pro(T_{n-1}\wedge \ell_n\wedge S_{n-1})\notag\\
+&= (1-\pro(\ell_n))\pro(T_{n-1})+\pro(\ell_n)\pro(S_{n-1})\quad\text{since }T_{n-1}\wedge S_{n-1}=T_{n-1}\notag\\
+&= (1-\pro(\ell_n))\pro(T_{n-1})+\pro(\ell_n)\left[1-\!\!\prod_{1\leq k\leq n-1}\!\!\!(1-\pro(\ell_k))\right]
+%&=\pro(((S_{n-1}\vee \bar S_{n-1})\wedge T_{n-1})  \vee (\ell_n\wedge S_{n-1}))\notag\\
+\label{e:2s}
+\end{align}
+This is straightforward to implement: 
+
+\begin{verbatim}
+p[0] = 0
+s[0] = 1
+for k = 1 to n:
+    p[k] = (1-e[k])*p[k-1] + e[k]*(1-s[k-1])
+    s[k] *= (1-e[k])
+return p[n]
+\end{verbatim}
+
+\subsection{One asymmetric $\ell\ell$ trigger, $n$ leptons}
+
+For example \textrm{mu18\_mu8noL1}. The two legs are differentiated by superscripts ($\ell_k^1$, $\ell_k^2$), 
+with the leg(1) having a higher \pt\ threshold than the leg (2). 
+Using induction again: 
+
+\begin{align}
+\pro(T_n) &= 
+\pro(T_{n-1}\vee (\ell_n^1 \wedge S_{n-1}^2) \vee (\ell_n^2 \wedge S_{n-1}^1))\notag\\
+&=(1-\pro(\ell_n^{\lambda_n}))\pro(T_{n-1})
++\pro(\ell_n^1)\pro(S_{n-1}^2) + \pro(\ell_n^2)\pro(S_{n-1}^1)\notag\\
+&\qquad- \pro(\ell_n^{\tau_n})\pro(S_{n-1}^1\wedge S_{n-1}^2)\notag\\
+&=(1-\pro(\ell_n^{\lambda_n}))\pro(T_{n-1})
++(\pro(\ell_n^{\lambda_n})-\pro(\ell_n^{\tau_n}))\pro(S_{n-1}^{\tau_n})\notag\\
+&\qquad + \pro(\ell_n^{\tau_n}) \pro(S_{n-1}^1\vee S_{n-1}^2)
+\label{e:2a}
+\end{align}
+where $\lambda_k$ (resp. $\tau_k$) is the index of the trigger leg that is the loosest 
+(resp. tightest) according to the established hierarchy at the lepton $k$'s \pt. 
+
+The expressions for $\pro(S_{n-1}^1)$ and $\pro(S_{n-1}^2)$ are given by~\ref{e:1}, 
+and $\pro(S_{n}^1\vee S_{n}^2)$ is simply the probability 
+for a logical ``or'' of two same-flavour two single-lepton triggers, hence is given by~\ref{e:x1l}. 
+
+\section{Combination of dilepton and single lepton triggers, only one lepton flavour}
+
+\subsection{One symmetric $\ell\ell$ + one or more same-flavour $\ell$ triggers, $n$ leptons}
+
+First addressing the case of one single-lepton trigger, then generalizing. 
+Superscripts 1 and 2 will respectively correspond to the single lepton trigger leg, and the dilepton trigger leg. 
+\begin{align}
+\pro(T_n) &= \pro(T_{n-1} \vee \ell_n^1 \vee (\ell_n^2 \wedge S_{n-1}^2))\notag\\
+&= \pro(T_{n-1})[1-\pro(\ell_n^1)] + \pro(\ell_n^1)
++ [\pro(\ell_n^2)-\pro(\ell_n^{\tau_n})][\pro(S_{n-1}^2) - \pro(T_{n-1}\wedge S_{n-1}^2)] \notag\\
+&= \pro(T_{n-1})[1-\pro(\ell_n^1)] + \pro(\ell_n^1)
++ [\pro(\ell_n^2)-\pro(\ell_n^{\tau_n})][\pro(T_{n-1}\vee S_{n-1}^2) - \pro(T_{n-1})]\notag\\
+&= \pro(T_{n-1})[1-\pro(\ell_n^1)] + \pro(\ell_n^1)
++ [\pro(\ell_n^2)-\pro(\ell_n^{\tau_n})][\pro(S_{n-1}^1\vee S_{n-1}^2) - \pro(T_{n-1})]\notag\\
+&= \pro(T_{n-1})[1-\pro(\ell_n^{\lambda_n})] + \pro(\ell_n^1)
++ \pro(S_{n-1}^1\vee S_{n-1}^2)[\pro(\ell_n^2)-\pro(\ell_n^{\tau_n})]\notag\\
+&= \pro(T_{n-1})[1-\pro(\ell_n^{\lambda_n})] + \pro(\ell_n^1)
++ \delta_2^{\lambda_n}\pro(S_{n-1}^1\vee S_{n-1}^2)[\pro(\ell_n^2)-\pro(\ell_n^1)]\notag
+\end{align}
+
+The expression for $\pro(S_{n-1}^1\vee S_{n-1}^2)$ is given by~\ref{e:1O1}. 
+
+For more than one single-lepton trigger, we denote $Z_n:=S_n^{1,1}\vee\ldots\vee S_n^{1,k}$ the union of the 
+$k$ single-lepton triggers. We also denote by the superscript $1$ the loosest single-lepton trigger for the lepton $n$.  
+Then: 
+\begin{align}
+\pro(T_n) 
+&= \pro(T_{n-1} \vee (\ell_n^{1,1}\vee\ldots\vee\ell_n^{1,k}) \vee (\ell_n^2 \wedge S_{n-1}^2))\notag\\
+&= \pro(T_{n-1} \vee \ell_n^{1} \vee (\ell_n^2 \wedge S_{n-1}^2))\notag\\
+&= \pro(T_{n-1})[1-\pro(\ell_n^{\lambda_n})] + \pro(\ell_n^{1})
++ \delta_2^{\lambda_n}
+\pro(Z_{n-1}\vee S_{n-1}^2)[\pro(\ell_n^2)-\pro(\ell_n^{1})]
+\label{e:2sO1}
+\end{align}
+
+
+\subsection{One asymmetric $\ell\ell$ + one or more same-flavour $\ell$ trigger, $n$ leptons}
+
+Uperscripts $2$ and $3$ indicate the two legs of the dilepton trigger, while $1$ indicates the loosest of the single-lepton trigger legs 
+for the lepton $n$ (i.e. equivalent to $\lambda_n^1$ in the previous section). However, $S_{n-1}^1$ still represents the event of triggering with any of the single-lepton triggers for one of the first $n-1$ leptons. 
+ 
+\begin{align}
+\pro(T_n) &= \pro(T_{n-1} \
+\vee (\ell_n^{1} \wedge S_{n-1}^{2}) \vee (\ell_n^{2} \wedge S_{n-1}^{1}) \vee \ell_n^3) \notag\\
+%
+&=[1-\pro(\ell_n^3)]\pro(T_{n-1}) + \pro(\ell_n^3)
++ [\pro(\ell_n^{1}) - \pro(\ell_n^{\tau_n^{1,3}})][\pro(S_{n-1}^{2}) - \pro(T_{n-1}\wedge S_{n-1}^2) ]\notag\\
+&\qquad + [\pro(\ell_n^{2}) - \pro(\ell_n^{\tau_n^{2,3}})][\pro(S_{n-1}^{1})-\pro(T_{n-1}\wedge S_{n-1}^1)]\notag\\
+&\qquad +  [\pro(\ell_n^{\tau_{n}}) - \pro(\ell_n^{\tau_{n}^{1,2}}) ]
+[\pro(S_{n-1}^{1}\wedge S_{n-1}^{2}) - \pro(T_{n-1}\wedge S_{n-1}^{1}\wedge S_{n-1}^{2})]\notag\\
+%
+&=[1-\pro(\ell_n^3)]\pro(T_{n-1}) + \pro(\ell_n^3)
+ + [\pro(\ell_n^{1}) - \pro(\ell_n^{\tau_n^{1,3}})][\pro(T_{n-1}\vee  S_{n-1}^2) - \pro(T_{n-1})]\notag\\
+&\qquad + [\pro(\ell_n^{2}) - \pro(\ell_n^{\tau_n^{2,3}})][\pro(T_{n-1}\vee  S_{n-1}^1) - \pro(T_{n-1})]\notag\\
+&\qquad +  [\pro(\ell_n^{\tau_{n}}) - \pro(\ell_n^{\tau_{n}^{1,2}}) ]
+[\pro(T_{n-1} \vee S_{n-1}^{1})+\pro(T_{n-1}\vee S_{n-1}^{2}) 
+- \pro(T_{n-1})-\pro(T_{n-1} \vee S_{n-1}^{1} \vee S_{n-1}^{2})]\notag\\
+%
+&= [1-\pro(\ell_n^{\lambda_n})]\pro(T_{n-1}) + \pro(\ell_n^3)
++ (1-\delta_3^{\lambda_n})[\pro(\ell_n^{\lambda_n}) - \pro(\ell_n^{m_n})]\pro(T_{n-1}\vee  S_{n-1}^{\tau_n^{1,2}})\notag\\
+&\qquad +  \delta_3^{\tau_n}[\pro(\ell_n^{m_n}) - \pro(\ell_n^3) ]
+\pro(T_{n-1} \vee (S_{n-1}^{1}\wedge S_{n-1}^{2}))\notag\\
+%
+&= [1-\pro(\ell_n^{\lambda_n})]\pro(T_{n-1}) + \pro(\ell_n^3)
++ (1-\delta_3^{\lambda_n})[\pro(\ell_n^{\lambda_n}) -\pro(\ell_n^{m_n})]\pro(S_{n-1}^3\vee  S_{n-1}^{\tau^{1,2}_n})\notag\\
+&\qquad + \delta_3^{\tau_n} [\pro(\ell_n^{m_n}) - \pro(\ell_n^3) ]
+\pro(S_{n-1}^1 \vee S_{n-1}^{2}\vee S_{n-1}^{3})
+\label{e:2aO1}
+\end{align}
+where $m_n$ stands for the ``medium'' leg (neither the tightest, nor the loosest) according to the hierarchy for the lepton $n$. 
+The different terms can be evaluated with~\ref{e:x1l}, and using induction. 
+
+
+%\subsection{One sym. $\ell\ell$ + one asym. $\ell\ell$, $n$ leptons}
+%
+%Notation: $D_n$ for the symmetric trigger, $A_n$ for the asymmetric trigger, $S_n^1$ for a single leg of the 
+%symmetric trigger, $S_n^2$ and $S_n^3$ similarly for the two different legs of the asymmetric trigger. 
+%\begin{align}
+%\pro(T_n)
+%&= \pro(T_{n-1}\vee (\ell_n^1\wedge S_{n-1}^1)
+%\vee  (\ell_n^2\wedge S_{n-1}^3) \vee (\ell_n^3\wedge S_{n-1}^2))\notag\\
+%%
+%&= \pro(T_{n-1}) 
+%+\pro(\ell_n^1)[\pro(S_{n-1}^1) - \pro(T_{n-1}\wedge S_{n-1}^1)]
+%+\pro(\ell_n^2)[\pro(S_{n-1}^3) - \pro(T_{n-1}\wedge S_{n-1}^3)]\notag\\
+%&\qquad +\pro(\ell_n^3)[\pro(S_{n-1}^2) - \pro(T_{n-1}\wedge S_{n-1}^2)]
+%+\pro(\ell_n^{\tau_n^{1,2}})[\pro(T_{n-1}\wedge S_{n-1}^1\wedge S_{n-1}^3) - \pro( S_{n-1}^1\wedge S_{n-1}^3)]\notag\\
+%&\qquad+\pro(\ell_n^{\tau_n^{1,3}})[\pro(T_{n-1}\wedge S_{n-1}^1\wedge S_{n-1}^2) - \pro( S_{n-1}^1\wedge S_{n-1}^2)]\notag\\
+%&\qquad+\pro(\ell_n^{\tau_n^{2,3}})[\pro(T_{n-1}\wedge S_{n-1}^2\wedge S_{n-1}^3) - \pro( S_{n-1}^2\wedge S_{n-1}^3)]\notag\\
+%&\qquad+ \pro(\ell_n^{\tau_n^{1,2,3}})[\pro(S_{n-1}^1 \wedge S_{n-1}^2\wedge S_{n-1}^3) - 
+%\pro(T_{n-1}\wedge S_{n-1}^1\wedge S_{n-1}^2\wedge S_{n-1}^3)]\notag\\
+%%
+%&= \pro(T_{n-1}) 
+%+\pro(\ell_n^1)[\pro(T_{n-1}\vee S_{n-1}^1) - \pro(T_{n-1})]
+%+\pro(\ell_n^2)[\pro(T_{n-1}\vee S_{n-1}^3) - \pro(T_{n-1})]\notag\\
+%&\qquad +\pro(\ell_n^3)[\pro(T_{n-1}\vee S_{n-1}^2) - \pro(T_{n-1})]
+%+ \pro(\ell_n^{\tau_n^{1,2}})X_{1,3}+\pro(\ell_n^{\tau_n^{1,3}})X_{1,2}
+%+\pro(\ell_n^{\tau_n^{2,3}})X_{2,3}\notag\\
+%&\qquad+ \pro(\ell_n^{\tau_n^{1,2,3}})[\pro(T_{n-1}\vee S_{n-1}^1\vee S_{n-1}^2\vee S_{n-1}^3)
+%- X_{1,2} - X_{1,3} - X_{2,3}\notag\\
+%&\qquad\qquad+ 2\pro(T_{n-1}) - \pro(T_{n-1}\vee S_{n-1}^1) - \pro(T_{n-1}\vee S_{n-1}^2) - \pro(T_{n-1}\vee S_{n-1}^3)]\notag\\
+%\text{with }&X_{j,k}:=
+%\pro(T_{n-1}\wedge S_{n-1}^j\wedge S_{n-1}^k) - \pro( S_{n-1}^j\wedge S_{n-1}^k)\notag\\
+%&\qquad=\pro(T_{n-1}\vee S_{n-1}^j\vee S_{n-1}^k) 
+%- \pro(T_{n-1}\vee S_{n-1}^j) - \pro(T_{n-1}\vee S_{n-1}^k) + \pro( T_{n-1})\notag
+%\end{align}
+%
+%Therefore: 
+%\begin{align}
+%\pro(T_n)
+%&= [1 - \pro(\ell_n^1) - \pro(\ell_n^2) - \pro(\ell_n^3) 
+%+ \pro(\ell_n^{\tau_n^{1,2}}) + \pro(\ell_n^{\tau_n^{1,3}}) + \pro(\ell_n^{\tau_n^{2,3}})
+%- \pro(\ell_n^{\tau_n^{1,2,3}})]\pro(T_{n-1})\notag\\
+%&\qquad+\pro(\ell_n^1)\pro(T_{n-1}\vee S_{n-1}^1)
+%+\pro(\ell_n^2)\pro(T_{n-1}\vee S_{n-1}^3)
+%+\pro(\ell_n^3)\pro(T_{n-1}\vee S_{n-1}^2)
+%\notag\\
+%&\qquad + [\pro(\ell_n^{\tau_n^{1,2}}) - \pro(\ell_n^{\tau_n^{1,2,3}})]\pro(T_{n-1}\vee S_{n-1}^1\vee S_{n-1}^3)
+%+ [\pro(\ell_n^{\tau_n^{1,3}}) - \pro(\ell_n^{\tau_n^{1,2,3}})]\pro(T_{n-1}\vee S_{n-1}^1\vee S_{n-1}^2)\notag\\
+%&\qquad+ [\pro(\ell_n^{\tau_n^{2,3}}) - \pro(\ell_n^{\tau_n^{1,2,3}})]\pro(T_{n-1}\vee S_{n-1}^2\vee S_{n-1}^3)
+%+ \pro(\ell_n^{\tau_n^{1,2,3}})\pro(T_{n-1}\vee S_{n-1}^1\vee S_{n-1}^2\vee S_{n-1}^3)\notag\\
+%&\qquad- [\pro(\ell_n^{\tau_n^{1,2}}) + \pro(\ell_n^{\tau_n^{1,3}}) - \pro(\ell_n^{\tau_n^{1,2,3}})]
+%\pro(T_{n-1}\vee S_{n-1}^1)\notag\\
+%&\qquad- [\pro(\ell_n^{\tau_n^{1,3}}) + \pro(\ell_n^{\tau_n^{2,3}}) - \pro(\ell_n^{\tau_n^{1,2,3}})]
+%\pro(T_{n-1}\vee S_{n-1}^2)\notag\\
+%&\qquad- [\pro(\ell_n^{\tau_n^{1,2}}) + \pro(\ell_n^{\tau_n^{2,3}}) - \pro(\ell_n^{\tau_n^{1,2,3}})]
+%\pro(T_{n-1}\vee S_{n-1}^3)\notag\\
+%%
+%&= [1 - \pro(\ell_n^{\lambda_n})]\pro(T_{n-1}) 
+%+ \pro(\ell_n^{\tau_n^{1,2,3}})\pro(S_{n-1}^1\vee S_{n-1}^2\vee S_{n-1}^3)\notag\\
+%&\qquad
+%-\delta_1^{\lambda_n}\pro(\ell_n^{m_n})\pro(A_{n-1}\vee S_{n-1}^1)
+%-\delta_2^{\lambda_n}\pro(\ell_n^{m_n})\pro(D_{n-1}\vee S_{n-1}^3)
+%-\delta_3^{\lambda_n}\pro(\ell_n^{m_n})\pro(D_{n-1}\vee S_{n-1}^2)
+%\notag\\
+%&\qquad + \delta_3^{\tau_n}[\pro(\ell_n^{m_n}) - \pro(\ell_n^3)]\pro(S_{n-1}^1\vee S_{n-1}^3)
+%+ \delta_2^{\tau_n}[\pro(\ell_n^{m_n}) - \pro(\ell_n^2)]\pro(S_{n-1}^1\vee S_{n-1}^2)\notag\\
+%&\qquad+  \delta_1^{\tau_n}[\pro(\ell_n^{m_n}) - \pro(\ell_n^1)]\pro(D_{n-1}\vee S_{n-1}^2\vee S_{n-1}^3)
+%%  + \delta_2^{\tau_n}[\pro(\ell_n^{m_n}) - \pro(\ell_n^2)]\pro(T_{n-1}\vee S_{n-1}^1\vee S_{n-1}^3)\notag\\
+%% &\qquad + \delta_3^{\tau_n}[\pro(\ell_n^{m_n}) - \pro(\ell_n^3)]\pro(T_{n-1}\vee S_{n-1}^1\vee S_{n-1}^2)
+%\end{align}
+
+\subsection{Two sym. $\ell\ell$ + several $\ell$ triggers, $n$ leptons}
+
+Superscripts $1$ and $2$ stand for the symmetric triggers, and superscript $3$ for the loosest single lepton trigger for the lepton $n$. $S_{n-1}^j$ represents the event of triggering the leg $j$ with any of the first $n-1$ leptons 
+(for $j=3$, it should be interpreted as ``any single lepton trigger''). 
+$m_n$ stands for the sub-tightest leg for the lepton $n$. 
+
+\begin{align*}
+\pro(T_n)&=
+\pro(T_{n-1}\vee (\ell_n^1\wedge S_{n-1}^1) \vee (\ell_n^2\wedge S_{n-1}^2) \vee \ell_n^3)
+\end{align*}
+
+This happens to be the same starting expression as eq.\ref{e:2sO1}, except that the reduction of the $(T_{n-1}\vee S_{n-1}\ldots)$ 
+terms in the last step is different; here the remaining terms resolve to:
+\begin{itemize}
+\item $T_{n-1}\vee S_{n-1}^{1,2} = D_{n-1}^{2,1}\vee Z_{n-1}\vee S_{n-1}^{1,2}$, then evaluated with eq.~\ref{e:2sO1}
+\item $T_{n-1}\vee S_{n-1}^{1}\vee S_{n-1}^{2} = Z_{n-1} \vee S_{n-1}^{1}\vee S_{n-1}^2$, with eq.~\ref{e:eOm}
+\end{itemize}
+where $D^{1,2}$ stand for the symmetric triggers and $Z$ for the combination of single-lepton triggers. 
+
+\subsection{One sym. $\ell\ell$ + one asym. $\ell\ell$ + several $\ell$ triggers, $n$ leptons}
+
+Superscript $1$ stands for the symmetric trigger, superscripts $2$ and $3$ for the two legs of the asymmetric trigger, 
+and superscript $4$ for the loosest single lepton trigger for the lepton $n$. $S_{n-1}^j$ represents the event of 
+triggering the leg $j$ with any of the first $n-1$ leptons (for $j=4$, it should be interpreted as ``any single lepton trigger''). 
+$m_n$ stands for the second tightest leg for the lepton $n$, $\nu_n$ for the third. 
+\begin{align}
+\pro(T_n)&=
+\pro(T_{n-1}\vee (\ell_n^1\wedge S_{n-1}^1) \vee (\ell_n^2\wedge S_{n-1}^3) 
+\vee (\ell_n^3\wedge S_{n-1}^2) \vee \ell_n^4)\notag\\
+%
+&=\pro(\ell_n^4) + \pro(T_{n-1})[1-\pro(\ell_n^4)]
++ [\pro(S_{n-1}^1) - \pro(T_{n-1}\wedge S_{n-1}^1)][\pro(\ell_n^1)-\pro(\ell_n^{\tau_n^{1,4}})])\notag\\
+&\qquad+[\pro(S_{n-1}^2) - \pro(T_{n-1}\wedge S_{n-1}^2)][\pro(\ell_n^3)-\pro(\ell_n^{\tau_n^{3,4}})]
++ [\pro(S_{n-1}^3) - \pro(T_{n-1}\wedge S_{n-1}^3)][\pro(\ell_n^2)-\pro(\ell_n^{\tau_n^{2,4}})])\notag\\
+&\qquad + [\pro(S_{n-1}^1\wedge S_{n-1}^2) - \pro(T_{n-1}\wedge S_{n-1}^1\wedge S_{n-1}^2)]
+[\pro(\ell_n^{\tau_n^{1,3,4}})-\pro(\ell_n^{\tau_n^{1,3}})])\notag\\
+&\qquad+ [\pro(S_{n-1}^1\wedge S_{n-1}^3) - \pro(T_{n-1}\wedge S_{n-1}^1\wedge S_{n-1}^3)]
+[\pro(\ell_n^{\tau_n^{1,2,4}})-\pro(\ell_n^{\tau_n^{1,2}})])\notag\\
+&\qquad+ [\pro(S_{n-1}^2\wedge S_{n-1}^3) - \pro(T_{n-1}\wedge S_{n-1}^2\wedge S_{n-1}^3)]
+[\pro(\ell_n^{\tau_n^{2,3,4}})-\pro(\ell_n^{\tau_n^{2,3}})])\notag\\
+&\qquad+ [\pro(S_{n-1}^1\wedge S_{n-1}^2\wedge S_{n-1}^3) 
+- \pro(T_{n-1}\wedge S_{n-1}^1\wedge S_{n-1}^2\wedge S_{n-1}^3)]
+[\pro(\ell_n^{\tau_n^{1,2,3}})-\pro(\ell_n^{\tau_n^{1,2,3,4}})]\notag\\
+%
+&= \pro(\ell_n^4) + \pro(T_{n-1})[1 - \pro(\ell_n^{\lambda_n})]
++ \delta_1^{\lambda_n}\pro(T_{n-1}\vee S_{n-1}^1)
+[\pro(\ell_n^1)-\pro(\ell_n^{\nu_n})])\notag\\
+&\qquad+\delta_3^{\lambda_n}\pro(T_{n-1}\vee S_{n-1}^2)
+[\pro(\ell_n^3)-\pro(\ell_n^{\nu_n})]
++ \delta_2^{\lambda_n}\pro(T_{n-1}\vee S_{n-1}^3)
+[\pro(\ell_n^2)-\pro(\ell_n^{\nu_n})])\notag\\
+&\qquad -\pro(T_{n-1}\vee S_{n-1}^1\vee S_{n-1}^2)
+[\pro(\ell_n^{m_n})-\pro(\ell_n^{\tau_n^{1,3}})]
+-\pro(T_{n-1}\vee S_{n-1}^1\vee S_{n-1}^3)[\pro(\ell_n^{m_n})-\pro(\ell_n^{\tau_n^{1,2}})])\notag\\
+&\qquad -\pro(T_{n-1}\vee S_{n-1}^2\vee S_{n-1}^3)[\pro(\ell_n^{m_n})-\pro(\ell_n^{\tau_n^{2,3}})]
++ \delta_4^{\tau_n}\pro(T_{n-1}\vee S_{n-1}^1\vee S_{n-1}^2\vee S_{n-1}^3)]
+[\pro(\ell_n^{m_n})-\pro(\ell_n^{4})]
+\label{e:2s2a}
+%
+\end{align}
+
+The different terms forming this expression can be evaluated with already-established formulas for simpler combinations of triggers, 
+by using that: 
+\begin{itemize}
+\item $T_{n-1}\vee S_{n-1}^1 = A_{n-1} \vee Z_{n-1} \vee S_{n-1}^1$, then evaluated with eq.~\ref{e:2aO1}
+\item $T_{n-1}\vee S_{n-1}^{2,3} = D_{n-1} \vee Z_{n-1} \vee S_{n-1}^{2,3}$, with eq.~\ref{e:2sO1}
+\item $T_{n-1}\vee S_{n-1}^1\vee S_{n-1}^{2,3} = Z_{n-1} \vee S_{n-1}^1\vee S_{n-1}^{2,3}$, with eq.~\ref{e:eOm}
+\item $T_{n-1}\vee S_{n-1}^2\vee S_{n-1}^3= D_{n-1}\vee Z_{n-1} \vee S_{n-1}^2\vee S_{n-1}^3$, with eq.~\ref{e:2sO1}
+\item $T_{n-1}\vee S_{n-1}^1\vee S_{n-1}^2\vee S_{n-1}^3= Z_{n-1} \vee S_{n-1}^1\vee S_{n-1}^2\vee S_{n-1}^3$, with eq.~\ref{e:eOm}
+\end{itemize}
+where $D$ stands for the symmetric trigger, $A$ for the asymmetric trigger, and $Z$ for the combination of single-lepton triggers. 
+
+
+
+
+
+\section{Combinations of dilepton and single lepton triggers, mixing lepton flavours}
+
+\subsection{One $e\mu$ + several single-$e/\mu$ triggers, $n_e+n_\mu$ leptons}
+\label{s:emO1}
+
+We denote by $Z_e$ and $Z_\mu$ the unions of the single-electron (resp. single-muon) triggers, 
+and by $S_e^2/S_\mu^2$ the legs of the $e\mu$ trigger. Then: 
+
+\begin{align}
+\pro(T_{n_e+n_\mu}) & = \pro((S_e^2\wedge S_\mu^2)\vee Z_e \vee Z_\mu)\notag\\
+&= \pro(Z_e\vee Z_\mu) + [\pro(S_e^2) - \pro(S_e^2\wedge Z_e)][\pro(S_\mu^2) - \pro(S_\mu^2\wedge Z_\mu)]\notag\\
+&= \pro(Z_e\vee Z_\mu)+ [\pro(Z_e\vee S_e^2) - \pro(Z_e)][\pro(Z_\mu\vee S_\mu^2) - \pro(Z_\mu) ]\notag\\
+&= 1 - [1-\pro(Z_e)][1-\pro(Z_\mu)]+ [\pro(Z_e\vee S_e^2) - \pro(Z_e)][\pro(Z_\mu\vee S_\mu^2) - \pro(Z_\mu) ]
+\end{align}
+
+\subsection{One $ee/\mu\mu$ + one $e\mu$ trigger, $n_e+n_\mu$ leptons}
+
+\begin{align}
+\pro(T_{n_e+n_\mu}) &= \pro(D_e \vee (S_e\wedge S_\mu))\notag\\
+&= \pro(D_e)(1-\pro(S_\mu)) + \pro(S_\mu)\pro(D_e\vee S_e) 
+\end{align}
+
+the different terms can be evaluated with~\ref{e:1},~\ref{e:2s} (\ref{e:2a}) or~\ref{e:2sO1}, 
+depending whether the $ee/\mu\mu$ trigger is symmetric or not. 
+
+\subsection{One $ee$ + one $\mu\mu$ + one $e\mu$ trigger, $n_e+n_\mu$ leptons}
+
+\begin{align}
+\pro(T_{n_e+n_\mu}) &= \pro(D_e \vee (S_e\wedge S_\mu) \vee D_\mu)\notag\\
+&= \pro(D_e)[1-\pro(D_\mu\vee S_\mu)] + \pro(D_\mu)[1-\pro(D_e\vee S_e)]\notag\\
+&\qquad\qquad +  \pro(D_e\vee S_e) \pro(D_\mu\vee S_\mu) 
+\end{align}
+
+the different terms can be evaluated with~\ref{e:1},~\ref{e:2s} or~\ref{e:2sO1}. 
+
+
+%\subsection{One $ee$ + one $\mu\mu$ + one $e\mu$ trigger + one or more same-flavour $e/\mu$ trigger, $n_e+n_\mu$ leptons}
+%
+%We denote $Z_e:=S_e^{1a}\vee\ldots\vee S_e^{1k}$ the union of the $k$ single-lepton triggers. Then: 
+%\begin{align}
+%&\quad\,\,\pro(D_e \vee (S_e^2\wedge S_\mu^2) \vee D_\mu \vee Z_e)\notag\\
+%&=
+%\pro(D_\mu)
+%+ [\pro(D_e)+\pro(Z_e) - \pro(D_e \wedge Z_e)][1 - \pro(D_\mu)]\notag\\
+%&\quad+ [\pro(S_e^2) - \pro(D_e \wedge S_e^2) - \pro(Z_e\wedge S_e^2) + \pro(D_e \wedge Z_e\wedge S_e^2) ]
+%[\pro(S_\mu^2) - \pro( D_\mu\wedge S_\mu^2)]\notag\\
+%&= \pro(D_\mu) + \pro(D_e \vee Z_e)[1 - \pro(D_\mu)]\notag\\
+%&\quad+ [\pro(D_e \vee Z_e\vee S_e^2) - \pro(D_e\vee Z_e)]
+%[\pro( D_\mu\vee S_\mu^2)-\pro(D_\mu)]
+%\end{align}
+
+\subsection{One $ee$ + one $\mu\mu$ + one $e\mu$ trigger + several $e/\mu$ triggers, $n_e+n_\mu$ leptons}
+
+We denote $Z_e:=S_e^{1a}\vee\ldots\vee S_e^{1{k_e}}$ the union of the $k_e$ single-electron triggers, 
+and similarly $Z_\mu$ for the $k_\mu$ single-muon triggers. Then: 
+\begin{align}
+&\quad\,\,\pro(D_e \vee (S_e^2\wedge S_\mu^2) \vee D_\mu \vee Z_e \vee Z_\mu)\notag\\
+&=
+\pro(D_\mu \vee Z_\mu)
++ [1-\pro(D_\mu \vee Z_\mu)]\pro(D_e \vee Z_e)\notag\\
+&\qquad+ [\pro(S_\mu^2) - \pro(S_\mu^2\wedge D_\mu) 
+- \pro(S_\mu^2\wedge Z_\mu)+ \pro(S_\mu^2\wedge D_\mu\wedge Z_\mu)]\notag\\
+&\qquad\qquad\times[\pro(S_e^2) - \pro(S_e^2\wedge D_e) - \pro(S_e^2\wedge Z_e) + \pro(S_e^2\wedge D_e\wedge Z_e)]\notag\\
+&=
+1
+- [1-\pro(D_\mu \vee Z_\mu)][1-\pro(D_e \vee Z_e)]\notag\\
+&\qquad+[\pro(D_\mu\vee Z_\mu\vee S_\mu^2) - \pro(D_\mu\vee Z_\mu)]
+[\pro(D_e\vee Z_e \vee S_e^2) - \pro(D_e\vee Z_e)]
+\end{align}
+
+the evaluation of the different terms (one dilepton trigger + several single-lepton triggers) can be performed 
+with~\ref{e:2sO1} and~\ref{e:2aO1}. 
+
+
+\subsection{Two $ee$ + two $\mu\mu$ + two $e\mu$ + several $e/\mu$ triggers, $n_e+n_\mu$ leptons}
+
+Notation: $E=$ all dielectron or single electron triggers, $M=$ all dimuon or single muon triggers, 
+$S_e^k$ (resp. $S_\mu^k$) the electron leg (resp. muon leg) of the $k$-th $e\mu$ trigger. 
+
+\begin{align}
+\pro(T_n)&=\pro(E\vee (S_e^1\wedge S_\mu^1)\vee(S_e^1\wedge S_\mu^1)\vee M)\notag\\
+&= 1 - (1-\pro(E))(1-\pro(M)) + [\pro(E\vee S_e^1)-\pro(E)][\pro(M\vee S_\mu^1)-\pro(M)]\notag\\
+&\qquad + [\pro(E\vee S_e^2)-\pro(E)][\pro(M\vee S_\mu^2)-\pro(M)]\notag\\
+&\qquad + [\pro(E\vee S_e^1)+\pro(E\vee S_e^2)-\pro(E)-\pro(E\vee S_e^1\vee S_e^2)]\times\notag\\
+&\qquad\qquad\times[-\pro(M\vee S_\mu^1)-\pro(M\vee S_\mu^2)+\pro(M)+\pro(M\vee S_\mu^1\vee S_\mu^2)]
+\end{align}
+
+\section{Trilepton triggers}
+
+\subsection{Fully symmetric $3e/3\mu$ trigger, $n$ leptons}
+By induction:
+\begin{align}
+\pro(T_n) &= \pro(T_{n-1} \vee (D_{n-1}\wedge \ell_n))\notag\\
+&= \pro(T_{n-1})(1-\pro(\ell_n)) + \pro(\ell_n)\pro(D_{n-1})
+\end{align}
+with $\pro(D_{n-1})$ given by~\ref{e:2s}. 
+
+\subsection{Mixed $2e\_\mu/2\mu\_e/e\_e\_\mu/\mu\_\mu\_e$ trigger, $n_e+n_\mu$ leptons}
+
+
+\begin{align}
+\pro(T_{n_e+n_\mu}) &= \pro(E_{n_e})\pro(M_{n_\mu})
+\end{align}
+with $\pro(M_{n_\mu})$ given by~\ref{e:1} and $\pro(E_{n_e})$ by either~\ref{e:2s} or~\ref{e:2a} 
+depending whether the two electrons legs are identical or not. 
+
+
+
+
+\subsection{Half-symmetric $e\_2e/\mu\_2\mu$ trigger, $n$ leptons}
+Superscript 1 indicates the leg of the symmetric part, and 2 the other leg; $D_{n-1}$ 
+and $A_{n-1}$ stand for pseudo dilepton triggers built respectively with legs $1+1$ and $1+2$. 
+By induction: 
+\begin{align}
+\pro(T_n) &= \pro(T_{n-1} \vee (A_{n-1}\wedge \ell_n^1) \vee (D_{n-1}\wedge \ell_n^2))\notag\\
+&= [1-\pro(\ell_n^{\lambda_n})]\pro(T_{n-1}) +  [\pro(\ell_n^1) - \pro(\ell_n^{\tau_n})]\pro(A_{n-1})\notag\\
+&\qquad+ [\pro(\ell_n^2) - \pro(\ell_n^{\tau_n})]\pro(D_{n-1})
++ \pro(\ell_n^{\tau_n})\pro(D_{n-1}\vee A_{n-1})
+\end{align}
+
+with $\pro(D_{n-1})$ given by~\ref{e:2s}, $\pro(A_{n-1})$ by~\ref{e:2a}, 
+ and $\pro(D_{n-1}\vee A_{n-1})$ by~\ref{e:2s2a}; 
+the latter's expression is however greatly simplified since there is no single-lepton trigger involved 
+and the two ``dilepton'' triggers have a leg in common. 
+Its expression is therefore: 
+\begin{align}
+\pro(D_{n}\vee A_{n}) = [1-\pro(\ell_n^{\lambda_n})]\pro(D_{n-1}\vee A_{n-1}) + [\pro(\ell_n^{\lambda_n})-\pro(\ell_n^1)]\pro(S_{n-1}^1)
++\pro(\ell_n^1)\pro(S_{n-1}^1\vee S_{n-1}^2) 
+\end{align}
+
+
+\subsection{Two complementary mixed $2e\_\mu/2\mu\_e/e\_e\_\mu/\mu\_\mu\_e$ triggers, $n_e+n_\mu$ leptons}
+
+Complementary = two electrons+1 muon for one trigger, and two muons+1 electron for the other. 
+
+\begin{align}
+\pro(T_{n_e+n_\mu}) &= \pro((S_e\wedge D_\mu) \vee (S_\mu\wedge D_e))\notag\\
+&= \pro(S_e)\pro(D_\mu) + \pro(S_\mu)\pro(D_e) 
++ [\pro(D_e\vee S_e) - \pro(D_e)-\pro(S_e)]
+[\pro(D_\mu)+\pro(S_\mu)-\pro(D_\mu\vee S_\mu)]
+\end{align}
+with $\pro(S)$ given by~\ref{e:1}, $\pro(D)$ by either~\ref{e:2s} or~\ref{e:2a} 
+and $\pro(D\vee S)$ by~\ref{e:2sO1} or~\ref{e:2aO1}.
+
+
+
+\end{document}
\ No newline at end of file
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample0.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample0.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..12075a2d260b44f6a1b3370b733f6e0ba8ac1804
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample0.cxx
@@ -0,0 +1,269 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+/// Based on CPToolTester.cxx (A. Kraznahorkay) 
+/// and ut_ath_checkTrigger_test.cxx (W. Buttinger)
+/// Contact: jmaurer@cern.ch
+/*
+ *    Simple example: single electron or single muon trigger, using different 
+ * triggers for 2015 and 2016-2018.
+ * 
+ */
+
+// ROOT include(s):
+#include <TFile.h>
+#include <TError.h>
+
+// Infrastructure include(s):
+#ifdef XAOD_STANDALONE
+    #include "xAODRootAccess/Init.h"
+    #include "xAODRootAccess/TEvent.h"
+    #include "xAODRootAccess/TStore.h"
+#else
+    #include "AthAnalysisBaseComps/AthAnalysisHelper.h"
+    #include "POOLRootAccess/TEvent.h"
+#endif
+#include "AsgMessaging/MessageCheck.h"
+// EDM include(s):
+#include "AsgTools/AnaToolHandle.h"
+#include "EgammaAnalysisInterfaces/IAsgElectronEfficiencyCorrectionTool.h"
+#include "MuonAnalysisInterfaces/IMuonTriggerScaleFactors.h"
+#include "TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODMuon/MuonContainer.h"
+#include "PATCore/PATCoreEnums.h"
+#include "AthContainers/AuxElement.h"
+
+// stdlib include(s):
+#include <random>
+#include <vector>
+#include <array>
+using std::vector;
+using std::string;
+
+#define MSGSOURCE "Example 0"
+
+ANA_MSG_HEADER(Test)
+ANA_MSG_SOURCE(Test, MSGSOURCE)
+using namespace Test;
+int main(int argc, char* argv[])
+{
+    ANA_CHECK_SET_TYPE(bool)
+    const char* filename = nullptr;
+    bool debug = false, cmdline_error = false, toys = false;
+    for(int i=1;i<argc;++i)
+    {
+        if(string(argv[i]) == "--debug") debug = true;
+        else if(string(argv[i]) == "--toys") toys = true;
+        else if(!filename && *argv[i]!='-') filename = argv[i];
+        else cmdline_error = true;
+    }
+    if(!filename || cmdline_error)
+    {
+        Error(MSGSOURCE, "No file name received!");
+        Error(MSGSOURCE, "  Usage: %s [--debug] [--toys] [DxAOD file name]", argv[0]);
+        return 1;
+    }
+    #ifdef XAOD_STANDALONE
+        xAOD::Init(MSGSOURCE).ignore();
+        TFile* file = TFile::Open(filename, "READ");
+        if(!file)
+        {
+            Error(MSGSOURCE, "Unable to open file!");
+            return 2;
+        }
+        xAOD::TEvent event(xAOD::TEvent::kClassAccess);
+        xAOD::TStore store;
+        StatusCode::enableFailure();
+    #else
+       IAppMgrUI* app = POOL::Init();
+       POOL::TEvent event(POOL::TEvent::kClassAccess);
+       TString file(filename);
+    #endif
+    event.readFrom(file).ignore();
+    Long64_t entries = event.getEntries();
+    Info(MSGSOURCE, "Number of events in the file: %lli", entries);
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the electron CP tools");
+    /// For property 'ElectronEfficiencyTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronEffTools;
+    /// For property 'ElectronScaleFactorTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronSFTools; 
+    /// RAII on-the-fly creation of electron CP tools:
+    vector<asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool>> factory;
+    const char* mapPath = "ElectronEfficiencyCorrection/2015_2017/"
+            "rel21.2/Consolidation_September2018_v1/map1.txt";
+    for(int j=0;j<2;++j) /// two instances: 0 -> MC efficiencies, 1 -> SFs
+    {
+        string name = "AsgElectronEfficiencyCorrectionTool/"
+                + ((j? "ElTrigEff_" : "ElTrigSF_")
+                + std::to_string(factory.size()/2));
+        auto t = factory.emplace(factory.end(), name);
+        t->setProperty("MapFilePath", mapPath).ignore();
+        t->setProperty("TriggerKey", string(j?"":"Eff_")
+            + "SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2018_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0").ignore();
+        t->setProperty("IdKey", "Tight").ignore();
+        t->setProperty("IsoKey", "FCTight").ignore();
+        t->setProperty("CorrelationModel", "TOTAL").ignore();
+        t->setProperty("ForceDataType", (int)PATCore::ParticleDataType::Full).ignore();
+        if(t->initialize() != StatusCode::SUCCESS)
+        {
+            Error(MSGSOURCE, "Unable to initialize the electron CP tool <%s>!",
+                    t->name().c_str());
+            return 3;
+        }
+        auto& handles = (j? electronSFTools : electronEffTools);
+        handles.push_back(t->getHandle());
+    }
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the muon CP tools");
+    /// For property 'MuonTools':
+    ToolHandleArray<CP::IMuonTriggerScaleFactors> muonTools;
+    asg::AnaToolHandle<CP::IMuonTriggerScaleFactors> muonTool("CP::MuonTriggerScaleFactors/MuonTrigEff");
+    muonTool.setProperty("MuonQuality", "Tight").ignore();
+    muonTool.setProperty("useRel207", false).ignore();
+    if(muonTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the muon CP tool!");
+        return 3;
+    }
+    muonTools.push_back(muonTool.getHandle());
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the global trigger SF tool");
+    asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> myTool("TrigGlobalEfficiencyCorrectionTool/TrigGlobal");
+    myTool.setProperty("ElectronEfficiencyTools", electronEffTools).ignore();
+    myTool.setProperty("ElectronScaleFactorTools", electronSFTools).ignore();
+    myTool.setProperty("MuonTools", muonTools).ignore();
+    const char* triggers2015 = 
+        "mu20_iloose_L1MU15_OR_mu50"
+        "|| e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose";
+    myTool.setProperty("TriggerCombination2015", triggers2015).ignore();
+    const char* triggers2016to2018 = 
+        "mu26_ivarmedium_OR_mu50"
+        "|| e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0";
+    myTool.setProperty("TriggerCombination2016", triggers2016to2018).ignore();
+    myTool.setProperty("TriggerCombination2017", triggers2016to2018).ignore();
+    myTool.setProperty("TriggerCombination2018", triggers2016to2018).ignore();
+
+    if(debug) myTool.setProperty("OutputLevel", MSG::DEBUG).ignore();
+    if(toys) myTool.setProperty("NumberOfToys", 1000).ignore();
+    if(myTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the TrigGlob tool!");
+        return 3;
+    }
+    
+    /// Uniform random run number generation spanning the target dataset.
+    /// In real life, use the PileupReweightingTool instead!
+    const unsigned periodRuns[] = {
+        /// 2015 periods D-H, J
+        276073, 278727, 279932, 280423, 281130, 282625,
+        /// 2016 periods A-L
+        296939, 300345, 301912, 302737, 303638, 303943, 305291, 307124, 
+        305359, 309311, 310015,
+        /// 2017 periods B-K
+        325713, 329385, 330857, 332720, 334842, 336497, 336832, 338183,
+        /// 2018 periods B-Q
+        348885, 349534, 350310, 352274, 354107, 354826, 355261, 355331,
+        355529, 357050, 359191, 361635, 361738, 363664
+    };
+    std::uniform_int_distribution<unsigned> uniformPdf(0,
+            sizeof(periodRuns)/sizeof(*periodRuns) - 1);
+    std::default_random_engine randomEngine;
+    
+    SG::AuxElement::ConstAccessor<int> truthType("truthType");
+    SG::AuxElement::ConstAccessor<int> truthOrigin("truthOrigin");
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Starting the event loop");
+    unsigned errors = 0;
+    double nSuitableEvents = 0., sumW = 0.;
+    for(Long64_t entry = 0; entry < entries; ++entry)
+    {
+        event.getEntry(entry);
+        
+        /// Get a random run number, and decorate the event info
+        const xAOD::EventInfo* eventInfo = nullptr;
+        event.retrieve(eventInfo,"EventInfo").ignore();
+        unsigned runNumber = periodRuns[uniformPdf(randomEngine)];
+        eventInfo->auxdecor<unsigned>("RandomRunNumber") = runNumber;
+        vector<const xAOD::Electron*> myTriggeringElectrons;
+        const xAOD::ElectronContainer* electrons = nullptr;
+        event.retrieve(electrons,"Electrons").ignore();
+        for(auto electron : *electrons)
+        {
+            if(!electron->caloCluster()) continue;
+            float eta = fabs(electron->caloCluster()->etaBE(2));
+            float pt = electron->pt();
+            if(pt<10e3f || eta>=2.47) continue;
+            if(!truthType.isAvailable(*electron)) continue;
+            if(!truthOrigin.isAvailable(*electron)) continue;
+            int t = truthType(*electron), o = truthOrigin(*electron);
+            if(t!=2 || !(o==10 || (o>=12 && o<=22) || o==43)) continue;
+            /// lepton must be above trigger threshold:
+            if(pt < (runNumber>290000? 27e3f : 25e3f)) continue;
+
+            myTriggeringElectrons.push_back(electron);
+        }
+
+        vector<const xAOD::Muon*> myTriggeringMuons;
+        const xAOD::MuonContainer* muons = nullptr;
+        event.retrieve(muons,"Muons").ignore();
+        for(auto muon : *muons)
+        {
+            float pt = muon->pt();
+            if(pt<10e3f || fabs(muon->eta())>=2.5) continue;
+            auto mt = muon->muonType();
+            if(mt!=xAOD::Muon::Combined && mt!=xAOD::Muon::MuonStandAlone) continue;
+            auto& mtp = *(muon->primaryTrackParticle());
+            if(!truthType.isAvailable(mtp)) continue;
+            if(!truthOrigin.isAvailable(mtp)) continue;
+            int t = truthType(mtp), o = truthOrigin(mtp);
+            if(t!=6 || !(o==10 || (o>=12 && o<=22) || o==43)) continue;
+            /// lepton must be above trigger threshold:
+            if(pt < (runNumber>290000? 27.3e3f : 21e3f)) continue;
+
+            myTriggeringMuons.push_back(muon);
+        }
+
+        /// Events must contain at least one lepton above trigger threshold
+        if(myTriggeringElectrons.size()+myTriggeringMuons.size() < 1) continue;
+
+
+        /// Finally retrieve the global trigger scale factor
+        double sf = 1.;
+        auto cc = myTool->getEfficiencyScaleFactor(myTriggeringElectrons,
+            myTriggeringMuons, sf);
+        if(cc==CP::CorrectionCode::Ok)
+        {
+            nSuitableEvents += 1;
+            sumW += sf;
+        }
+        else
+        {
+            Warning(MSGSOURCE, "Scale factor evaluation failed");
+            ++errors;
+        }
+        if(errors>10)
+        {
+            Error(MSGSOURCE, "Too many errors reported!");
+            break;
+        }
+    }
+    Info(MSGSOURCE, "Average scale factor: %f (over %ld events)",
+            sumW / nSuitableEvents, long(nSuitableEvents));
+    #ifndef XAOD_STANDALONE
+		ANA_CHECK(app->finalize())
+    #endif
+    return errors? 4 : 0;
+}
+
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample1.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample1.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..4e97ff780f9b2e6ddb960972f26d321b0ef4bf89
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample1.cxx
@@ -0,0 +1,321 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+/// Based on CPToolTester.cxx (A. Kraznahorkay) 
+/// and ut_ath_checkTrigger_test.cxx (W. Buttinger)
+/// Contact: jmaurer@cern.ch
+/*
+ *    Another example: combination of single-lepton, dielectron and dimuon
+ * triggers, using different configurations for each year, and illustrating
+ * how to fill the property 'ListOfLegsPerTool'.
+ * 
+ */
+
+// ROOT include(s):
+#include <TFile.h>
+#include <TError.h>
+
+// Infrastructure include(s):
+#ifdef XAOD_STANDALONE
+    #include "xAODRootAccess/Init.h"
+    #include "xAODRootAccess/TEvent.h"
+    #include "xAODRootAccess/TStore.h"
+#else
+    #include "AthAnalysisBaseComps/AthAnalysisHelper.h"
+    #include "POOLRootAccess/TEvent.h"
+#endif
+
+#include "AsgMessaging/MessageCheck.h"
+// EDM include(s):
+#include "AsgTools/AnaToolHandle.h"
+#include "EgammaAnalysisInterfaces/IAsgElectronEfficiencyCorrectionTool.h"
+#include "MuonAnalysisInterfaces/IMuonTriggerScaleFactors.h"
+#include "TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODMuon/MuonContainer.h"
+#include "PATCore/PATCoreEnums.h"
+#include "AthContainers/AuxElement.h"
+
+// stdlib include(s):
+#include <random>
+#include <vector>
+#include <array>
+using std::vector;
+using std::string;
+
+#define MSGSOURCE "Example 1"
+
+ANA_MSG_HEADER(Test)
+ANA_MSG_SOURCE(Test, MSGSOURCE)
+using namespace Test;
+int main(int argc, char* argv[])
+{
+    ANA_CHECK_SET_TYPE(bool)
+    const char* filename = nullptr;
+    bool debug = false, cmdline_error = false, toys = false;
+    for(int i=1;i<argc;++i)
+    {
+        if(string(argv[i]) == "--debug") debug = true;
+        else if(string(argv[i]) == "--toys") toys = true;
+        else if(!filename && *argv[i]!='-') filename = argv[i];
+        else cmdline_error = true;
+    }
+    if(!filename || cmdline_error)
+    {
+        Error(MSGSOURCE, "No file name received!");
+        Error(MSGSOURCE, "  Usage: %s [--debug] [--toys] [DxAOD file name]", argv[0]);
+        return 1;
+    }
+    #ifdef XAOD_STANDALONE
+        xAOD::Init(MSGSOURCE).ignore();
+        TFile* file = TFile::Open(filename, "READ");
+        if(!file)
+        {
+            Error(MSGSOURCE, "Unable to open file!");
+            return 2;
+        }
+        xAOD::TEvent event(xAOD::TEvent::kClassAccess);
+        xAOD::TStore store;
+        StatusCode::enableFailure();
+    #else
+       IAppMgrUI* app = POOL::Init();
+       POOL::TEvent event(POOL::TEvent::kClassAccess);
+       TString file(filename);
+    #endif
+    event.readFrom(file).ignore();
+    Long64_t entries = event.getEntries();
+    Info(MSGSOURCE, "Number of events in the file: %lli", entries);
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the electron CP tools");
+    /// For property 'ElectronEfficiencyTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronEffTools;
+    /// For property 'ElectronScaleFactorTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronSFTools; 
+        /// For property 'ListOfLegsPerTool':
+    std::map<string,string> legsPerTool;
+
+    /// RAII on-the-fly creation of electron CP tools:
+    vector<asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool>> factory;
+    enum{ cLEGS, cKEY };
+    vector<std::array<string,2>> toolConfigs = {
+         /// {<list of trigger legs>, <key in map file>}
+         /// Single-electron trigger (same tool instance for 2015-2018):
+        {"e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose, e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0",
+            "SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2018_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"}, 
+        /// Dielectron trigger (same tool instance for 2015-2018):
+        {"e12_lhloose_L1EM10VH, e17_lhvloose_nod0, e24_lhvloose_nod0_L1EM20VH", 
+            "DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_2018_e24_lhvloose_nod0_L1EM20VH"},
+        /// Complementary 2e17_lhvloose_nod0_L12EM15VHI trigger
+        {"e17_lhvloose_nod0_L1EM15VHI", 
+            "DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_2018_e17_lhvloose_nod0_L1EM15VHI"}
+     };
+
+    const char* mapPath = "ElectronEfficiencyCorrection/2015_2017/"
+            "rel21.2/Consolidation_September2018_v1/map2.txt";
+    for(auto& cfg : toolConfigs) /// one instance per trigger leg x working point
+    for(int j=0;j<2;++j) /// two instances: 0 -> MC efficiencies, 1 -> SFs
+    {
+        string name = "AsgElectronEfficiencyCorrectionTool/"
+                + ((j? "ElTrigEff_" : "ElTrigSF_")
+                + std::to_string(factory.size()/2));
+        auto t = factory.emplace(factory.end(), name);
+        t->setProperty("MapFilePath", mapPath).ignore();
+        t->setProperty("TriggerKey", string(j?"":"Eff_") + cfg[cKEY]).ignore();
+        t->setProperty("IdKey", "Tight").ignore();
+        t->setProperty("IsoKey", "FCTight").ignore();
+        t->setProperty("CorrelationModel", "TOTAL").ignore();
+        t->setProperty("ForceDataType", (int)PATCore::ParticleDataType::Full).ignore();
+        if(t->initialize() != StatusCode::SUCCESS)
+        {
+            Error(MSGSOURCE, "Unable to initialize the electron CP tool <%s>!",
+                    t->name().c_str());
+            return 3;
+        }
+        auto& handles = (j? electronSFTools : electronEffTools);
+        handles.push_back(t->getHandle());
+        /// Safer to retrieve the name from the final ToolHandle, it might be
+        /// prefixed (by the parent tool name) when the handle is copied
+        name = handles[handles.size()-1].name();
+        legsPerTool[name] = cfg[cLEGS];
+
+    }
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the muon CP tools");
+    /// For property 'MuonTools':
+    ToolHandleArray<CP::IMuonTriggerScaleFactors> muonTools;
+    asg::AnaToolHandle<CP::IMuonTriggerScaleFactors> muonTool("CP::MuonTriggerScaleFactors/MuonTrigEff");
+    muonTool.setProperty("MuonQuality", "Tight").ignore();
+    muonTool.setProperty("useRel207", false).ignore();
+    if(muonTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the muon CP tool!");
+        return 3;
+    }
+    muonTools.push_back(muonTool.getHandle());
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the global trigger SF tool");
+    asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> myTool("TrigGlobalEfficiencyCorrectionTool/TrigGlobal");
+    myTool.setProperty("ElectronEfficiencyTools", electronEffTools).ignore();
+    myTool.setProperty("ElectronScaleFactorTools", electronSFTools).ignore();
+    myTool.setProperty("MuonTools", muonTools).ignore();
+    std::map<std::string, std::string> triggers;
+    triggers["2015"] = 
+        "mu20_iloose_L1MU15_OR_mu50"
+        "|| mu18_mu8noL1"
+        "|| e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose"
+        "|| 2e12_lhloose_L12EM10VH";
+    triggers["2016"] = 
+        "mu26_ivarmedium_OR_mu50"
+        "|| mu22_mu8noL1"
+        "|| e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"
+        "|| 2e17_lhvloose_nod0";
+    std::string only2e24 = 
+        "mu26_ivarmedium_OR_mu50"
+        "|| mu22_mu8noL1"
+        "|| e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"
+        "|| 2e24_lhvloose_nod0";
+    std::string nominal = only2e24 + "|| 2e17_lhvloose_nod0_L12EM15VHI";
+    triggers["324320-326695"] = nominal; /// 2017 before accidental prescale of L12EM15VHI
+    triggers["326834-328393"] = only2e24; /// 2017 during accidental prescale
+    triggers["329385-364292"] = nominal; /// 2017 after accidental prescale + 2018
+    myTool.setProperty("TriggerCombination", triggers).ignore();
+    myTool.setProperty("ListOfLegsPerTool", legsPerTool).ignore();
+
+    if(debug) myTool.setProperty("OutputLevel", MSG::DEBUG).ignore();
+    if(toys) myTool.setProperty("NumberOfToys", 1000).ignore();
+    if(myTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the TrigGlob tool!");
+        return 3;
+    }
+    
+    /// Uniform random run number generation spanning the target dataset.
+    /// In real life, use the PileupReweightingTool instead!
+    const unsigned periodRuns[] = {
+        /// 2015 periods D-H, J
+        276073, 278727, 279932, 280423, 281130, 282625,
+        /// 2016 periods A-L
+        296939, 300345, 301912, 302737, 303638, 303943, 305291, 307124, 
+        305359, 309311, 310015,
+        /// 2017 periods B-K
+        325713, 329385, 330857, 332720, 334842, 336497, 336832, 338183,
+        /// 2018 periods B-Q
+        348885, 349534, 350310, 352274, 354107, 354826, 355261, 355331,
+        355529, 357050, 359191, 361635, 361738, 363664
+    };
+    std::uniform_int_distribution<unsigned> uniformPdf(0,
+            sizeof(periodRuns)/sizeof(*periodRuns) - 1);
+    std::default_random_engine randomEngine;
+    
+    SG::AuxElement::ConstAccessor<int> truthType("truthType");
+    SG::AuxElement::ConstAccessor<int> truthOrigin("truthOrigin");
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Starting the event loop");
+    unsigned errors = 0;
+    double nSuitableEvents = 0., sumW = 0.;
+    for(Long64_t entry = 0; entry < entries; ++entry)
+    {
+        event.getEntry(entry);
+        
+        /// Get a random run number, and decorate the event info
+        const xAOD::EventInfo* eventInfo = nullptr;
+        event.retrieve(eventInfo,"EventInfo").ignore();
+        unsigned runNumber = periodRuns[uniformPdf(randomEngine)];
+        eventInfo->auxdecor<unsigned>("RandomRunNumber") = runNumber;
+
+        unsigned nTrig1L = 0, nTrig2mu = 0;
+        
+        vector<const xAOD::Electron*> myTriggeringElectrons;
+        const xAOD::ElectronContainer* electrons = nullptr;
+        event.retrieve(electrons,"Electrons").ignore();
+        for(auto electron : *electrons)
+        {
+            if(!electron->caloCluster()) continue;
+            float eta = fabs(electron->caloCluster()->etaBE(2));
+            float pt = electron->pt();
+            if(pt<10e3f || eta>=2.47) continue;
+            if(!truthType.isAvailable(*electron)) continue;
+            if(!truthOrigin.isAvailable(*electron)) continue;
+            int t = truthType(*electron), o = truthOrigin(*electron);
+            if(t!=2 || !(o==10 || (o>=12 && o<=22) || o==43)) continue;
+            /// lepton must be above softest trigger threshold:
+            if((runNumber>=326834 && runNumber<=328393 && pt<25e3f) /// 2017 during accidental prescale: 2e24
+                || (runNumber>290000 && pt<18e3f) /// 2016-2018: 2e17
+                || (pt<13e3f)) continue; /// 2015: 2e12
+            /// also count leptons above single-lepton trigger threshold
+            if(pt >= (runNumber>290000? 27e3f : 25e3f)) ++nTrig1L;
+
+            myTriggeringElectrons.push_back(electron);
+        }
+
+        vector<const xAOD::Muon*> myTriggeringMuons;
+        const xAOD::MuonContainer* muons = nullptr;
+        event.retrieve(muons,"Muons").ignore();
+        for(auto muon : *muons)
+        {
+            float pt = muon->pt();
+            if(pt<10e3f || fabs(muon->eta())>=2.5) continue;
+            auto mt = muon->muonType();
+            if(mt!=xAOD::Muon::Combined && mt!=xAOD::Muon::MuonStandAlone) continue;
+            auto& mtp = *(muon->primaryTrackParticle());
+            if(!truthType.isAvailable(mtp)) continue;
+            if(!truthOrigin.isAvailable(mtp)) continue;
+            int t = truthType(mtp), o = truthOrigin(mtp);
+            if(t!=6 || !(o==10 || (o>=12 && o<=22) || o==43)) continue;
+            /// lepton must be above softest trigger threshold (mu8noL1 here):
+            if(pt < 10e3f) continue;
+            /// also count leptons above single-lepton trigger threshold
+            if(pt >= (runNumber>290000? 27.3e3f : 21e3f)) ++nTrig1L;
+            /// and count muons suitable for the hard leg of the dimuon trigger
+            if(pt >= (runNumber>290000? 23e3f : 19e3f)) ++nTrig2mu;
+
+            myTriggeringMuons.push_back(muon);
+        }
+
+        /// Events must contain enough leptons to trigger
+        if(nTrig1L==0 /// single-lepton trigger
+            && myTriggeringElectrons.size()<2 /// dielectron
+            && (nTrig2mu==0 || myTriggeringMuons.size()<2)) /// dimuon
+        {
+            continue;
+        }
+
+
+        /// Finally retrieve the global trigger scale factor
+        double sf = 1.;
+        auto cc = myTool->getEfficiencyScaleFactor(myTriggeringElectrons,
+            myTriggeringMuons, sf);
+        if(cc==CP::CorrectionCode::Ok)
+        {
+            nSuitableEvents += 1;
+            sumW += sf;
+        }
+        else
+        {
+            Warning(MSGSOURCE, "Scale factor evaluation failed");
+            ++errors;
+        }
+        if(errors>10)
+        {
+            Error(MSGSOURCE, "Too many errors reported!");
+            break;
+        }
+    }
+    Info(MSGSOURCE, "Average scale factor: %f (over %ld events)",
+            sumW / nSuitableEvents, long(nSuitableEvents));
+    #ifndef XAOD_STANDALONE
+		ANA_CHECK(app->finalize())
+    #endif
+    return errors? 4 : 0;
+}
+
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample3a.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample3a.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..580331847dd660a8f0966402a49a30ae0c0c79f0
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample3a.cxx
@@ -0,0 +1,335 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+/// Based on CPToolTester.cxx (A. Kraznahorkay) 
+/// and ut_ath_checkTrigger_test.cxx (W. Buttinger)
+/// Contact: jmaurer@cern.ch
+/*
+ *    The set of examples 3a - 3e illustrates the use of lepton selection tags
+ * for various scenarios:
+ * 
+ * - Example 3a: trigger = 2e12_lhloose_L12EM10VH, selecting events containing
+ *               >=2 loose electrons, the leading-pT electron always satisfying
+ *               in addition tight PID+isolation requirements.
+ * 
+ * - Example 3b: trigger = e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose
+ *                         || 2e12_lhloose_L12EM10VH
+ *               selecting events with >=2 loose electrons where the leading-pT
+ *               electron also satisfies medium PID requirements.
+ *               Only the latter is allowed to fire the single-electron trigger.
+ * 
+ * - Example 3c: trigger = e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose
+ *                         || 2e12_lhloose_L12EM10VH
+ *               selecting events with >=2 loose electrons. Any electron also
+ *               satisfying medium PID requirements is allowed to fire the
+ *               single-electron trigger.
+ * 
+ * - Example 3d: trigger = 2e17_lhvloose_nod0 || e7_lhmedium_nod0_mu24
+ *       || e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+ *               same type of selection as example 3c but with 3 PID working
+ *               points, using two distinct decorations.
+ * 
+ * - Example 3e: same scenario as example 3d, but using an alternative
+ *               implementation that requires only one decoration.
+ * 
+ */
+/*
+ *    For this example (3a), one needs to set up two versions of the electron
+ * trigger tools: one configured for offline tight PID+isolation, to be used for
+ * the leading electron, and another configured for offline loose PID, to be
+ * used for subleading electrons.
+ * 
+ *    The configuration of the TrigGlobalEfficiencyCorrectionTool then involves 
+ * filling two additional properties, 'ListOfTagsPerTool' and
+ * 'LeptonTagDecorations'. We also fill a third one, 'ElectronLegsPerTag';
+ * it isn't required but still advised as the tool can then perform further
+ * consistency checks of its configuration.",  
+ * 
+ *    The leading electron will always be tagged with a 'Signal' decoration
+ * (decorated value set to 1), while subleading electrons are never tagged 
+ * (-> decorated value set to 0).
+ *    Since efficiencies provided by CP tools are inclusive, one should NEVER
+ *  tag the subleading leptons as 'Signal', even if they satisfy the tight PID
+ * + isolation requirements; doing so would bias the results.
+ *    See example 3c that deals with a more complicate situation requiring
+ * handling multiple PID levels for all leptons.
+ * 
+ */
+
+// ROOT include(s):
+#include <TFile.h>
+#include <TError.h>
+
+// Infrastructure include(s):
+#ifdef XAOD_STANDALONE
+    #include "xAODRootAccess/Init.h"
+    #include "xAODRootAccess/TEvent.h"
+    #include "xAODRootAccess/TStore.h"
+#else
+    #include "AthAnalysisBaseComps/AthAnalysisHelper.h"
+    #include "POOLRootAccess/TEvent.h"
+#endif
+
+#include "AsgMessaging/MessageCheck.h"
+// EDM include(s):
+#include "AsgTools/AnaToolHandle.h"
+#include "EgammaAnalysisInterfaces/IAsgElectronEfficiencyCorrectionTool.h"
+#include "MuonAnalysisInterfaces/IMuonTriggerScaleFactors.h"
+#include "TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODMuon/MuonContainer.h"
+#include "PATCore/PATCoreEnums.h"
+#include "AthContainers/AuxElement.h"
+
+// stdlib include(s):
+#include <sstream>
+#include <random>
+#include <vector>
+#include <array>
+using std::vector;
+using std::string;
+
+/// Helper function to split comma-delimited strings
+namespace { vector<string> split_comma_delimited(const std::string&); }
+
+#define MSGSOURCE "Example 3a"
+
+ANA_MSG_HEADER(Test)
+ANA_MSG_SOURCE(Test, MSGSOURCE)
+using namespace Test;
+int main(int argc, char* argv[])
+{
+    ANA_CHECK_SET_TYPE(bool)
+    const char* filename = nullptr;
+    bool debug = false, cmdline_error = false, toys = false;
+    for(int i=1;i<argc;++i)
+    {
+        if(string(argv[i]) == "--debug") debug = true;
+        else if(string(argv[i]) == "--toys") toys = true;
+        else if(!filename && *argv[i]!='-') filename = argv[i];
+        else cmdline_error = true;
+    }
+    if(!filename || cmdline_error)
+    {
+        Error(MSGSOURCE, "No file name received!");
+        Error(MSGSOURCE, "  Usage: %s [--debug] [--toys] [DxAOD file name]", argv[0]);
+        return 1;
+    }
+    #ifdef XAOD_STANDALONE
+        xAOD::Init(MSGSOURCE).ignore();
+        TFile* file = TFile::Open(filename, "READ");
+        if(!file)
+        {
+            Error(MSGSOURCE, "Unable to open file!");
+            return 2;
+        }
+        xAOD::TEvent event(xAOD::TEvent::kClassAccess);
+        xAOD::TStore store;
+        StatusCode::enableFailure();
+    #else
+       IAppMgrUI* app = POOL::Init();
+       POOL::TEvent event(POOL::TEvent::kClassAccess);
+       TString file(filename);
+    #endif
+    event.readFrom(file).ignore();
+    Long64_t entries = event.getEntries();
+    Info(MSGSOURCE, "Number of events in the file: %lli", entries);
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the electron CP tools");
+    /// For property 'ElectronEfficiencyTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronEffTools;
+    /// For property 'ElectronScaleFactorTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronSFTools; 
+        /// For property 'ListOfLegsPerTool':
+    std::map<std::string,std::string> legsPerTool;
+    /// For property 'ListOfTagsPerTool':
+    std::map<std::string,std::string> tagsPerTool;
+    /// For property 'ElectronLegsPerTag':
+    std::map<std::string,std::string> legsPerTag;
+    /// To tag the leading electron as 'Signal'
+    SG::AuxElement::Decorator<char> dec_signal("Signal");
+
+    /// RAII on-the-fly creation of electron CP tools:
+    vector<asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool>> factory;
+    enum{ cLEGS, cTAG, cKEY, cPID, cISO };
+    std::vector<std::array<std::string,5> > toolConfigs = {
+        /// <list of legs>, <list of tags>, <key in map file>, <PID WP>, <iso WP>
+        /// For leading electron:
+        {"e12_lhloose_L1EM10VH", "Signal", "2015_e12_lhloose_L1EM10VH", "Tight", "FixedCutTightTrackOnly"},
+        /// For subleading electron(s):
+        {"e12_lhloose_L1EM10VH", "*", "2015_e12_lhloose_L1EM10VH", "LooseBLayer", ""}
+    };
+
+    const char* mapPath = "ElectronEfficiencyCorrection/2015_2017/"
+            "rel21.2/Moriond_February2018_v2/map6.txt";
+    for(auto& cfg : toolConfigs) /// one instance per trigger leg x working point
+    for(int j=0;j<2;++j) /// two instances: 0 -> MC efficiencies, 1 -> SFs
+    {
+        string name = "AsgElectronEfficiencyCorrectionTool/"
+                + ((j? "ElTrigEff_" : "ElTrigSF_")
+                + std::to_string(factory.size()/2));
+        auto t = factory.emplace(factory.end(), name);
+        t->setProperty("MapFilePath", mapPath).ignore();
+        t->setProperty("TriggerKey", string(j?"":"Eff_") + cfg[cKEY]).ignore();
+        t->setProperty("IdKey", cfg[cPID]).ignore();
+        t->setProperty("IsoKey", cfg[cISO]).ignore();
+
+        t->setProperty("CorrelationModel", "TOTAL").ignore();
+        t->setProperty("ForceDataType", (int)PATCore::ParticleDataType::Full).ignore();
+        if(t->initialize() != StatusCode::SUCCESS)
+        {
+            Error(MSGSOURCE, "Unable to initialize the electron CP tool <%s>!",
+                    t->name().c_str());
+            return 3;
+        }
+        auto& handles = (j? electronSFTools : electronEffTools);
+        handles.push_back(t->getHandle());
+        /// Safer to retrieve the name from the final ToolHandle, it might be
+        /// prefixed (by the parent tool name) when the handle is copied    
+        name = handles[handles.size()-1].name();
+        legsPerTool[name] = cfg[cLEGS];
+        tagsPerTool[name] = cfg[cTAG];
+        if(!j)
+        {
+            for(auto& tag : ::split_comma_delimited(cfg[cTAG]))
+            {
+                if(legsPerTag[tag]=="") legsPerTag[tag] = cfg[cLEGS];
+                else legsPerTag[tag] += "," + cfg[cLEGS];
+            }
+        }
+
+    }
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the global trigger SF tool");
+    asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> myTool("TrigGlobalEfficiencyCorrectionTool/TrigGlobal");
+    myTool.setProperty("ElectronEfficiencyTools", electronEffTools).ignore();
+    myTool.setProperty("ElectronScaleFactorTools", electronSFTools).ignore();
+    const char* triggers2015 = "2e12_lhloose_L12EM10VH";
+    myTool.setProperty("TriggerCombination2015", triggers2015).ignore();
+    myTool.setProperty("LeptonTagDecorations", "Signal").ignore();
+    myTool.setProperty("ListOfLegsPerTool", legsPerTool).ignore();
+    myTool.setProperty("ListOfTagsPerTool", tagsPerTool).ignore();
+    myTool.setProperty("ListOfLegsPerTag", legsPerTag).ignore();
+
+    if(debug) myTool.setProperty("OutputLevel", MSG::DEBUG).ignore();
+    if(toys) myTool.setProperty("NumberOfToys", 1000).ignore();
+    if(myTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the TrigGlob tool!");
+        return 3;
+    }
+    
+    /// Uniform random run number generation spanning the target dataset.
+    /// In real life, use the PileupReweightingTool instead!
+    const unsigned periodRuns[] = {
+        /// 2015 periods D-H, J
+        276073, 278727, 279932, 280423, 281130, 282625
+    };
+    std::uniform_int_distribution<unsigned> uniformPdf(0,
+            sizeof(periodRuns)/sizeof(*periodRuns) - 1);
+    std::default_random_engine randomEngine;
+    
+    SG::AuxElement::ConstAccessor<int> truthType("truthType");
+    SG::AuxElement::ConstAccessor<int> truthOrigin("truthOrigin");
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Starting the event loop");
+    unsigned errors = 0;
+    double nSuitableEvents = 0., sumW = 0.;
+    for(Long64_t entry = 0; entry < entries; ++entry)
+    {
+        event.getEntry(entry);
+        
+        /// Get a random run number, and decorate the event info
+        const xAOD::EventInfo* eventInfo = nullptr;
+        event.retrieve(eventInfo,"EventInfo").ignore();
+        unsigned runNumber = periodRuns[uniformPdf(randomEngine)];
+        eventInfo->auxdecor<unsigned>("RandomRunNumber") = runNumber;
+        vector<const xAOD::Electron*> myTriggeringElectrons;
+        const xAOD::ElectronContainer* electrons = nullptr;
+        event.retrieve(electrons,"Electrons").ignore();
+        for(auto electron : *electrons)
+        {
+            if(!electron->caloCluster()) continue;
+            float eta = fabs(electron->caloCluster()->etaBE(2));
+            float pt = electron->pt();
+            if(pt<10e3f || eta>=2.47) continue;
+            if(!truthType.isAvailable(*electron)) continue;
+            if(!truthOrigin.isAvailable(*electron)) continue;
+            int t = truthType(*electron), o = truthOrigin(*electron);
+            if(t!=2 || !(o==10 || (o>=12 && o<=22) || o==43)) continue;
+            /// electron must be above softest trigger threshold (e12 here)
+            if(pt < 13e3f) continue;
+
+            myTriggeringElectrons.push_back(electron);
+        }
+
+        vector<const xAOD::Muon*> myTriggeringMuons;
+
+        /// Events must contain at least two lepton above trigger threshold
+        if(myTriggeringElectrons.size() < 2) continue;
+
+        /// Let's pretend that the leading electron passes TightLH+isolation,
+        /// thus the event passes the selection; now we tag the electrons:
+        auto compareByPt = [](const xAOD::Electron*e1, const xAOD::Electron*e2)
+            { return e1->pt() < e2->pt(); };
+        auto leadingElectron = *std::max_element(myTriggeringElectrons.begin(),
+            myTriggeringElectrons.end(), compareByPt);
+        for(auto electron : myTriggeringElectrons)
+        {
+            /// Leading electron tagged as 'Signal' -> decorated value set to 1
+            /// Subleading electron(s) not tagged -> decorated value set to 0
+            dec_signal(*electron) = (electron==leadingElectron)? 1 : 0;
+        }
+
+
+        /// Finally retrieve the global trigger scale factor
+        double sf = 1.;
+        auto cc = myTool->getEfficiencyScaleFactor(myTriggeringElectrons,
+            myTriggeringMuons, sf);
+        if(cc==CP::CorrectionCode::Ok)
+        {
+            nSuitableEvents += 1;
+            sumW += sf;
+        }
+        else
+        {
+            Warning(MSGSOURCE, "Scale factor evaluation failed");
+            ++errors;
+        }
+        if(errors>10)
+        {
+            Error(MSGSOURCE, "Too many errors reported!");
+            break;
+        }
+    }
+    Info(MSGSOURCE, "Average scale factor: %f (over %ld events)",
+            sumW / nSuitableEvents, long(nSuitableEvents));
+    #ifndef XAOD_STANDALONE
+		ANA_CHECK(app->finalize())
+    #endif
+    return errors? 4 : 0;
+}
+
+/// Split comma-delimited string
+namespace
+{
+    inline vector<string> split_comma_delimited(const string& s)
+    {
+        std::stringstream ss(s);
+        std::vector<std::string> tokens;
+        std::string token;
+        while(std::getline(ss, token, ','))
+        {
+            if(token.length()) tokens.push_back(token);
+        }
+        return tokens;
+    }
+}
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample3b.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample3b.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..4478a185cbc261f16fe09992aa04d48e39aa8971
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample3b.cxx
@@ -0,0 +1,340 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+/// Based on CPToolTester.cxx (A. Kraznahorkay) 
+/// and ut_ath_checkTrigger_test.cxx (W. Buttinger)
+/// Contact: jmaurer@cern.ch
+/*
+ *    The set of examples 3a - 3e illustrates the use of lepton selection tags
+ * for various scenarios:
+ * 
+ * - Example 3a: trigger = 2e12_lhloose_L12EM10VH, selecting events containing
+ *               >=2 loose electrons, the leading-pT electron always satisfying
+ *               in addition tight PID+isolation requirements.
+ * 
+ * - Example 3b: trigger = e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose
+ *                         || 2e12_lhloose_L12EM10VH
+ *               selecting events with >=2 loose electrons where the leading-pT
+ *               electron also satisfies medium PID requirements.
+ *               Only the latter is allowed to fire the single-electron trigger.
+ * 
+ * - Example 3c: trigger = e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose
+ *                         || 2e12_lhloose_L12EM10VH
+ *               selecting events with >=2 loose electrons. Any electron also
+ *               satisfying medium PID requirements is allowed to fire the
+ *               single-electron trigger.
+ * 
+ * - Example 3d: trigger = 2e17_lhvloose_nod0 || e7_lhmedium_nod0_mu24
+ *       || e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+ *               same type of selection as example 3c but with 3 PID working
+ *               points, using two distinct decorations.
+ * 
+ * - Example 3e: same scenario as example 3d, but using an alternative
+ *               implementation that requires only one decoration.
+ * 
+ */
+/*
+ *    For this example (3b), one needs to set up three versions of the electron
+ * trigger tools: two configured for offline tight PID+isolation, to be used for
+ * the leading electron (one for the trigger leg e24_xxx, another for the leg
+ * e12_xxx), and another configured for offline loose PID (for the leg e12_xxx)
+ * to be used for subleading electrons.
+ * 
+ *    The configuration of the TrigGlobalEfficiencyCorrectionTool is very similar
+ * to the example 3a (e.g. the decoration of electrons is identical), please
+ * refer to that example for more details.
+ *    Here, in addition, one needs to let the tool know, via the property
+ * 'ListOfLegsPerTag', that only 'Signal'-tagged electrons are allowed to fire
+ * the e24_xxx leg.
+ * 
+ */
+
+// ROOT include(s):
+#include <TFile.h>
+#include <TError.h>
+
+// Infrastructure include(s):
+#ifdef XAOD_STANDALONE
+    #include "xAODRootAccess/Init.h"
+    #include "xAODRootAccess/TEvent.h"
+    #include "xAODRootAccess/TStore.h"
+#else
+    #include "AthAnalysisBaseComps/AthAnalysisHelper.h"
+    #include "POOLRootAccess/TEvent.h"
+#endif
+
+#include "AsgMessaging/MessageCheck.h"
+// EDM include(s):
+#include "AsgTools/AnaToolHandle.h"
+#include "EgammaAnalysisInterfaces/IAsgElectronEfficiencyCorrectionTool.h"
+#include "MuonAnalysisInterfaces/IMuonTriggerScaleFactors.h"
+#include "TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODMuon/MuonContainer.h"
+#include "PATCore/PATCoreEnums.h"
+#include "AthContainers/AuxElement.h"
+
+// stdlib include(s):
+#include <sstream>
+#include <random>
+#include <vector>
+#include <array>
+using std::vector;
+using std::string;
+
+/// Helper function to split comma-delimited strings
+namespace { vector<string> split_comma_delimited(const std::string&); }
+
+#define MSGSOURCE "Example 3b"
+
+ANA_MSG_HEADER(Test)
+ANA_MSG_SOURCE(Test, MSGSOURCE)
+using namespace Test;
+int main(int argc, char* argv[])
+{
+    ANA_CHECK_SET_TYPE(bool)
+    const char* filename = nullptr;
+    bool debug = false, cmdline_error = false, toys = false;
+    for(int i=1;i<argc;++i)
+    {
+        if(string(argv[i]) == "--debug") debug = true;
+        else if(string(argv[i]) == "--toys") toys = true;
+        else if(!filename && *argv[i]!='-') filename = argv[i];
+        else cmdline_error = true;
+    }
+    if(!filename || cmdline_error)
+    {
+        Error(MSGSOURCE, "No file name received!");
+        Error(MSGSOURCE, "  Usage: %s [--debug] [--toys] [DxAOD file name]", argv[0]);
+        return 1;
+    }
+    #ifdef XAOD_STANDALONE
+        xAOD::Init(MSGSOURCE).ignore();
+        TFile* file = TFile::Open(filename, "READ");
+        if(!file)
+        {
+            Error(MSGSOURCE, "Unable to open file!");
+            return 2;
+        }
+        xAOD::TEvent event(xAOD::TEvent::kClassAccess);
+        xAOD::TStore store;
+        StatusCode::enableFailure();
+    #else
+       IAppMgrUI* app = POOL::Init();
+       POOL::TEvent event(POOL::TEvent::kClassAccess);
+       TString file(filename);
+    #endif
+    event.readFrom(file).ignore();
+    Long64_t entries = event.getEntries();
+    Info(MSGSOURCE, "Number of events in the file: %lli", entries);
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the electron CP tools");
+    /// For property 'ElectronEfficiencyTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronEffTools;
+    /// For property 'ElectronScaleFactorTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronSFTools; 
+        /// For property 'ListOfLegsPerTool':
+    std::map<std::string,std::string> legsPerTool;
+    /// For property 'ListOfTagsPerTool':
+    std::map<std::string,std::string> tagsPerTool;
+    /// For property 'ElectronLegsPerTag':
+    std::map<std::string,std::string> legsPerTag;
+    /// To tag electron(s) as 'Signal'
+    SG::AuxElement::Decorator<char> dec_signal("Signal");
+    /// To emulate PID selection (90% loose-to-medium efficiency)
+    std::bernoulli_distribution bernoulliPdf(0.9);
+
+    /// RAII on-the-fly creation of electron CP tools:
+    vector<asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool>> factory;
+    enum{ cLEGS, cTAG, cKEY, cPID, cISO };
+    std::vector<std::array<std::string,5> > toolConfigs = {
+        /// <list of legs>, <list of tags>, <key in map file>, <PID WP>, <iso WP>
+        /// Single electron trigger, only for the leading electron ("Signal")
+        {"e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose", "Signal", "2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose", "Tight", "FixedCutTightTrackOnly"}, 
+        /// Dielectron trigger, for the leading electron ("Signal")
+        {"e12_lhloose_L1EM10VH", "Signal", "2015_e12_lhloose_L1EM10VH", "Tight", "FixedCutTightTrackOnly"}, 
+        /// Dielectron trigger, for subleading electron(s) (not tagged => "*")
+        {"e12_lhloose_L1EM10VH", "*", "2015_e12_lhloose_L1EM10VH", "LooseBLayer", ""}
+     };
+
+    const char* mapPath = "ElectronEfficiencyCorrection/2015_2017/"
+            "rel21.2/Moriond_February2018_v2/map6.txt";
+    for(auto& cfg : toolConfigs) /// one instance per trigger leg x working point
+    for(int j=0;j<2;++j) /// two instances: 0 -> MC efficiencies, 1 -> SFs
+    {
+        string name = "AsgElectronEfficiencyCorrectionTool/"
+                + ((j? "ElTrigEff_" : "ElTrigSF_")
+                + std::to_string(factory.size()/2));
+        auto t = factory.emplace(factory.end(), name);
+        t->setProperty("MapFilePath", mapPath).ignore();
+        t->setProperty("TriggerKey", string(j?"":"Eff_") + cfg[cKEY]).ignore();
+        t->setProperty("IdKey", cfg[cPID]).ignore();
+        t->setProperty("IsoKey", cfg[cISO]).ignore();
+
+        t->setProperty("CorrelationModel", "TOTAL").ignore();
+        t->setProperty("ForceDataType", (int)PATCore::ParticleDataType::Full).ignore();
+        if(t->initialize() != StatusCode::SUCCESS)
+        {
+            Error(MSGSOURCE, "Unable to initialize the electron CP tool <%s>!",
+                    t->name().c_str());
+            return 3;
+        }
+        auto& handles = (j? electronSFTools : electronEffTools);
+        handles.push_back(t->getHandle());
+        /// Safer to retrieve the name from the final ToolHandle, it might be
+        /// prefixed (by the parent tool name) when the handle is copied    
+        name = handles[handles.size()-1].name();
+        legsPerTool[name] = cfg[cLEGS];
+        tagsPerTool[name] = cfg[cTAG];
+        if(!j)
+        {
+            for(auto& tag : ::split_comma_delimited(cfg[cTAG]))
+            {
+                if(legsPerTag[tag]=="") legsPerTag[tag] = cfg[cLEGS];
+                else legsPerTag[tag] += "," + cfg[cLEGS];
+            }
+        }
+
+    }
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the global trigger SF tool");
+    asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> myTool("TrigGlobalEfficiencyCorrectionTool/TrigGlobal");
+    myTool.setProperty("ElectronEfficiencyTools", electronEffTools).ignore();
+    myTool.setProperty("ElectronScaleFactorTools", electronSFTools).ignore();
+    const char* triggers2015 = 
+        "e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose"
+        "|| 2e12_lhloose_L12EM10VH";
+    myTool.setProperty("TriggerCombination2015", triggers2015).ignore();
+    myTool.setProperty("LeptonTagDecorations", "Signal").ignore();
+    myTool.setProperty("ListOfLegsPerTool", legsPerTool).ignore();
+    myTool.setProperty("ListOfTagsPerTool", tagsPerTool).ignore();
+    myTool.setProperty("ListOfLegsPerTag", legsPerTag).ignore();
+
+    if(debug) myTool.setProperty("OutputLevel", MSG::DEBUG).ignore();
+    if(toys) myTool.setProperty("NumberOfToys", 1000).ignore();
+    if(myTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the TrigGlob tool!");
+        return 3;
+    }
+    
+    /// Uniform random run number generation spanning the target dataset.
+    /// In real life, use the PileupReweightingTool instead!
+    const unsigned periodRuns[] = {
+        /// 2015 periods D-H, J
+        276073, 278727, 279932, 280423, 281130, 282625
+    };
+    std::uniform_int_distribution<unsigned> uniformPdf(0,
+            sizeof(periodRuns)/sizeof(*periodRuns) - 1);
+    std::default_random_engine randomEngine;
+    
+    SG::AuxElement::ConstAccessor<int> truthType("truthType");
+    SG::AuxElement::ConstAccessor<int> truthOrigin("truthOrigin");
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Starting the event loop");
+    unsigned errors = 0;
+    double nSuitableEvents = 0., sumW = 0.;
+    for(Long64_t entry = 0; entry < entries; ++entry)
+    {
+        event.getEntry(entry);
+        
+        /// Get a random run number, and decorate the event info
+        const xAOD::EventInfo* eventInfo = nullptr;
+        event.retrieve(eventInfo,"EventInfo").ignore();
+        unsigned runNumber = periodRuns[uniformPdf(randomEngine)];
+        eventInfo->auxdecor<unsigned>("RandomRunNumber") = runNumber;
+        vector<const xAOD::Electron*> myTriggeringElectrons;
+        const xAOD::ElectronContainer* electrons = nullptr;
+        event.retrieve(electrons,"Electrons").ignore();
+        for(auto electron : *electrons)
+        {
+            if(!electron->caloCluster()) continue;
+            float eta = fabs(electron->caloCluster()->etaBE(2));
+            float pt = electron->pt();
+            if(pt<10e3f || eta>=2.47) continue;
+            if(!truthType.isAvailable(*electron)) continue;
+            if(!truthOrigin.isAvailable(*electron)) continue;
+            int t = truthType(*electron), o = truthOrigin(*electron);
+            if(t!=2 || !(o==10 || (o>=12 && o<=22) || o==43)) continue;
+            /// electron must be above softest trigger threshold (e12 here)
+            if(pt < 13e3f) continue;
+
+            myTriggeringElectrons.push_back(electron);
+        }
+
+        vector<const xAOD::Muon*> myTriggeringMuons;
+
+        if(myTriggeringElectrons.size() < 1) continue;
+        
+        /// Let's pretend that the leading electron passes TightLH+isolation,
+        /// thus the event passes the selection; now we tag the electrons:
+        auto compareByPt = [](const xAOD::Electron*e1, const xAOD::Electron*e2)
+            { return e1->pt() < e2->pt(); };
+        auto leadingElectron = *std::max_element(myTriggeringElectrons.begin(),
+            myTriggeringElectrons.end(), compareByPt);
+        for(auto electron : myTriggeringElectrons)
+        {
+            /// Leading electron tagged as 'Signal' -> decorated value set to 1
+            /// Subleading electron(s) not tagged -> decorated value set to 0
+            dec_signal(*electron) = (electron==leadingElectron)? 1 : 0;
+        }
+        
+        /// Events must contain enough leptons to trigger
+        if(leadingElectron->pt() < 25e3f /// single-electron trigger
+            && myTriggeringElectrons.size() < 2) /// dielectron
+        {
+            continue;
+        }
+
+
+        /// Finally retrieve the global trigger scale factor
+        double sf = 1.;
+        auto cc = myTool->getEfficiencyScaleFactor(myTriggeringElectrons,
+            myTriggeringMuons, sf);
+        if(cc==CP::CorrectionCode::Ok)
+        {
+            nSuitableEvents += 1;
+            sumW += sf;
+        }
+        else
+        {
+            Warning(MSGSOURCE, "Scale factor evaluation failed");
+            ++errors;
+        }
+        if(errors>10)
+        {
+            Error(MSGSOURCE, "Too many errors reported!");
+            break;
+        }
+    }
+    Info(MSGSOURCE, "Average scale factor: %f (over %ld events)",
+            sumW / nSuitableEvents, long(nSuitableEvents));
+    #ifndef XAOD_STANDALONE
+		ANA_CHECK(app->finalize())
+    #endif
+    return errors? 4 : 0;
+}
+
+/// Split comma-delimited string
+namespace
+{
+    inline vector<string> split_comma_delimited(const string& s)
+    {
+        std::stringstream ss(s);
+        std::vector<std::string> tokens;
+        std::string token;
+        while(std::getline(ss, token, ','))
+        {
+            if(token.length()) tokens.push_back(token);
+        }
+        return tokens;
+    }
+}
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample3c.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample3c.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..0273ed4671a13856705d7a7e0b676ec837fe93a2
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample3c.cxx
@@ -0,0 +1,335 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+/// Based on CPToolTester.cxx (A. Kraznahorkay) 
+/// and ut_ath_checkTrigger_test.cxx (W. Buttinger)
+/// Contact: jmaurer@cern.ch
+/*
+ *    The set of examples 3a - 3e illustrates the use of lepton selection tags
+ * for various scenarios:
+ * 
+ * - Example 3a: trigger = 2e12_lhloose_L12EM10VH, selecting events containing
+ *               >=2 loose electrons, the leading-pT electron always satisfying
+ *               in addition tight PID+isolation requirements.
+ * 
+ * - Example 3b: trigger = e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose
+ *                         || 2e12_lhloose_L12EM10VH
+ *               selecting events with >=2 loose electrons where the leading-pT
+ *               electron also satisfies medium PID requirements.
+ *               Only the latter is allowed to fire the single-electron trigger.
+ * 
+ * - Example 3c: trigger = e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose
+ *                         || 2e12_lhloose_L12EM10VH
+ *               selecting events with >=2 loose electrons. Any electron also
+ *               satisfying medium PID requirements is allowed to fire the
+ *               single-electron trigger.
+ * 
+ * - Example 3d: trigger = 2e17_lhvloose_nod0 || e7_lhmedium_nod0_mu24
+ *       || e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+ *               same type of selection as example 3c but with 3 PID working
+ *               points, using two distinct decorations.
+ * 
+ * - Example 3e: same scenario as example 3d, but using an alternative
+ *               implementation that requires only one decoration.
+ * 
+ */
+/*
+ *    For this example (3c), any electron might be tagged as 'Signal' if it
+ * passes MediumLH selection (here emulated with a random number). Electron tools
+ * providing the efficiency/SF for the e24_xxx leg are configured with the
+ * MediumLH working point. For the tools providing efficiency/SF for the e12_xxx
+ * leg however, one SHOULD NOT set up one version for 'Medium'-tagged electrons
+ * and another version for untagged electrons. This is because for the latter
+ * one would need to configure the tools for a LooseLH-but-not-MediumLH working
+ * point, which is not provided by egamma. Instead, we use a single version,
+ * configured with the LooseLH working point, and instruct the TrigGlob tool to
+ * use that version for both 'Medium'-tagged and untagged electrons. In this way,
+ * no bias is introduced. ",
+ *    The configuration of the TrigGlobalEfficiencyCorrectionTool is otherwise
+ * essentially the same as for the example 3b, please refer to that example for
+ * more details.
+ *     
+ */
+
+// ROOT include(s):
+#include <TFile.h>
+#include <TError.h>
+
+// Infrastructure include(s):
+#ifdef XAOD_STANDALONE
+    #include "xAODRootAccess/Init.h"
+    #include "xAODRootAccess/TEvent.h"
+    #include "xAODRootAccess/TStore.h"
+#else
+    #include "AthAnalysisBaseComps/AthAnalysisHelper.h"
+    #include "POOLRootAccess/TEvent.h"
+#endif
+
+#include "AsgMessaging/MessageCheck.h"
+// EDM include(s):
+#include "AsgTools/AnaToolHandle.h"
+#include "EgammaAnalysisInterfaces/IAsgElectronEfficiencyCorrectionTool.h"
+#include "MuonAnalysisInterfaces/IMuonTriggerScaleFactors.h"
+#include "TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODMuon/MuonContainer.h"
+#include "PATCore/PATCoreEnums.h"
+#include "AthContainers/AuxElement.h"
+
+// stdlib include(s):
+#include <sstream>
+#include <random>
+#include <vector>
+#include <array>
+using std::vector;
+using std::string;
+
+/// Helper function to split comma-delimited strings
+namespace { vector<string> split_comma_delimited(const std::string&); }
+
+#define MSGSOURCE "Example 3c"
+
+ANA_MSG_HEADER(Test)
+ANA_MSG_SOURCE(Test, MSGSOURCE)
+using namespace Test;
+int main(int argc, char* argv[])
+{
+    ANA_CHECK_SET_TYPE(bool)
+    const char* filename = nullptr;
+    bool debug = false, cmdline_error = false, toys = false;
+    for(int i=1;i<argc;++i)
+    {
+        if(string(argv[i]) == "--debug") debug = true;
+        else if(string(argv[i]) == "--toys") toys = true;
+        else if(!filename && *argv[i]!='-') filename = argv[i];
+        else cmdline_error = true;
+    }
+    if(!filename || cmdline_error)
+    {
+        Error(MSGSOURCE, "No file name received!");
+        Error(MSGSOURCE, "  Usage: %s [--debug] [--toys] [DxAOD file name]", argv[0]);
+        return 1;
+    }
+    #ifdef XAOD_STANDALONE
+        xAOD::Init(MSGSOURCE).ignore();
+        TFile* file = TFile::Open(filename, "READ");
+        if(!file)
+        {
+            Error(MSGSOURCE, "Unable to open file!");
+            return 2;
+        }
+        xAOD::TEvent event(xAOD::TEvent::kClassAccess);
+        xAOD::TStore store;
+        StatusCode::enableFailure();
+    #else
+       IAppMgrUI* app = POOL::Init();
+       POOL::TEvent event(POOL::TEvent::kClassAccess);
+       TString file(filename);
+    #endif
+    event.readFrom(file).ignore();
+    Long64_t entries = event.getEntries();
+    Info(MSGSOURCE, "Number of events in the file: %lli", entries);
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the electron CP tools");
+    /// For property 'ElectronEfficiencyTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronEffTools;
+    /// For property 'ElectronScaleFactorTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronSFTools; 
+        /// For property 'ListOfLegsPerTool':
+    std::map<std::string,std::string> legsPerTool;
+    /// For property 'ListOfTagsPerTool':
+    std::map<std::string,std::string> tagsPerTool;
+    /// For property 'ElectronLegsPerTag':
+    std::map<std::string,std::string> legsPerTag;
+    /// To tag electron(s) as 'Signal'
+    SG::AuxElement::Decorator<char> dec_signal("Signal");
+    /// To emulate PID selection (90% loose-to-medium efficiency)
+    std::bernoulli_distribution bernoulliPdf(0.9);
+
+    /// RAII on-the-fly creation of electron CP tools:
+    vector<asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool>> factory;
+    enum{ cLEGS, cTAG, cKEY, cPID, cISO };
+    std::vector<std::array<std::string,5> > toolConfigs = {
+        /// <list of legs>, <list of tags>, <key in map file>, <PID WP>, <iso WP>
+        /// Single electron trigger: electrons tagged 'Signal'
+        {"e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose", "Signal", "2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose", "Medium", ""}, 
+        /// Dielectron trigger: all electrons (tagged or not)
+        {"e12_lhloose_L1EM10VH", "*,Signal", "2015_e12_lhloose_L1EM10VH", "LooseBLayer", ""}
+     };
+
+    const char* mapPath = "ElectronEfficiencyCorrection/2015_2017/"
+            "rel21.2/Moriond_February2018_v2/map6.txt";
+    for(auto& cfg : toolConfigs) /// one instance per trigger leg x working point
+    for(int j=0;j<2;++j) /// two instances: 0 -> MC efficiencies, 1 -> SFs
+    {
+        string name = "AsgElectronEfficiencyCorrectionTool/"
+                + ((j? "ElTrigEff_" : "ElTrigSF_")
+                + std::to_string(factory.size()/2));
+        auto t = factory.emplace(factory.end(), name);
+        t->setProperty("MapFilePath", mapPath).ignore();
+        t->setProperty("TriggerKey", string(j?"":"Eff_") + cfg[cKEY]).ignore();
+        t->setProperty("IdKey", cfg[cPID]).ignore();
+        t->setProperty("IsoKey", cfg[cISO]).ignore();
+
+        t->setProperty("CorrelationModel", "TOTAL").ignore();
+        t->setProperty("ForceDataType", (int)PATCore::ParticleDataType::Full).ignore();
+        if(t->initialize() != StatusCode::SUCCESS)
+        {
+            Error(MSGSOURCE, "Unable to initialize the electron CP tool <%s>!",
+                    t->name().c_str());
+            return 3;
+        }
+        auto& handles = (j? electronSFTools : electronEffTools);
+        handles.push_back(t->getHandle());
+        /// Safer to retrieve the name from the final ToolHandle, it might be
+        /// prefixed (by the parent tool name) when the handle is copied    
+        name = handles[handles.size()-1].name();
+        legsPerTool[name] = cfg[cLEGS];
+        tagsPerTool[name] = cfg[cTAG];
+        if(!j)
+        {
+            for(auto& tag : ::split_comma_delimited(cfg[cTAG]))
+            {
+                if(legsPerTag[tag]=="") legsPerTag[tag] = cfg[cLEGS];
+                else legsPerTag[tag] += "," + cfg[cLEGS];
+            }
+        }
+
+    }
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the global trigger SF tool");
+    asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> myTool("TrigGlobalEfficiencyCorrectionTool/TrigGlobal");
+    myTool.setProperty("ElectronEfficiencyTools", electronEffTools).ignore();
+    myTool.setProperty("ElectronScaleFactorTools", electronSFTools).ignore();
+    const char* triggers2015 = 
+        "e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose"
+        "|| 2e12_lhloose_L12EM10VH";
+    myTool.setProperty("TriggerCombination2015", triggers2015).ignore();
+    myTool.setProperty("LeptonTagDecorations", "Signal").ignore();
+    myTool.setProperty("ListOfLegsPerTool", legsPerTool).ignore();
+    myTool.setProperty("ListOfTagsPerTool", tagsPerTool).ignore();
+    myTool.setProperty("ListOfLegsPerTag", legsPerTag).ignore();
+
+    if(debug) myTool.setProperty("OutputLevel", MSG::DEBUG).ignore();
+    if(toys) myTool.setProperty("NumberOfToys", 1000).ignore();
+    if(myTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the TrigGlob tool!");
+        return 3;
+    }
+    
+    /// Uniform random run number generation spanning the target dataset.
+    /// In real life, use the PileupReweightingTool instead!
+    const unsigned periodRuns[] = {
+        /// 2015 periods D-H, J
+        276073, 278727, 279932, 280423, 281130, 282625
+    };
+    std::uniform_int_distribution<unsigned> uniformPdf(0,
+            sizeof(periodRuns)/sizeof(*periodRuns) - 1);
+    std::default_random_engine randomEngine;
+    
+    SG::AuxElement::ConstAccessor<int> truthType("truthType");
+    SG::AuxElement::ConstAccessor<int> truthOrigin("truthOrigin");
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Starting the event loop");
+    unsigned errors = 0;
+    double nSuitableEvents = 0., sumW = 0.;
+    for(Long64_t entry = 0; entry < entries; ++entry)
+    {
+        event.getEntry(entry);
+        
+        /// Get a random run number, and decorate the event info
+        const xAOD::EventInfo* eventInfo = nullptr;
+        event.retrieve(eventInfo,"EventInfo").ignore();
+        unsigned runNumber = periodRuns[uniformPdf(randomEngine)];
+        eventInfo->auxdecor<unsigned>("RandomRunNumber") = runNumber;
+        vector<const xAOD::Electron*> myTriggeringElectrons;
+        const xAOD::ElectronContainer* electrons = nullptr;
+        event.retrieve(electrons,"Electrons").ignore();
+        for(auto electron : *electrons)
+        {
+            if(!electron->caloCluster()) continue;
+            float eta = fabs(electron->caloCluster()->etaBE(2));
+            float pt = electron->pt();
+            if(pt<10e3f || eta>=2.47) continue;
+            if(!truthType.isAvailable(*electron)) continue;
+            if(!truthOrigin.isAvailable(*electron)) continue;
+            int t = truthType(*electron), o = truthOrigin(*electron);
+            if(t!=2 || !(o==10 || (o>=12 && o<=22) || o==43)) continue;
+            /// electron must be above softest trigger threshold (e12 here)
+            if(pt < 13e3f) continue;
+
+            myTriggeringElectrons.push_back(electron);
+        }
+
+        vector<const xAOD::Muon*> myTriggeringMuons;
+
+        /// Add 'Signal' decorations to random electrons
+        /// also count 'Signal' electrons above e24_xxx threshold
+        unsigned nTrig1L = 0;
+        for(auto electron : myTriggeringElectrons)
+        {
+            bool signal = bernoulliPdf(randomEngine);
+            dec_signal(*electron) = signal? 1 : 0;
+            if(signal && electron->pt()>25e3f) ++nTrig1L;
+        }
+        
+        /// Events must contain enough leptons to trigger
+        if(nTrig1L < 1 /// single-electron trigger
+            && myTriggeringElectrons.size() < 2) /// dielectron
+        {
+            continue;
+        }
+
+
+        /// Finally retrieve the global trigger scale factor
+        double sf = 1.;
+        auto cc = myTool->getEfficiencyScaleFactor(myTriggeringElectrons,
+            myTriggeringMuons, sf);
+        if(cc==CP::CorrectionCode::Ok)
+        {
+            nSuitableEvents += 1;
+            sumW += sf;
+        }
+        else
+        {
+            Warning(MSGSOURCE, "Scale factor evaluation failed");
+            ++errors;
+        }
+        if(errors>10)
+        {
+            Error(MSGSOURCE, "Too many errors reported!");
+            break;
+        }
+    }
+    Info(MSGSOURCE, "Average scale factor: %f (over %ld events)",
+            sumW / nSuitableEvents, long(nSuitableEvents));
+    #ifndef XAOD_STANDALONE
+		ANA_CHECK(app->finalize())
+    #endif
+    return errors? 4 : 0;
+}
+
+/// Split comma-delimited string
+namespace
+{
+    inline vector<string> split_comma_delimited(const string& s)
+    {
+        std::stringstream ss(s);
+        std::vector<std::string> tokens;
+        std::string token;
+        while(std::getline(ss, token, ','))
+        {
+            if(token.length()) tokens.push_back(token);
+        }
+        return tokens;
+    }
+}
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample3d.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample3d.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..87eed517ba35fb8de09d0b92563e2d141a621cac
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample3d.cxx
@@ -0,0 +1,378 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+/// Based on CPToolTester.cxx (A. Kraznahorkay) 
+/// and ut_ath_checkTrigger_test.cxx (W. Buttinger)
+/// Contact: jmaurer@cern.ch
+/*
+ *    The set of examples 3a - 3e illustrates the use of lepton selection tags
+ * for various scenarios:
+ * 
+ * - Example 3a: trigger = 2e12_lhloose_L12EM10VH, selecting events containing
+ *               >=2 loose electrons, the leading-pT electron always satisfying
+ *               in addition tight PID+isolation requirements.
+ * 
+ * - Example 3b: trigger = e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose
+ *                         || 2e12_lhloose_L12EM10VH
+ *               selecting events with >=2 loose electrons where the leading-pT
+ *               electron also satisfies medium PID requirements.
+ *               Only the latter is allowed to fire the single-electron trigger.
+ * 
+ * - Example 3c: trigger = e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose
+ *                         || 2e12_lhloose_L12EM10VH
+ *               selecting events with >=2 loose electrons. Any electron also
+ *               satisfying medium PID requirements is allowed to fire the
+ *               single-electron trigger.
+ * 
+ * - Example 3d: trigger = 2e17_lhvloose_nod0 || e7_lhmedium_nod0_mu24
+ *       || e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+ *               same type of selection as example 3c but with 3 PID working
+ *               points, using two distinct decorations.
+ * 
+ * - Example 3e: same scenario as example 3d, but using an alternative
+ *               implementation that requires only one decoration.
+ * 
+ */
+/*
+ *    We use two decorations, 'MyMedium' and 'MyTight'
+ * Note that the TrigGlob tool considers only one single tag per electron. When
+ * an electron has >=2 non-zero decorations (e.g. 'MyMedium' + 'MyTight'),
+ * the tag associated to the electron by the tool is chosen as the first one
+ * appearing in the list of decorations provided in the 'LeptonTagDecorations'
+ * property.
+ *     
+ */
+
+// ROOT include(s):
+#include <TFile.h>
+#include <TError.h>
+
+// Infrastructure include(s):
+#ifdef XAOD_STANDALONE
+    #include "xAODRootAccess/Init.h"
+    #include "xAODRootAccess/TEvent.h"
+    #include "xAODRootAccess/TStore.h"
+#else
+    #include "AthAnalysisBaseComps/AthAnalysisHelper.h"
+    #include "POOLRootAccess/TEvent.h"
+#endif
+
+#include "AsgMessaging/MessageCheck.h"
+// EDM include(s):
+#include "AsgTools/AnaToolHandle.h"
+#include "EgammaAnalysisInterfaces/IAsgElectronEfficiencyCorrectionTool.h"
+#include "MuonAnalysisInterfaces/IMuonTriggerScaleFactors.h"
+#include "TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODMuon/MuonContainer.h"
+#include "PATCore/PATCoreEnums.h"
+#include "AthContainers/AuxElement.h"
+
+// stdlib include(s):
+#include <sstream>
+#include <random>
+#include <vector>
+#include <array>
+using std::vector;
+using std::string;
+
+/// Helper function to split comma-delimited strings
+namespace { vector<string> split_comma_delimited(const std::string&); }
+
+#define MSGSOURCE "Example 3d"
+
+ANA_MSG_HEADER(Test)
+ANA_MSG_SOURCE(Test, MSGSOURCE)
+using namespace Test;
+int main(int argc, char* argv[])
+{
+    ANA_CHECK_SET_TYPE(bool)
+    const char* filename = nullptr;
+    bool debug = false, cmdline_error = false, toys = false;
+    for(int i=1;i<argc;++i)
+    {
+        if(string(argv[i]) == "--debug") debug = true;
+        else if(string(argv[i]) == "--toys") toys = true;
+        else if(!filename && *argv[i]!='-') filename = argv[i];
+        else cmdline_error = true;
+    }
+    if(!filename || cmdline_error)
+    {
+        Error(MSGSOURCE, "No file name received!");
+        Error(MSGSOURCE, "  Usage: %s [--debug] [--toys] [DxAOD file name]", argv[0]);
+        return 1;
+    }
+    #ifdef XAOD_STANDALONE
+        xAOD::Init(MSGSOURCE).ignore();
+        TFile* file = TFile::Open(filename, "READ");
+        if(!file)
+        {
+            Error(MSGSOURCE, "Unable to open file!");
+            return 2;
+        }
+        xAOD::TEvent event(xAOD::TEvent::kClassAccess);
+        xAOD::TStore store;
+        StatusCode::enableFailure();
+    #else
+       IAppMgrUI* app = POOL::Init();
+       POOL::TEvent event(POOL::TEvent::kClassAccess);
+       TString file(filename);
+    #endif
+    event.readFrom(file).ignore();
+    Long64_t entries = event.getEntries();
+    Info(MSGSOURCE, "Number of events in the file: %lli", entries);
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the electron CP tools");
+    /// For property 'ElectronEfficiencyTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronEffTools;
+    /// For property 'ElectronScaleFactorTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronSFTools; 
+        /// For property 'ListOfLegsPerTool':
+    std::map<std::string,std::string> legsPerTool;
+    /// For property 'ListOfTagsPerTool':
+    std::map<std::string,std::string> tagsPerTool;
+    /// For property 'ElectronLegsPerTag':
+    std::map<std::string,std::string> legsPerTag;
+    /// To tag electron(s) as 'MyMedium' and 'MyTight'
+    SG::AuxElement::Decorator<char> dec_medium("MyMedium");
+    SG::AuxElement::Decorator<char> dec_tight("MyTight");
+    /// To emulate PID selection (90% loose-to-medium/medium-to-tight eff.)
+    std::bernoulli_distribution bernoulliPdf(0.9);
+
+    /// RAII on-the-fly creation of electron CP tools:
+    vector<asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool>> factory;
+    enum{ cLEGS, cTAG, cKEY, cPID, cISO };
+    std::vector<std::array<std::string,5> > toolConfigs = {
+        /// <list of legs>, <list of tags>, <key in map file>, <PID WP>, <iso WP>
+        /// Single-electron trigger: electrons tagged 'MyTight'
+        {"e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0", "MyTight", 
+            "2016_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0", "Tight", "GradientLoose"},
+        /// Electron-muon trigger: electrons tagged 'MyTight' or 'MyMedium'
+        {"e7_lhmedium_nod0", "MyMedium,MyTight", "2016_e7_lhmedium_nod0", "Medium", ""},
+        /// Dielectron trigger: all electrons (tagged or not)
+        {"e17_lhvloose_nod0", "*,MyMedium,MyTight", "2016_e17_lhvloose_nod0", "LooseBLayer", ""},
+     };
+
+    const char* mapPath = "ElectronEfficiencyCorrection/2015_2017/"
+            "rel21.2/Moriond_February2018_v2/map6.txt";
+    for(auto& cfg : toolConfigs) /// one instance per trigger leg x working point
+    for(int j=0;j<2;++j) /// two instances: 0 -> MC efficiencies, 1 -> SFs
+    {
+        string name = "AsgElectronEfficiencyCorrectionTool/"
+                + ((j? "ElTrigEff_" : "ElTrigSF_")
+                + std::to_string(factory.size()/2));
+        auto t = factory.emplace(factory.end(), name);
+        t->setProperty("MapFilePath", mapPath).ignore();
+        t->setProperty("TriggerKey", string(j?"":"Eff_") + cfg[cKEY]).ignore();
+        t->setProperty("IdKey", cfg[cPID]).ignore();
+        t->setProperty("IsoKey", cfg[cISO]).ignore();
+
+        t->setProperty("CorrelationModel", "TOTAL").ignore();
+        t->setProperty("ForceDataType", (int)PATCore::ParticleDataType::Full).ignore();
+        if(t->initialize() != StatusCode::SUCCESS)
+        {
+            Error(MSGSOURCE, "Unable to initialize the electron CP tool <%s>!",
+                    t->name().c_str());
+            return 3;
+        }
+        auto& handles = (j? electronSFTools : electronEffTools);
+        handles.push_back(t->getHandle());
+        /// Safer to retrieve the name from the final ToolHandle, it might be
+        /// prefixed (by the parent tool name) when the handle is copied    
+        name = handles[handles.size()-1].name();
+        legsPerTool[name] = cfg[cLEGS];
+        tagsPerTool[name] = cfg[cTAG];
+        if(!j)
+        {
+            for(auto& tag : ::split_comma_delimited(cfg[cTAG]))
+            {
+                if(legsPerTag[tag]=="") legsPerTag[tag] = cfg[cLEGS];
+                else legsPerTag[tag] += "," + cfg[cLEGS];
+            }
+        }
+
+    }
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the muon CP tools");
+    /// For property 'MuonTools':
+    ToolHandleArray<CP::IMuonTriggerScaleFactors> muonTools;
+    asg::AnaToolHandle<CP::IMuonTriggerScaleFactors> muonTool("CP::MuonTriggerScaleFactors/MuonTrigEff");
+    muonTool.setProperty("MuonQuality", "Tight").ignore();
+    muonTool.setProperty("useRel207", false).ignore();
+    if(muonTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the muon CP tool!");
+        return 3;
+    }
+    muonTools.push_back(muonTool.getHandle());
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the global trigger SF tool");
+    asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> myTool("TrigGlobalEfficiencyCorrectionTool/TrigGlobal");
+    myTool.setProperty("ElectronEfficiencyTools", electronEffTools).ignore();
+    myTool.setProperty("ElectronScaleFactorTools", electronSFTools).ignore();
+    myTool.setProperty("MuonTools", muonTools).ignore();
+    const char* triggers2016 = 
+        "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"
+        "|| e7_lhmedium_nod0_mu24"
+        "|| 2e17_lhvloose_nod0";
+    myTool.setProperty("TriggerCombination2016", triggers2016).ignore();
+    /// Listing 'Tight' first as it has higher priority (an electron with both
+    /// non-zero 'Tight'+'Medium' decorations will then be tagged as 'Tight')
+    myTool.setProperty("LeptonTagDecorations", "MyTight,MyMedium").ignore();
+    myTool.setProperty("ListOfLegsPerTool", legsPerTool).ignore();
+    myTool.setProperty("ListOfTagsPerTool", tagsPerTool).ignore();
+    myTool.setProperty("ListOfLegsPerTag", legsPerTag).ignore();
+
+    if(debug) myTool.setProperty("OutputLevel", MSG::DEBUG).ignore();
+    if(toys) myTool.setProperty("NumberOfToys", 1000).ignore();
+    if(myTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the TrigGlob tool!");
+        return 3;
+    }
+    
+    /// Uniform random run number generation spanning the target dataset.
+    /// In real life, use the PileupReweightingTool instead!
+    const unsigned periodRuns[] = {
+        /// 2016 periods A-L
+        296939, 300345, 301912, 302737, 303638, 303943, 305291, 307124, 
+        305359, 309311, 310015
+    };
+    std::uniform_int_distribution<unsigned> uniformPdf(0,
+            sizeof(periodRuns)/sizeof(*periodRuns) - 1);
+    std::default_random_engine randomEngine;
+    
+    SG::AuxElement::ConstAccessor<int> truthType("truthType");
+    SG::AuxElement::ConstAccessor<int> truthOrigin("truthOrigin");
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Starting the event loop");
+    unsigned errors = 0;
+    double nSuitableEvents = 0., sumW = 0.;
+    for(Long64_t entry = 0; entry < entries; ++entry)
+    {
+        event.getEntry(entry);
+        
+        /// Get a random run number, and decorate the event info
+        const xAOD::EventInfo* eventInfo = nullptr;
+        event.retrieve(eventInfo,"EventInfo").ignore();
+        unsigned runNumber = periodRuns[uniformPdf(randomEngine)];
+        eventInfo->auxdecor<unsigned>("RandomRunNumber") = runNumber;
+
+        unsigned nTrig_e26 = 0, nTrig_e7 = 0, nTrig_e17 = 0;
+        
+        vector<const xAOD::Electron*> myTriggeringElectrons;
+        const xAOD::ElectronContainer* electrons = nullptr;
+        event.retrieve(electrons,"Electrons").ignore();
+        for(auto electron : *electrons)
+        {
+            if(!electron->caloCluster()) continue;
+            float eta = fabs(electron->caloCluster()->etaBE(2));
+            float pt = electron->pt();
+            if(pt<10e3f || eta>=2.47) continue;
+            if(!truthType.isAvailable(*electron)) continue;
+            if(!truthOrigin.isAvailable(*electron)) continue;
+            int t = truthType(*electron), o = truthOrigin(*electron);
+            if(t!=2 || !(o==10 || (o>=12 && o<=22) || o==43)) continue;
+            /// electron must be above softest trigger threshold (e7 here
+            if(pt < 7e3f) continue;
+            if(pt >= 18e3f) ++nTrig_e17;
+
+            myTriggeringElectrons.push_back(electron);
+        }
+
+        vector<const xAOD::Muon*> myTriggeringMuons;
+        const xAOD::MuonContainer* muons = nullptr;
+        event.retrieve(muons,"Muons").ignore();
+        for(auto muon : *muons)
+        {
+            if(runNumber >= 324320) break; // delete line once all SFs available for 2017
+            float pt = muon->pt();
+            if(pt<10e3f || fabs(muon->eta())>=2.5) continue;
+            auto mt = muon->muonType();
+            if(mt!=xAOD::Muon::Combined && mt!=xAOD::Muon::MuonStandAlone) continue;
+            auto& mtp = *(muon->primaryTrackParticle());
+            if(!truthType.isAvailable(mtp)) continue;
+            if(!truthOrigin.isAvailable(mtp)) continue;
+            int t = truthType(mtp), o = truthOrigin(mtp);
+            if(t!=6 || !(o==10 || (o>=12 && o<=22) || o==43)) continue;
+            /// muon must be above softest trigger threshold (mu24 here)
+            if(pt < 25.2e3f) continue;
+
+            myTriggeringMuons.push_back(muon);
+        }
+
+        /// Add 'MyMedium' & 'MyTight' decorations to random electrons
+        /// also count tight electrons above e26_xxx threshold
+        /// and medium electrons above e7_xxx threshold
+        for(auto electron : myTriggeringElectrons)
+        {
+            bool medium = bernoulliPdf(randomEngine);
+            dec_medium(*electron) = medium? 1 : 0;
+            if(medium && electron->pt()>8e3f) ++nTrig_e7;
+            bool tight = medium && bernoulliPdf(randomEngine);
+            dec_tight(*electron) = tight? 1 : 0;
+            if(tight && electron->pt()>27e3f) ++nTrig_e26;
+        }
+        
+        /// Events must contain enough leptons to trigger
+        if(nTrig_e26 < 1 /// single-electron trigger
+            && (nTrig_e7==0 || myTriggeringMuons.size()==0) /// electron-muon
+            && nTrig_e17 < 2) /// dielectron
+        {
+            continue;
+        }
+
+
+        /// Finally retrieve the global trigger scale factor
+        double sf = 1.;
+        auto cc = myTool->getEfficiencyScaleFactor(myTriggeringElectrons,
+            myTriggeringMuons, sf);
+        if(cc==CP::CorrectionCode::Ok)
+        {
+            nSuitableEvents += 1;
+            sumW += sf;
+        }
+        else
+        {
+            Warning(MSGSOURCE, "Scale factor evaluation failed");
+            ++errors;
+        }
+        if(errors>10)
+        {
+            Error(MSGSOURCE, "Too many errors reported!");
+            break;
+        }
+    }
+    Info(MSGSOURCE, "Average scale factor: %f (over %ld events)",
+            sumW / nSuitableEvents, long(nSuitableEvents));
+    #ifndef XAOD_STANDALONE
+		ANA_CHECK(app->finalize())
+    #endif
+    return errors? 4 : 0;
+}
+
+/// Split comma-delimited string
+namespace
+{
+    inline vector<string> split_comma_delimited(const string& s)
+    {
+        std::stringstream ss(s);
+        std::vector<std::string> tokens;
+        std::string token;
+        while(std::getline(ss, token, ','))
+        {
+            if(token.length()) tokens.push_back(token);
+        }
+        return tokens;
+    }
+}
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample3e.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample3e.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..624d98f15d48a01c447e05d73f33ba6f65c9794e
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample3e.cxx
@@ -0,0 +1,375 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+/// Based on CPToolTester.cxx (A. Kraznahorkay) 
+/// and ut_ath_checkTrigger_test.cxx (W. Buttinger)
+/// Contact: jmaurer@cern.ch
+/*
+ *    The set of examples 3a - 3e illustrates the use of lepton selection tags
+ * for various scenarios:
+ * 
+ * - Example 3a: trigger = 2e12_lhloose_L12EM10VH, selecting events containing
+ *               >=2 loose electrons, the leading-pT electron always satisfying
+ *               in addition tight PID+isolation requirements.
+ * 
+ * - Example 3b: trigger = e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose
+ *                         || 2e12_lhloose_L12EM10VH
+ *               selecting events with >=2 loose electrons where the leading-pT
+ *               electron also satisfies medium PID requirements.
+ *               Only the latter is allowed to fire the single-electron trigger.
+ * 
+ * - Example 3c: trigger = e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose
+ *                         || 2e12_lhloose_L12EM10VH
+ *               selecting events with >=2 loose electrons. Any electron also
+ *               satisfying medium PID requirements is allowed to fire the
+ *               single-electron trigger.
+ * 
+ * - Example 3d: trigger = 2e17_lhvloose_nod0 || e7_lhmedium_nod0_mu24
+ *       || e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+ *               same type of selection as example 3c but with 3 PID working
+ *               points, using two distinct decorations.
+ * 
+ * - Example 3e: same scenario as example 3d, but using an alternative
+ *               implementation that requires only one decoration.
+ * 
+ */
+/*
+ *    We use a single decoration named 'PID', and rely on the decorated value to
+ * indicate whether the electron passes TightLH PID + isolation (=> value = 2)
+ * or only MediumLH PID (=> value = 1). The TrigGlob tool then forms tags
+ * by suffixing the decorated value to the decoration name, i.e. 'PID1' and
+ * 'PID2'. One must then use the latter tags in the properties 'ListOfLegsPerTag'
+ * and 'ListOfTagsPerTool'. */
+
+// ROOT include(s):
+#include <TFile.h>
+#include <TError.h>
+
+// Infrastructure include(s):
+#ifdef XAOD_STANDALONE
+    #include "xAODRootAccess/Init.h"
+    #include "xAODRootAccess/TEvent.h"
+    #include "xAODRootAccess/TStore.h"
+#else
+    #include "AthAnalysisBaseComps/AthAnalysisHelper.h"
+    #include "POOLRootAccess/TEvent.h"
+#endif
+
+#include "AsgMessaging/MessageCheck.h"
+// EDM include(s):
+#include "AsgTools/AnaToolHandle.h"
+#include "EgammaAnalysisInterfaces/IAsgElectronEfficiencyCorrectionTool.h"
+#include "MuonAnalysisInterfaces/IMuonTriggerScaleFactors.h"
+#include "TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODMuon/MuonContainer.h"
+#include "PATCore/PATCoreEnums.h"
+#include "AthContainers/AuxElement.h"
+
+// stdlib include(s):
+#include <sstream>
+#include <random>
+#include <vector>
+#include <array>
+using std::vector;
+using std::string;
+
+/// Helper function to split comma-delimited strings
+namespace { vector<string> split_comma_delimited(const std::string&); }
+
+#define MSGSOURCE "Example 3e"
+
+ANA_MSG_HEADER(Test)
+ANA_MSG_SOURCE(Test, MSGSOURCE)
+using namespace Test;
+int main(int argc, char* argv[])
+{
+    ANA_CHECK_SET_TYPE(bool)
+    const char* filename = nullptr;
+    bool debug = false, cmdline_error = false, toys = false;
+    for(int i=1;i<argc;++i)
+    {
+        if(string(argv[i]) == "--debug") debug = true;
+        else if(string(argv[i]) == "--toys") toys = true;
+        else if(!filename && *argv[i]!='-') filename = argv[i];
+        else cmdline_error = true;
+    }
+    if(!filename || cmdline_error)
+    {
+        Error(MSGSOURCE, "No file name received!");
+        Error(MSGSOURCE, "  Usage: %s [--debug] [--toys] [DxAOD file name]", argv[0]);
+        return 1;
+    }
+    #ifdef XAOD_STANDALONE
+        xAOD::Init(MSGSOURCE).ignore();
+        TFile* file = TFile::Open(filename, "READ");
+        if(!file)
+        {
+            Error(MSGSOURCE, "Unable to open file!");
+            return 2;
+        }
+        xAOD::TEvent event(xAOD::TEvent::kClassAccess);
+        xAOD::TStore store;
+        StatusCode::enableFailure();
+    #else
+       IAppMgrUI* app = POOL::Init();
+       POOL::TEvent event(POOL::TEvent::kClassAccess);
+       TString file(filename);
+    #endif
+    event.readFrom(file).ignore();
+    Long64_t entries = event.getEntries();
+    Info(MSGSOURCE, "Number of events in the file: %lli", entries);
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the electron CP tools");
+    /// For property 'ElectronEfficiencyTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronEffTools;
+    /// For property 'ElectronScaleFactorTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronSFTools; 
+        /// For property 'ListOfLegsPerTool':
+    std::map<std::string,std::string> legsPerTool;
+    /// For property 'ListOfTagsPerTool':
+    std::map<std::string,std::string> tagsPerTool;
+    /// For property 'ElectronLegsPerTag':
+    std::map<std::string,std::string> legsPerTag;
+    /// To tag electrons according to the PID criteria they fulfil
+    SG::AuxElement::Decorator<char> dec_pid("PID");
+    /// To emulate PID selection (90% loose-to-medium/medium-to-tight eff.)
+    std::bernoulli_distribution bernoulliPdf(0.9);
+
+    /// RAII on-the-fly creation of electron CP tools:
+    vector<asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool>> factory;
+    enum{ cLEGS, cTAG, cKEY, cPID, cISO };
+    std::vector<std::array<std::string,5> > toolConfigs = {
+        /// <list of legs>, <list of tags>, <key in map file>, <PID WP>, <iso WP>
+        /// Single-electron trigger: only electrons tagged 'PID2' (TightLH+iso) 
+        {"e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0", "PID2", 
+            "2016_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0", "Tight", "GradientLoose"},
+        /// Electron-muon trigger: electrons tagged 'PID2' or 'PID1' (MediumLH)
+        {"e7_lhmedium_nod0", "PID1,PID2", "2016_e7_lhmedium_nod0", "Medium", ""},
+        /// Dielectron trigger: all electrons (tagged or not)
+        {"e17_lhvloose_nod0", "*,PID1,PID2", "2016_e17_lhvloose_nod0", "LooseBLayer", ""},
+     };
+
+    const char* mapPath = "ElectronEfficiencyCorrection/2015_2017/"
+            "rel21.2/Moriond_February2018_v2/map6.txt";
+    for(auto& cfg : toolConfigs) /// one instance per trigger leg x working point
+    for(int j=0;j<2;++j) /// two instances: 0 -> MC efficiencies, 1 -> SFs
+    {
+        string name = "AsgElectronEfficiencyCorrectionTool/"
+                + ((j? "ElTrigEff_" : "ElTrigSF_")
+                + std::to_string(factory.size()/2));
+        auto t = factory.emplace(factory.end(), name);
+        t->setProperty("MapFilePath", mapPath).ignore();
+        t->setProperty("TriggerKey", string(j?"":"Eff_") + cfg[cKEY]).ignore();
+        t->setProperty("IdKey", cfg[cPID]).ignore();
+        t->setProperty("IsoKey", cfg[cISO]).ignore();
+
+        t->setProperty("CorrelationModel", "TOTAL").ignore();
+        t->setProperty("ForceDataType", (int)PATCore::ParticleDataType::Full).ignore();
+        if(t->initialize() != StatusCode::SUCCESS)
+        {
+            Error(MSGSOURCE, "Unable to initialize the electron CP tool <%s>!",
+                    t->name().c_str());
+            return 3;
+        }
+        auto& handles = (j? electronSFTools : electronEffTools);
+        handles.push_back(t->getHandle());
+        /// Safer to retrieve the name from the final ToolHandle, it might be
+        /// prefixed (by the parent tool name) when the handle is copied    
+        name = handles[handles.size()-1].name();
+        legsPerTool[name] = cfg[cLEGS];
+        tagsPerTool[name] = cfg[cTAG];
+        if(!j)
+        {
+            for(auto& tag : ::split_comma_delimited(cfg[cTAG]))
+            {
+                if(legsPerTag[tag]=="") legsPerTag[tag] = cfg[cLEGS];
+                else legsPerTag[tag] += "," + cfg[cLEGS];
+            }
+        }
+
+    }
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the muon CP tools");
+    /// For property 'MuonTools':
+    ToolHandleArray<CP::IMuonTriggerScaleFactors> muonTools;
+    asg::AnaToolHandle<CP::IMuonTriggerScaleFactors> muonTool("CP::MuonTriggerScaleFactors/MuonTrigEff");
+    muonTool.setProperty("MuonQuality", "Tight").ignore();
+    muonTool.setProperty("useRel207", false).ignore();
+    if(muonTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the muon CP tool!");
+        return 3;
+    }
+    muonTools.push_back(muonTool.getHandle());
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the global trigger SF tool");
+    asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> myTool("TrigGlobalEfficiencyCorrectionTool/TrigGlobal");
+    myTool.setProperty("ElectronEfficiencyTools", electronEffTools).ignore();
+    myTool.setProperty("ElectronScaleFactorTools", electronSFTools).ignore();
+    myTool.setProperty("MuonTools", muonTools).ignore();
+    const char* triggers2016 = 
+        "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"
+        "|| e7_lhmedium_nod0_mu24"
+        "|| 2e17_lhvloose_nod0";
+    myTool.setProperty("TriggerCombination2016", triggers2016).ignore();
+    /// Special character '?' indicates that the decorated value is to be 
+    /// suffixed to the name (=> 'PID1' for medium, 'PID2' for tight)
+    myTool.setProperty("LeptonTagDecorations", "PID?").ignore();
+    myTool.setProperty("ListOfLegsPerTool", legsPerTool).ignore();
+    myTool.setProperty("ListOfTagsPerTool", tagsPerTool).ignore();
+    myTool.setProperty("ListOfLegsPerTag", legsPerTag).ignore();
+
+    if(debug) myTool.setProperty("OutputLevel", MSG::DEBUG).ignore();
+    if(toys) myTool.setProperty("NumberOfToys", 1000).ignore();
+    if(myTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the TrigGlob tool!");
+        return 3;
+    }
+    
+    /// Uniform random run number generation spanning the target dataset.
+    /// In real life, use the PileupReweightingTool instead!
+    const unsigned periodRuns[] = {
+        /// 2016 periods A-L
+        296939, 300345, 301912, 302737, 303638, 303943, 305291, 307124, 
+        305359, 309311, 310015
+    };
+    std::uniform_int_distribution<unsigned> uniformPdf(0,
+            sizeof(periodRuns)/sizeof(*periodRuns) - 1);
+    std::default_random_engine randomEngine;
+    
+    SG::AuxElement::ConstAccessor<int> truthType("truthType");
+    SG::AuxElement::ConstAccessor<int> truthOrigin("truthOrigin");
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Starting the event loop");
+    unsigned errors = 0;
+    double nSuitableEvents = 0., sumW = 0.;
+    for(Long64_t entry = 0; entry < entries; ++entry)
+    {
+        event.getEntry(entry);
+        
+        /// Get a random run number, and decorate the event info
+        const xAOD::EventInfo* eventInfo = nullptr;
+        event.retrieve(eventInfo,"EventInfo").ignore();
+        unsigned runNumber = periodRuns[uniformPdf(randomEngine)];
+        eventInfo->auxdecor<unsigned>("RandomRunNumber") = runNumber;
+
+        unsigned nTrig_e26 = 0, nTrig_e7 = 0, nTrig_e17 = 0;
+        
+        vector<const xAOD::Electron*> myTriggeringElectrons;
+        const xAOD::ElectronContainer* electrons = nullptr;
+        event.retrieve(electrons,"Electrons").ignore();
+        for(auto electron : *electrons)
+        {
+            if(!electron->caloCluster()) continue;
+            float eta = fabs(electron->caloCluster()->etaBE(2));
+            float pt = electron->pt();
+            if(pt<10e3f || eta>=2.47) continue;
+            if(!truthType.isAvailable(*electron)) continue;
+            if(!truthOrigin.isAvailable(*electron)) continue;
+            int t = truthType(*electron), o = truthOrigin(*electron);
+            if(t!=2 || !(o==10 || (o>=12 && o<=22) || o==43)) continue;
+            /// electron must be above softest trigger threshold (e7 here
+            if(pt < 7e3f) continue;
+            if(pt >= 18e3f) ++nTrig_e17;
+
+            myTriggeringElectrons.push_back(electron);
+        }
+
+        vector<const xAOD::Muon*> myTriggeringMuons;
+        const xAOD::MuonContainer* muons = nullptr;
+        event.retrieve(muons,"Muons").ignore();
+        for(auto muon : *muons)
+        {
+            if(runNumber >= 324320) break; // delete line once all SFs available for 2017
+            float pt = muon->pt();
+            if(pt<10e3f || fabs(muon->eta())>=2.5) continue;
+            auto mt = muon->muonType();
+            if(mt!=xAOD::Muon::Combined && mt!=xAOD::Muon::MuonStandAlone) continue;
+            auto& mtp = *(muon->primaryTrackParticle());
+            if(!truthType.isAvailable(mtp)) continue;
+            if(!truthOrigin.isAvailable(mtp)) continue;
+            int t = truthType(mtp), o = truthOrigin(mtp);
+            if(t!=6 || !(o==10 || (o>=12 && o<=22) || o==43)) continue;
+            /// muon must be above softest trigger threshold (mu24 here)
+            if(pt < 25.2e3f) continue;
+
+            myTriggeringMuons.push_back(muon);
+        }
+
+        /// Add 'PID' decorations to random electrons
+        /// also count 'Tight' electrons above e26_xxx threshold
+        /// and 'Medium' electrons above e7_xxx threshold
+        for(auto electron : myTriggeringElectrons)
+        {
+            bool medium = bernoulliPdf(randomEngine);
+            bool tight = medium && bernoulliPdf(randomEngine);
+            /// Set decorated value to 2 for TightLH+iso or 1 for MediumLH
+            dec_pid(*electron) = tight? 2 : medium? 1 : 0;
+            if(medium && electron->pt()>8e3f) ++nTrig_e7;
+            if(tight && electron->pt()>27e3f) ++nTrig_e26;
+        }
+        
+        /// Events must contain enough leptons to trigger
+        if(nTrig_e26 < 1 /// single-electron trigger
+            && (nTrig_e7==0 || myTriggeringMuons.size()==0) /// electron-muon
+            && nTrig_e17 < 2) /// dielectron
+        {
+            continue;
+        }
+
+
+        /// Finally retrieve the global trigger scale factor
+        double sf = 1.;
+        auto cc = myTool->getEfficiencyScaleFactor(myTriggeringElectrons,
+            myTriggeringMuons, sf);
+        if(cc==CP::CorrectionCode::Ok)
+        {
+            nSuitableEvents += 1;
+            sumW += sf;
+        }
+        else
+        {
+            Warning(MSGSOURCE, "Scale factor evaluation failed");
+            ++errors;
+        }
+        if(errors>10)
+        {
+            Error(MSGSOURCE, "Too many errors reported!");
+            break;
+        }
+    }
+    Info(MSGSOURCE, "Average scale factor: %f (over %ld events)",
+            sumW / nSuitableEvents, long(nSuitableEvents));
+    #ifndef XAOD_STANDALONE
+		ANA_CHECK(app->finalize())
+    #endif
+    return errors? 4 : 0;
+}
+
+/// Split comma-delimited string
+namespace
+{
+    inline vector<string> split_comma_delimited(const string& s)
+    {
+        std::stringstream ss(s);
+        std::vector<std::string> tokens;
+        std::string token;
+        while(std::getline(ss, token, ','))
+        {
+            if(token.length()) tokens.push_back(token);
+        }
+        return tokens;
+    }
+}
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample4.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample4.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..77b9cac090bcb70923840adc72b7e9dcc508a4eb
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample4.cxx
@@ -0,0 +1,173 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+// Based on CPToolTester.cxx (A. Kraznahorkay) and ut_ath_checkTrigger_test.cxx (W. Buttinger)
+// Contact: jmaurer@cern.ch
+
+/*
+ *   Examples of "automatic" configuration using TrigGlobalEfficiencyCorrectionTool::suggestElectronMapKeys()
+ *
+ */
+
+// ROOT include(s):
+#include <TFile.h>
+#include <TError.h>
+
+// Infrastructure include(s):
+#ifdef XAOD_STANDALONE
+	#include "xAODRootAccess/Init.h"
+	#include "xAODRootAccess/TEvent.h"
+	#include "xAODRootAccess/TStore.h"
+#else
+	#include "AthAnalysisBaseComps/AthAnalysisHelper.h"
+	#include "POOLRootAccess/TEvent.h"
+#endif
+
+#include "AsgMessaging/MessageCheck.h"
+// EDM include(s):
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODEgamma/ElectronContainer.h"
+#include "PATCore/PATCoreEnums.h"
+#include "AsgTools/AnaToolHandle.h"
+#include "EgammaAnalysisInterfaces/IAsgElectronEfficiencyCorrectionTool.h"
+// The interface header is not sufficient here as this example makes use of a static method of TrigGlobalEfficiencyCorrectionTool
+#include "TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrectionTool.h"
+
+// stdlib include(s):
+#include <random>
+
+bool quiet = false;
+
+#define MSGSOURCE "Example 4"
+ANA_MSG_HEADER(Test)
+ANA_MSG_SOURCE(Test, MSGSOURCE)
+using namespace Test;
+int main(int argc, char* argv[])
+{
+    ANA_CHECK_SET_TYPE(bool)
+	const std::string flagQuiet("--quiet");
+	for(int i=1;i<argc;++i)
+	{
+		if(argv[i] == flagQuiet) quiet = true;
+	}
+	
+	const char* APP_NAME = argv[0];
+	#ifdef XAOD_STANDALONE
+		xAOD::Init(APP_NAME).ignore();
+		StatusCode::enableFailure();
+	#else
+	   IAppMgrUI* app = POOL::Init();
+	#endif
+	
+	/// Retrieve the list of electron map keys for the chosen trigger combination
+	std::map<std::string,std::string> triggerCombination;
+	triggerCombination["2015"] = "2e12_lhloose_L12EM10VH || e17_lhloose_mu14  || mu18_mu8noL1"
+		"|| e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose || mu20_iloose_L1MU15";
+	triggerCombination["2016"] = "2e17_lhvloose_nod0 || e17_lhloose_nod0_mu14  || mu22_mu8noL1 "
+		"|| e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium";
+	triggerCombination["2017"] = "2e17_lhvloose_nod0_L12EM15VHI || 2e24_lhvloose_nod0 || e17_lhloose_nod0_mu14  || mu22_mu8noL1 "
+		"|| e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium";
+	triggerCombination["2018"] = triggerCombination["2017"];
+	std::map<std::string,std::string> legsPerKey, legsAlone;
+	auto cc = TrigGlobalEfficiencyCorrectionTool::suggestElectronMapKeys(triggerCombination, "", legsAlone);
+	if(cc == CP::CorrectionCode::Ok)
+	{
+		if(!quiet)
+		{
+			std::string msg = "List of trigger legs for this combination of triggers:\n";
+			for(auto& kv : legsAlone)
+			{
+				msg += "   - " + kv.second + '\n';
+			}
+			Info(APP_NAME, "%s", msg.c_str());
+		}
+	}
+	else
+	{
+		Error(APP_NAME, "Unable to find list of trigger legs!");
+		return 1;
+	}
+	
+	cc = TrigGlobalEfficiencyCorrectionTool::suggestElectronMapKeys(triggerCombination, "2015_2017/rel21.2/Consolidation_September2018_v1", legsPerKey);
+	if(cc == CP::CorrectionCode::Ok)
+	{
+		if(!quiet)
+		{
+			std::string msg = "List of map keys necessary for this combination of triggers:\n";
+			for(auto& kv : legsPerKey)
+			{
+				msg += "   - tool with key \"" + kv.first + "\" chosen for legs " + kv.second + '\n';
+			}
+			Info(APP_NAME, "%s", msg.c_str());
+		}
+	}
+	else
+	{
+		Error(APP_NAME, "Unable to find list of map keys!");
+		return 1;
+	}
+	
+	/// Then create all the needed electron tools and initialize the TrigGlob tool
+	/// using the information returned by suggestElectronMapKeys()
+
+	/// Trigger efficiency/scale factor CP tools for electrons and muons
+	ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronEffTools, electronSFTools;
+	std::vector<asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool> > electronToolsFactory; // for RAII
+	std::map<std::string,std::string> legsPerTool;
+	int nTools = 0;
+	for(auto& kv : legsPerKey)
+	{
+		const std::string& trigKey = kv.first;
+		for(int j=0;j<2;++j) /// one tool instance for efficiencies, another for scale factors
+		{
+			auto t = electronToolsFactory.emplace(electronToolsFactory.end(), "AsgElectronEfficiencyCorrectionTool/ElTrigEff_"+std::to_string(nTools++));
+			t->setProperty("MapFilePath", "ElectronEfficiencyCorrection/2015_2017/rel21.2/Consolidation_September2018_v1/map3.txt").ignore();
+			t->setProperty("TriggerKey", (j? trigKey : "Eff_"+trigKey)).ignore();
+			t->setProperty("IdKey","Tight").ignore();
+			t->setProperty("IsoKey","FCTight").ignore();
+			t->setProperty("CorrelationModel","TOTAL").ignore();
+			t->setProperty("ForceDataType", (int)PATCore::ParticleDataType::Full).ignore();
+			t->setProperty("OutputLevel", MSG::ERROR).ignore();
+			if(t->initialize() != StatusCode::SUCCESS)
+			{
+				Error(APP_NAME, "Unable to initialize CP tool <%s>!", t->name().c_str());
+				return 2;
+			}
+			auto& handles = j? electronSFTools : electronEffTools;
+			handles.push_back(t->getHandle());
+			/// Safer to retrieve the name from the final ToolHandle, it might be prefixed (by the parent tool name) when the handle is copied
+			std::string name = handles[handles.size()-1].name();
+			legsPerTool[name] = legsPerKey[trigKey];
+		}
+	}
+	
+    ToolHandleArray<CP::IMuonTriggerScaleFactors> muonTools;
+    asg::AnaToolHandle<CP::IMuonTriggerScaleFactors> muonTool("CP::MuonTriggerScaleFactors/MuonTrigEff");
+    muonTool.setProperty("MuonQuality", "Tight").ignore();
+	muonTool.setProperty("OutputLevel", MSG::ERROR).ignore();
+    if(muonTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(APP_NAME, "Unable to initialize the muon CP tool!");
+        return 3;
+    }
+    muonTools.push_back(muonTool.getHandle());
+	
+	asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> myTool("TrigGlobalEfficiencyCorrectionTool/MyTool");
+	myTool.setProperty("ElectronEfficiencyTools",electronEffTools).ignore();
+	myTool.setProperty("ElectronScaleFactorTools",electronSFTools).ignore();
+	myTool.setProperty("MuonTools",muonTools).ignore();
+	myTool.setProperty("TriggerCombination", triggerCombination).ignore();
+	myTool.setProperty("ListOfLegsPerTool", legsPerTool).ignore();
+	myTool.setProperty("OutputLevel", quiet? MSG::WARNING : MSG::INFO).ignore();
+	if(myTool.initialize() != StatusCode::SUCCESS)
+	{
+		Error( APP_NAME, "Unable to initialize tool!" );
+		return 4;
+	}
+	
+	#ifndef XAOD_STANDALONE
+		ANA_CHECK(app->finalize())
+	#endif
+	return 0;
+}
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample5a.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample5a.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..489e198352dea8a9da6420a099a4c3d298b3b8bb
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample5a.cxx
@@ -0,0 +1,215 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+/// Based on CPToolTester.cxx (A. Kraznahorkay) 
+/// and ut_ath_checkTrigger_test.cxx (W. Buttinger)
+/// Contact: jmaurer@cern.ch
+/*
+ *    This example shows how to configure the tool for photon triggers. 
+ *    Here, the minimal configuration is shown (one symmetric diphoton trigger)
+ */
+
+// ROOT include(s):
+#include <TFile.h>
+#include <TError.h>
+
+// Infrastructure include(s):
+#ifdef XAOD_STANDALONE
+    #include "xAODRootAccess/Init.h"
+    #include "xAODRootAccess/TEvent.h"
+    #include "xAODRootAccess/TStore.h"
+#else
+    #include "AthAnalysisBaseComps/AthAnalysisHelper.h"
+    #include "POOLRootAccess/TEvent.h"
+#endif
+
+#include "AsgMessaging/MessageCheck.h"
+// EDM include(s):
+#include "AsgTools/AnaToolHandle.h"
+#include "EgammaAnalysisInterfaces/IAsgPhotonEfficiencyCorrectionTool.h"
+#include "TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODEgamma/PhotonContainer.h"
+#include "PATCore/PATCoreEnums.h"
+
+// stdlib include(s):
+#include <random>
+#include <vector>
+#include <array>
+using std::vector;
+using std::string;
+
+#define MSGSOURCE "Example 5a"
+
+ANA_MSG_HEADER(Test)
+ANA_MSG_SOURCE(Test, MSGSOURCE)
+using namespace Test;
+int main(int argc, char* argv[])
+{
+    ANA_CHECK_SET_TYPE(bool)
+    const char* filename = nullptr;
+    bool debug = false, cmdline_error = false, toys = false;
+    for(int i=1;i<argc;++i)
+    {
+        if(string(argv[i]) == "--debug") debug = true;
+        else if(string(argv[i]) == "--toys") toys = true;
+        else if(!filename && *argv[i]!='-') filename = argv[i];
+        else cmdline_error = true;
+    }
+    if(!filename || cmdline_error)
+    {
+        Error(MSGSOURCE, "No file name received!");
+        Error(MSGSOURCE, "  Usage: %s [--debug] [--toys] [DxAOD file name]", argv[0]);
+        return 1;
+    }
+    #ifdef XAOD_STANDALONE
+        xAOD::Init(MSGSOURCE).ignore();
+        TFile* file = TFile::Open(filename, "READ");
+        if(!file)
+        {
+            Error(MSGSOURCE, "Unable to open file!");
+            return 2;
+        }
+        xAOD::TEvent event(xAOD::TEvent::kClassAccess);
+        xAOD::TStore store;
+        StatusCode::enableFailure();
+    #else
+       IAppMgrUI* app = POOL::Init();
+       POOL::TEvent event(POOL::TEvent::kClassAccess);
+       TString file(filename);
+    #endif
+    event.readFrom(file).ignore();
+    Long64_t entries = event.getEntries();
+    Info(MSGSOURCE, "Number of events in the file: %lli", entries);
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the photon CP tools");
+    /// For property 'PhotonEfficiencyTools':
+    ToolHandleArray<IAsgPhotonEfficiencyCorrectionTool> photonEffTools;
+    /// For property 'PhotonScaleFactorTools':
+    ToolHandleArray<IAsgPhotonEfficiencyCorrectionTool> photonSFTools; 
+
+    /// RAII on-the-fly creation of photon CP tools:
+    vector<asg::AnaToolHandle<IAsgPhotonEfficiencyCorrectionTool>> factory;
+
+    const char* mapPath = "PhotonEfficiencyCorrection/2015_2018/"
+            "rel21.2/Summer2018_Rec_v1/map1.txt";
+    for(int j=0;j<2;++j) /// two instances: 0 -> MC efficiencies, 1 -> SFs
+    {
+        string name = "AsgPhotonEfficiencyCorrectionTool/" + std::string(j? "PhTrigEff" : "PhTrigSF");
+        auto t = factory.emplace(factory.end(), name);
+        t->setProperty("MapFilePath", mapPath).ignore();
+        t->setProperty("TriggerKey", string(j?"":"Eff_") + "DI_PH_2015_2016_g20_tight_2016_g22_tight_2017_2018_g20_tight_icalovloose_L1EM15VHI").ignore();
+        t->setProperty("IsoKey", "Loose").ignore();
+        t->setProperty("ForceDataType", (int)PATCore::ParticleDataType::Full).ignore();
+        if(t->initialize() != StatusCode::SUCCESS)
+        {
+            Error(MSGSOURCE, "Unable to initialize the photon CP tool <%s>!",
+                    t->name().c_str());
+            return 3;
+        }
+        auto& handles = (j? photonSFTools : photonEffTools);
+        handles.push_back(t->getHandle());
+    }
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the global trigger SF tool");
+    asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> myTool("TrigGlobalEfficiencyCorrectionTool/TrigGlobal");
+    myTool.setProperty("PhotonEfficiencyTools", photonEffTools).ignore();
+    myTool.setProperty("PhotonScaleFactorTools", photonSFTools).ignore();
+    std::map<std::string, std::string> triggers;
+    triggers["266904-302872"] = "2g20_tight"; /// 2015 + 2016 periods A-D3
+    triggers["302919-311481"] = "2g22_tight"; /// 2016 periods D4-L
+    triggers["2017"] = "2g22_tight_L12EM15VHI";
+    triggers["2018"] = "2g22_tight_L12EM15VHI";
+    myTool.setProperty("TriggerCombination", triggers).ignore();
+
+    if(debug) myTool.setProperty("OutputLevel", MSG::DEBUG).ignore();
+    if(toys) myTool.setProperty("NumberOfToys", 1000).ignore();
+    if(myTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the TrigGlob tool!");
+        return 3;
+    }
+    
+    /// Uniform random run number generation spanning the target dataset.
+    /// In real life, use the PileupReweightingTool instead!
+    const unsigned periodRuns[] = {
+        /// 2015 periods D3-H, J
+        276262, 278727, 279932, 280423, 281130, 282625,
+        /// 2016 periods A3-L
+        297730, 300345, 301912, 302737, 303638, 303943, 305291, 307124, 
+        305359, 309311, 310015,
+        /// 2017 periods B-K
+        325713, 329385, 330857, 332720, 334842, 336497, 336832, 338183,
+        /// 2018 periods B-M
+        348885, 349534, 350310, 352274, 354107, 354826, 355261, 355331,
+        355529, 357050, 359191
+    };
+    std::uniform_int_distribution<unsigned> uniformPdf(0,
+            sizeof(periodRuns)/sizeof(*periodRuns) - 1);
+    std::default_random_engine randomEngine;
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Starting the event loop");
+    unsigned errors = 0;
+    double nSuitableEvents = 0., sumW = 0.;
+    for(Long64_t entry = 0; entry < entries; ++entry)
+    {
+        event.getEntry(entry);
+        
+        /// Get a random run number, and decorate the event info
+        const xAOD::EventInfo* eventInfo = nullptr;
+        event.retrieve(eventInfo,"EventInfo").ignore();
+        unsigned runNumber = periodRuns[uniformPdf(randomEngine)];
+        eventInfo->auxdecor<unsigned>("RandomRunNumber") = runNumber;
+
+        vector<const xAOD::Photon*> myTriggeringPhotons;
+        const xAOD::PhotonContainer* photons = nullptr;
+        event.retrieve(photons,"Photons").ignore();
+        for(auto photon : *photons)
+        {
+            if(!photon->caloCluster()) continue;
+            float eta = fabs(photon->caloCluster()->etaBE(2));
+            float pt = photon->pt();
+            if(pt<10e3f || eta>=2.37 || (eta>1.37 && eta<1.52)) continue;
+            int t = photon->auxdata<int>("truthType");
+            if(t!=14) continue;
+            /// photon must be above trigger threshold:
+            if(pt < (runNumber>=302919? 23e3f : 21e3f)) continue;
+            myTriggeringPhotons.push_back(photon);
+        }
+
+        /// Events must contain enough photons to trigger
+        if(myTriggeringPhotons.size() < 2) continue;
+
+        /// Finally retrieve the global trigger scale factor
+        double sf = 1.;
+        auto cc = myTool->getEfficiencyScaleFactor(myTriggeringPhotons, sf);
+        if(cc==CP::CorrectionCode::Ok)
+        {
+            nSuitableEvents += 1;
+            sumW += sf;
+        }
+        else
+        {
+            Warning(MSGSOURCE, "Scale factor evaluation failed");
+            ++errors;
+        }
+        if(errors>10)
+        {
+            Error(MSGSOURCE, "Too many errors reported!");
+            break;
+        }
+    }
+    Info(MSGSOURCE, "Average scale factor: %f (over %ld events)",
+            sumW / nSuitableEvents, long(nSuitableEvents));
+    #ifndef XAOD_STANDALONE
+		ANA_CHECK(app->finalize())
+    #endif
+    return errors? 4 : 0;
+}
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample5b.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample5b.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..c57df606d95289b2521caa502b31602a2b459e8e
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample5b.cxx
@@ -0,0 +1,233 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+/// Based on CPToolTester.cxx (A. Kraznahorkay) 
+/// and ut_ath_checkTrigger_test.cxx (W. Buttinger)
+/// Contact: jmaurer@cern.ch
+/*
+ *    Another example showing how to configure the tool for photon triggers. 
+ *    This time for a more complex configuration (asymmetric diphoton trigger);
+ *    see also the explanations in the example 1 as the configuration for photon triggers 
+ *    is very similar to that for electron triggers. 
+ */
+
+// ROOT include(s):
+#include <TFile.h>
+#include <TError.h>
+
+// Infrastructure include(s):
+#ifdef XAOD_STANDALONE
+    #include "xAODRootAccess/Init.h"
+    #include "xAODRootAccess/TEvent.h"
+    #include "xAODRootAccess/TStore.h"
+#else
+    #include "AthAnalysisBaseComps/AthAnalysisHelper.h"
+    #include "POOLRootAccess/TEvent.h"
+#endif
+
+#include "AsgMessaging/MessageCheck.h"
+// EDM include(s):
+#include "AsgTools/AnaToolHandle.h"
+#include "EgammaAnalysisInterfaces/IAsgPhotonEfficiencyCorrectionTool.h"
+#include "TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODEgamma/PhotonContainer.h"
+#include "PATCore/PATCoreEnums.h"
+
+// stdlib include(s):
+#include <random>
+#include <vector>
+#include <array>
+using std::vector;
+using std::string;
+
+#define MSGSOURCE "Example 5b"
+
+ANA_MSG_HEADER(Test)
+ANA_MSG_SOURCE(Test, MSGSOURCE)
+using namespace Test;
+int main(int argc, char* argv[])
+{
+    ANA_CHECK_SET_TYPE(bool)
+    const char* filename = nullptr;
+    bool debug = false, cmdline_error = false, toys = false;
+    for(int i=1;i<argc;++i)
+    {
+        if(string(argv[i]) == "--debug") debug = true;
+        else if(string(argv[i]) == "--toys") toys = true;
+        else if(!filename && *argv[i]!='-') filename = argv[i];
+        else cmdline_error = true;
+    }
+    if(!filename || cmdline_error)
+    {
+        Error(MSGSOURCE, "No file name received!");
+        Error(MSGSOURCE, "  Usage: %s [--debug] [--toys] [DxAOD file name]", argv[0]);
+        return 1;
+    }
+    #ifdef XAOD_STANDALONE
+        xAOD::Init(MSGSOURCE).ignore();
+        TFile* file = TFile::Open(filename, "READ");
+        if(!file)
+        {
+            Error(MSGSOURCE, "Unable to open file!");
+            return 2;
+        }
+        xAOD::TEvent event(xAOD::TEvent::kClassAccess);
+        xAOD::TStore store;
+        StatusCode::enableFailure();
+    #else
+       IAppMgrUI* app = POOL::Init();
+       POOL::TEvent event(POOL::TEvent::kClassAccess);
+       TString file(filename);
+    #endif
+    event.readFrom(file).ignore();
+    Long64_t entries = event.getEntries();
+    Info(MSGSOURCE, "Number of events in the file: %lli", entries);
+
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the photon CP tools");
+    /// For property 'PhotonEfficiencyTools':
+    ToolHandleArray<IAsgPhotonEfficiencyCorrectionTool> photonEffTools;
+    /// For property 'PhotonScaleFactorTools':
+    ToolHandleArray<IAsgPhotonEfficiencyCorrectionTool> photonSFTools; 
+    /// For property 'ListOfLegsPerTool':
+    std::map<string,string> legsPerTool;
+
+    /// RAII on-the-fly creation of photon CP tools:
+    vector<asg::AnaToolHandle<IAsgPhotonEfficiencyCorrectionTool>> factory;
+    enum{ cLEGS, cKEY };
+    vector<std::array<string,2>> toolConfigs = {
+         /// {<list of trigger legs>, <key in map file>}
+        {"g35_loose, g35_medium_L1EM20VH", "DI_PH_2015_g35_loose_2016_g35_loose_2017_g35_medium_L1EM20VH_2018_g35_medium_L1EM20VH"},
+        {"g25_loose, g25_medium_L1EM20VH", "DI_PH_2015_g25_loose_2016_g25_loose_2017_g25_medium_L1EM20VH_2018_g25_medium_L1EM20VH"}
+     };
+
+    const char* mapPath = "PhotonEfficiencyCorrection/2015_2018/"
+            "rel21.2/Summer2018_Rec_v1/map1.txt";
+    for(auto& cfg : toolConfigs) /// one instance per trigger leg x working point
+    for(int j=0;j<2;++j) /// two instances: 0 -> MC efficiencies, 1 -> SFs
+    {
+        string name = "AsgPhotonEfficiencyCorrectionTool/"
+                + ((j? "PhTrigEff_" : "PhTrigSF_")
+                + std::to_string(factory.size()/2));
+        auto t = factory.emplace(factory.end(), name);
+        t->setProperty("MapFilePath", mapPath).ignore();
+        t->setProperty("TriggerKey", string(j?"":"Eff_") + cfg[cKEY]).ignore();
+        t->setProperty("IsoKey", "Loose").ignore();
+        t->setProperty("ForceDataType", (int)PATCore::ParticleDataType::Full).ignore();
+        if(t->initialize() != StatusCode::SUCCESS)
+        {
+            Error(MSGSOURCE, "Unable to initialize the photon CP tool <%s>!",
+                    t->name().c_str());
+            return 3;
+        }
+        auto& handles = (j? photonSFTools : photonEffTools);
+        handles.push_back(t->getHandle());
+        /// Safer to retrieve the name from the final ToolHandle, it might be
+        /// prefixed (by the parent tool name) when the handle is copied
+        name = handles[handles.size()-1].name();
+        legsPerTool[name] = cfg[cLEGS];
+    }
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the global trigger SF tool");
+    asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> myTool("TrigGlobalEfficiencyCorrectionTool/TrigGlobal");
+    myTool.setProperty("PhotonEfficiencyTools", photonEffTools).ignore();
+    myTool.setProperty("PhotonScaleFactorTools", photonSFTools).ignore();
+    myTool.setProperty("TriggerCombination2015", "g35_loose_g25_loose").ignore();
+    myTool.setProperty("TriggerCombination2016", "g35_loose_g25_loose").ignore();
+    myTool.setProperty("TriggerCombination2017", "g35_medium_g25_medium_L12EM20VH").ignore();
+    myTool.setProperty("TriggerCombination2018", "g35_medium_g25_medium_L12EM20VH").ignore();
+    myTool.setProperty("ListOfLegsPerTool", legsPerTool).ignore();
+
+    if(debug) myTool.setProperty("OutputLevel", MSG::DEBUG).ignore();
+    if(toys) myTool.setProperty("NumberOfToys", 1000).ignore();
+    if(myTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the TrigGlob tool!");
+        return 3;
+    }
+
+    /// Uniform random run number generation spanning the target dataset.
+    /// In real life, use the PileupReweightingTool instead!
+    const unsigned periodRuns[] = {
+        /// 2015 periods D3-H, J
+        276262, 278727, 279932, 280423, 281130, 282625,
+        /// 2016 periods A3-L
+        297730, 300345, 301912, 302737, 303638, 303943, 305291, 307124, 
+        305359, 309311, 310015,
+        /// 2017 periods B-K
+        325713, 329385, 330857, 332720, 334842, 336497, 336832, 338183,
+        /// 2018 periods B-M
+        348885, 349534, 350310, 352274, 354107, 354826, 355261, 355331,
+        355529, 357050, 359191
+    };
+    std::uniform_int_distribution<unsigned> uniformPdf(0,
+            sizeof(periodRuns)/sizeof(*periodRuns) - 1);
+    std::default_random_engine randomEngine;
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Starting the event loop");
+    unsigned errors = 0;
+    double nSuitableEvents = 0., sumW = 0.;
+    for(Long64_t entry = 0; entry < entries; ++entry)
+    {
+        event.getEntry(entry);
+        
+        /// Get a random run number, and decorate the event info
+        const xAOD::EventInfo* eventInfo = nullptr;
+        event.retrieve(eventInfo,"EventInfo").ignore();
+        unsigned runNumber = periodRuns[uniformPdf(randomEngine)];
+        eventInfo->auxdecor<unsigned>("RandomRunNumber") = runNumber;
+
+        vector<const xAOD::Photon*> myTriggeringPhotons;
+        const xAOD::PhotonContainer* photons = nullptr;
+        event.retrieve(photons,"Photons").ignore();
+        unsigned n36 = 0;
+        for(auto photon : *photons)
+        {
+            if(!photon->caloCluster()) continue;
+            float eta = fabs(photon->caloCluster()->etaBE(2));
+            float pt = photon->pt();
+            if(pt<10e3f || eta>=2.37 || (eta>1.37 && eta<1.52)) continue;
+            int t = photon->auxdata<int>("truthType");
+            if(t!=14) continue;
+            /// photon must be above trigger threshold for the softest leg:
+            if(pt < 26e3f) continue;
+            myTriggeringPhotons.push_back(photon);
+			if(pt > 36e3f) ++n36; /// also counting those suitable for the highest-pT leg
+        }
+
+        /// Events must contain enough photons to trigger
+        if(myTriggeringPhotons.size()<2 || n36<1) continue;
+
+        /// Finally retrieve the global trigger scale factor
+        double sf = 1.;
+        auto cc = myTool->getEfficiencyScaleFactor(myTriggeringPhotons, sf);
+        if(cc==CP::CorrectionCode::Ok)
+        {
+            nSuitableEvents += 1;
+            sumW += sf;
+        }
+        else
+        {
+            Warning(MSGSOURCE, "Scale factor evaluation failed");
+            ++errors;
+        }
+        if(errors>10)
+        {
+            Error(MSGSOURCE, "Too many errors reported!");
+            break;
+        }
+    }
+    Info(MSGSOURCE, "Average scale factor: %f (over %ld events)",
+            sumW / nSuitableEvents, long(nSuitableEvents));
+    #ifndef XAOD_STANDALONE
+		ANA_CHECK(app->finalize())
+    #endif
+    return errors? 4 : 0;
+}
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample6.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample6.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..e6e3b36851bf37f98b472e13aca59d5cb11ff781
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/TrigGlobEffCorrExample6.cxx
@@ -0,0 +1,220 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+/// Based on CPToolTester.cxx (A. Kraznahorkay) 
+/// and ut_ath_checkTrigger_test.cxx (W. Buttinger)
+/// Contact: jmaurer@cern.ch
+/*
+ *    Trigger matching example: one can use the same configuration as in other examples;
+ *    the only addition is the (mandatory) creation of a Trig::MatchingTool instance 
+ *    for the "TriggerMatchingTool" property.
+ */
+
+// ROOT include(s):
+#include <TFile.h>
+#include <TError.h>
+
+// Infrastructure include(s):
+#ifdef XAOD_STANDALONE
+    #include "xAODRootAccess/Init.h"
+    #include "xAODRootAccess/TEvent.h"
+    #include "xAODRootAccess/TStore.h"
+#else
+    #include "AthAnalysisBaseComps/AthAnalysisHelper.h"
+    #include "POOLRootAccess/TEvent.h"
+#endif
+
+#include "AsgMessaging/MessageCheck.h"
+// EDM include(s):
+#include "AsgTools/AnaToolHandle.h"
+#include "TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h"
+#include "TrigConfInterfaces/ITrigConfigTool.h"
+#include "TrigDecisionTool/TrigDecisionTool.h"
+#include "TriggerMatchingTool/IMatchingTool.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODMuon/MuonContainer.h"
+#include "PATCore/PATCoreEnums.h"
+
+// stdlib include(s):
+#include <random>
+#include <vector>
+#include <array>
+using std::vector;
+using std::string;
+
+#define MSGSOURCE "Example 6"
+// messaging
+ANA_MSG_HEADER(Test)
+ANA_MSG_SOURCE(Test, MSGSOURCE)
+using namespace Test;
+int main(int argc, char* argv[])
+{
+    ANA_CHECK_SET_TYPE(bool)
+    const char* filename = nullptr;
+    bool debug = false, fast = false, cmdline_error = false;
+    for(int i=1;i<argc;++i)
+    {
+        if(string(argv[i]) == "--debug") debug = true;
+        if(string(argv[i]) == "--fast") fast = true;
+        else if(!filename && *argv[i]!='-') filename = argv[i];
+        else cmdline_error = true;
+    }
+    if(!filename || cmdline_error)
+    {
+        Error(MSGSOURCE, "No file name received!");
+        Error(MSGSOURCE, "  Usage: %s [--debug] [--fast] [DxAOD file name]", argv[0]);
+        return 1;
+    }
+    #ifdef XAOD_STANDALONE
+        xAOD::Init(MSGSOURCE).ignore();
+        TFile* file = TFile::Open(filename, "READ");
+        if(!file)
+        {
+            Error(MSGSOURCE, "Unable to open file!");
+            return 2;
+        }
+        xAOD::TEvent event(xAOD::TEvent::kClassAccess);
+        xAOD::TStore store;
+        StatusCode::enableFailure();
+    #else
+       IAppMgrUI* app = POOL::Init();
+       POOL::TEvent event(POOL::TEvent::kClassAccess);
+       TString file(filename);
+    #endif
+    event.readFrom(file).ignore();
+    Long64_t entries = event.getEntries();
+    Info(MSGSOURCE, "Number of events in the file: %lli", entries);
+    if(fast) entries = std::min(entries, 1000LL);
+
+    /* ********************************************************************** */
+    
+    asg::AnaToolHandle<TrigConf::ITrigConfigTool> trigConfTool("TrigConf::xAODConfigTool/TrigConfig");
+    if(trigConfTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the trigger config tool!");
+        return 3;
+    }
+    asg::AnaToolHandle<Trig::TrigDecisionTool> trigDecTool("Trig::TrigDecisionTool/TrigDecision");
+    trigDecTool.setProperty("ConfigTool", trigConfTool.getHandle()).ignore();
+    trigDecTool.setProperty("TrigDecisionKey", "xTrigDecision").ignore();
+    if(trigDecTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the trigger matching tool!");
+        return 3;
+    }
+    asg::AnaToolHandle<Trig::IMatchingTool> trigMatchTool("Trig::MatchingTool/TrigMatch");
+    trigMatchTool.setProperty("TrigDecisionTool", trigDecTool.getHandle()).ignore();
+    if(trigMatchTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the trigger matching tool!");
+        return 3;
+    }
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the global trigger SF tool");
+    asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> myTool("TrigGlobalEfficiencyCorrectionTool/TrigGlobal");
+    const char* triggers2015 = 
+        "mu20_iloose_L1MU15_OR_mu50"
+        "|| mu18_mu8noL1"
+        "|| e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose"
+        "|| 2e12_lhloose_L12EM10VH";
+    myTool.setProperty("TriggerCombination2015", triggers2015).ignore();
+    const char* triggers2016 = 
+        "mu26_ivarmedium_OR_mu50"
+        "|| mu22_mu8noL1"
+        "|| e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"
+        "|| 2e17_lhvloose_nod0";
+    myTool.setProperty("TriggerCombination2016", triggers2016).ignore();
+    myTool.setProperty("TriggerMatchingTool", trigMatchTool.getHandle()).ignore();
+    if(debug) myTool.setProperty("OutputLevel", MSG::DEBUG).ignore();
+    if(myTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the TrigGlob tool!");
+        return 3;
+    }
+    
+    /// Uniform random run number generation spanning the target dataset.
+    /// In real life, use the PileupReweightingTool instead!
+    const unsigned periodRuns[] = {
+        276073, 278727, 279932, 280423, 281130, 282625, /// 2015 periods D-H, J
+        296939, 300345, 301912, 302737, 303638, 303943, 305291, 307124, 
+        305359, 309311, 310015 /// 2016 periods A-L
+    };
+    std::uniform_int_distribution<unsigned> uniformPdf(0,
+            sizeof(periodRuns)/sizeof(*periodRuns) - 1);
+    std::default_random_engine randomEngine;
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Starting the event loop");
+    unsigned errors = 0;
+    double nSuitableEvents = 0., nMatched = 0.;
+    for(Long64_t entry = 0; entry < entries; ++entry)
+    {
+        event.getEntry(entry);
+        
+        /// Get a random run number, and decorate the event info
+        const xAOD::EventInfo* eventInfo = nullptr;
+        event.retrieve(eventInfo,"EventInfo").ignore();
+        unsigned runNumber = periodRuns[uniformPdf(randomEngine)];
+        eventInfo->auxdecor<unsigned>("RandomRunNumber") = runNumber;
+        vector<const xAOD::Electron*> myTriggeringElectrons;
+        const xAOD::ElectronContainer* electrons = nullptr;
+        event.retrieve(electrons,"Electrons").ignore();
+        for(auto electron : *electrons)
+        {
+            if(!electron->caloCluster()) continue;
+            float eta = fabs(electron->caloCluster()->etaBE(2));
+            float pt = electron->pt();
+            if(pt<10e3f || eta>=2.47) continue;
+            int t = electron->auxdata<int>("truthType");
+            int o = electron->auxdata<int>("truthOrigin");
+            if(t!=2 || !(o==10 || (o>=12 && o<=22) || o==43)) continue;
+            myTriggeringElectrons.push_back(electron);
+        }
+
+        vector<const xAOD::Muon*> myTriggeringMuons;
+        const xAOD::MuonContainer* muons = nullptr;
+        event.retrieve(muons,"Muons").ignore();
+        for(auto muon : *muons)
+        {
+            float pt = muon->pt();
+            if(pt<10e3f || fabs(muon->eta())>=2.5) continue;
+            auto mt = muon->muonType();
+            if(mt!=xAOD::Muon::Combined && mt!=xAOD::Muon::MuonStandAlone) continue;
+            int t = muon->primaryTrackParticle()->auxdata<int>("truthType");
+            int o = muon->primaryTrackParticle()->auxdata<int>("truthOrigin");
+            if(t!=6 || !(o==10 || (o>=12 && o<=22) || o==43)) continue;
+            myTriggeringMuons.push_back(muon);
+        }
+
+        /// Events must contain at least one lepton above trigger threshold
+        if(myTriggeringElectrons.size()+myTriggeringMuons.size() < 1) continue;
+        nSuitableEvents += 1;
+        
+        bool matched = false;
+        if(myTool->checkTriggerMatching(matched, myTriggeringElectrons, myTriggeringMuons) != CP::CorrectionCode::Ok)
+        {
+            Error(MSGSOURCE, "trigger matching could not be checked, interrupting execution");
+            ++errors;
+            break;
+        }
+            
+        if(matched) nMatched += 1;
+    }
+    
+    if(errors < nSuitableEvents)
+    {
+        Info(MSGSOURCE, "Fraction of trigger-matched events: %f (over %ld events)",
+            nMatched / nSuitableEvents, long(nSuitableEvents));
+    }
+    
+    #ifndef XAOD_STANDALONE
+		ANA_CHECK(app->finalize())
+    #endif
+    return errors? 4 : 0;
+}
+
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/comments.txt b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/comments.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e769012cf6630b174491dfa8935db392f801abe8
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/comments.txt
@@ -0,0 +1,108 @@
+[example0] ###################################################################
+   Simple example: single electron or single muon trigger, using different 
+configurations for 2015 and 2016.
+
+[example1] ###################################################################
+   Another example: combination of single-lepton, dielectron and dimuon
+triggers, using different configurations for 2015 and 2016, and illustrating
+how to fill the property 'ListOfLegsPerTool'.
+
+[example2] ###################################################################
+   Similar to example 1 (combination of single-lepton, dielectron and dimuon
+triggers), but showing how to use different triggers in different data-taking
+periods, and how to modify some of the trigger pT thresholds.
+
+[example3com] ################################################################
+   The set of examples 3a - 3e illustrates the use of lepton selection tags
+for various scenarios:
+
+- Example 3a: trigger = 2e12_lhloose_L12EM10VH, selecting events containing
+              >=2 loose electrons, the leading-pT electron always satisfying
+              in addition tight PID+isolation requirements.
+
+- Example 3b: trigger = e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose
+                        || 2e12_lhloose_L12EM10VH
+              selecting events with >=2 loose electrons where the leading-pT
+              electron also satisfies medium PID requirements.
+              Only the latter is allowed to fire the single-electron trigger.
+
+- Example 3c: trigger = e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose
+                        || 2e12_lhloose_L12EM10VH
+              selecting events with >=2 loose electrons. Any electron also
+              satisfying medium PID requirements is allowed to fire the
+              single-electron trigger.
+
+- Example 3d: trigger = 2e17_lhvloose_nod0 || e7_lhmedium_nod0_mu24
+      || e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
+              same type of selection as example 3c but with 3 PID working
+              points, using two distinct decorations.
+
+- Example 3e: same scenario as example 3d, but using an alternative
+              implementation that requires only one decoration.
+
+[example3a] ##################################################################
+   For this example (3a), one needs to set up two versions of the electron
+trigger tools: one configured for offline tight PID+isolation, to be used for
+the leading electron, and another configured for offline loose PID, to be
+used for subleading electrons.
+
+   The configuration of the TrigGlobalEfficiencyCorrectionTool then involves 
+filling two additional properties, 'ListOfTagsPerTool' and
+'LeptonTagDecorations'. We also fill a third one, 'ElectronLegsPerTag';
+it isn't required but still advised as the tool can then perform further
+consistency checks of its configuration.",  
+
+   The leading electron will always be tagged with a 'Signal' decoration
+(decorated value set to 1), while subleading electrons are never tagged 
+(-> decorated value set to 0).
+   Since efficiencies provided by CP tools are inclusive, one should NEVER
+ tag the subleading leptons as 'Signal', even if they satisfy the tight PID
++ isolation requirements; doing so would bias the results.
+   See example 3c that deals with a more complicate situation requiring
+handling multiple PID levels for all leptons.
+
+[example3b] ##################################################################
+   For this example (3b), one needs to set up three versions of the electron
+trigger tools: two configured for offline tight PID+isolation, to be used for
+the leading electron (one for the trigger leg e24_xxx, another for the leg
+e12_xxx), and another configured for offline loose PID (for the leg e12_xxx)
+to be used for subleading electrons.
+
+   The configuration of the TrigGlobalEfficiencyCorrectionTool is very similar
+to the example 3a (e.g. the decoration of electrons is identical), please
+refer to that example for more details.
+   Here, in addition, one needs to let the tool know, via the property
+'ListOfLegsPerTag', that only 'Signal'-tagged electrons are allowed to fire
+the e24_xxx leg.
+
+[example3c] ##################################################################
+   For this example (3c), any electron might be tagged as 'Signal' if it
+passes MediumLH selection (here emulated with a random number). Electron tools
+providing the efficiency/SF for the e24_xxx leg are configured with the
+MediumLH working point. For the tools providing efficiency/SF for the e12_xxx
+leg however, one SHOULD NOT set up one version for 'Medium'-tagged electrons
+and another version for untagged electrons. This is because for the latter
+one would need to configure the tools for a LooseLH-but-not-MediumLH working
+point, which is not provided by egamma. Instead, we use a single version,
+configured with the LooseLH working point, and instruct the TrigGlob tool to
+use that version for both 'Medium'-tagged and untagged electrons. In this way,
+no bias is introduced. ",
+   The configuration of the TrigGlobalEfficiencyCorrectionTool is otherwise
+essentially the same as for the example 3b, please refer to that example for
+more details.
+    
+[example3d] ##################################################################
+   We use two decorations, 'MyMedium' and 'MyTight'
+Note that the TrigGlob tool considers only one single tag per electron. When
+an electron has >=2 non-zero decorations (e.g. 'MyMedium' + 'MyTight'),
+the tag associated to the electron by the tool is chosen as the first one
+appearing in the list of decorations provided in the 'LeptonTagDecorations'
+property.
+    
+[example3e] ##################################################################
+   We use a single decoration named 'PID', and rely on the decorated value to
+indicate whether the electron passes TightLH PID + isolation (=> value = 2)
+or only MediumLH PID (=> value = 1). The TrigGlob tool then forms tags
+by suffixing the decorated value to the decoration name, i.e. 'PID1' and
+'PID2'. One must then use the latter tags in the properties 'ListOfLegsPerTag'
+and 'ListOfTagsPerTool'.
\ No newline at end of file
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/cptools_config.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/cptools_config.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..456911fd5465d4ac9f31a378d3cb130e2b011854
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/cptools_config.cxx
@@ -0,0 +1,160 @@
+[example0:electron_properties_set] #############################################
+        t->setProperty("TriggerKey", string(j?"":"Eff_")
+			+ "SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2017_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0").ignore();
+        t->setProperty("IdKey", "Tight").ignore();
+        t->setProperty("IsoKey", "FixedCutTightTrackOnly").ignore();
+	
+[example1and2:electron_extraproperties_declare] ################################
+    /// For property 'ListOfLegsPerTool':
+    std::map<string,string> legsPerTool;
+
+[example1:electron_toolconfigs] ############################################
+    enum{ cLEGS, cKEY };
+    vector<std::array<string,2>> toolConfigs = {
+         /// {<list of trigger legs>, <key in map file>}
+         /// Single-electron trigger (same tool instance for 2015 and 2016):
+        {"e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose, e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0",
+            "SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2017_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"}, 
+        /// Dielectron trigger (same tool instance for 2015-2017):
+        {"e12_lhloose_L1EM10VH, e17_lhvloose_nod0, e24_lhvloose_nod0_L1EM20VH", 
+            "DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_e24_lhvloose_nod0_L1EM20VH"}
+     };
+
+[example2:electron_toolconfigs] ############################################
+    enum{ cLEGS, cKEY };
+    vector<std::array<string,2>> toolConfigs = {
+         /// {<list of trigger legs>, <key in map file>}
+         /// Single-electron trigger (different instances for 2015-2017):
+        {"e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose", "2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose"}, 
+        {"e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 [2016]", "2016_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"}, 
+        {"e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 [2017]", "2017_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"}, 
+        /// the above splitting per year is just for illustration -- better
+        ///  to use a single instance for 2015-2017, as in the Example 1
+        /// Dielectron trigger (same tool instance for 2015-2017):
+        {"e12_lhloose_L1EM10VH, e17_lhvloose_nod0, e24_lhvloose_nod0_L1EM20VH", 
+            "DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_e24_lhvloose_nod0_L1EM20VH"}
+     };
+
+[example1and2:electron_properties_set] #########################################
+        t->setProperty("TriggerKey", string(j?"":"Eff_") + cfg[cKEY]).ignore();
+        t->setProperty("IdKey", "Tight").ignore();
+        t->setProperty("IsoKey", "FixedCutTightTrackOnly").ignore();
+
+[example1and2:electron_extraproperties_fill] ###################################
+        /// Safer to retrieve the name from the final ToolHandle, it might be
+        /// prefixed (by the parent tool name) when the handle is copied
+		name = handles[handles.size()-1].name();
+		legsPerTool[name] = cfg[cLEGS];
+
+[example3com:electron_extraproperties_declare] #################################
+    /// For property 'ListOfLegsPerTool':
+	std::map<std::string,std::string> legsPerTool;
+    /// For property 'ListOfTagsPerTool':
+	std::map<std::string,std::string> tagsPerTool;
+    /// For property 'ElectronLegsPerTag':
+	std::map<std::string,std::string> legsPerTag;
+  
+[example3a3b:electron_extraproperties_declare] #################################
++[example3com:electron_extraproperties_declare]
+    /// To tag the leading electron as 'Signal'
+    SG::AuxElement::Decorator<char> dec_signal("Signal");
+
+[example3c:electron_extraproperties_declare] ###################################
++[example3com:electron_extraproperties_declare]
+    /// To tag electron(s) as 'Signal'
+    SG::AuxElement::Decorator<char> dec_signal("Signal");
+    /// To emulate PID selection (90% loose-to-medium efficiency)
+    std::bernoulli_distribution bernoulliPdf(0.9);
+
+[example3d:electron_extraproperties_declare] ###################################
++[example3com:electron_extraproperties_declare]
+    /// To tag electron(s) as 'MyMedium' and 'MyTight'
+    SG::AuxElement::Decorator<char> dec_medium("MyMedium");
+    SG::AuxElement::Decorator<char> dec_tight("MyTight");
+    /// To emulate PID selection (90% loose-to-medium/medium-to-tight eff.)
+    std::bernoulli_distribution bernoulliPdf(0.9);
+ 
+[example3e:electron_extraproperties_declare] ###################################
++[example3com:electron_extraproperties_declare]
+    /// To tag electrons according to the PID criteria they fulfil
+    SG::AuxElement::Decorator<char> dec_pid("PID");
+    /// To emulate PID selection (90% loose-to-medium/medium-to-tight eff.)
+    std::bernoulli_distribution bernoulliPdf(0.9);
+ 
+[example3a:electron_toolconfigs] ###############################################
+    enum{ cLEGS, cTAG, cKEY, cPID, cISO };
+    std::vector<std::array<std::string,5> > toolConfigs = {
+        /// <list of legs>, <list of tags>, <key in map file>, <PID WP>, <iso WP>
+        /// For leading electron:
+        {"e12_lhloose_L1EM10VH", "Signal", "2015_e12_lhloose_L1EM10VH", "Tight", "FixedCutTightTrackOnly"},
+        /// For subleading electron(s):
+        {"e12_lhloose_L1EM10VH", "*", "2015_e12_lhloose_L1EM10VH", "LooseBLayer", ""}
+    };
+        
+[example3b:electron_toolconfigs] ###############################################
+    enum{ cLEGS, cTAG, cKEY, cPID, cISO };
+    std::vector<std::array<std::string,5> > toolConfigs = {
+		/// <list of legs>, <list of tags>, <key in map file>, <PID WP>, <iso WP>
+        /// Single electron trigger, only for the leading electron ("Signal")
+		{"e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose", "Signal", "2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose", "Tight", "FixedCutTightTrackOnly"}, 
+		/// Dielectron trigger, for the leading electron ("Signal")
+		{"e12_lhloose_L1EM10VH", "Signal", "2015_e12_lhloose_L1EM10VH", "Tight", "FixedCutTightTrackOnly"}, 
+		/// Dielectron trigger, for subleading electron(s) (not tagged => "*")
+		{"e12_lhloose_L1EM10VH", "*", "2015_e12_lhloose_L1EM10VH", "LooseBLayer", ""}
+     };
+        
+[example3c:electron_toolconfigs] ###############################################
+    enum{ cLEGS, cTAG, cKEY, cPID, cISO };
+    std::vector<std::array<std::string,5> > toolConfigs = {
+		/// <list of legs>, <list of tags>, <key in map file>, <PID WP>, <iso WP>
+        /// Single electron trigger: electrons tagged 'Signal'
+		{"e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose", "Signal", "2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose", "Medium", ""}, 
+		/// Dielectron trigger: all electrons (tagged or not)
+		{"e12_lhloose_L1EM10VH", "*,Signal", "2015_e12_lhloose_L1EM10VH", "LooseBLayer", ""}
+     };
+        
+[example3d:electron_toolconfigs] ###############################################
+    enum{ cLEGS, cTAG, cKEY, cPID, cISO };
+    std::vector<std::array<std::string,5> > toolConfigs = {
+		/// <list of legs>, <list of tags>, <key in map file>, <PID WP>, <iso WP>
+		/// Single-electron trigger: electrons tagged 'MyTight'
+		{"e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0", "MyTight", 
+			"2016_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0", "Tight", "GradientLoose"},
+		/// Electron-muon trigger: electrons tagged 'MyTight' or 'MyMedium'
+		{"e7_lhmedium_nod0", "MyMedium,MyTight", "2016_e7_lhmedium_nod0", "Medium", ""},
+		/// Dielectron trigger: all electrons (tagged or not)
+		{"e17_lhvloose_nod0", "*,MyMedium,MyTight", "2016_e17_lhvloose_nod0", "LooseBLayer", ""},
+     };
+        
+[example3e:electron_toolconfigs] ###############################################
+    enum{ cLEGS, cTAG, cKEY, cPID, cISO };
+    std::vector<std::array<std::string,5> > toolConfigs = {
+		/// <list of legs>, <list of tags>, <key in map file>, <PID WP>, <iso WP>
+		/// Single-electron trigger: only electrons tagged 'PID2' (TightLH+iso) 
+		{"e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0", "PID2", 
+			"2016_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0", "Tight", "GradientLoose"},
+		/// Electron-muon trigger: electrons tagged 'PID2' or 'PID1' (MediumLH)
+		{"e7_lhmedium_nod0", "PID1,PID2", "2016_e7_lhmedium_nod0", "Medium", ""},
+		/// Dielectron trigger: all electrons (tagged or not)
+		{"e17_lhvloose_nod0", "*,PID1,PID2", "2016_e17_lhvloose_nod0", "LooseBLayer", ""},
+     };
+        
+[example3:electron_properties_set] #############################################
+        t->setProperty("TriggerKey", string(j?"":"Eff_") + cfg[cKEY]).ignore();
+        t->setProperty("IdKey", cfg[cPID]).ignore();
+        t->setProperty("IsoKey", cfg[cISO]).ignore();
+        
+[example3:electron_extraproperties_fill] #######################################
+        /// Safer to retrieve the name from the final ToolHandle, it might be
+        /// prefixed (by the parent tool name) when the handle is copied    
+        name = handles[handles.size()-1].name();
+        legsPerTool[name] = cfg[cLEGS];
+        tagsPerTool[name] = cfg[cTAG];
+        if(!j)
+        {
+            for(auto& tag : ::split_comma_delimited(cfg[cTAG]))
+            {
+                if(legsPerTag[tag]=="") legsPerTag[tag] = cfg[cLEGS];
+                else legsPerTag[tag] += "," + cfg[cLEGS];
+            }
+        }
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/eventloop.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/eventloop.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..56865211a6ab2130ed2d91fb9acadbb235189b83
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/eventloop.cxx
@@ -0,0 +1,166 @@
+[example0:electron_selection] ##################################################
+            /// lepton must be above trigger threshold:
+            if(pt < (runNumber>290000? 27e3f : 25e3f)) continue;
+
+[example0:muon_selection] ######################################################
+            /// lepton must be above trigger threshold:
+            if(pt < (runNumber>290000? 27.3e3f : 21e3f)) continue;
+
+[example0:trigger_matching] ####################################################
+        /// Events must contain at least one lepton above trigger threshold
+        if(myTriggeringElectrons.size()+myTriggeringMuons.size() < 1) continue;
+
+[example1and2:trigcounters] ####################################################
+        unsigned nTrig1L = 0, nTrig2mu = 0;
+
+[example1and2:electron_selection] ##############################################
+            /// lepton must be above softest trigger threshold:
+            if((runNumber>320000 && pt<25e3f) /// 2017: 2e24
+				|| (runNumber>290000 && pt<18e3f) /// 2016: 2e17
+				|| (pt<13e3f)) continue; /// 2015: 2e12
+            /// also count leptons above single-lepton trigger threshold
+            if(pt >= (runNumber>290000? 27e3f : 25e3f)) ++nTrig1L;
+
+[example1:muon_selection] ######################################################
+            /// lepton must be above softest trigger threshold (mu8noL1 here):
+            if(pt < 10e3f) continue;
+            /// also count leptons above single-lepton trigger threshold
+            if(pt >= (runNumber>290000? 27.3e3f : 21e3f)) ++nTrig1L;
+            // and count muons suitable for the hard leg of the dimuon trigger
+            if(pt >= (runNumber>290000? 23e3f : 19e3f)) ++nTrig2mu;
+        
+[example2:muon_selection] ######################################################
+            /// lepton must be above softest trigger threshold (mu8noL1 here):
+            if(pt < 10e3f) continue;
+            /// also count leptons above single-lepton trigger threshold
+            if(pt >= (runNumber>290000? 27.3e3f : 21e3f)) ++nTrig1L;
+            /// and count muons suitable for the hard leg of the dimuon trigger
+            if(pt >= 25e3f) ++nTrig2mu;
+
+[example1:trigger_matching] ####################################################
+        /// Events must contain enough leptons to trigger
+        if(nTrig1L==0 /// single-lepton trigger
+            && myTriggeringElectrons.size()<2 /// dielectron
+            && (nTrig2mu==0 || myTriggeringMuons.size()<2)) /// dimuon
+        {
+            continue;
+        }
+
+[example2:trigger_matching] ####################################################
+        /// Events must contain enough leptons to trigger
+        if((nTrig1L==0 || (runNumber>=303638 && runNumber<320000)) /// single-lepton trigger (when used)
+            && myTriggeringElectrons.size()<2 /// dielectron
+            && (nTrig2mu==0 || myTriggeringMuons.size()<2)) /// dimuon
+        {
+            continue;
+        }
+
+[example3d3e:trigcounters] #####################################################
+        unsigned nTrig_e26 = 0, nTrig_e7 = 0, nTrig_e17 = 0;
+
+[example3a3b3c:electron_selection] #############################################
+            /// electron must be above softest trigger threshold (e12 here)
+            if(pt < 13e3f) continue;
+        
+[example3d3e:electron_selection] ###############################################
+            /// electron must be above softest trigger threshold (e7 here
+            if(pt < 7e3f) continue;
+            if(pt >= 18e3f) ++nTrig_e17;
+        
+[example3d3e:muon_selection] ###################################################
+            /// muon must be above softest trigger threshold (mu24 here)
+            if(pt < 25.2e3f) continue;
+        
+[example3a3b:tagging] ##########################################################
+        /// Let's pretend that the leading electron passes TightLH+isolation,
+		/// thus the event passes the selection; now we tag the electrons:
+        auto compareByPt = [](const xAOD::Electron*e1, const xAOD::Electron*e2)
+            { return e1->pt() < e2->pt(); };
+        auto leadingElectron = *std::max_element(myTriggeringElectrons.begin(),
+            myTriggeringElectrons.end(), compareByPt);
+		for(auto electron : myTriggeringElectrons)
+        {
+            /// Leading electron tagged as 'Signal' -> decorated value set to 1
+            /// Subleading electron(s) not tagged -> decorated value set to 0
+            dec_signal(*electron) = (electron==leadingElectron)? 1 : 0;
+        }
+        
+[example3a:trigger_matching] ###################################################
+        /// Events must contain at least two lepton above trigger threshold
+        if(myTriggeringElectrons.size() < 2) continue;
+
++[example3a3b:tagging]
+        
+[example3b:trigger_matching] ###################################################
+        if(myTriggeringElectrons.size() < 1) continue;
+        
++[example3a3b:tagging]
+        
+        /// Events must contain enough leptons to trigger
+        if(leadingElectron->pt() < 25e3f /// single-electron trigger
+            && myTriggeringElectrons.size() < 2) /// dielectron
+        {
+            continue;
+        }
+        
+[example3c:trigger_matching] ###################################################
+        /// Add 'Signal' decorations to random electrons
+        /// also count 'Signal' electrons above e24_xxx threshold
+        unsigned nTrig1L = 0;
+		for(auto electron : myTriggeringElectrons)
+        {
+            bool signal = bernoulliPdf(randomEngine);
+            dec_signal(*electron) = signal? 1 : 0;
+            if(signal && electron->pt()>25e3f) ++nTrig1L;
+        }
+        
+        /// Events must contain enough leptons to trigger
+        if(nTrig1L < 1 /// single-electron trigger
+            && myTriggeringElectrons.size() < 2) /// dielectron
+        {
+            continue;
+        }
+        
+[example3d:trigger_matching] ###################################################
+        /// Add 'MyMedium' & 'MyTight' decorations to random electrons
+        /// also count tight electrons above e26_xxx threshold
+        /// and medium electrons above e7_xxx threshold
+		for(auto electron : myTriggeringElectrons)
+        {
+            bool medium = bernoulliPdf(randomEngine);
+            dec_medium(*electron) = medium? 1 : 0;
+            if(medium && electron->pt()>8e3f) ++nTrig_e7;
+            bool tight = medium && bernoulliPdf(randomEngine);
+            dec_tight(*electron) = tight? 1 : 0;
+            if(tight && electron->pt()>27e3f) ++nTrig_e26;
+        }
+        
+        /// Events must contain enough leptons to trigger
+        if(nTrig_e26 < 1 /// single-electron trigger
+            && (nTrig_e7==0 || myTriggeringMuons.size()==0) /// electron-muon
+            && nTrig_e17 < 2) /// dielectron
+        {
+            continue;
+        }
+        
+[example3e:trigger_matching] ###################################################
+        /// Add 'PID' decorations to random electrons
+        /// also count 'Tight' electrons above e26_xxx threshold
+        /// and 'Medium' electrons above e7_xxx threshold
+		for(auto electron : myTriggeringElectrons)
+        {
+            bool medium = bernoulliPdf(randomEngine);
+            bool tight = medium && bernoulliPdf(randomEngine);
+            /// Set decorated value to 2 for TightLH+iso or 1 for MediumLH
+            dec_pid(*electron) = tight? 2 : medium? 1 : 0;
+            if(medium && electron->pt()>8e3f) ++nTrig_e7;
+            if(tight && electron->pt()>27e3f) ++nTrig_e26;
+        }
+        
+        /// Events must contain enough leptons to trigger
+        if(nTrig_e26 < 1 /// single-electron trigger
+            && (nTrig_e7==0 || myTriggeringMuons.size()==0) /// electron-muon
+            && nTrig_e17 < 2) /// dielectron
+        {
+            continue;
+        }
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/generateExamples.py b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/generateExamples.py
new file mode 100755
index 0000000000000000000000000000000000000000..76d5ea619ae66f1a52b3a7727a0f6b2a9d2b691b
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/generateExamples.py
@@ -0,0 +1,221 @@
+#!/usr/bin/env python
+import copy, re, os, sys
+
+wdir = sys.argv[0].replace('generateExamples.py', '')
+if not os.path.isabs(wdir): wdir = os.getcwd() + '/' + wdir
+
+def import_skeleton(discarded_blocks = []):
+    filename = 'skeleton.cxx'
+    discard = False
+    first_discarded_line = 0
+    blocks = []
+    buffer = ''
+    with open(wdir + filename,'r') as f:
+        linenumber = 0
+        for line in f:
+            linenumber += 1
+            if line.startswith('['):
+                opening = (line[1] != '/')
+                if ']' not in line:
+                    print "Parsing error on %s line %d: character ']' not found"%(filename,linenumber)
+                    exit(-1)
+                token = line.split(']')[0][(1 if opening else 2):]
+                if opening:
+                    if token in blocks:
+                        print "Parsing error on %s line %d: request for opening block [%s] which is already open"%(filename,linenumber,token)
+                        exit(-1)
+                    blocks.append(token)
+                else:
+                    if len(blocks)==0 or blocks[-1] != token:
+                        print "Parsing error on %s line %d: request for closing block [%s] which either isn't open or isn't the last one opened"%(filename,linenumber,token)
+                        exit(-1)
+                    blocks.pop()
+                will_discard = any(b in discarded_blocks for b in blocks)
+                if discard and not will_discard:
+                    print '   discarded lines %d - %d from block [%s]'%(first_discarded_line,linenumber,token)
+                elif not discard and will_discard:
+                    first_discarded_line = linenumber
+                discard = will_discard
+                continue
+            if discard: continue
+            if 'DATA2015' in blocks: comma = ',' if ('DATA2016' not in discarded_blocks or 'DATA2017' not in discarded_blocks) else ''
+            elif 'DATA2016' in blocks: comma = ',' if ('DATA2017' not in discarded_blocks) else ''
+            elif 'DATA2017' in blocks: comma = ''
+            else: comma = None
+            if comma is not None: line = line.replace(' MAYBE_COMMA', comma)
+            buffer += line
+    return buffer
+
+def import_stuffing(src, tag, comment_out = False):
+	lines = None
+	with open(wdir + src, 'r') as f:
+		for line in f:
+			if line.startswith('[example%s]'%(tag)): lines = ['/*\n'] if comment_out else []
+			elif lines is not None:
+				if line.startswith('[example'): break
+				if line.startswith('+[example') and not comment_out: lines.append(import_stuffing(src, line[9:].split(']')[0], False))
+				else: lines.append((' * ' if comment_out else '') + line)
+	if lines is None or len(lines)==0:
+		print 'ERROR: unable to import example' + tag + ' when parsing ' + src
+		exit(-1)
+	if comment_out: lines.append(' */')
+	elif lines[-1].isspace(): del lines[-1]
+	return ''.join(lines)
+	
+def import_comments(tag):
+	return import_stuffing('comments.txt', tag, True)
+	
+def import_trigglob_config(tag):
+	return import_stuffing('trigglob_config.cxx', tag, False)
+
+def import_cptools_config(tag):
+	return import_stuffing('cptools_config.cxx', tag, False)
+
+def import_eventloop(tag):
+	return import_stuffing('eventloop.cxx', tag, False)
+	
+def safe_format(txt, replacements):
+    newtxt = txt.replace('{','{{').replace('}','}}')
+    for token in replacements:
+        newtxt = newtxt.replace('{{'+token+'}}','{'+token+'}')
+    newtxt = newtxt.format(**replacements).replace('\t','    ')
+    newtxt = re.sub(r'\n\s*?DELETE\-THIS\-LINE\s*?\n','\n',newtxt)
+    if newtxt.count('DELETE-THIS-LINE') != 0:
+        print 'ERROR: not all DELETE-THIS-LINE symbols were replaced'
+    return newtxt
+    
+replacements = {
+    'head_comments': 'DELETE-THIS-LINE', 
+    'example_number': 'DELETE-THIS-LINE',
+    'electron_extraproperties_declare': 'DELETE-THIS-LINE', 
+    'electron_toolconfigs': 'DELETE-THIS-LINE', 
+    'electron_tools_properties_set': 'DELETE-THIS-LINE',
+    'electron_extraproperties_fill': 'DELETE-THIS-LINE',
+    'muon_extraproperties_fill': 'DELETE-THIS-LINE',
+    'trigglob_properties_set': 'DELETE-THIS-LINE',
+    'eventloop_trigcounters': 'DELETE-THIS-LINE',
+    'eventloop_electron_selection': 'DELETE-THIS-LINE',
+    'eventloop_muon_selection': 'DELETE-THIS-LINE',
+    'trigger_matching_requirements': 'DELETE-THIS-LINE',
+}
+
+def write_example(subs,tokens=[]):
+    path = wdir + '/../'
+    txt = import_skeleton(tokens) # 'ELECTRONS', 'MUONS', 'MULTITRIGGERS', '2016_RUNS'
+    txt = safe_format(txt,r)
+    filename = 'TrigGlobEffCorrExample%s.cxx'%(subs['example_number'])
+    dest = path + filename
+    writeCXX = True
+    if os.path.exists(dest):
+        with open(dest,'r') as f:
+            oldtxt = f.read()
+            if txt==oldtxt:
+                print "INFO: %s didn't change, it won't be overwritten"%(filename)
+                writeCXX = False
+    if writeCXX:
+        with open(dest,'w') as f:
+            f.write(txt)
+
+r = copy.deepcopy(replacements)
+r['head_comments'] = import_comments('0')
+r['example_number'] = '0'
+r['electron_tools_properties_set'] = import_cptools_config('0:electron_properties_set')
+r['trigglob_properties_set'] = import_trigglob_config('0')
+r['eventloop_electron_selection'] = import_eventloop('0:electron_selection')
+r['eventloop_muon_selection'] = import_eventloop('0:muon_selection')
+r['trigger_matching_requirements'] = import_eventloop('0:trigger_matching')
+write_example(r, ['MULTITRIGGERS','SPLITFUNC'])
+
+
+r = copy.deepcopy(replacements)
+r['head_comments'] = import_comments('1')
+r['example_number'] = '1'
+r['electron_extraproperties_declare'] = import_cptools_config('1and2:electron_extraproperties_declare')
+r['electron_toolconfigs'] = import_cptools_config('1:electron_toolconfigs')
+r['electron_tools_properties_set'] = import_cptools_config('1and2:electron_properties_set')
+r['electron_extraproperties_fill'] = import_cptools_config('1and2:electron_extraproperties_fill')
+r['trigglob_properties_set'] = import_trigglob_config('1')
+r['eventloop_trigcounters'] = import_eventloop('1and2:trigcounters')
+r['eventloop_electron_selection'] = import_eventloop('1and2:electron_selection')
+r['eventloop_muon_selection'] = import_eventloop('1:muon_selection')
+r['trigger_matching_requirements'] = import_eventloop('1:trigger_matching')
+write_example(r,['SPLITFUNC'])
+
+
+r = copy.deepcopy(replacements)
+r['head_comments'] = import_comments('2')
+r['example_number'] = '2'
+r['electron_extraproperties_declare'] = import_cptools_config('1and2:electron_extraproperties_declare')
+r['electron_toolconfigs'] = import_cptools_config('2:electron_toolconfigs')
+r['electron_tools_properties_set'] = import_cptools_config('1and2:electron_properties_set')
+r['electron_extraproperties_fill'] = import_cptools_config('1and2:electron_extraproperties_fill')
+r['trigglob_properties_set'] = import_trigglob_config('2')
+r['eventloop_trigcounters'] = import_eventloop('1and2:trigcounters')
+r['eventloop_electron_selection'] = import_eventloop('1and2:electron_selection')
+r['eventloop_muon_selection'] = import_eventloop('2:muon_selection')
+r['trigger_matching_requirements'] = import_eventloop('2:trigger_matching')
+write_example(r,['SPLITFUNC'])
+
+r = copy.deepcopy(replacements)
+r['head_comments'] = import_comments('3com') + '\n' + import_comments('3a')
+r['example_number'] = '3a'
+r['electron_extraproperties_declare'] = import_cptools_config('3a3b:electron_extraproperties_declare')
+r['electron_toolconfigs'] = import_cptools_config('3a:electron_toolconfigs')
+r['electron_tools_properties_set'] = import_cptools_config('3:electron_properties_set')
+r['electron_extraproperties_fill'] = import_cptools_config('3:electron_extraproperties_fill')
+r['trigglob_properties_set'] = import_trigglob_config('3a')
+r['eventloop_electron_selection'] = import_eventloop('3a3b3c:electron_selection')
+r['trigger_matching_requirements'] = import_eventloop('3a:trigger_matching')
+write_example(r,['MUONS','DATA2016','DATA2017'])
+
+r = copy.deepcopy(replacements)
+r['head_comments'] = import_comments('3com') + '\n' + import_comments('3b')
+r['example_number'] = '3b'
+r['electron_extraproperties_declare'] = import_cptools_config('3c:electron_extraproperties_declare')
+r['electron_toolconfigs'] = import_cptools_config('3b:electron_toolconfigs')
+r['electron_tools_properties_set'] = import_cptools_config('3:electron_properties_set')
+r['electron_extraproperties_fill'] = import_cptools_config('3:electron_extraproperties_fill')
+r['trigglob_properties_set'] = import_trigglob_config('3b3c')
+r['eventloop_electron_selection'] = import_eventloop('3a3b3c:electron_selection')
+r['trigger_matching_requirements'] = import_eventloop('3b:trigger_matching')
+write_example(r,['MUONS','DATA2016','DATA2017'])
+
+r = copy.deepcopy(replacements)
+r['head_comments'] = import_comments('3com') + '\n' + import_comments('3c')
+r['example_number'] = '3c'
+r['electron_extraproperties_declare'] = import_cptools_config('3c:electron_extraproperties_declare')
+r['electron_toolconfigs'] = import_cptools_config('3c:electron_toolconfigs')
+r['electron_tools_properties_set'] = import_cptools_config('3:electron_properties_set')
+r['electron_extraproperties_fill'] = import_cptools_config('3:electron_extraproperties_fill')
+r['trigglob_properties_set'] = import_trigglob_config('3b3c')
+r['eventloop_electron_selection'] = import_eventloop('3a3b3c:electron_selection')
+r['trigger_matching_requirements'] = import_eventloop('3c:trigger_matching')
+write_example(r,['MUONS','DATA2016','DATA2017'])
+
+r = copy.deepcopy(replacements)
+r['head_comments'] = import_comments('3com') + '\n' + import_comments('3d')
+r['example_number'] = '3d'
+r['electron_extraproperties_declare'] = import_cptools_config('3d:electron_extraproperties_declare')
+r['electron_toolconfigs'] = import_cptools_config('3d:electron_toolconfigs')
+r['electron_tools_properties_set'] = import_cptools_config('3:electron_properties_set')
+r['electron_extraproperties_fill'] = import_cptools_config('3:electron_extraproperties_fill')
+r['trigglob_properties_set'] = import_trigglob_config('3d')
+r['eventloop_trigcounters'] = import_eventloop('3d3e:trigcounters')
+r['eventloop_electron_selection'] = import_eventloop('3d3e:electron_selection')
+r['eventloop_muon_selection'] = import_eventloop('3d3e:muon_selection')
+r['trigger_matching_requirements'] = import_eventloop('3d:trigger_matching')
+write_example(r,['DATA2015','DATA2017'])
+
+r = copy.deepcopy(replacements)
+r['head_comments'] = import_comments('3com') + '\n' + import_comments('3e')
+r['example_number'] = '3e'
+r['electron_extraproperties_declare'] = import_cptools_config('3e:electron_extraproperties_declare')
+r['electron_toolconfigs'] = import_cptools_config('3e:electron_toolconfigs')
+r['electron_tools_properties_set'] = import_cptools_config('3:electron_properties_set')
+r['electron_extraproperties_fill'] = import_cptools_config('3:electron_extraproperties_fill')
+r['trigglob_properties_set'] = import_trigglob_config('3e')
+r['eventloop_trigcounters'] = import_eventloop('3d3e:trigcounters')
+r['eventloop_electron_selection'] = import_eventloop('3d3e:electron_selection')
+r['eventloop_muon_selection'] = import_eventloop('3d3e:muon_selection')
+r['trigger_matching_requirements'] = import_eventloop('3e:trigger_matching')
+write_example(r,['DATA2015','DATA2017'])
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/skeleton.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/skeleton.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..3a420c681589f163d708437c2da50f453e688bdd
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/skeleton.cxx
@@ -0,0 +1,296 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+/// Based on CPToolTester.cxx (A. Kraznahorkay) 
+/// and ut_ath_checkTrigger_test.cxx (W. Buttinger)
+/// Contact: jmaurer@cern.ch
+{head_comments}
+
+// ROOT include(s):
+#include <TFile.h>
+#include <TError.h>
+
+// Infrastructure include(s):
+#ifdef XAOD_STANDALONE
+    #include "xAODRootAccess/Init.h"
+    #include "xAODRootAccess/TEvent.h"
+    #include "xAODRootAccess/TStore.h"
+#else
+    #include "AthAnalysisBaseComps/AthAnalysisHelper.h"
+    #include "POOLRootAccess/TEvent.h"
+#endif
+
+// EDM include(s):
+#include "AsgTools/AnaToolHandle.h"
+#include "EgammaAnalysisInterfaces/IAsgElectronEfficiencyCorrectionTool.h"
+#include "MuonAnalysisInterfaces/IMuonTriggerScaleFactors.h"
+#include "TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODMuon/MuonContainer.h"
+#include "PATCore/PATCoreEnums.h"
+#include "AthContainers/AuxElement.h"
+
+// stdlib include(s):
+[SPLITFUNC]
+#include <sstream>
+[/SPLITFUNC]
+#include <random>
+#include <vector>
+#include <array>
+using std::vector;
+using std::string;
+
+[SPLITFUNC]
+/// Helper function to split comma-delimited strings
+namespace { vector<string> split_comma_delimited(const std::string&); }
+
+[/SPLITFUNC]
+#define MSGSOURCE "Example {example_number}"
+
+int main(int argc, char* argv[])
+{
+	const char* filename = nullptr;
+	bool debug = false, cmdline_error = false, toys = false;
+	for(int i=1;i<argc;++i)
+	{
+		if(string(argv[i]) == "--debug") debug = true;
+		else if(string(argv[i]) == "--toys") toys = true;
+		else if(!filename && *argv[i]!='-') filename = argv[i];
+		else cmdline_error = true;
+	}
+    if(!filename || cmdline_error)
+    {
+        Error(MSGSOURCE, "No file name received!");
+        Error(MSGSOURCE, "  Usage: %s [--debug] [--toys] [DxAOD file name]", argv[0]);
+        return 1;
+    }
+    #ifdef XAOD_STANDALONE
+        xAOD::Init(MSGSOURCE).ignore();
+        TFile* file = TFile::Open(filename, "READ");
+        if(!file)
+        {
+            Error(MSGSOURCE, "Unable to open file!");
+            return 2;
+        }
+        xAOD::TEvent event(xAOD::TEvent::kClassAccess);
+        xAOD::TStore store;
+        StatusCode::enableFailure();
+    #else
+       IAppMgrUI* app = POOL::Init();
+       POOL::TEvent event(POOL::TEvent::kClassAccess);
+       TString file(filename);
+    #endif
+    event.readFrom(file).ignore();
+    Long64_t entries = event.getEntries();
+    Info(MSGSOURCE, "Number of events in the file: %lli", entries);
+
+[ELECTRONS]
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the electron CP tools");
+    /// For property 'ElectronEfficiencyTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronEffTools;
+    /// For property 'ElectronScaleFactorTools':
+    ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronSFTools; 
+    {electron_extraproperties_declare}
+    /// RAII on-the-fly creation of electron CP tools:
+    vector<asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool>> factory;
+[MULTITRIGGERS]
+{electron_toolconfigs}
+[/MULTITRIGGERS]
+    const char* mapPath = "ElectronEfficiencyCorrection/2015_2017/"
+            "rel21.2/Moriond_February2018_v2/map6.txt";
+[MULTITRIGGERS]
+    for(auto& cfg : toolConfigs) /// one instance per trigger leg x working point
+[/MULTITRIGGERS]
+    for(int j=0;j<2;++j) /// two instances: 0 -> MC efficiencies, 1 -> SFs
+    {
+        string name = "AsgElectronEfficiencyCorrectionTool/"
+                + ((j? "ElTrigEff_" : "ElTrigSF_")
+                + std::to_string(factory.size()/2));
+        auto t = factory.emplace(factory.end(), name);
+        t->setProperty("MapFilePath", mapPath).ignore();
+{electron_tools_properties_set}
+        t->setProperty("CorrelationModel", "TOTAL").ignore();
+        t->setProperty("ForceDataType", (int)PATCore::ParticleDataType::Full).ignore();
+        if(t->initialize() != StatusCode::SUCCESS)
+        {
+            Error(MSGSOURCE, "Unable to initialize the electron CP tool <%s>!",
+                    t->name().c_str());
+            return 3;
+        }
+        auto& handles = (j? electronSFTools : electronEffTools);
+        handles.push_back(t->getHandle());
+{electron_extraproperties_fill}
+    }
+
+[/ELECTRONS]
+[MUONS]
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the muon CP tools");
+    /// For property 'MuonTools':
+    ToolHandleArray<CP::IMuonTriggerScaleFactors> muonTools;
+    asg::AnaToolHandle<CP::IMuonTriggerScaleFactors> muonTool("CP::MuonTriggerScaleFactors/MuonTrigEff");
+    muonTool.setProperty("CalibrationRelease", "180905_TriggerUpdate").ignore();
+    muonTool.setProperty("MuonQuality", "Tight").ignore();
+    muonTool.setProperty("useRel207", false).ignore();
+    if(muonTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the muon CP tool!");
+        return 3;
+    }
+    muonTools.push_back(muonTool.getHandle());
+{muon_extraproperties_fill}
+    
+[/MUONS]
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Configuring the global trigger SF tool");
+    asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> myTool("TrigGlobalEfficiencyCorrectionTool/TrigGlobal");
+[ELECTRONS]
+    myTool.setProperty("ElectronEfficiencyTools", electronEffTools).ignore();
+    myTool.setProperty("ElectronScaleFactorTools", electronSFTools).ignore();
+[/ELECTRONS]
+[MUONS]
+    myTool.setProperty("MuonTools", muonTools).ignore();
+[/MUONS]
+{trigglob_properties_set}
+    if(debug) myTool.setProperty("OutputLevel", MSG::DEBUG).ignore();
+    if(toys) myTool.setProperty("NumberOfToys", 1000).ignore();
+    if(myTool.initialize() != StatusCode::SUCCESS)
+    {
+        Error(MSGSOURCE, "Unable to initialize the TrigGlob tool!");
+        return 3;
+    }
+    
+    /// Uniform random run number generation spanning the target dataset.
+    /// In real life, use the PileupReweightingTool instead!
+    const unsigned periodRuns[] = {
+[DATA2015]
+        /// 2015 periods D-H, J
+        276073, 278727, 279932, 280423, 281130, 282625 MAYBE_COMMA
+[/DATA2015]
+[DATA2016]
+        /// 2016 periods A-L
+        296939, 300345, 301912, 302737, 303638, 303943, 305291, 307124, 
+        305359, 309311, 310015 MAYBE_COMMA
+[/DATA2016]
+[DATA2017]
+        /// 2017 periods B-K
+        325713, 329385, 330857, 332720, 334842, 335302, 336497, 336832, 
+        338183 MAYBE_COMMA
+[/DATA2017]
+    };
+    std::uniform_int_distribution<unsigned> uniformPdf(0,
+            sizeof(periodRuns)/sizeof(*periodRuns) - 1);
+    std::default_random_engine randomEngine;
+    
+    SG::AuxElement::ConstAccessor<int> truthType("truthType");
+    SG::AuxElement::ConstAccessor<int> truthOrigin("truthOrigin");
+    
+    /* ********************************************************************** */
+    
+    Info(MSGSOURCE, "Starting the event loop");
+    unsigned errors = 0;
+    double nSuitableEvents = 0., sumW = 0.;
+    for(Long64_t entry = 0; entry < entries; ++entry)
+    {
+        event.getEntry(entry);
+        
+        /// Get a random run number, and decorate the event info
+        const xAOD::EventInfo* eventInfo = nullptr;
+        event.retrieve(eventInfo,"EventInfo").ignore();
+        unsigned runNumber = periodRuns[uniformPdf(randomEngine)];
+        eventInfo->auxdecor<unsigned>("RandomRunNumber") = runNumber;
+
+{eventloop_trigcounters}        
+        vector<const xAOD::Electron*> myTriggeringElectrons;
+[ELECTRONS]
+        const xAOD::ElectronContainer* electrons = nullptr;
+        event.retrieve(electrons,"Electrons").ignore();
+        for(auto electron : *electrons)
+        {
+            if(!electron->caloCluster()) continue;
+            float eta = fabs(electron->caloCluster()->etaBE(2));
+            float pt = electron->pt();
+            if(pt<10e3f || eta>=2.47) continue;
+            if(!truthType.isAvailable(*electron)) continue;
+            if(!truthOrigin.isAvailable(*electron)) continue;
+            int t = truthType(*electron), o = truthOrigin(*electron);
+            if(t!=2 || !(o==10 || (o>=12 && o<=22) || o==43)) continue;
+{eventloop_electron_selection}
+            myTriggeringElectrons.push_back(electron);
+        }
+
+[/ELECTRONS]
+        vector<const xAOD::Muon*> myTriggeringMuons;
+[MUONS]
+        const xAOD::MuonContainer* muons = nullptr;
+        event.retrieve(muons,"Muons").ignore();
+        for(auto muon : *muons)
+        {
+            if(runNumber >= 324320) break; // delete line once all SFs available for 2017
+            float pt = muon->pt();
+            if(pt<10e3f || fabs(muon->eta())>=2.5) continue;
+            auto mt = muon->muonType();
+            if(mt!=xAOD::Muon::Combined && mt!=xAOD::Muon::MuonStandAlone) continue;
+            auto& mtp = *(muon->primaryTrackParticle());
+            if(!truthType.isAvailable(mtp)) continue;
+            if(!truthOrigin.isAvailable(mtp)) continue;
+            int t = truthType(mtp), o = truthOrigin(mtp);
+            if(t!=6 || !(o==10 || (o>=12 && o<=22) || o==43)) continue;
+{eventloop_muon_selection}
+            myTriggeringMuons.push_back(muon);
+        }
+[/MUONS]
+
+{trigger_matching_requirements}
+
+        /// Finally retrieve the global trigger scale factor
+        double sf = 1.;
+        auto cc = myTool->getEfficiencyScaleFactor(myTriggeringElectrons,
+			myTriggeringMuons, sf);
+        if(cc==CP::CorrectionCode::Ok)
+        {
+            nSuitableEvents += 1;
+            sumW += sf;
+        }
+        else
+        {
+            Warning(MSGSOURCE, "Scale factor evaluation failed");
+            ++errors;
+        }
+        if(errors>10)
+        {
+            Error(MSGSOURCE, "Too many errors reported!");
+            break;
+        }
+    }
+    Info(MSGSOURCE, "Average scale factor: %f (over %ld events)",
+            sumW / nSuitableEvents, long(nSuitableEvents));
+    #ifndef XAOD_STANDALONE
+        app->finalize();
+    #endif
+    return errors? 4 : 0;
+}
+
+[SPLITFUNC]
+/// Split comma-delimited string
+namespace
+{
+	inline vector<string> split_comma_delimited(const string& s)
+	{
+		std::stringstream ss(s);
+		std::vector<std::string> tokens;
+		std::string token;
+		while(std::getline(ss, token, ','))
+		{
+			if(token.length()) tokens.push_back(token);
+		}
+		return tokens;
+	}
+}
+[/SPLITFUNC]
\ No newline at end of file
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/trigglob_config.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/trigglob_config.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..fba54f2cf896b0839c7d20b62b31200cb17026dd
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/examples/generator/trigglob_config.cxx
@@ -0,0 +1,101 @@
+[example0] #####################################################################
+    const char* triggers2015 = 
+        "mu20_iloose_L1MU15_OR_mu50"
+        "|| e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose";
+    myTool.setProperty("TriggerCombination2015", triggers2015).ignore();
+    const char* triggers2016and2017 = 
+        "mu26_ivarmedium_OR_mu50"
+        "|| e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0";
+    myTool.setProperty("TriggerCombination2016", triggers2016and2017).ignore();
+    myTool.setProperty("TriggerCombination2017", triggers2016and2017).ignore();
+
+[example1] #####################################################################
+    const char* triggers2015 = 
+        "mu20_iloose_L1MU15_OR_mu50"
+        "|| mu18_mu8noL1"
+        "|| e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose"
+        "|| 2e12_lhloose_L12EM10VH";
+    myTool.setProperty("TriggerCombination2015", triggers2015).ignore();
+    const char* triggers2016 = 
+        "mu26_ivarmedium_OR_mu50"
+        "|| mu22_mu8noL1"
+        "|| e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"
+        "|| 2e17_lhvloose_nod0";
+    myTool.setProperty("TriggerCombination2016", triggers2016).ignore();
+    const char* triggers2017 = 
+        "mu26_ivarmedium_OR_mu50"
+        "|| mu22_mu8noL1"
+        "|| e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"
+        "|| 2e24_lhvloose_nod0";
+    myTool.setProperty("TriggerCombination2017", triggers2017).ignore();
+    myTool.setProperty("ListOfLegsPerTool", legsPerTool).ignore();
+        
+[example2] #####################################################################
+    /// Fill a map with the trigger combinations
+    std::map<string, string> triggers;
+    triggers["2015"] = 
+        "mu20_iloose_L1MU15_OR_mu50"
+        "|| mu18_mu8noL1"
+        "|| e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose"
+        "|| 2e12_lhloose_L12EM10VH";
+    triggers["2016:A-2016:D"] = 
+        "mu26_ivarmedium_OR_mu50"
+        "|| mu22_mu8noL1"
+        "|| e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"
+        "|| 2e17_lhvloose_nod0";
+    triggers["303638-311481"] = /// (change triggers for fun in 2016 periods E-L)
+        "mu22_mu8noL1"
+        "|| 2e17_lhvloose_nod0";
+    triggers["2017"] = 
+        "mu26_ivarmedium_OR_mu50"
+        "|| mu22_mu8noL1"
+        "|| e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"
+        "|| 2e24_lhvloose_nod0";
+    myTool.setProperty("TriggerCombination", triggers).ignore();
+    myTool.setProperty("ListOfLegsPerTool", legsPerTool).ignore();
+    /// Change for fun the pT thresholds used by the tool for mu18 and mu22
+    std::map<string, string> thresholds;
+    thresholds["mu18"] = "25e3";
+    thresholds["mu22"] = "25e3";
+    myTool.setProperty("OverrideThresholds", thresholds).ignore();
+
+[example3com] ##################################################################
+    myTool.setProperty("ListOfLegsPerTool", legsPerTool).ignore();
+    myTool.setProperty("ListOfTagsPerTool", tagsPerTool).ignore();
+    myTool.setProperty("ListOfLegsPerTag", legsPerTag).ignore();
+        
+[example3a] ####################################################################
+    const char* triggers2015 = "2e12_lhloose_L12EM10VH";
+    myTool.setProperty("TriggerCombination2015", triggers2015).ignore();
+    myTool.setProperty("LeptonTagDecorations", "Signal").ignore();
++[example3com]
+        
+[example3b3c] ##################################################################
+    const char* triggers2015 = 
+        "e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose"
+        "|| 2e12_lhloose_L12EM10VH";
+    myTool.setProperty("TriggerCombination2015", triggers2015).ignore();
+    myTool.setProperty("LeptonTagDecorations", "Signal").ignore();
++[example3com]
+ 
+[example3d] ####################################################################
+    const char* triggers2016 = 
+        "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"
+        "|| e7_lhmedium_nod0_mu24"
+        "|| 2e17_lhvloose_nod0";
+    myTool.setProperty("TriggerCombination2016", triggers2016).ignore();
+    /// Listing 'Tight' first as it has higher priority (an electron with both
+    /// non-zero 'Tight'+'Medium' decorations will then be tagged as 'Tight')
+    myTool.setProperty("LeptonTagDecorations", "MyTight,MyMedium").ignore();
++[example3com]
+        
+[example3e] ####################################################################
+    const char* triggers2016 = 
+        "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"
+        "|| e7_lhmedium_nod0_mu24"
+        "|| 2e17_lhvloose_nod0";
+    myTool.setProperty("TriggerCombination2016", triggers2016).ignore();
+    /// Special character '?' indicates that the decorated value is to be 
+    /// suffixed to the name (=> 'PID1' for medium, 'PID2' for tight)
+    myTool.setProperty("LeptonTagDecorations", "PID?").ignore();
++[example3com]
\ No newline at end of file
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/src/TrigGlobalEfficiencyCorrection_entries.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/src/TrigGlobalEfficiencyCorrection_entries.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..0043eb6da2abbf3b56376fdbebc2f30fbde83440
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/src/TrigGlobalEfficiencyCorrection_entries.cxx
@@ -0,0 +1,3 @@
+#include "TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrectionTool.h"
+
+DECLARE_COMPONENT( TrigGlobalEfficiencyCorrectionTool )
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/util/TrigGlobEffCorrValidation.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/util/TrigGlobEffCorrValidation.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..d91f8f9ca135fe5da82181d578347d06972c4cc2
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/util/TrigGlobEffCorrValidation.cxx
@@ -0,0 +1,654 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+// contact: jmaurer@cern.ch
+
+#include "xAODRootAccess/Init.h"
+#include "xAODRootAccess/TStore.h"
+#include "AsgTools/AnaToolHandle.h"
+#include "TriggerAnalysisInterfaces/ITrigGlobalEfficiencyCorrectionTool.h"
+#include "EgammaAnalysisInterfaces/IAsgElectronEfficiencyCorrectionTool.h"
+#include "EgammaAnalysisInterfaces/IAsgPhotonEfficiencyCorrectionTool.h"
+#include "MuonAnalysisInterfaces/IMuonTriggerScaleFactors.h"
+#include "xAODEgamma/Electron.h"
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODEgamma/ElectronAuxContainer.h"
+#include "xAODMuon/MuonContainer.h"
+#include "xAODMuon/MuonAuxContainer.h"
+#include "PATInterfaces/ISystematicsTool.h"
+#include "xAODEgamma/Photon.h"
+#include "xAODEgamma/PhotonContainer.h"
+#include "xAODEgamma/PhotonAuxContainer.h"
+
+#include <random>
+#include <functional>
+#include <algorithm>
+#include <initializer_list>
+
+#define MSGSOURCE "TrigGlobEffCorrValidation"
+
+class SimpleElectronEfficiencyCorrectionTool : virtual public IAsgElectronEfficiencyCorrectionTool, public asg::AsgTool
+{
+	ASG_TOOL_CLASS(SimpleElectronEfficiencyCorrectionTool, IAsgElectronEfficiencyCorrectionTool)
+	std::function<double(float)> m_func;
+public:
+	SimpleElectronEfficiencyCorrectionTool(const std::string& name, double eff = 0.8) : AsgTool(name), m_func([=](float){return eff;}) {}
+	SimpleElectronEfficiencyCorrectionTool(const std::string& name, const std::function<double(float)>& func) : AsgTool(name), m_func(func) {}
+	virtual ~SimpleElectronEfficiencyCorrectionTool() {}
+	virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::Electron& electron, double& efficiencyScaleFactor) const override
+	{
+		efficiencyScaleFactor = m_func(electron.pt());
+		return CP::CorrectionCode::Ok;
+	}
+	virtual CP::CorrectionCode applyEfficiencyScaleFactor(const xAOD::Electron&) const override { return CP::CorrectionCode::Error; }
+	virtual bool isAffectedBySystematic(const CP::SystematicVariation&) const override { return false; }
+	virtual CP::SystematicSet affectingSystematics() const override { return CP::SystematicSet(); }
+	virtual CP::SystematicSet recommendedSystematics() const override { return CP::SystematicSet(); }
+	virtual StatusCode applySystematicVariation(const CP::SystematicSet&) override { return StatusCode::SUCCESS; }
+	virtual int systUncorrVariationIndex( const xAOD::Electron &) const override { return 0; }
+};
+
+class SimplePhotonEfficiencyCorrectionTool : virtual public IAsgPhotonEfficiencyCorrectionTool, public asg::AsgTool
+{
+	ASG_TOOL_CLASS(SimplePhotonEfficiencyCorrectionTool, IAsgPhotonEfficiencyCorrectionTool)
+	std::function<double(float)> m_func;
+public:
+	SimplePhotonEfficiencyCorrectionTool(const std::string& name, double eff = 0.8) : AsgTool(name), m_func([=](float){return eff;}) {}
+	SimplePhotonEfficiencyCorrectionTool(const std::string& name, const std::function<double(float)>& func) : AsgTool(name), m_func(func) {}
+	virtual ~SimplePhotonEfficiencyCorrectionTool() {}
+	virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::Egamma& photon, double& efficiencyScaleFactor) const override
+	{
+		efficiencyScaleFactor = m_func(photon.pt());
+		return CP::CorrectionCode::Ok;
+	}
+	virtual CP::CorrectionCode getEfficiencyScaleFactorError(const xAOD::Egamma&, double&) const override { return CP::CorrectionCode::Error; }
+	virtual CP::CorrectionCode applyEfficiencyScaleFactor(xAOD::Egamma&) const override { return CP::CorrectionCode::Error; }
+	virtual bool isAffectedBySystematic(const CP::SystematicVariation&) const override { return false; }
+	virtual CP::SystematicSet affectingSystematics() const override { return CP::SystematicSet(); }
+	virtual CP::SystematicSet recommendedSystematics() const override { return CP::SystematicSet(); }
+	virtual StatusCode applySystematicVariation(const CP::SystematicSet&) override { return StatusCode::SUCCESS; }
+};
+
+class SimpleMuonTriggerScaleFactors : public CP::IMuonTriggerScaleFactors, public asg::AsgTool 
+{
+	ASG_TOOL_CLASS(SimpleMuonTriggerScaleFactors, CP::IMuonTriggerScaleFactors)
+	std::map<std::string, std::function<double(float)>> m_efficiencies;
+public:
+	SimpleMuonTriggerScaleFactors(const std::string& name, const std::map<std::string,std::function<double(float)>>& efficiencies = {}) : AsgTool(name)
+	{
+		for(auto& kv : efficiencies)
+		{
+			if(kv.first[0] != 'm') continue;
+			std::string leg;
+			for(char c : kv.first)
+			{
+				if(c=='u' && leg.back()=='m') leg.replace(leg.end()-1, leg.end(), "HLT_mu");
+				else leg.push_back(c);
+			}
+			m_efficiencies.emplace(leg, kv.second);
+		}
+	}
+	virtual ~SimpleMuonTriggerScaleFactors() {}
+	virtual StatusCode initialize(void) override { return StatusCode::SUCCESS; }
+	virtual CP::CorrectionCode getTriggerScaleFactor(const xAOD::MuonContainer&, Double_t&, const std::string&) const override { return CP::CorrectionCode::Ok; }
+	virtual CP::CorrectionCode getTriggerScaleFactor(const xAOD::Muon&, Double_t&, const std::string&) const override { return CP::CorrectionCode::Ok; }
+	virtual CP::CorrectionCode getTriggerEfficiency(const xAOD::Muon& muon, Double_t& efficiency, const std::string& trig, Bool_t) const override
+	{
+		auto itr = m_efficiencies.find(trig);
+		if(itr != m_efficiencies.end())
+		{
+			efficiency = itr->second(muon.pt());
+			return CP::CorrectionCode::Ok;
+		}
+		return CP::CorrectionCode::Error;
+	}
+	virtual int getBinNumber(const xAOD::Muon&, const std::string&) const override { return 0; };
+    virtual bool isAffectedBySystematic(const CP::SystematicVariation&) const override { return false; }
+	virtual CP::SystematicSet affectingSystematics() const override { return CP::SystematicSet(); }
+	virtual CP::SystematicSet recommendedSystematics() const override { return CP::SystematicSet(); }
+	virtual StatusCode applySystematicVariation(const CP::SystematicSet&) override { return StatusCode::SUCCESS; }
+	virtual bool isTriggerSupported(const std::string& ) const override {return false;}
+};
+
+struct Config
+{
+	std::string testName;
+	std::string triggers = "";
+	unsigned minLeptons = 1;
+	unsigned maxLeptons = 5;
+	std::vector<float> leptonPtValues;
+	std::map<std::string, std::function<double(float)>> efficiencies;
+	std::function<bool(const std::vector<const xAOD::Electron*>&,const std::vector<const xAOD::Muon*>&,const std::vector<const xAOD::Photon*>&)> eventSelection = nullptr;
+	double expectedEfficiency = -1.;
+	double expectedEfficiencyTolerance = 1e-6;
+	bool debug = false;
+	
+	Config(const char* name) : testName(name) { leptonPtValues = {30e4f}; }
+	Config& setTriggers(const std::string& t) { triggers = t; return *this; }
+	Config& setLeptonPDF(unsigned nmin, unsigned nmax, std::initializer_list<float> ptvalues)
+	{
+		minLeptons = nmin;
+		maxLeptons = nmax;
+		leptonPtValues = ptvalues;
+		return *this;
+	}
+	Config& setEfficiency(const std::string& leg, double eff)
+	{
+		efficiencies.emplace(leg, [=](float){return eff;});
+		return *this;
+	}
+	Config& setEfficiency(const std::string& leg, std::function<double(float)>&& eff)
+	{
+		efficiencies.emplace(leg, eff);
+		return *this;
+	}
+	Config& setEventSelection(const decltype(eventSelection)& sel) { eventSelection = sel; return *this; }
+	Config& setDebug() { debug = true; return *this; };
+	Config& setExpectedEfficiency(double eff, double tolerance)
+	{
+		expectedEfficiency = eff;
+		expectedEfficiencyTolerance = tolerance;
+		return *this;
+	}
+};
+
+xAOD::ElectronContainer* electronContainer = nullptr;
+xAOD::MuonContainer* muonContainer = nullptr;
+xAOD::PhotonContainer* photonContainer = nullptr;
+bool quiet = false, fast = false, skip = false;
+
+template<class Lepton>
+inline unsigned count(const std::vector<const Lepton*>& leptons, float ptmin, float ptmax = 1e12f)
+{
+	return std::count_if(leptons.cbegin(), leptons.cend(), [=](const Lepton* l){return l->pt()>=ptmin && l->pt()<ptmax;});
+}
+
+bool run_test(const Config& cfg, int toy_to_debug = -1);
+
+using namespace asg::msgUserCode;
+
+int main(int argc, char* argv[])
+{	
+	ANA_CHECK_SET_TYPE(bool);
+	const std::string flagQuiet("--quiet"), flagFast("--fast"), flagSkip("--skip-if-athena");
+	for(int i=1;i<argc;++i)
+	{
+		if(argv[i] == flagQuiet) quiet = true;
+		else if(argv[i] == flagFast) fast = true;
+	#ifndef XAOD_STANDALONE
+		else if(argv[i] == flagSkip) skip = true;
+	#endif
+	}
+	if(skip) return 0;
+	
+#ifndef XAOD_STANDALONE
+	Warning(MSGSOURCE, "This test doesn't work with athena for the moment.");
+	// the problem is that one can't initialize a ToolHandle from a pointer
+	// and the Simple* tools are not known to the athena framework.
+#endif
+	
+#ifdef XAOD_STANDALONE
+	StatusCode::enableFailure();
+	ANA_CHECK (xAOD::Init());
+#endif
+	xAOD::TStore store;
+	CP::CorrectionCode::enableFailure();
+	
+	electronContainer = new xAOD::ElectronContainer();
+	ANA_CHECK(store.record(electronContainer, "Electrons"));
+	auto electronContainerAux = new xAOD::ElectronAuxContainer();
+	ANA_CHECK(store.record(electronContainerAux, "ElectronsAux"));
+	electronContainer->setStore(electronContainerAux);
+	for(int i=0;i<10;++i)
+	{
+		auto el = new xAOD::Electron();
+		electronContainer->push_back(el);
+	}
+	
+	muonContainer = new xAOD::MuonContainer();
+	ANA_CHECK(store.record(muonContainer, "Muons"));
+	auto muonContainerAux = new xAOD::MuonAuxContainer();
+	ANA_CHECK(store.record(muonContainerAux, "MuonsAux"));
+	muonContainer->setStore(muonContainerAux);
+	for(int i=0;i<10;++i)
+	{
+		auto mu = new xAOD::Muon();
+		muonContainer->push_back(mu);
+	}
+	
+	photonContainer = new xAOD::PhotonContainer();
+	ANA_CHECK(store.record(photonContainer, "Photons"));
+	auto photonContainerAux = new xAOD::PhotonAuxContainer();
+	ANA_CHECK(store.record(photonContainerAux, "PhotonsAux"));
+	photonContainer->setStore(photonContainerAux);
+	for(int i=0;i<10;++i)
+	{
+		auto ph = new xAOD::Photon();
+		photonContainer->push_back(ph);
+	}
+	
+	using VE = const std::vector<const xAOD::Electron*>&;
+	using VM = const std::vector<const xAOD::Muon*>&;
+	using VP = const std::vector<const xAOD::Photon*>&;
+	
+	ANA_CHECK(run_test(Config("1L (1 lepton)")
+		.setTriggers("e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose || mu20_iloose_L1MU15_OR_mu50")
+		.setLeptonPDF(1, 1, {30e3f})
+		.setEfficiency("e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose", 0.60)
+		.setEfficiency("mu20_iloose_L1MU15_OR_mu50", 0.60)
+		.setExpectedEfficiency(0.60, 1e-6)
+	));
+	
+	ANA_CHECK(run_test(Config("1L (2 flavours, 1-4 leptons)")
+		.setTriggers("e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose || mu20_iloose_L1MU15_OR_mu50")
+		.setLeptonPDF(1, 4, {30e3f})
+		.setEfficiency("e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose", 0.40)
+	));
+	
+	ANA_CHECK(run_test(Config("2e (2 leptons)")
+		.setTriggers("2e12_lhloose_L12EM10VH")
+		.setLeptonPDF(2, 2, {30e3f})
+		.setEfficiency("e12_lhloose_L1EM10VH", 0.50)
+		.setExpectedEfficiency(0.25, 1e-6)
+	));
+
+	ANA_CHECK(run_test(Config("2e (2-3 leptons)")
+		.setTriggers("2e12_lhloose_L12EM10VH")
+		.setLeptonPDF(2, 3, {30e3f})
+		.setEfficiency("e12_lhloose_L1EM10VH", 0.50)
+	));
+	
+	ANA_CHECK(run_test(Config("emu (2 leptons)")
+		.setTriggers("e17_lhloose_mu14")
+		.setLeptonPDF(2, 2, {20e3f})
+		.setEfficiency("e17_lhloose", 0.60)
+		.setEfficiency("mu14", 0.60)
+		.setExpectedEfficiency(0.36, 1e-6)
+		.setEventSelection([](VE ve, VM vm, VP) { return count(ve,18e3f)>0&&count(vm,15e3f)>0; })
+	));
+	
+	ANA_CHECK(run_test(Config("emu (2-3 leptons)")
+		.setTriggers("e17_lhloose_mu14")
+		.setLeptonPDF(2, 3, {16e3f, 20e3f})
+		.setEfficiency("e17_lhloose", 0.64)
+		.setEfficiency("mu14", 0.56)
+		.setEventSelection([](VE ve, VM vm, VP) { return count(ve,18e3f)>0&&count(vm,15e3f)>0; })
+	));
+	
+	ANA_CHECK(run_test(Config("2mu (asym) (2 leptons)")
+		.setTriggers("mu18_mu8noL1")
+		.setLeptonPDF(2, 2, {30e3f})
+		.setEfficiency("mu18", 0.70)
+		.setEfficiency("mu8noL1", 0.70)
+		.setExpectedEfficiency(0.49, 1e-6)
+	));
+	
+	ANA_CHECK(run_test(Config("2mu (asym) (2-3 leptons)")
+		.setTriggers("mu18_mu8noL1")
+		.setLeptonPDF(2, 3, {11e3f, 21e3f})
+		.setEfficiency("mu18", 0.60)
+		.setEfficiency("mu8noL1", 0.70)
+		.setEventSelection([](VE, VM vm, VP) { return count(vm,19e3f)>0&&count(vm,10e3f)>1; })
+	));
+	
+	ANA_CHECK(run_test(Config("2e||emu||2mu")
+		.setTriggers("2e12_lhloose_L12EM10VH || e17_lhloose_mu14 || mu18_mu8noL1")
+		.setLeptonPDF(2, 4, {10e3f, 16e3f, 20e3f})
+		.setEfficiency("e12_lhloose_L1EM10VH", 0.50)
+		.setEfficiency("e17_lhloose", 0.60)
+		.setEfficiency("mu18", 0.60)
+		.setEfficiency("mu14", 0.60)
+		.setEfficiency("mu8noL1", 0.70)
+		.setEventSelection([](VE ve, VM vm, VP) { return count(ve,13e3f)>1 
+			|| (count(ve,18e3f)>0&&count(vm,15e3f)>0) || (count(vm,19e3f)>0&&count(vm,10e3f)>1); })
+	));
+	
+	ANA_CHECK(run_test(Config("2e||emu||2mu||1e||1mu")
+		.setTriggers("2e12_lhloose_L12EM10VH || e17_lhloose_mu14 || mu18_mu8noL1 || e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose || mu20_iloose_L1MU15_OR_mu50")
+		.setLeptonPDF(1, 4, {10e3f, 16e3f, 20e3f, 30e3f})
+		.setEfficiency("e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose", 0.40)
+		.setEfficiency("mu20_iloose_L1MU15_OR_mu50", 0.40)
+		.setEfficiency("e12_lhloose_L1EM10VH", 0.50)
+		.setEfficiency("e17_lhloose", 0.60)
+		.setEfficiency("mu18", 0.60)
+		.setEfficiency("mu14", 0.60)
+		.setEfficiency("mu8noL1", 0.70)
+		.setEventSelection([](VE ve, VM vm, VP) { return count(ve,13e3f)>1 
+			|| (count(ve,18e3f)>0&&count(vm,15e3f)>0) || (count(vm,19e3f)>0&&count(vm,10e3f)>1)
+			|| count(ve,25e3f)>0 || count(vm,21.5e3f)>0; })
+	));
+	
+	ANA_CHECK(run_test(Config("e_2e (3 leptons)")
+		.setTriggers("e17_lhloose_2e9_lhloose")
+		.setLeptonPDF(3, 3, {20e3f})
+		.setEfficiency("e17_lhloose", 0.90)
+		.setEfficiency("e9_lhloose", 0.90)
+		.setExpectedEfficiency(0.729, 1e-6)
+	));
+	
+	ANA_CHECK(run_test(Config("e_2e (3-5 leptons)")
+		.setTriggers("e17_lhloose_2e9_lhloose")
+		.setLeptonPDF(3, 5, {12e3f, 20e3f})
+		.setEfficiency("e17_lhloose", 0.60)
+		.setEfficiency("e9_lhloose", 0.70)
+		.setEventSelection([](VE ve, VM, VP) { return (count(ve,18e3f)>0&&count(ve,10e3f)>2); })
+	));
+	
+	ANA_CHECK(run_test(Config("3mu (3 leptons)")
+		.setTriggers("3mu6")
+		.setLeptonPDF(3, 3, {10e3f})
+		.setEfficiency("mu6", 0.90)
+		.setExpectedEfficiency(0.729, 1e-6)
+	));
+	
+	ANA_CHECK(run_test(Config("3mu (3-5 leptons)")
+		.setTriggers("3mu6")
+		.setLeptonPDF(3, 5, {10e3f})
+		.setEfficiency("mu6", 0.70)
+		.setEventSelection([](VE, VM vm, VP) { return count(vm,7e3f)>2; })
+	));
+	
+	ANA_CHECK(run_test(Config("2e_mu||e_2mu")
+		.setTriggers("e12_lhloose_2mu10 || 2e12_lhloose_mu10")
+		.setLeptonPDF(3, 5, {14e3f})
+		.setEfficiency("e12_lhloose", 0.50)
+		.setEfficiency("mu10", 0.60)
+		.setEventSelection([](VE ve, VM vm, VP) { return (count(ve,13e3f)>1&&count(vm,11e3f)>0) || (count(ve,13e3f)>0&&count(vm,11e3f)>1); })
+	));	
+	
+	// not a full test of the function since 2mu10 completely shadows 2mu14, but it validates at least part of the logic. Full test done with photons (see below).
+	ANA_CHECK(run_test(Config("2mu||2mu||mu")
+		.setTriggers("2mu10 || 2mu14 || mu24_iloose_L1MU15")
+		.setLeptonPDF(1, 4, {13e3f, 16e3f, 30e3f})
+		.setEfficiency("mu10", 0.70)
+		.setEfficiency("mu14", 0.60)
+		.setEfficiency("mu24_iloose_L1MU15", 0.30)
+		.setEventSelection([](VE, VM vm, VP) { return (count(vm,11e3f)>1) || (count(vm,25.5e3f)>1) ; })
+	));
+	
+	ANA_CHECK(run_test(Config("mu_mu||2mu||mu")
+		.setTriggers("mu18_mu8noL1 || 2mu14 || mu24_iloose_L1MU15")
+		.setLeptonPDF(1, 4, {11e3f, 16e3f, 20e3f, 30e3f})
+		.setEfficiency("mu8noL1", 0.80)
+		.setEfficiency("mu14", 0.70)
+		.setEfficiency("mu18", 0.60)
+		.setEfficiency("mu24_iloose_L1MU15", 0.30)
+		.setEventSelection([](VE, VM vm, VP) { return (count(vm,25.5e3f)>0) || (count(vm,10e3f)>1&&count(vm,19e3f)>0) || (count(vm,15e3f)>1) ; })
+	));
+	
+	ANA_CHECK(run_test(Config("2e||mu_mu||2mu||emu||emu||e||mu")
+		.setTriggers("2e12_lhloose_L12EM10VH || mu18_mu8noL1 || 2mu14 || e17_lhloose_mu14 || e7_lhmedium_mu24 || e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose || mu20_iloose_L1MU15")
+		.setLeptonPDF(2, 2, {11e3f, 13e3f, 16e3f, 20e3f, 30e3f})
+		.setEfficiency("mu8noL1", 0.80)
+		.setEfficiency("mu14", 0.70)
+		.setEfficiency("mu18", 0.60)
+		.setEfficiency("mu20_iloose_L1MU15", 0.30)
+		.setEfficiency("mu24", 0.37)
+		.setEfficiency("e7_lhmedium", 0.53)
+		.setEfficiency("e12_lhloose_L1EM10VH", 0.73)
+		.setEfficiency("e17_lhloose", 0.67)
+		.setEfficiency("e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose", 0.42)
+		.setEventSelection([](VE ve, VM vm, VP) { return (count(vm,25.5e3f)>0) || (count(ve,25e3f)>0) || (count(ve,13e3f)>1) || (count(vm,15e3f)>1)
+			|| (count(vm,10e3f)>1&&count(vm,19e3f)>0) ||  (count(ve,18e3f)>0&&count(vm,15e3f)>0) || (count(ve,8e3f)>0&&count(vm,25.5e3f)>0); })
+	));
+	
+	ANA_CHECK(run_test(Config("2g (sym)")
+		.setTriggers("2g22_tight_L12EM15VHI")
+		.setLeptonPDF(2, 3, {30e3f})
+		.setEfficiency("g22_tight_L1EM15VHI", 0.60)
+		.setEventSelection([](VE, VM, VP vp) { return count(vp,23e3f)>1; })
+	));
+	
+	ANA_CHECK(run_test(Config("2g (sym) || 2g (sym) || 1g")
+		.setTriggers("2g50_loose_L12EM20VH || 2g22_tight_L12EM15VHI || g120_loose")
+		.setLeptonPDF(2, 3, {25e3f, 60e3f, 150e3f})
+		.setEfficiency("g22_tight_L1EM15VHI", 0.43)
+		.setEfficiency("g50_loose_L1EM20VH", 0.74)
+		.setEfficiency("g120_loose", 0.82)
+		.setEventSelection([](VE, VM, VP vp) { return count(vp,23e3f)>1 || count(vp,121e3f)>0; })
+	));
+	
+	ANA_CHECK(run_test(Config("2g (sym) || 2g (asym)")
+		.setTriggers("2g22_tight_L12EM15VHI || g35_medium_g25_medium_L12EM20VH")
+		.setLeptonPDF(2, 4, {24e3f, 30e3f, 40e3f})
+		.setEfficiency("g22_tight_L1EM15VHI", 0.43)
+		.setEfficiency("g35_medium_L1EM20VH", 0.74)
+		.setEfficiency("g25_medium_L1EM20VH", 0.82)
+		.setEventSelection([](VE, VM, VP vp) { return count(vp,23e3f)>1; })
+	));
+
+	ANA_CHECK(run_test(Config("2g_g (3 photons)")
+		.setTriggers("2g25_loose_g15_loose")
+		.setLeptonPDF(3, 3, {30e3f})
+		.setEfficiency("g25_loose", 0.8)
+		.setEfficiency("g15_loose", 0.9)
+		.setExpectedEfficiency(0.704, 1e-6)
+	));
+	
+	ANA_CHECK(run_test(Config("2g_g (3-5 photons)")
+		.setTriggers("2g25_loose_g15_loose")
+		.setLeptonPDF(3, 5, {20e3f, 30e3f})
+		.setEfficiency("g25_loose", 0.63)
+		.setEfficiency("g15_loose", 0.88)
+		.setEventSelection([](VE, VM, VP vp) { return count(vp,26e3f)>1 && count(vp,16e3f)>2; })
+	));
+	
+	ANA_CHECK(run_test(Config("e || mu || g (factorized)")
+		.setTriggers("e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose || mu20_iloose_L1MU15_OR_mu50 || g120_loose")
+		.setLeptonPDF(1, 2, {150e3f})
+		.setEfficiency("e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose", 0.55)
+		.setEfficiency("mu20_iloose_L1MU15_OR_mu50", 0.66)
+		.setEfficiency("g120_loose", 0.77)
+	));
+
+	ANA_CHECK(run_test(Config("3e || 3mu || 3g (factorized)")
+		.setTriggers("e17_lhloose_2e9_lhloose || 3mu6 || 3g20_loose")
+		.setLeptonPDF(4, 6, {30e3f})
+		.setEfficiency("e9_lhloose", 0.68)
+		.setEfficiency("e17_lhloose", 0.54)
+		.setEfficiency("mu6", 0.77)
+		.setEfficiency("g20_loose", 0.81)
+		.setEventSelection([](VE ve, VM vm, VP vp) { return count(ve,18e3f)>2 || count(vm,10e3f)>2 || count(vp,21e3f)>2; })
+	));
+
+	ANA_CHECK(run_test(Config("e_2mu || 2g || 1g (factorized)")
+		.setTriggers("g120_loose || 2e12_lhloose_mu10 || 2g22_tight_L12EM15VHI")
+		.setLeptonPDF(3, 6, {150e3f})
+		.setEfficiency("e12_lhloose", 0.48)
+		.setEfficiency("mu10", 0.62)
+		.setEfficiency("g22_tight_L1EM15VHI", 0.35)
+		.setEfficiency("g120_loose", 0.56)
+		.setEventSelection([](VE ve, VM vm, VP vp) { return (count(ve,13e3f)>1  && count(vm,11e3f)>0) || count(vp,21e3f)>0; })
+	));	
+	
+	//Info(MSGSOURCE, "Boost version: %i", BOOST_VERSION);
+	return 0;
+}
+
+
+bool configure(asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool>& tool, 
+	ToolHandleArray<IAsgElectronEfficiencyCorrectionTool>& electronEffToolsHandles, ToolHandleArray<IAsgElectronEfficiencyCorrectionTool>& electronSFToolsHandles, 
+	ToolHandleArray<CP::IMuonTriggerScaleFactors>& muonToolsHandles,
+	ToolHandleArray<IAsgPhotonEfficiencyCorrectionTool>& photonEffToolsHandles, ToolHandleArray<IAsgPhotonEfficiencyCorrectionTool>& photonSFToolsHandles, 
+	const std::string& triggers, const std::map<std::string, std::string>& legsPerTool, unsigned long nToys, bool debug)
+{
+	ANA_CHECK_SET_TYPE(bool);
+	ANA_CHECK(tool.setProperty("ElectronEfficiencyTools", electronEffToolsHandles));
+	ANA_CHECK(tool.setProperty("ElectronScaleFactorTools", electronSFToolsHandles));
+	ANA_CHECK(tool.setProperty("PhotonEfficiencyTools", photonEffToolsHandles));
+	ANA_CHECK(tool.setProperty("PhotonScaleFactorTools", photonSFToolsHandles));
+	ANA_CHECK(tool.setProperty("ListOfLegsPerTool", legsPerTool));
+	ANA_CHECK(tool.setProperty("MuonTools", muonToolsHandles));
+	ANA_CHECK(tool.setProperty("TriggerCombination2015", triggers));
+	ANA_CHECK(tool.setProperty("NumberOfToys", nToys));
+	ANA_CHECK(tool.setProperty("UseInternalSeed", true));
+	ANA_CHECK(tool.setProperty("OutputLevel", debug? MSG::DEBUG : quiet? MSG::WARNING : MSG::INFO));
+	ANA_CHECK(tool.initialize());
+	return true;
+}
+
+bool run_test(const Config& cfg, int toy_to_debug)
+{
+	ANA_CHECK_SET_TYPE(bool);
+	if(!quiet) Info(MSGSOURCE, "Running test %s", cfg.testName.c_str());
+	const int nToysPerEvent = (fast? 250 : 500), nToysPerTest = (fast? 200 : 2000), nToySamples = 10;
+	std::vector<SimpleElectronEfficiencyCorrectionTool*> electronTools;
+	ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronEffToolsHandles, electronSFToolsHandles;
+	std::vector<SimplePhotonEfficiencyCorrectionTool*> photonTools;
+	ToolHandleArray<IAsgPhotonEfficiencyCorrectionTool> photonEffToolsHandles, photonSFToolsHandles;
+	std::map<std::string,std::string> legsPerTool;
+	bool generateElectrons = false, generateMuons = false, generatePhotons = false;
+	for(auto& kv : cfg.efficiencies)
+	{
+		if(kv.first[0]=='e')
+		{
+			electronTools.emplace_back(new SimpleElectronEfficiencyCorrectionTool("EFF-"+kv.first, kv.second));
+			legsPerTool.emplace(electronTools.back()->name(), kv.first);
+			#ifdef XAOD_STANDALONE
+				electronEffToolsHandles.push_back(electronTools.back());
+			#endif
+			electronTools.emplace_back(new SimpleElectronEfficiencyCorrectionTool("SF-"+kv.first, 1.));
+			legsPerTool.emplace(electronTools.back()->name(), kv.first);
+			#ifdef XAOD_STANDALONE
+				electronSFToolsHandles.push_back(electronTools.back());
+			#endif
+			generateElectrons  =true;
+		}
+		else if(kv.first[0]=='g')
+		{
+			photonTools.emplace_back(new SimplePhotonEfficiencyCorrectionTool("EFF-"+kv.first, kv.second));
+			legsPerTool.emplace(photonTools.back()->name(), kv.first);
+			#ifdef XAOD_STANDALONE
+				photonEffToolsHandles.push_back(photonTools.back());
+			#endif
+			photonTools.emplace_back(new SimplePhotonEfficiencyCorrectionTool("SF-"+kv.first, 1.));
+			legsPerTool.emplace(photonTools.back()->name(), kv.first);
+			#ifdef XAOD_STANDALONE
+				photonSFToolsHandles.push_back(photonTools.back());
+			#endif
+			generatePhotons = true;
+		}
+		else if(kv.first[0]=='m') generateMuons = true;
+	}
+	std::vector<SimpleMuonTriggerScaleFactors*> muonTools;
+	muonTools.emplace_back(new SimpleMuonTriggerScaleFactors("EFF-muons", cfg.efficiencies));
+	ToolHandleArray<CP::IMuonTriggerScaleFactors> muonToolsHandles;
+	#ifdef XAOD_STANDALONE
+		muonToolsHandles.push_back(muonTools.back());
+	#endif
+	std::string suffix = ((toy_to_debug>=0)? "_debug" : "");
+	asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> trigGlobTool("TrigGlobalEfficiencyCorrectionTool/trigGlobTool" + suffix);
+	asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> trigGlobTool_toys("TrigGlobalEfficiencyCorrectionTool/trigGlobTool_toys" + suffix);
+	bool debug = cfg.debug || (toy_to_debug>=0);
+	ANA_CHECK(configure(trigGlobTool, electronEffToolsHandles, electronSFToolsHandles, muonToolsHandles, photonEffToolsHandles, photonSFToolsHandles, cfg.triggers, legsPerTool, 0, debug));
+	ANA_CHECK(configure(trigGlobTool_toys, electronEffToolsHandles, electronSFToolsHandles, muonToolsHandles, photonEffToolsHandles, photonSFToolsHandles, cfg.triggers, legsPerTool, nToysPerEvent, debug));
+	std::default_random_engine rdm;
+	std::uniform_int_distribution<unsigned> nleptonsPdf(cfg.minLeptons, cfg.maxLeptons);
+	std::discrete_distribution<> flavourPdf({1.*generateElectrons, 1.*generateMuons, 1.*generatePhotons});
+	std::uniform_int_distribution<unsigned> ptIndexPdf(0, cfg.leptonPtValues.size()-1);
+	std::vector<const xAOD::Electron*> electrons;
+	std::vector<const xAOD::Muon*> muons;
+	std::vector<const xAOD::Photon*> photons;
+	std::vector<const xAOD::IParticle*> particles;
+	double sum_eff = 0., sum_eff_toys[nToySamples];
+	std::fill(std::begin(sum_eff_toys), std::end(sum_eff_toys), 0.);
+	for(int toy=0; toy<nToysPerTest; ++toy)
+	{
+		do
+		{
+			electrons.clear();
+			muons.clear();
+			photons.clear();
+			particles.clear();
+			const unsigned nLeptons = nleptonsPdf(rdm);
+			for(unsigned index=0;index<nLeptons;++index)
+			{
+				float pt = cfg.leptonPtValues[ptIndexPdf(rdm)];
+				switch(flavourPdf(rdm))
+				{
+					case 0:
+					{
+						auto electron = electronContainer->at(electrons.size());
+						particles.push_back(electron);
+						electrons.push_back(electron);
+						electron->setP4(pt, 0.f, 0.f, 0.511f);
+						break;
+					}
+					case 1:
+					{
+						auto muon = muonContainer->at(muons.size());
+						particles.push_back(muon);
+						muons.push_back(muon);
+						muon->setP4(pt, 0.f, 0.f);
+						break;
+					}
+					case 2:
+					{
+						auto photon = photonContainer->at(photons.size());
+						particles.push_back(photon);
+						photons.push_back(photon);
+						photon->setP4(pt, 0.f, 0.f, 0.f);
+						break;
+					}
+				}
+			}
+		}
+		while(cfg.eventSelection && !cfg.eventSelection(electrons, muons, photons));
+		if(toy_to_debug>=0 && toy!=toy_to_debug) continue;
+		
+		double dummy, eff = 0., eff_toys;
+		const int runNumber = 281130;
+		if(trigGlobTool->getEfficiency(runNumber, particles, eff, dummy) != CP::CorrectionCode::Ok)
+		{
+			if(toy_to_debug < 0)
+			{
+				Info(MSGSOURCE, "Running %s test again for this toy event, with the debug flag set", cfg.testName.c_str());
+				run_test(cfg, toy);
+			}
+			return false;
+		}
+		sum_eff += eff;
+		for(int spl=0;spl<nToySamples;++spl)
+		{
+			eff_toys = 0.;
+			if(trigGlobTool_toys->getEfficiency(runNumber, particles, eff_toys, dummy) != CP::CorrectionCode::Ok)
+			{
+				if(toy_to_debug < 0)
+				{
+					Info(MSGSOURCE, "Running %s test again for this toy event, with the debug flag set", cfg.testName.c_str());
+					run_test(cfg, toy);
+					return false;
+				}
+				return false;
+			}
+			sum_eff_toys[spl] += eff_toys;
+		}
+		if(toy == toy_to_debug) return true;
+	}
+	if(cfg.expectedEfficiency > 0.)
+	{
+		double eff = sum_eff / nToysPerTest;
+		if(fabs(eff - cfg.expectedEfficiency) > cfg.expectedEfficiencyTolerance)
+		{
+			return false;
+		}
+	}
+	double eff = sum_eff/nToysPerTest, eff_toys = 0., toys_rms = 0.;
+	for(double sum : sum_eff_toys) eff_toys += sum / nToysPerTest;
+	eff_toys /= nToySamples;
+	for(double sum : sum_eff_toys) toys_rms += pow(sum/nToysPerTest - eff_toys, 2);
+	toys_rms = sqrt(toys_rms / (nToySamples-1));
+	double  sigma = fabs(eff-eff_toys) / toys_rms;
+	if(!quiet) Info(MSGSOURCE, "Efficiency: %f, toys: %f (signif. = %.1f sigma)", eff, eff_toys, sigma);
+	if(sigma >= 3.)
+	{
+		Error(MSGSOURCE, "The difference is too large");
+		return false;
+	}
+	else if(sigma >= 2.) Warning(MSGSOURCE, "The difference isn't small");
+	for(auto tool : electronTools) delete tool;
+	for(auto tool : muonTools) delete tool;
+	for(auto tool : photonTools) delete tool;
+	return true;
+}
diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/util/unit_tests.sh b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/util/unit_tests.sh
new file mode 100755
index 0000000000000000000000000000000000000000..b9eeaf0a43b098f3284a8e581cbf79a59fdb394e
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/util/unit_tests.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+set -e
+echo "Testing TrigGlobalEfficiencyCorrectionTool internal logic (standalone only)"
+TrigGlobEffCorrValidation --quiet --fast --skip-if-athena
+echo "Testing TrigGlobalEfficiencyCorrectionTool interactions with CP tools"
+TrigGlobEffCorrExample4 --quiet
+echo "Test successful."
+exit 0
diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfigMT_Ntuple.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfigMT_Ntuple.cxx
index 1eef195dc469dab95f589f1933ce8ef1ba6b3c3e..5f93f5604a9111eb1d4fa14903ac16a3be29ca08 100644
--- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfigMT_Ntuple.cxx
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfigMT_Ntuple.cxx
@@ -434,7 +434,7 @@ void AnalysisConfigMT_Ntuple::loop() {
 		  
 		  int _ip = 0; /// count of particles in this interaction 
 		  
-		  int pid = (*evitr)->signal_process_id();
+		  int pid = HepMC::signal_process_id((*evitr));
 		  
 		  //      if ( (*evitr)->particles_size()>0 ) std::cout << "process " << "\tpid " << pid << std::endl;  
 		  
diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata-run3-offline-vtx.dat b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata-run3-offline-vtx.dat
new file mode 100755
index 0000000000000000000000000000000000000000..d644001651d9d37a0dd5e65e9f776687d1e346cc
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata-run3-offline-vtx.dat
@@ -0,0 +1,31 @@
+// emacs: this is -*- c++ -*-
+
+#include "TIDAdata_cuts-offline.dat"
+
+VertexSelection    = 0;
+VertexSelectionRec = 0;
+
+
+
+
+//refChain = "Truth";
+refChain = "Offline";
+//refChain = "Electrons";
+//refChain = "Muons";
+//refChain = "Taus";
+
+
+MinVertices = 0;
+
+
+#include "TIDAdata-chains-run3.dat"
+
+
+InitialiseFirstEvent = 1;
+
+outputFile = "data-output.root";
+DataFiles = { "TrkNtuple-0000.root"};
+//DataSets = {"./"}
+
+
+#include "TIDAbeam.dat"
diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts-offline.dat b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts-offline.dat
index 82f449ead7d6d98dbadb92cc1857734570e32ae2..929b3bb49242745536ef7dea3694ec0a33196c68 100644
--- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts-offline.dat
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts-offline.dat
@@ -24,5 +24,5 @@ dumpflag = 1;
 a0v = 10.5;
 z0v = 300.5;
 
-VertexSelection    = 0;
-VertexSelectionRec = 0;
+// VertexSelection    = 0;
+// VertexSelectionRec = 0;
diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAhisto-panel-vtx.dat b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAhisto-panel-vtx.dat
new file mode 100644
index 0000000000000000000000000000000000000000..d6933c847c57146bbb673a6411ae78de94a10604
--- /dev/null
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAhisto-panel-vtx.dat
@@ -0,0 +1,50 @@
+// emacs: this is -*- c++ -*-                                                                                                                                                                                 
+
+
+panels = { vtx_eff_panel, vtx_res_panel, vtx_kin_panel };
+
+vtx_eff_panel = {
+
+  "ntrax_eff",     "Tracks efficiency",           "xaxis:lin:0:200",      "Number of tracks",                  "yaxis:auto:lin:80:102",       "Vertex finding efficiency" ,
+  "zed_eff",       "Efficiency z",                "xaxis:lin:-175:175",  "Offline vertex z [mm]",             "yaxis:auto:lin:50:102",       "Vertex finding efficiency" ,
+  "mu_eff",        "efficiency vs mu",            "xaxis:lin:auto",      "pileup <#mu>",                      "yaxis:auto:lin:50:102",        "Efficiency"  ,
+
+  //  "nvtx_eff",      "Vertices efficiency",         "xaxis:lin:auto",     "Number of vertices",                 "yaxis:lin:auto:0.5:1.05",   "Vertex finding efficiency" ,                                  
+  //  "lb_eff",       "Efficiency lb",                "xaxis:lin:auto",     "luminosity block",                  "yaxis:lin:auto:0.50:1.05",       "Vertex finding efficiency" ,                              
+
+  "ntrax",        "Number of tracks",    "xaxis:lin:auto",              "Offline track multiplcicty",    "yaxis:log:autow",          "Entries"  ,
+  "zed",          "Vertex z position",   "xaxis:lin:auto:-175:175",     "Offline vertex z [mm]",         "yaxis:log:auto",           "Entries"  ,
+  "mu",            "mu",                 "xaxis:lin:auto",              "pileup <#mu>",                  "yaxis:log:auto",           "Entries"	
+
+};
+
+
+
+vtx_res_panel = {
+
+  "rdz_vs_ntrax/mean",        "Offset z vs N_{tracks}",     "xaxis:lin:auto",     "Offline track multiplicity",  "yaxis:auto:lin:-1:1.", "z_{0} mean [mm]" ,
+  "rdz_vs_zed/mean",          "Offset z vs z",              "xaxis:lin:-175:175", "Offline vertex z [mm]",        "yaxis:auto:lin:-1:1",  "z_{0} mean [mm]" ,
+  "rdz_vs_zed/1d+rebin10",     "Residual z",                 "xaxis:lin:-5:5",   "#Delta z [mm]",                 "yaxis:log:auton",    "(1/N)dN/dz [mm^{-1}]" ,
+
+
+  "rdz_vs_ntrax/sigma",       "Offset z vs N_{tracks}",     "xaxis:lin:auto",     "Offline track multiplicity",  "yaxis:auto:lin:0:2.", "z_{0} resolution [mm]" ,
+  "rdz_vs_zed/sigma",         "Resolution z vs z",          "xaxis:lin:-175:175", "Offline vertex z [mm]",        "yaxis:lin:auto:0:2",       "z_{0} resolution [mm]" ,
+  "rdz_vs_zed/1d+lin+rebin10", "Residual z",                 "xaxis:lin:-5:5",   "#Delta z [mm]",                  "yaxis:lin:auton",    "(1/N)dN/dz [mm^{-1}]"	
+
+};
+
+
+
+vtx_kin_panel = {
+
+  "ntrax",        "Number of tracks",       "xaxis:lin:auto",           "Offline vertex track multiplcicty",   "yaxis:log:autow",   "Entries" ,
+  "zed",          "Vertex z position",      "xaxis:lin:auto:-175:175",  "Offline vertex z [mm]",               "yaxis:log:auto",    "Entries" ,
+  "nvtx",         "Vertices multiplicity",  "xaxis:lin:auto",           "Number of vertices",                  "yaxis:lin:auto",    "Entries" ,
+
+  "ntrax_rec",    "Number of tracks",      "xaxis:lin:auto",            "Trigger vertex track multiplicity",  "yaxis:log:autow",   "Entries" ,
+  "zed_rec",      "Vertex z position",     "xaxis:lin:auto:-175:175",   "Trigger Vertex z [mm]",              "yaxis:log:auto",    "Entries" ,
+  "nvtx_rec",     "Vertices multiplicity", "xaxis:lin:auto",            "Number of vertices",                 "yaxis:lin:auto",    "Entries"
+
+};
+
+
diff --git a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1Connector.h b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1Connector.h
index 69cd439b7ec972f06603675d78524a47c9b696d0..5b85a067afabffc709437479114397047b6691f5 100644
--- a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1Connector.h
+++ b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1Connector.h
@@ -20,8 +20,8 @@ namespace TrigConf {
     */
    class TriggerLine {
    public:
-      TriggerLine(const std::string & name, unsigned int startbit, unsigned int nbits, unsigned int fpga=0, unsigned int clock=0) :
-         m_name(name), m_startbit(startbit), m_nbits(nbits), m_fpga(fpga), m_clock(clock)
+   TriggerLine(const std::string & name, unsigned int startbit, unsigned int nbits, unsigned int fpga=0, unsigned int clock=0, const std::string & connName="") :
+     m_name(name), m_startbit(startbit), m_nbits(nbits), m_fpga(fpga), m_clock(clock), m_connName(connName)
       {}
       const std::string & name() const { return m_name; }
       unsigned int startbit() const { return  m_startbit; }
@@ -29,12 +29,14 @@ namespace TrigConf {
       unsigned int nbits() const { return m_nbits; }
       unsigned int fpga() const { return m_fpga; }
       unsigned int clock() const { return m_clock; }
+      const std::string & connName() const { return m_connName; }
    private:
       std::string m_name{""};      // the name of the threshold whose multiplicity is transmitted
       unsigned int m_startbit{0};  // the location on the cable - first bit
       unsigned int m_nbits{0};     // the location on the cable - number of bits used to encode the multiplicity
       unsigned int m_fpga{0};      // for electrical signals from L1Topo boards only: the fpga the signal is coming from
       unsigned int m_clock{0};     // for electrical signals from L1Topo boards only: the clock of the signal
+      std::string m_connName{""};  // the name of the connector where the triggerline is allocated
    };
 
    /** @brief L1 connectors configuration */
diff --git a/Trigger/TrigConfiguration/TrigConfData/src/L1Connector.cxx b/Trigger/TrigConfiguration/TrigConfData/src/L1Connector.cxx
index 3d7de39fe718199f18ac10d63949e17473a802ee..7a08959afc26af703a9aecd23d2038cea389d4a1 100644
--- a/Trigger/TrigConfiguration/TrigConfData/src/L1Connector.cxx
+++ b/Trigger/TrigConfiguration/TrigConfData/src/L1Connector.cxx
@@ -52,10 +52,10 @@ TrigConf::L1Connector::update()
       for( size_t clock = 0; clock < m_maxClock; ++clock ) {
          std::string path = "triggerlines";
          if( m_type == ConnectorType::ELECTRICAL ) {
-            if(hasMultipleFPGAs) {
-               path += ".fpga";
-               path += std::to_string(fpga);
-            }
+	    if(hasMultipleFPGAs) {
+ 	       path += ".fpga";
+	       path += std::to_string(fpga);
+	    }
             path += ".clock";
             path += std::to_string(clock);
          }
@@ -66,7 +66,7 @@ TrigConf::L1Connector::update()
             m_triggerLines[fpga][clock].emplace_back( name,
                                                       tl.second.get_child("startbit").get_value<unsigned int>(),
                                                       tl.second.get_child("nbits").get_value<unsigned int>(),
-                                                      fpga, clock);
+                                                      fpga, clock, m_name);
             m_lineByName[name] = & m_triggerLines[fpga][clock].back();
          }
       }
diff --git a/Trigger/TrigConfiguration/TrigConfIO/python/JsonUtils.py b/Trigger/TrigConfiguration/TrigConfIO/python/JsonUtils.py
index 8ad10599b87156b89a5b803c34440762fdc1dac0..d7323b95832443754f08ee13632fe35b7090ec51 100755
--- a/Trigger/TrigConfiguration/TrigConfIO/python/JsonUtils.py
+++ b/Trigger/TrigConfiguration/TrigConfIO/python/JsonUtils.py
@@ -3,48 +3,59 @@
 #
 # Module to collect JSON specific trigger configuration helpers
 #
+import pickle
 import json
 
-def create_joboptions_json(properties, filename="HLTJobOptions.json"):
-   """Create the configuration JSON file from the `properties` dictionary
-   and save it into `filename`.
+def create_joboptions_json(pkl_file, json_file):
+   """Create the configuration JSON file from the properties in `pkl_file`
+   and save it into `json_file`.
    """
-   hlt_json = {'filetype' : 'joboptions'}
-   with open(filename,'w') as f:
-      hlt_json['properties'] = properties
-      json.dump(hlt_json, f, sort_keys=True, indent=4)
+
+   with open(pkl_file, "rb") as f:
+      jocat = pickle.load(f)   # basic job properties
+      jocfg = pickle.load(f)   # some specialized services
+      jocat.update(jocfg)       # merge the two dictionaries
+
+      hlt_json = {'filetype' : 'joboptions'}
+      hlt_json['properties'] = jocat
+
+
+   with open(json_file, "w") as f:
+      json.dump(hlt_json, f, indent=4, sort_keys=True, ensure_ascii=True)
 
 
    """ also create a configuration JSON file that can be uploaded
    to the triggerdb for running at P1
    """
-   base, ending = (filename.rsplit('.',1) + ["json"])[:2]
-   filenameUpload = base + ".db." + ending
+   assert json_file[-5:] == ".json"
+   db_file = json_file.replace(".json", ".db.json")
 
-   modifyConfigForP1(properties)
-
-   with open(filenameUpload,'w') as f:
-      hlt_json['properties'] = properties
-      json.dump(hlt_json, f, sort_keys=True, indent=4)
+   modifyConfigForP1(json_file, db_file)
 
 
-def modifyConfigForP1(properties):
-   """ modifies (in place) a number of job properties to run from the TriggerDB
-   modification in place is OK, as the original properties are temporary
+def modifyConfigForP1(json_file, db_file):
+   """ modifies a number of job properties to run from the TriggerDB and writes out modified JSON
    """
 
-   def mod(props, alg, prop, fnc):
-      if alg in props and prop in props[alg]:
-         origVal = props[alg][prop]
-      else:
-         origVal = ""
-      props[alg][prop] = fnc(origVal)
+   with open(json_file, 'r') as f:
+      jocat = json.load(f)
+      properties = jocat['properties']
+
+      def mod(props, alg, prop, fnc):
+         if alg in props and prop in props[alg]:
+            origVal = props[alg][prop]
+         else:
+            origVal = ""
+         props[alg][prop] = fnc(origVal)
+
+      # L1 and HLT Config Svc must read from db
+      mod( properties, "LVL1ConfigSvc", "InputType", lambda x : "db" )
+      mod( properties, "HLTConfigSvc", "InputType", lambda x : "db" )
+      mod( properties, "HLTPrescaleCondAlg", "Source", lambda x : "COOL" ) # prescales will be read from COOL online
+      mod( properties, "HLTPrescaleCondAlg", "TriggerDB", lambda x : "JOSVC" ) # configuration will be taken from the JOSvc at P1
 
-   # L1 and HLT Config Svc must read from db
-   mod( properties, "LVL1ConfigSvc", "InputType", lambda x : "db" )
-   mod( properties, "HLTConfigSvc", "InputType", lambda x : "db" )
-   mod( properties, "HLTPrescaleCondAlg", "Source", lambda x : "COOL" ) # prescales will be read from COOL online
-   mod( properties, "HLTPrescaleCondAlg", "TriggerDB", lambda x : "JOSVC" ) # configuration will be taken from the JOSvc at P1
+   with open(db_file,'w') as f:
+      json.dump(jocat, f, indent=4, sort_keys=True, ensure_ascii=True)
 
 
 if __name__ == "__main__":
@@ -57,10 +68,10 @@ if __name__ == "__main__":
       hlt_json = json.load( fh )
       properties = hlt_json["properties"]
 
-   modifyConfigForP1(properties)
+   modifyConfigForP1(sys.argv[1], sys.argv[1].replace("json", "db.json"))
 
    outfn = sys.argv[1].replace(".json",".test.json")
    with open(outfn,'w') as f:
       hlt_json['properties'] = properties
-      json.dump(hlt_json, f, sort_keys=True, indent=4)
+      json.dump(hlt_json, f, indent=2, sort_keys=True, ensure_ascii=True)
       print("Wrote %s" % outfn)
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcConfig.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcConfig.py
index 59b620da65188398096f77ff782781665c077125..fbf5759f4bde80153ac8984f92a3bbd692e95f67 100755
--- a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcConfig.py
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcConfig.py
@@ -364,9 +364,27 @@ class SetupTrigConfigSvc(object):
                     self.mlog.info( "Will not setup HLTConfigSvc, since TriggerFlags doLVL2(), doEF(), and doHLT() are all False" )
                     self.states[self.states.index("xml")] = "xmll1"
 
-                self.mlog.info( "setup LVL1ConfigSvc and add instance to ServiceMgr (xml file="+self.l1XmlFile+")" )
+                # generating a json L1 menu for Physics_pp_v7_primaries
+                # is needed for a transition period where we still have jobs
+                # running on this old menu, but the software expects a
+                # json-style L1 menu
+                menuName = TriggerFlags.triggerMenuSetup()
+                doGenerateJsonMenuForRun2Menu = (menuName == "Physics_pp_v7_primaries")
+                if doGenerateJsonMenuForRun2Menu:
+                    self.mlog.info("Generating L1 menu %s", menuName)
+                    from TriggerMenuMT.L1.L1MenuConfig import L1MenuConfig
+                    l1cfg = L1MenuConfig(menuName = menuName) # create menu
+                    fileName = 'L1Menu_' + menuName + '.json'
+                    l1JsonFileName = l1cfg.writeJSON(outputFile = fileName) # write menu
+                self.mlog.info("setup LVL1 ConfigSvc and add instance to ServiceMgr")
+                self.mlog.info("xml file = %s", self.l1XmlFile)
+                if doGenerateJsonMenuForRun2Menu:
+                    self.mlog.info("json file= %s", l1JsonFileName)
                 l1 = LVL1ConfigSvc("LVL1ConfigSvc")
                 l1.XMLMenuFile = self.l1XmlFile
+                if doGenerateJsonMenuForRun2Menu:
+                    l1.JsonFileName = l1JsonFileName
+
                 ServiceMgr += l1
 
                 self.mlog.info( "setup L1TopoConfigSvc and add instance to ServiceMgr (xml file="+self.l1topoXmlFile+")" )
diff --git a/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructors/AlgorithmTableConstructor.cxx b/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructors/AlgorithmTableConstructor.cxx
index 9578c89632c12564c21940d232a8aeb333a017a0..46eae42412081210c744d597c304160b6b77d3a2 100644
--- a/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructors/AlgorithmTableConstructor.cxx
+++ b/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructors/AlgorithmTableConstructor.cxx
@@ -14,6 +14,12 @@ AlgorithmTableConstructor::AlgorithmTableConstructor(const std::string& name) :
   addExpectedHistogram("AlgCalls_perEvent");
   addExpectedHistogram("RoIID_perCall");
   addExpectedHistogram("InEventView_perCall");
+  addExpectedHistogram("Request_perEvent");
+  addExpectedHistogram("NetworkRequest_perEvent");
+  addExpectedHistogram("CachedROBSize_perEvent");
+  addExpectedHistogram("NetworkROBSize_perEvent");
+  addExpectedHistogram("RequestTime_perEvent");
+
 
   getBaseEntry().addColumn("name", "Name", "Algorithms name");
   getBaseEntry().addColumn("events", "Raw Active Events", "Raw underlying statistics on number of events processed with the alg active");
@@ -26,6 +32,11 @@ AlgorithmTableConstructor::AlgorithmTableConstructor(const std::string& name) :
   getBaseEntry().addColumn("totalTimePerc", "Alg Total Time [%]", "Total weighted integrated walltime of the alg as a percentage of all algs");
   getBaseEntry().addColumn("timePerCall", "Alg Total Time/Call [ms]", "Mean weighted alg time. Normalised to all alg calls");
   getBaseEntry().addColumn("timePerEvent", "Alg Total Time/Event [ms]", "Mean weighted alg time. Normalised to all events with one or more alg calls");
+  getBaseEntry().addColumn("requestTimePerEvent", "ROS Data Request Time/Event [ms]", "Average time waiting for ROS data per event for  events with at least one execution in this run range");
+  getBaseEntry().addColumn("dataRate", "Data Request Rate [Hz]", "Rate of calls to the ROS from this algorithm in this run range");
+  getBaseEntry().addColumn("retrievedDataRate", "Retrieved ROB Rate [Hz]", "Rate of ROB retrievals from this algorithm in this run range");
+  getBaseEntry().addColumn("cachedDataSizeRate", "Cached ROB Rate [kB/s]", "Average size of cached ROB data fetches for this algorithm in this run range");
+  getBaseEntry().addColumn("retrievedDataSizeRate", "Retrieved ROB Rate [kB/s]", "Average size of retrieved ROB data fetches for this algorithm in this run range");
 }
 
 
@@ -47,6 +58,11 @@ TableEntry AlgorithmTableConstructor::getTableEntry(const std::string name) {
   //"totalTimePerc" is set in post
   tableEntry.setEntry("timePerCall", hist("Time_perCall")->GetMean());
   tableEntry.setEntry("timePerEvent", hist("Time_perEvent")->GetMean());
+  tableEntry.setEntry("requestTimePerEvent", hist("RequestTime_perEvent")->GetMean());
+  tableEntry.setEntry("dataRate", histGetXWeightedIntegral("Request_perEvent", /*isLog*/ false)); // Needs normalising in tablePostProcessing
+  tableEntry.setEntry("retrievedDataRate", histGetXWeightedIntegral("NetworkRequest_perEvent", /*isLog*/ false)); // Needs normalising in tablePostProcessing
+  tableEntry.setEntry("retrievedDataSizeRate", histGetXWeightedIntegral("NetworkROBSize_perEvent", /*isLog*/ false)); // Needs normalising in tablePostProcessing
+  tableEntry.setEntry("cachedDataSizeRate", histGetXWeightedIntegral("CachedROBSize_perEvent", /*isLog*/ false)); // Needs normalising in tablePostProcessing
 
   return tableEntry;
 }
@@ -63,6 +79,10 @@ void AlgorithmTableConstructor::tablePostProcessing(std::vector<TableEntry>& tab
     te.setEntry("totalTimePerc", 100.0 * (te.getEntryFloat("totalTimeSec") / totalTime));
     te.normaliseEntry("eventRate", walltime);
     te.normaliseEntry("callRate", walltime);
+    te.normaliseEntry("dataRate", walltime);
+    te.normaliseEntry("retrievedDataRate", walltime);
+    te.normaliseEntry("cachedDataSizeRate", walltime);
+    te.normaliseEntry("retrievedDataSizeRate", walltime);
   }
 }
 
diff --git a/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructors/ROSTableConstructor.cxx b/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructors/ROSTableConstructor.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..526594b4003b12f07592c16ce3f18804a264662a
--- /dev/null
+++ b/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructors/ROSTableConstructor.cxx
@@ -0,0 +1,70 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "../../TrigCostAnalysis/TableConstructors/ROSTableConstructor.h"
+
+#include "TH1.h"
+
+ROSTableConstructor::ROSTableConstructor(const std::string& name) : TableConstructorBase(name) {
+ 
+  addExpectedHistogram("Request_perEvent");
+  addExpectedHistogram("NetworkRequest_perEvent");
+  addExpectedHistogram("CachedROBSize_perEvent");
+  addExpectedHistogram("NetworkROBSize_perEvent");
+  addExpectedHistogram("Time_perEvent");
+  addExpectedHistogram("ROBStatus_perCall");
+
+  getBaseEntry().addColumn("name", "Name", "ROS name");
+  getBaseEntry().addColumn("events", "Raw Active Events", "Raw underlying statistics on the number of events in which this ROS was accessed.");
+  getBaseEntry().addColumn("eventsWeighted", "Active Events", "How many events in which this sequence was executed.");
+  getBaseEntry().addColumn("requestRate", "Data Requests Rate [Hz]", "Rate of ROS access requests each may contain many ROB reads.");
+  getBaseEntry().addColumn("networkRequestRate", "Retrieved Data Requests Rate [Hz]", "Rate of ROS access requests that fetch data from the ROBs.");
+  getBaseEntry().addColumn("retrievedSizeRate", "Retrieved ROB Data Rate [kB/s]", "Amount of data fetched from the ROBs in kB/s.");
+  getBaseEntry().addColumn("cachedSizeRate", "Cached ROB Data Rate [kB/s]", "Amount of cached data requested from the ROBs in kB/s.");
+  getBaseEntry().addColumn("time", "Time Per Event [ms]", "Average time for all requests and retrievals per event.");
+  getBaseEntry().addColumn("robsUnclassified", "Unclassified ROBs/Event", "ROB calls which were flagged unclassified.");
+  getBaseEntry().addColumn("robsScheduled", "Prefetched ROBs/Event", "ROB calls which were flagged as prefetched.");
+  getBaseEntry().addColumn("robsRetrieved","Retrieved ROBs/Event","Total number of fetched ROB calls.");
+  getBaseEntry().addColumn("robsHLTCached","Cached HLT ROBs/Event","Total number of HLT cached ROB calls.");
+  getBaseEntry().addColumn("robsDCMCached","Cached DCM ROBs/Event","Total number of DCM cached ROB calls.");
+  getBaseEntry().addColumn("robsIgnored", "Ignored ROBs/Event", "ROB calls which were flagged as ignored.");
+  getBaseEntry().addColumn("robsDisabled", "Disabled ROBs/Event", "ROB calls which were flagged as disabled.");
+  getBaseEntry().addColumn("robsNotOk","Not OK ROBs/Event", "ROB calls in which the is OK bit was false.");
+
+}
+
+TableEntry ROSTableConstructor::getTableEntry(const std::string name) {
+  TableEntry tableEntry(getBaseEntry());
+  getHistograms(name);
+
+  tableEntry.setEntry("name", name);
+  tableEntry.setEntry("events", hist("Request_perEvent")->GetEntries());
+  tableEntry.setEntry("eventsWeighted", hist("Request_perEvent")->Integral());
+  tableEntry.setEntry("requestRate", histGetXWeightedIntegral("Request_perEvent", /*isLog*/ false)); // Needs normalising in tablePostProcessing
+  tableEntry.setEntry("networkRequestRate", histGetXWeightedIntegral("NetworkRequest_perEvent", /*isLog*/ false)); // Needs normalising in tablePostProcessing
+  tableEntry.setEntry("retrievedSizeRate", histGetXWeightedIntegral("NetworkROBSize_perEvent", /*isLog*/ false)); // Needs normalising in tablePostProcessing
+  tableEntry.setEntry("cachedSizeRate", histGetXWeightedIntegral("CachedROBSize_perEvent", /*isLog*/ false)); // Needs normalising in tablePostProcessing
+  tableEntry.setEntry("time", hist("Time_perEvent")->GetMean());
+
+  tableEntry.setEntry("robsUnclassified", hist("ROBStatus_perCall")->GetBinContent(1));
+  tableEntry.setEntry("robsScheduled", hist("ROBStatus_perCall")->GetBinContent(2));
+  tableEntry.setEntry("robsRetrieved", hist("ROBStatus_perCall")->GetBinContent(3));
+  tableEntry.setEntry("robsHLTCached", hist("ROBStatus_perCall")->GetBinContent(4));
+  tableEntry.setEntry("robsDCMCached", hist("ROBStatus_perCall")->GetBinContent(5));
+  tableEntry.setEntry("robsIgnored", hist("ROBStatus_perCall")->GetBinContent(6));
+  tableEntry.setEntry("robsDisabled", hist("ROBStatus_perCall")->GetBinContent(7)); 
+  tableEntry.setEntry("robsNotOk", hist("ROBStatus_perCall")->GetBinContent(8)); 
+
+  return tableEntry;
+}
+
+void ROSTableConstructor::tablePostProcessing(std::vector<TableEntry>& tableEntries, const float walltime) {
+
+  for (TableEntry& te : tableEntries) {
+    te.normaliseEntry("requestRate", walltime);
+    te.normaliseEntry("networkRequestRate", walltime);
+    te.normaliseEntry("retrievedSizeRate", walltime);
+    te.normaliseEntry("cachedSizeRate", walltime);
+  }
+}
\ No newline at end of file
diff --git a/Trigger/TrigCost/TrigCostAnalysis/TrigCostAnalysis/TableConstructors/ROSTableConstructor.h b/Trigger/TrigCost/TrigCostAnalysis/TrigCostAnalysis/TableConstructors/ROSTableConstructor.h
new file mode 100644
index 0000000000000000000000000000000000000000..53ba4125791a3fcc5c8ed611b3a17a15abd71533
--- /dev/null
+++ b/Trigger/TrigCost/TrigCostAnalysis/TrigCostAnalysis/TableConstructors/ROSTableConstructor.h
@@ -0,0 +1,45 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TRIGCOSTANALYSIS_ROSTABLECONSTRUCTOR_H
+#define TRIGCOSTANALYSIS_ROSTABLECONSTRUCTOR_H 1
+
+#include "../TableConstructorBase.h"
+
+/**
+ * @class ROSTableConstructor
+ * @brief Construct a CSV table to process the output of a MonitorROS
+ */
+class ROSTableConstructor : public TableConstructorBase {
+  public:
+    /**
+     * @brief Construct ROSTableConstructor
+     * @param[in] name ROSTableConstructor's name
+     */
+    ROSTableConstructor(const std::string& name);
+
+    /**
+     * @brief Default destructor
+     */
+    virtual ~ROSTableConstructor() = default;
+
+  protected:
+
+    /**
+     * @brief Get TableEntry for a single Algorithm
+     * @param[in] name Name of algorithm TDirectory to generate a TableEntry.
+     * @return TableEntry populated with a row of data for the given TDirectory.
+     */  
+    virtual TableEntry getTableEntry(const std::string name) override;
+
+    /**
+     * @brief Post-processing for the algorithm table.
+     * @param[in,out] tableEntry Mutable vector of TableEntries, each corresponding to a row in the table.
+     * @param[in] walltime Normalisation parameter.
+     */  
+    virtual void tablePostProcessing(std::vector<TableEntry>& tableEntries, const float walltime) override;
+  
+};
+
+#endif // TRIGCOSTANALYSIS_ROSTABLECONSTRUCTOR_H
\ No newline at end of file
diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterROS.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterROS.cxx
index 0f898774e2cdaca820fa98e79a1fa25435fe2418..1a165d64cb59a43476acd9be9e0956fc23d3f38a 100644
--- a/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterROS.cxx
+++ b/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterROS.cxx
@@ -39,7 +39,6 @@ StatusCode CounterROS::newEvent(const CostData& data, size_t index, const float
   bool networkRequestIncremented = false;
   for (size_t i = 0; i < robIdsPerRequest.size(); ++i) {
     if (std::find(m_robIdsPerROS.begin(), m_robIdsPerROS.end(), robIdsPerRequest[i]) != m_robIdsPerROS.end()) {
-
       ATH_CHECK( fill("ROBStatus_perCall", getROBHistoryBin(robs_history[i]), weight) );
       if (robs_status[i]) {
         // The last bin of ROBStatus_perCall histogram store isStatusOk bool value
@@ -48,11 +47,12 @@ StatusCode CounterROS::newEvent(const CostData& data, size_t index, const float
 
       // ROB request was fetched over the network
       if (robs_history[i] == robmonitor::RETRIEVED) {
-        ATH_CHECK( fill("NetworkROBSize_perEvent", robs_size[i], weight) );
+        // size is stored in words, should be in kilobytes
+        ATH_CHECK( fill("NetworkROBSize_perEvent", robs_size[i] / 500., weight) );
         networkRequestIncremented = true;
       }
-      else {
-        ATH_CHECK( fill("CachedROBSize_perEvent", robs_size[i], weight) );
+      else if (robs_history[i] == robmonitor::HLT_CACHED || robs_history[i] == robmonitor::DCM_CACHED) {
+        ATH_CHECK( fill("CachedROBSize_perEvent", robs_size[i] / 500., weight) );
       }
     }
   }
diff --git a/Trigger/TrigCost/TrigCostAnalysis/util/trigCostHistToCSV.cxx b/Trigger/TrigCost/TrigCostAnalysis/util/trigCostHistToCSV.cxx
index de1398f19b613f00e29e33840fc85b3cc9ec6023..41c6703f035b840733581a6db909f1cb2703203e 100644
--- a/Trigger/TrigCost/TrigCostAnalysis/util/trigCostHistToCSV.cxx
+++ b/Trigger/TrigCost/TrigCostAnalysis/util/trigCostHistToCSV.cxx
@@ -14,6 +14,7 @@
 #include "TrigCostAnalysis/TableConstructors/AlgorithmTableConstructor.h"
 #include "TrigCostAnalysis/TableConstructors/GlobalTableConstructor.h"
 #include "TrigCostAnalysis/TableConstructors/ThreadOccupancyTableConstructor.h"
+#include "TrigCostAnalysis/TableConstructors/ROSTableConstructor.h"
 
 #include "TFile.h"
 #include "TString.h"
@@ -67,6 +68,9 @@ void exportDirectory(TFile* file, const std::vector<TString>& dir, float walltim
   } else if (dir.at(1) == "Thread_Occupancy_HLT") {
     ThreadOccupancyTableConstructor totc("Thread_Occupancy_HLT");
     table = totc.getTable(file, rootDir, walltime);
+  } else if (dir.at(1) == "ROS_HLT") {
+    ROSTableConstructor rtc("ROS_HLT");
+    table = rtc.getTable(file, rootDir, walltime);
   }
 
   std::ofstream fstream(exportName.Data());
diff --git a/Trigger/TrigDataAccess/TrigSerializeResult/CMakeLists.txt b/Trigger/TrigDataAccess/TrigSerializeResult/CMakeLists.txt
index ef0560b21342a56acf36a02dee923697b6dc825c..d7e1ebe89e8a55cfe98e2d8c48fd5004480becb8 100644
--- a/Trigger/TrigDataAccess/TrigSerializeResult/CMakeLists.txt
+++ b/Trigger/TrigDataAccess/TrigSerializeResult/CMakeLists.txt
@@ -15,8 +15,6 @@ atlas_add_library( TrigSerializeResultLib
                    LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel
                    PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} CxxUtils DataModelRoot PathResolver )
 
-atlas_install_python_modules( python/*.py )
-
 atlas_add_component( TrigSerializeResult
                      src/components/*.cxx
                      LINK_LIBRARIES TrigSerializeResultLib )
@@ -27,6 +25,7 @@ atlas_add_dictionary( TrigSerializeResultDict
                       LINK_LIBRARIES TrigSerializeResultLib )
 
 # Install files from the package:
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_runtime( share/bs-streamerinfos*.root )
 
 # Tests in the package:
diff --git a/Trigger/TrigDataAccess/TrigSerializeResult/python/StreamerInfoGenerator.py b/Trigger/TrigDataAccess/TrigSerializeResult/python/StreamerInfoGenerator.py
index 1b1ebd2ecc3b9278c828b7da61b7ca5c21cbf30b..9dd5a0a4f6c10c99c09bc98433a580bd13c995c5 100755
--- a/Trigger/TrigDataAccess/TrigSerializeResult/python/StreamerInfoGenerator.py
+++ b/Trigger/TrigDataAccess/TrigSerializeResult/python/StreamerInfoGenerator.py
@@ -1,8 +1,7 @@
 #!/usr/bin/env pyroot.py 
 
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 import cppyy
-import ROOT
 
 class StreamerInfoGenerator:
   def __init__(self):
@@ -42,7 +41,7 @@ class StreamerInfoGenerator:
         return
       if t.IsAbstract(): 
         dontAdd = True 
-    except:
+    except Exception:
       pass
 
     try:
@@ -60,11 +59,11 @@ class StreamerInfoGenerator:
       print("Making class {} -> {}".format(typename, bind_name))
       print("cl = " + bind_name)
       exec("cl = " + bind_name, globals())
-      print(cl)
+      print(cl)  # noqa: F821
       if not dontAdd:
         self.classlist.append(typename)
         print("appended type to the classlist")
-    except:
+    except Exception:
       print('Cannot create class of ', typename)
 
     t = self.type.ByName(typename)
@@ -89,7 +88,7 @@ class StreamerInfoGenerator:
         print('std::business removed')
         try:
           self.classlist.remove(typename)
-        except:
+        except Exception:
           pass
       for i in range(t.TemplateArgumentSize()):
         tt = t.TemplateArgumentAt(i)
@@ -123,7 +122,7 @@ class StreamerInfoGenerator:
 
 
 if __name__ == '__main__':
-  from ROOT import TClass, TFile
+  from ROOT import TClass, TFile  # noqa: F401
   a = StreamerInfoGenerator()
   a.inspect('TrigTauClusterContainer_tlp1')
 
diff --git a/Trigger/TrigDataAccess/TrigSerializeResult/python/dictwrite.py b/Trigger/TrigDataAccess/TrigSerializeResult/python/dictwrite.py
index 3dc80172aed0bb53c1a3c2af086dee66ec0b72fb..ea506f543f83793859cf58d4fc139208c2a99558 100755
--- a/Trigger/TrigDataAccess/TrigSerializeResult/python/dictwrite.py
+++ b/Trigger/TrigDataAccess/TrigSerializeResult/python/dictwrite.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env pyroot.py 
 
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #----------------------------------------------
 #
@@ -69,7 +69,7 @@ def update_streamerinfos(objects, updated_objects):
   types_bad = 0
   fulllist = list(set(fulllist))
   for item in fulllist:
-    if doxAODonly and not 'xAOD' in item: continue # current issues seen because of missing xAOD libs not being loaded
+    if doxAODonly and 'xAOD' not in item: continue # current issues seen because of missing xAOD libs not being loaded
     print("Trying to fill item", item, "to root file")
     c_clid = cgen.genClidFromName(item)
     c_typeinfo = cgen.getTidFromClid(c_clid)
@@ -77,11 +77,11 @@ def update_streamerinfos(objects, updated_objects):
     print("TypeInfo", c_typeinfo)
     try:
       cls = ROOT.gROOT.GetClass(item)
-    except:
+    except Exception:
       cls = ROOT.gROOT.GetClass(c_typeinfo)
     print(cls)
 
-    if cls!=None:
+    if cls is not None:
       streamerinfo = cls.GetStreamerInfo()
       if streamerinfo.GetCheckSum() == 0:
         # try to patch missing checksum in DataVectors
diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoToolInc.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoToolInc.h
index f39964f8e3816eb057b7ac501cc51fc470400ebc..9fadd88163ae845e1ef0316a994a460f6d7cb56a 100644
--- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoToolInc.h
+++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoToolInc.h
@@ -55,7 +55,7 @@ class TrigEgammaPrecisionElectronHypoToolInc : public extends<AthAlgTool, ITrigE
   float m_RelPtConeCut;
   
   /*Luminosity info*/
-  SG::ReadDecorHandleKey<xAOD::EventInfo> m_avgMuKey { this, "AveIntPerXKey", "EventInfo.AveIntPerXDecor", "Decoration for Average Interaction Per Crossing" };
+  SG::ReadDecorHandleKey<xAOD::EventInfo> m_avgMuKey { this, "averageInteractionsPerCrossingKey", "EventInfo.averageInteractionsPerCrossing", "Decoration for Average Interaction Per Crossing" };
   int findCutIndex( float eta ) const;
 
 }; 
diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionPhotonHypoToolInc.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionPhotonHypoToolInc.h
index 2a31172ff82aac24514fdde9b4642c3719dbe7ce..8f91562e18858ec9221dfa954b452a94d4f07005 100644
--- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionPhotonHypoToolInc.h
+++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionPhotonHypoToolInc.h
@@ -51,7 +51,7 @@ class TrigEgammaPrecisionPhotonHypoToolInc : public extends<AthAlgTool, ITrigEga
   ToolHandle< GenericMonitoringTool > m_monTool { this, "MonTool", "", "Monitoring tool" };
   ToolHandle<IAsgPhotonIsEMSelector> m_egammaPhotonCutIDTool;
 /*Luminosity info*/
-  SG::ReadDecorHandleKey<xAOD::EventInfo> m_avgMuKey { this, "AveIntPerXKey", "EventInfo.AveIntPerXDecor", "Decoration for Average Interaction Per Crossing" };
+  SG::ReadDecorHandleKey<xAOD::EventInfo> m_avgMuKey { this, "averageInteractionsPerCrossingKey", "EventInfo.averageInteractionsPerCrossing", "Decoration for Average Interaction Per Crossing" };
 
   int findCutIndex( float eta ) const;
 }; 
diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py
index 56259f399a81bbd59e3bc30d3e6c0799a452a034..7b8c93e6aca79ac932a90249bda672b67d77c701 100644
--- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py
+++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py
@@ -198,6 +198,7 @@ class TrigEgammaMonAlgBuilder:
             ]
 
     monitoringTP_electron = [
+            'HLT_e17_lhvloose_L1EM15VHI', 
             'HLT_e24_lhvloose_L1EM20VH', 
             'HLT_e26_lhloose_L1EM15VH',
             'HLT_e26_lhmedium_L1EM15VH',
diff --git a/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDPhysValMonitoringConfig.py b/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDPhysValMonitoringConfig.py
index e2fb83737d1417daebfbb26c5660590d20e15bf4..d991cce6bfd207d4233ca1d1b2c8d160fcdba0bd 100644
--- a/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDPhysValMonitoringConfig.py
+++ b/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDPhysValMonitoringConfig.py
@@ -200,8 +200,8 @@ def TrigIDPhysValMonitoringTool( legacy_monitoring=False ):
     useOffline=True
     if mt_chains:
       chainnames = [
-        "HLT_j45_ftf_L1J15:key=HLT_IDTrack_FS_FTF:vtx=HLT_IDVertex_FS",
-        "HLT_j.*_ftf.*boffperf.*:key=HLT_IDTrack_FS_FTF:vtx=HLT_IDVertex_FS",
+        "HLT_j45_ftf_L1J15:key=HLT_IDTrack_FS_FTF:roi=HLT_FSRoI:vtx=HLT_IDVertex_FS",
+        "HLT_j.*_ftf.*boffperf.*:key=HLT_IDTrack_FS_FTF:roi=HLT_FSRoI:vtx=HLT_IDVertex_FS",
         "HLT_j.*b.*perf_split:key=HLT_IDTrack_Bjet_FTF",
         "HLT_j.*b.*perf_split:key=HLT_IDTrack_Bjet_IDTrig"
       ]
diff --git a/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py b/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py
index 298da6a1f164916e458e8aa193cf519cef8c0a4d..2ddf8fe659be2e31f65f7c16b18391379f22e294 100644
--- a/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py
+++ b/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py
@@ -334,8 +334,8 @@ def TrigIDtrkMonitoringTool( legacy_monitoring=False ):
                 if mt_chains:
                         tidabjet.ntupleChainNames += [
                                 "Offline",
-                                "HLT_j45_ftf_L1J15:key=HLT_IDTrack_FS_FTF:vtx=HLT_IDVertex_FS",
-                                "HLT_j.*_ftf.*boffperf.*:key=HLT_IDTrack_FS_FTF:vtx=HLT_IDVertex_FS",
+                                "HLT_j45_ftf_L1J15:key=HLT_IDTrack_FS_FTF:roi=HLT_FSRoI:vtx=HLT_IDVertex_FS",
+                                "HLT_j.*_ftf.*boffperf.*:key=HLT_IDTrack_FS_FTF:roi=HLT_FSRoI:vtx=HLT_IDVertex_FS",
                                 "HLT_j.*.*boffperf.*:key=HLT_IDTrack_Bjet_FTF",
                                 "HLT_j.*.*boffperf.*:key=HLT_IDTrack_Bjet_IDTrig"
                         ]
diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitCategory.py b/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitCategory.py
index 62e5d79e5cf218a93549647a976585d92f98a5df..238d43b46d9dfd1d7c09d3753686da6463e7e379 100644
--- a/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitCategory.py
+++ b/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitCategory.py
@@ -91,18 +91,13 @@ monitoring_tau_validation = [
         'tau160_medium1HighptL_tracktwo',
         'tau160_medium1HighptM_tracktwo',
         'tau160_medium1HighptH_tracktwo',
-        'tau12_idperf_FTK',
-        'tau12_perf_FTK',
-        'tau12_perf0_FTK',
-        'tau12_perf_FTKNoPrec',
-        'tau12_perf0_FTKNoPrec',
-        'tau12_medium0_FTK',
-        'tau12_medium1_FTK',
-        'tau12_medium0_FTKNoPrec',
-        'tau12_medium1_FTKNoPrec',
-        'tau25_idperf_tracktwo_L1TAU12IM_FTK',
-        'tau25_perf_tracktwo_L1TAU12IM_FTK',
-        'tau25_medium1_tracktwo_L1TAU12IM_FTK'
+        'tau25_idperf_tracktwoMVABDT_L1TAU12IM',
+        'tau25_perf_tracktwoMVABDT_L1TAU12IM',
+        'tau25_medium1_tracktwoMVABDT_L1TAU12IM',
+        'tau25_verylooseRNN_tracktwoMVABDT_L1TAU12IM',
+        'tau25_looseRNN_tracktwoMVABDT_L1TAU12IM',
+        'tau25_mediumRNN_tracktwoMVABDT_L1TAU12IM',
+        'tau25_tightRNN_tracktwoMVABDT_L1TAU12IM',
 ]
 
 monitoring_tau_cosmic = [
diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitoringConfigMT.py b/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitoringConfigMT.py
index 431108af58da1a6d01df91f6276947154ea1985c..d187eeedf21bfd27f5bc6e731eed1fd154c9310b 100644
--- a/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitoringConfigMT.py
+++ b/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitoringConfigMT.py
@@ -136,6 +136,13 @@ class TrigTauMonAlgBuilder:
     
     # This will be removed for future.
     monitoring_tau = [
+    'HLT_tau25_idperf_tracktwoMVABDT_L1TAU12IM',
+    'HLT_tau25_perf_tracktwoMVABDT_L1TAU12IM',
+    'HLT_tau25_medium1_tracktwoMVABDT_L1TAU12IM',
+    'HLT_tau25_verylooseRNN_tracktwoMVABDT_L1TAU12IM',
+    'HLT_tau25_looseRNN_tracktwoMVABDT_L1TAU12IM',
+    'HLT_tau25_mediumRNN_tracktwoMVABDT_L1TAU12IM',
+    'HLT_tau25_tightRNN_tracktwoMVABDT_L1TAU12IM',
     'HLT_tau25_mediumRNN_tracktwoMVA_L1TAU12IM',
     'HLT_tau80_medium1_tracktwo_L1TAU60',
     'HLT_tau0_perf_ptonly_L1TAU100',
diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/CMakeLists.txt
index dd086bcc87c1216ef3d4fbaac804cc0a25a04963..39c5b7d102e512c9895b2fb41ae9a926b761cdc8 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/CMakeLists.txt
@@ -13,13 +13,13 @@ atlas_add_library( L1TopoCoreSim
                    Root/*.cxx
                    PUBLIC_HEADERS L1TopoCoreSim
                    PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${ROOT_LIBRARIES} L1TopoCommon L1TopoConfig L1TopoEvent L1TopoInterfaces TrigConfBase
+                   LINK_LIBRARIES ${ROOT_LIBRARIES} L1TopoCommon L1TopoConfig L1TopoEvent L1TopoInterfaces TrigConfBase TrigConfData
                    PRIVATE_LINK_LIBRARIES L1TopoHardware L1TopoAlgorithms )
 
 atlas_add_executable( TrigConfTopoStandAlone
                       src/test/TopoStandAlone.cxx
-                      LINK_LIBRARIES L1TopoCoreSim TrigConfBase )
+                      LINK_LIBRARIES L1TopoCoreSim TrigConfBase TrigConfIO TrigConfData)
 
 atlas_add_executable( TrigConfTopoTestSteeringConfig
                       src/test/TopoTestSteeringConfig.cxx
-                      LINK_LIBRARIES L1TopoCoreSim )
+                      LINK_LIBRARIES L1TopoCoreSim TrigConfBase TrigConfIO TrigConfData)
diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/DecisionConnector.h b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/DecisionConnector.h
index cf6143617d635fb7752132cbef679e24582a4472..f66de22f6e45dc0531cc61192865b67d0d02072a 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/DecisionConnector.h
+++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/DecisionConnector.h
@@ -1,4 +1,6 @@
-// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
 
 #ifndef L1TopoCoreSim_DecisionConnector
 #define L1TopoCoreSim_DecisionConnector
@@ -7,6 +9,7 @@
 
 #include "L1TopoInterfaces/Decision.h"
 #include "L1TopoConfig/L1TopoConfigOutputList.h"
+#include "TrigConfData/L1Connector.h"
 
 #include <vector>
 #include <string>
@@ -37,7 +40,7 @@ namespace TCS {
 
       bool decision(const std::string & trigger) const;
 
-      const std::vector<TXC::TriggerLine> & triggers() const { return m_triggers; }
+      const std::vector<TrigConf::TriggerLine> & triggers() const { return m_triggers; }
 
       // output data
       void attachOutputData(const std::vector<TOBArray *>&);
@@ -62,7 +65,7 @@ namespace TCS {
 
       TCS::DecisionAlg* m_decisionAlgorithm;
 
-      std::vector<TXC::TriggerLine> m_triggers;
+      std::vector<TrigConf::TriggerLine> m_triggers;
 
       // attached output data
       std::vector<TOBArray const *>  m_outputData;
diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/GlobalDecision.h b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/GlobalDecision.h
index 31903997479709a83f66ec3b70751424a8368a08..b50a84421f596098d2c4e7b7bd9b06c5fc34e34b 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/GlobalDecision.h
+++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/GlobalDecision.h
@@ -1,4 +1,7 @@
-// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
 
 #ifndef L1TopoCoreSim_GlobalDecision
 #define L1TopoCoreSim_GlobalDecision
@@ -8,6 +11,8 @@
 #include "L1TopoCommon/StatusCode.h"
 #include "L1TopoConfig/L1TopoConfigOutputList.h"
 
+#include "TrigConfData/L1Connector.h"
+
 #include <iostream>
 #include <vector>
 #include <set>
@@ -29,22 +34,22 @@ namespace TCS {
 
    class GlobalDecision : public TrigConf::TrigConfMessaging {
    public:
-      GlobalDecision();
+      GlobalDecision(const std::string & name = "L1TopoGlobalDecision");
 
-      uint64_t decision(unsigned int module) const { return m_decision[module]; }
+      uint64_t decision_field(const std::string & connName) const { return m_decision.find(connName)->second; }
 
-      uint32_t decision(unsigned int module, unsigned int clock) const;
+      uint32_t decision_field(std::string connName, unsigned int clock) const;
 
-      bool passed(unsigned int module, unsigned int bit) const { return ( ( (uint64_t)0x1 << bit) & m_decision[module]) != 0; }
-      uint64_t overflow(unsigned int module) const { return m_overflow[module]; }
-      uint32_t overflow(unsigned int module, unsigned int clock) const;
-      bool overflowed(unsigned int module, unsigned int bit) const { return ( ( (uint64_t)0x1 << bit) & m_overflow[module]) != 0; }
+      bool passed(std::string connName, unsigned int bit) const { return ( ( (uint64_t)0x1 << bit) & m_decision.find(connName)->second) != 0; }
+      uint64_t overflow_field(std::string connName) const { return m_overflow.find(connName)->second; }
+      uint32_t overflow_field(std::string connName, unsigned int clock) const;
+      bool overflowed(std::string connName, unsigned int bit) const { return ( ( (uint64_t)0x1 << bit) & m_overflow.find(connName)->second) != 0; }
 
       const Decision & decision(const std::string & algName) const;
 
       bool isValid() const { return m_valid; }
 
-      void setTriggerLines(const std::vector<TXC::TriggerLine> & triggers) { m_triggers = triggers; }
+      void setTriggerLines(const std::vector<TrigConf::TriggerLine> & triggers);
 
       StatusCode collectDecision(const std::set<DecisionConnector*> & outconn);
 
@@ -54,16 +59,16 @@ namespace TCS {
    private:
       friend std::ostream& operator<<(std::ostream&, const TCS::GlobalDecision &);
 
-      // 64 bit decision bit field
-      uint64_t m_decision[3] {0,0,0};
-      // 64 bit overflow bit field
-      uint64_t m_overflow[3] {0,0,0};
+      // 64 bit decision bit field - map connector name-decision field
+      std::map<std::string,uint64_t> m_decision;
+      // 64 bit overflow bit field - map connector name-overflow field
+      std::map<std::string,uint64_t> m_overflow;
       // flags if the decision field is up to date
       // set by @collectDecision(), unset by @resetDecision()
       bool m_valid {false};
 
       // trigger lines
-      std::vector<TXC::TriggerLine> m_triggers;
+      std::vector<TrigConf::TriggerLine> m_triggers;
    };
 
 }
diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/TopoCoreSimResult.h b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/TopoCoreSimResult.h
index 88aecb9e2eb424adffc8d650a18b315a4c302309..de178edb6796cc15aa2ec94cb630a08ba14a66d9 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/TopoCoreSimResult.h
+++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/TopoCoreSimResult.h
@@ -10,6 +10,8 @@
 
 #include "TrigConfBase/TrigConfMessaging.h"
 
+#include "TrigConfData/L1Menu.h"
+
 #include <iostream>
 #include "L1TopoCommon/StatusCode.h"
 #include "L1TopoCoreSim/GlobalDecision.h"
@@ -43,7 +45,7 @@ namespace TCS {
 
       const std::vector<const TCS::TOBArray*> & output(const std::string & connName) const;
 
-      StatusCode setupFromMenu(const TXC::L1TopoMenu & menu, const std::map<std::string, TCS::DecisionConnector*>& outputConnectorMap);
+      StatusCode setupFromMenu(const std::map<std::string, TCS::DecisionConnector*>& outputConnectorMap);
 
       StatusCode collectResult(TCS::DecisionConnector* outputConn = nullptr );
 
diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/TopoSteering.h b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/TopoSteering.h
index 042c4e20b000d6f27b0b9485a533df6057724a63..0f035f6597e5bd16b6a663f92ec80d819195d618 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/TopoSteering.h
+++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/TopoSteering.h
@@ -1,4 +1,6 @@
-// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
 
 #ifndef L1TopoCoreSim_TopoSteering
 #define L1TopoCoreSim_TopoSteering
@@ -17,6 +19,9 @@
 #include "L1TopoCoreSim/TopoCoreSimResult.h"
 #include "L1TopoCoreSim/TopoSteeringStructure.h"
 
+// Menu related dependencies
+#include "TrigConfData/L1Menu.h"
+
 namespace TXC {
    class L1TopoMenu;
 }
@@ -48,16 +53,20 @@ namespace TCS {
 
       const TopoCoreSimResult & simulationResult() const { return m_simulationResult; }
 
+
       // @brief: build the execution structure and parameterspace from
       // the configuration
       StatusCode setupFromConfiguration(const TXC::L1TopoMenu& menu);
-     
+
+      StatusCode setupFromConfiguration(const TrigConf::L1Menu& l1menu);
+
       void setUseBitwise(bool useBitwise) { m_useBitwise = useBitwise; }
  
       // @brief: call the initialize function of the algorithms
       // will be called after the parameters are set and before the event loop starts
       StatusCode initializeAlgorithms();
 
+
       // run the topo simulation
       StatusCode executeEvent();
       
@@ -149,8 +158,9 @@ namespace TCS {
 
       std::bitset<numberOfL1TopoBits> m_triggerHdwBits;
       std::bitset<numberOfL1TopoBits> m_ovrflowHdwBits;
-
    };
-}
 
-#endif
+   
+} 
+
+#endif 
diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/TopoSteeringStructure.h b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/TopoSteeringStructure.h
index 119c899410ad9c17321b720892bf858570fd3383..8aac19c35c5e14e52e8ada2414e366d82a33e190 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/TopoSteeringStructure.h
+++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/TopoSteeringStructure.h
@@ -3,6 +3,9 @@
 */
 #include "L1TopoCommon/StatusCode.h"
 
+#include "TrigConfData/L1Menu.h"
+#include "TrigConfData/L1TopoAlgorithm.h"
+
 #include <vector>
 #include <map>
 #include <string>
@@ -28,7 +31,7 @@ namespace TCS {
 
       ~TopoSteeringStructure();
 
-      StatusCode setupFromMenu(const TXC::L1TopoMenu& menu, bool debug = false);
+      StatusCode setupFromMenu(const TrigConf::L1Menu& l1menu, bool debug = false, bool legacy = false);
 
       // accessors
       bool isConfigured() const { return m_isConfigured; }
diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/DecisionConnector.cxx b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/DecisionConnector.cxx
index 1dba9be38b4ace77b2abd6676b9a9bd4abef8ce9..ee648be0973d64ead097974551c34004a9b4167e 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/DecisionConnector.cxx
+++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/DecisionConnector.cxx
@@ -1,4 +1,6 @@
-// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
 
 #include "L1TopoCoreSim/DecisionConnector.h"
 
@@ -24,7 +26,7 @@ DecisionConnector::~DecisionConnector() {
 bool
 TCS::DecisionConnector::decision(const std::string & trigger) const {
    unsigned int index(0);
-   for(const TXC::TriggerLine & tl : m_triggers) {
+   for(const TrigConf::TriggerLine & tl : m_triggers) {
       if(tl.name() == trigger)
          return m_decision.bit(index);
       ++index;
@@ -37,7 +39,7 @@ TCS::DecisionConnector::decision(const std::string & trigger) const {
 TCS::TOBArray const *
 TCS::DecisionConnector::output(const std::string & trigger) const {
    unsigned int index(0);
-   for(const TXC::TriggerLine & tl : m_triggers) {
+   for(const TrigConf::TriggerLine & tl : m_triggers) {
       if(tl.name() == trigger)
          return m_outputData[index];
       ++index;
diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/GlobalDecision.cxx b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/GlobalDecision.cxx
index 5c59db406927d7f9c9064ce40b1a0bf97adc690e..e6068f8b5083ebf7832458c365679ffefc70c9b7 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/GlobalDecision.cxx
+++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/GlobalDecision.cxx
@@ -1,4 +1,6 @@
-// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
 
 #include <iomanip>
 
@@ -10,33 +12,53 @@
 using namespace std;
 using namespace TCS;
 
+void
+GlobalDecision::setTriggerLines(const vector<TrigConf::TriggerLine> & triggers) {
+
+  m_triggers = triggers;
+  vector<string> connNames = {};
+  for (const TrigConf::TriggerLine & trigger : triggers){
+    auto it = find(connNames.begin(), connNames.end(), trigger.connName());
+    if (it == connNames.end()){
+      connNames.push_back(trigger.connName());
+      m_decision[trigger.connName()] = 0;
+    }
+  }
+}
+  
 uint32_t
-GlobalDecision::decision(unsigned int module, unsigned int clock) const {
-   if(clock==0) {
-      // lower 32 bit
-      return (uint32_t) (m_decision[module] & 0xffffffff);
-   } else {
-      // upper 32 bit
-      uint64_t clock1 = m_decision[module] & 0xffffffff00000000;
-      return (uint32_t) (clock1 >> 32);
+GlobalDecision::decision_field(string connName, unsigned int clock) const {
+   try {
+      if(clock==0) {
+         // lower 32 bit
+         return (uint32_t) (m_decision.at(connName) & 0xffffffff);
+      } else {
+         // upper 32 bit
+         uint64_t clock1 = m_decision.at(connName) & 0xffffffff00000000;
+         return (uint32_t) (clock1 >> 32);
+      }
+   }
+   catch(std::exception &) {
+      TRG_MSG_ERROR("Connector name " << connName << " unknown");
+      throw;
    }
 }
 
 uint32_t
-GlobalDecision::overflow(unsigned int module, unsigned int clock) const {
+GlobalDecision::overflow_field(string connName, unsigned int clock) const {
    if(clock==0) {
       // lower 32 bit
-      return (uint32_t) (m_overflow[module] & 0xffffffff);
+      return (uint32_t) (m_overflow.find(connName)->second & 0xffffffff);
    } else {
       // upper 32 bit
-      uint64_t clock1 = m_overflow[module] & 0xffffffff00000000;
+      uint64_t clock1 = m_overflow.find(connName)->second & 0xffffffff00000000;
       return (uint32_t) (clock1 >> 32);
    }
 }
 
 
-GlobalDecision::GlobalDecision() :
-   TrigConfMessaging("L1TopoGlobalDecision")
+GlobalDecision::GlobalDecision(const std::string &name) :
+   TrigConfMessaging(name)
 {}
 
 /****************************************************************
@@ -47,7 +69,7 @@ GlobalDecision::GlobalDecision() :
  *
  ****************************************************************/
 
-StatusCode
+TCS::StatusCode
 GlobalDecision::collectDecision(const set<DecisionConnector*> & outconn) {
    resetDecision();
 
@@ -56,34 +78,34 @@ GlobalDecision::collectDecision(const set<DecisionConnector*> & outconn) {
       const Decision& dec = conn->decision();
 
       unsigned int pos = 0; // for multi-output algorithms pos is the output index
-      for(const TXC::TriggerLine & trigger : conn->triggers() ) {
-
-         unsigned int bit = trigger.counter() % 64;  // trigger bit in module
+      for(const TrigConf::TriggerLine & trigger : conn->triggers() ) {
          
-         uint64_t & moduleDec = m_decision[trigger.module()];
-         uint64_t & moduleOvf = m_overflow[trigger.module()];
-         uint64_t mask(0x1);
+	      unsigned int position = trigger.startbit() + 32*trigger.fpga() + 16*trigger.clock();
 
-         //std::cout << "JOERG GlobalDecision::collectDecision: trigger line " << trigger.name() << " [counter="<<trigger.counter()<<"] on module " << trigger.module() << " and bit [0-63] " << bit << " -> dec " << dec << std::endl;
+         uint64_t & connectorDec = m_decision[trigger.connName()];
+         uint64_t & connectorOvf = m_overflow[trigger.connName()];
+         uint64_t mask(0x1);
 
          if( dec.bit(pos++) )  // bit set?
-            moduleDec |= (mask << bit);
+            connectorDec |= (mask << position);
          if( dec.overflow())
-            moduleOvf |= (mask << bit);
+            connectorOvf |= (mask << position);
       }
 
    }
    m_valid = true;
-   return StatusCode::SUCCESS;
+   return TCS::StatusCode::SUCCESS;
 }
 
 
-StatusCode
+TCS::StatusCode
 GlobalDecision::resetDecision() {
-   m_decision[0] = m_decision[1] = m_decision[2] = 0;
-   m_overflow[0] = m_overflow[1] = m_overflow[2] = 0;
+   for(auto const& dec : m_decision)
+     m_decision[dec.first] = 0;
+   for(auto const& ovf : m_overflow)
+     m_overflow[ovf.first] = 0;
    m_valid = false;
-   return StatusCode::SUCCESS;
+   return TCS::StatusCode::SUCCESS;
 }
 
 
@@ -96,18 +118,17 @@ operator<<(std::ostream& o, const TCS::GlobalDecision & dec) {
    if(!dec.isValid()) 
       o << "Note that the overall decision has not been calculated" << endl;
 
-   for(unsigned int module = 0; module<3; ++module)
-      o << "Overall decision module " << module << ": 0x" << right << hex << setfill('0') << setw(16) << dec.decision(module) << std::dec << setfill(' ') << endl;
-
+   for(auto const& itdec : dec.m_decision)
+      o << "Overall decision for connector " << itdec.first << ": 0x" << right << hex << setfill('0') << setw(16) << dec.decision_field(itdec.first) << std::dec << setfill(' ') << endl;
    
    if(dec.isValid()) {
-      for(const TXC::TriggerLine & trigger : dec.m_triggers)
-         o << "  " << setw(30) << left << trigger.name() << "  " << (dec.passed(trigger.module(), trigger.counter() % 64) ? "pass" : "fail") << endl;
+     for(const TrigConf::TriggerLine & trigger : dec.m_triggers){
+	 unsigned int position = trigger.startbit() + 32*trigger.fpga() + 16*trigger.clock();
+	 o << "  " << setw(30) << left << trigger.name() << "  " << (dec.passed(trigger.connName(), position) ? "pass" : "fail") << endl;}
    } else {
-      for(const TXC::TriggerLine & trigger : dec.m_triggers)
-         o << "  " << setw(30) << left << trigger.name() << "  unset" << endl;
+      for(const TrigConf::TriggerLine & trigger : dec.m_triggers)
+	o << "  " << setw(30) << left << trigger.name() << "  unset" << endl;
    }
-   
    return o;
 }
 //----------------------------------------------------------
@@ -117,17 +138,17 @@ GlobalDecision::print() const {
    if(!isValid()) 
       TRG_MSG_INFO("Note that the overall decision has not been calculated");
 
-   for(unsigned int module = 0; module<3; ++module)
-      TRG_MSG_INFO("Overall decision module " << module << ": 0x" << right << hex << setfill('0') << setw(16) << decision(module) << std::dec << setfill(' '));
+   for(auto const& dec : m_decision)
+      TRG_MSG_INFO("Overall decision from connector " << dec.first << ": 0x" << right << hex << setfill('0') << setw(16) << decision_field(dec.first) << std::dec << setfill(' '));
 
-   
    if(isValid()) {
-      for(const TXC::TriggerLine & trigger : m_triggers)
-         TRG_MSG_INFO("      " << setw(30) << left << trigger.name() << "  " << (passed(trigger.module(), trigger.counter() % 64) ? "pass" : "fail") );
+      for(const TrigConf::TriggerLine & trigger : m_triggers){
+	 unsigned int position = trigger.startbit() + 32*trigger.fpga() + 16*trigger.clock();
+ 	 TRG_MSG_INFO("      " << setw(30) << left << trigger.name() << "  " << (passed(trigger.connName(), position) ? "pass" : "fail") );}
    } else {
-      for(const TXC::TriggerLine & trigger : m_triggers)
+      for(const TrigConf::TriggerLine & trigger : m_triggers)
          TRG_MSG_INFO("      " << setw(30) << left << trigger.name() << "  unset" );
    }
-   
 }
+
 }
diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoCoreSimResult.cxx b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoCoreSimResult.cxx
index f1dcd5ee5395193680b12047d826906b2edd9b6c..fe17f5cfeaf5d1956d57b605e3e2f272662c3936 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoCoreSimResult.cxx
+++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoCoreSimResult.cxx
@@ -15,6 +15,8 @@
 
 #include "L1TopoCommon/Exception.h"
 
+#include "TrigConfData/L1Menu.h"
+
 #include <algorithm>
 
 using namespace std;
@@ -46,9 +48,9 @@ TopoCoreSimResult::triggerOutput(const std::string & triggerName) const {
 
 
 
-StatusCode
+TCS::StatusCode
 TopoCoreSimResult::collectResult(TCS::DecisionConnector* outputConn) {
-   StatusCode sc = StatusCode::SUCCESS;
+   TCS::StatusCode sc = TCS::StatusCode::SUCCESS;
    if (outputConn == nullptr ) {
       sc = m_globalDecision.collectDecision(m_outputConnectors);
    } else {
@@ -59,31 +61,33 @@ TopoCoreSimResult::collectResult(TCS::DecisionConnector* outputConn) {
 }
 
 
-StatusCode
+TCS::StatusCode
 TopoCoreSimResult::reset() {
    return m_globalDecision.resetDecision();
 }
 
 
-StatusCode
-TopoCoreSimResult::setupFromMenu(const TXC::L1TopoMenu & menu, 
-                                 const std::map<std::string, TCS::DecisionConnector*>& outputConnectorMap) {
+TCS::StatusCode
+TopoCoreSimResult::setupFromMenu(const std::map<std::string, TCS::DecisionConnector*>& outputConnectorMap) {
 
    m_outputConnectorMap = outputConnectorMap;
 
+   vector<TrigConf::TriggerLine> triggerLines;
+
    for(auto & x : m_outputConnectorMap) {
       // fill the set
       m_outputConnectors.insert(x.second);
 
       // fill the trigger line map (trigger name --> (TCS::DecisionConnector*,unsigned int index) )
-      for( const TXC::TriggerLine & trigger : x.second->triggers() ) {
+      for( const TrigConf::TriggerLine & trigger : x.second->triggers() ) {
          m_triggerLocation[trigger.name()] = x.second;
+	 triggerLines.push_back(trigger);
       }
    }
 
-   m_globalDecision.setTriggerLines(menu.getL1TopoConfigOutputList().getTriggerLines());
+   m_globalDecision.setTriggerLines(triggerLines);
 
-   return StatusCode::SUCCESS;
+   return TCS::StatusCode::SUCCESS;
 }
 
 
@@ -112,9 +116,9 @@ operator<<(std::ostream& o, const TCS::TopoCoreSimResult & simRes) {
 
    for( const DecisionConnector * conn : simRes.m_outputConnectors ) {
       o << conn->name() << endl;
-      for(const TXC::TriggerLine & trigger : conn->triggers()) {
-         o << "  " << trigger << endl;
-      }
+   //   for(const TrigConf::TriggerLine & trigger : conn->triggers()) {
+	//         o << "  " << trigger << endl;
+   //   }
       for(const TCS::TOBArray* output : conn->outputData())
          o << "  output " << output << endl;
    }
diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteering.cxx b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteering.cxx
index 007bfc2f624648894304bf9876950011be4d1892..a7e609b804dc2b92030738257ef21a35258b6063 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteering.cxx
+++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteering.cxx
@@ -1,8 +1,11 @@
-// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
 
 #include "L1TopoInterfaces/AlgFactory.h" 
 #include "L1TopoInterfaces/IL1TopoHistSvc.h"
 
+
 #include "L1TopoInterfaces/ConfigurableAlg.h"
 #include "L1TopoInterfaces/ParameterSpace.h"
 #include "L1TopoInterfaces/SortingAlg.h"
@@ -41,22 +44,31 @@ TopoSteering::~TopoSteering() {
    AlgFactory::destroy_instance();
 }
 
-StatusCode
-TopoSteering::setupFromConfiguration(const TXC::L1TopoMenu& menu) {
-   
-   if(m_useBitwise){ TRG_MSG_INFO("Will be using bitwise implementation of algorithms");}
-   else{TRG_MSG_INFO("Will NOT be using bitwise implementation of algorithms");}
+TCS::StatusCode
+TopoSteering::setupFromConfiguration(const TXC::L1TopoMenu&){
+  
+  // Keep this method to avoid crashes. TO-DO: Switch menu loading in L1TopoSimulation.cxx
+  TRG_MSG_WARNING("Cannot configure simulation from XML. Use JSON format");
 
+  return TCS::StatusCode::SUCCESS;
 
-   StatusCode sc = m_structure.setupFromMenu( menu );
+}
 
-   // configure layout of the simulation result
-   sc &= m_simulationResult.setupFromMenu( menu, m_structure.outputConnectors() );
 
-   return sc;
+TCS::StatusCode
+TopoSteering::setupFromConfiguration(const TrigConf::L1Menu& l1menu){
+
+
+  TCS::StatusCode sc = m_structure.setupFromMenu( l1menu );
+  
+  // configure layout of the simulation result
+  sc &= m_simulationResult.setupFromMenu( m_structure.outputConnectors() );
+
+  return sc;
+
 }
 
-StatusCode
+TCS::StatusCode
 TopoSteering::reset() {
 
    ClusterTOB::clearHeap();
@@ -74,11 +86,11 @@ TopoSteering::reset() {
 
    m_simulationResult.reset();
    
-   return StatusCode::SUCCESS;
+   return TCS::StatusCode::SUCCESS;
 }
 
 
-StatusCode
+TCS::StatusCode
 TopoSteering::initializeAlgorithms() {
    TRG_MSG_INFO("initializing algorithms");
    if( ! structure().isConfigured() ) {
@@ -101,7 +113,7 @@ TopoSteering::initializeAlgorithms() {
 }
 
 
-StatusCode
+TCS::StatusCode
 TopoSteering::setHistSvc(std::shared_ptr<IL1TopoHistSvc> histSvc) {
    TRG_MSG_INFO("setting L1TopoHistSvc ");
    m_histSvc = histSvc;
@@ -109,7 +121,7 @@ TopoSteering::setHistSvc(std::shared_ptr<IL1TopoHistSvc> histSvc) {
 }
 
 
-StatusCode
+TCS::StatusCode
 TopoSteering::saveHist() {
    if(m_histSvc) {
       m_histSvc->save();
@@ -120,7 +132,7 @@ TopoSteering::saveHist() {
 }
 
 
-StatusCode
+TCS::StatusCode
 TopoSteering::executeEvent() {
 
 
@@ -135,7 +147,7 @@ TopoSteering::executeEvent() {
    inputEvent().print();
 
    // execute all connectors
-   StatusCode sc = StatusCode::SUCCESS;
+   TCS::StatusCode sc = TCS::StatusCode::SUCCESS;
    TRG_MSG_INFO("Going to execute " << m_structure.outputConnectors().size() << " connectors");
    for(auto outConn: m_structure.outputConnectors()) {
       TRG_MSG_INFO("executing trigger line " << outConn.first);
@@ -148,19 +160,19 @@ TopoSteering::executeEvent() {
    m_simulationResult.globalDecision().print();
 
    TRG_MSG_INFO("finished executing event " << m_evtCounter++);
-   return StatusCode::SUCCESS;
+   return TCS::StatusCode::SUCCESS;
 }
 
 
 
-StatusCode
+TCS::StatusCode
 TopoSteering::executeTrigger(const std::string & TrigName) {
    if( ! structure().isConfigured() )
       TCS_EXCEPTION("TopoSteering has not been configured, can't run");
    
    DecisionConnector * outConn = m_structure.outputConnector(TrigName);
 
-   StatusCode sc = executeConnector(outConn);
+   TCS::StatusCode sc = executeConnector(outConn);
 
    m_simulationResult.collectResult(outConn);
 
@@ -168,18 +180,22 @@ TopoSteering::executeTrigger(const std::string & TrigName) {
 }
 
 
-StatusCode
+
+
+
+
+TCS::StatusCode
 TopoSteering::executeConnector(TCS::Connector *conn) {
 
    if (conn == NULL) {
-     return StatusCode::FAILURE;
+     return TCS::StatusCode::FAILURE;
    }
 
    // caching
    if(conn->isExecuted())
       return conn->executionStatusCode();
   
-   StatusCode sc(StatusCode::SUCCESS);
+   TCS::StatusCode sc(TCS::StatusCode::SUCCESS);
 
    if(conn->isInputConnector()) {
       //TRG_MSG_DEBUG("  ... executing input connector '" << conn->name() << "'");
@@ -200,14 +216,14 @@ TopoSteering::executeConnector(TCS::Connector *conn) {
 
 
 
-StatusCode
+TCS::StatusCode
 TopoSteering::executeInputConnector(TCS::InputConnector *conn) {
 
    if (conn == NULL) {
-     return StatusCode::FAILURE;
+     return TCS::StatusCode::FAILURE;
    }
 
-   StatusCode sc(StatusCode::SUCCESS);
+   TCS::StatusCode sc(TCS::StatusCode::SUCCESS);
 
    // attaching data from inputEvent to input connector, depending on the configured input type
 
@@ -223,14 +239,14 @@ TopoSteering::executeInputConnector(TCS::InputConnector *conn) {
 
 
 
-StatusCode
+TCS::StatusCode
 TopoSteering::executeSortingConnector(TCS::SortingConnector *conn) {
 
    if (conn == NULL) {
      return StatusCode::FAILURE;
    }
 
-   StatusCode sc = StatusCode::SUCCESS;
+   TCS::StatusCode sc = TCS::StatusCode::SUCCESS;
   
    // execute all the prior connectors
    for( TCS::Connector* inputConn: conn->inputConnectors() ){
@@ -253,14 +269,14 @@ TopoSteering::executeSortingConnector(TCS::SortingConnector *conn) {
 
 
 
-StatusCode
+TCS::StatusCode
 TopoSteering::executeDecisionConnector(TCS::DecisionConnector *conn) {
 
    if (conn == NULL) {
-     return StatusCode::FAILURE;
+     return TCS::StatusCode::FAILURE;
    }
 
-   StatusCode sc = StatusCode::SUCCESS;
+   TCS::StatusCode sc = TCS::StatusCode::SUCCESS;
   
    // execute all the prior connectors
    for( TCS::Connector* inputConn: conn->inputConnectors() ){
@@ -305,7 +321,7 @@ TopoSteering::executeDecisionConnector(TCS::DecisionConnector *conn) {
 
 
 
-StatusCode
+TCS::StatusCode
 TopoSteering::executeSortingAlgorithm(TCS::SortingAlg *alg,
                                       TCS::InputConnector* inputConnector,
                                       TCS::TOBArray * & sortedOutput) {
@@ -318,12 +334,12 @@ TopoSteering::executeSortingAlgorithm(TCS::SortingAlg *alg,
    if(m_useBitwise) alg->sortBitCorrect(*input, *sortedOutput);
    else alg->sort(*input, *sortedOutput);
 
-   return StatusCode::SUCCESS;
+   return TCS::StatusCode::SUCCESS;
 }
 
 
 
-StatusCode
+TCS::StatusCode
 TopoSteering::executeDecisionAlgorithm(TCS::DecisionAlg *alg,
                                        const std::vector<Connector*> & inputConnectors,
                                        const std::vector<TCS::TOBArray *> & output,
@@ -357,10 +373,11 @@ TopoSteering::executeDecisionAlgorithm(TCS::DecisionAlg *alg,
    else alg->process( input, output, decision );
    //TRG_MSG_ALWAYS("[XS1234sz]L1Topo Steering alg " << alg->name() << " has decision " << decision.decision());
      
-   return StatusCode::SUCCESS;
+   return TCS::StatusCode::SUCCESS;
 }
 
 
+
 void
 TopoSteering::printDebugInfo() {
    TRG_MSG_INFO("Number of ClusterTOB  : " << ClusterTOB::heap().size());
@@ -422,8 +439,8 @@ void TopoSteering::propagateHardwareBitsToAlgos()
        TCS::DecisionConnector *outCon = connector.second;
         outCon->decisionAlgorithm()->resetHardwareBits();
         unsigned int pos = 0; // for multi-output algorithms pos is the output index
-        for(const TXC::TriggerLine &trigger : outCon->triggers()){
-            unsigned int bitNumber = trigger.counter();
+        for(const TrigConf::TriggerLine &trigger : outCon->triggers()){
+	    unsigned int bitNumber = trigger.startbit() + 32*trigger.fpga() + 16*clock();
             outCon->decisionAlgorithm()->setHardwareBits(pos,
                                                          m_triggerHdwBits[bitNumber],
                                                          m_ovrflowHdwBits[bitNumber]);
diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteeringStructure.cxx b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteeringStructure.cxx
index e7b1fd48d0ede95226d44b8913519f309f63525b..e06236282245f3635db3b40d813a3ecd6e766848 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteeringStructure.cxx
+++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteeringStructure.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 "L1TopoCoreSim/TopoSteeringStructure.h"
 
@@ -20,6 +20,8 @@
 
 #include "L1TopoHardware/L1TopoHardware.h"
 
+#include "TrigConfData/L1Menu.h"
+
 #include <set>
 #include <iomanip>
 #include <boost/lexical_cast.hpp>
@@ -72,11 +74,11 @@ TopoSteeringStructure::~TopoSteeringStructure() {
 }
 
 
-StatusCode
+TCS::StatusCode
 TopoSteeringStructure::reset() {
    for(Connector* conn: m_connectors)
       conn->reset();
-   return StatusCode::SUCCESS;
+   return TCS::StatusCode::SUCCESS;
 }
 
 
@@ -117,189 +119,319 @@ TCS::TopoSteeringStructure::printParameters(std::ostream & o) const {
 }
 
 
-
-
 TCS::StatusCode
-TCS::TopoSteeringStructure::setupFromMenu(const TXC::L1TopoMenu& menu, bool debug) {
+TCS::TopoSteeringStructure::setupFromMenu(const TrigConf::L1Menu& l1menu, bool debug, bool legacy) {
 
    if(debug)
       cout << "/***************************************************************************/" << endl
            << "           L1Topo steering structure: configuring from L1 Topo Menu          " << endl
            << "/***************************************************************************/" << endl;
 
-   set<TCS::inputTOBType_t> neededInputs;
-   if(debug)
-      cout << "... building sorting connectors" << endl;
-
-   for( const TXC::L1TopoConfigAlg & configalgo: menu.getL1TopoConfigAlgs() ) {   
-
-      if(!configalgo.isSortAlg()) continue;
-      
-      // Input
-      for(string & algoInput : configalgo.getInputNames()) {
-         TCS::inputTOBType_t en = inputType(algoInput);
-         neededInputs.insert(en);
-      }
-
-      // create connector
-      SortingConnector * conn = new SortingConnector(configalgo.getInputNames()[0], configalgo.fullname(), configalgo.output());
-      if(debug)
-         cout << "Adding sorting connector " << "[" << *conn << "]" << endl;
-      addSortingConnector( conn );
-   }
-
-
+   //   set<TCS::inputTOBType_t> neededInputs; // Stores inputs for DecisionConnectors
+   vector<string> storedConn; // Stores decision connectors in order to avoid double counting
+   vector<vector<string>> confAlgorithms; // Stores algorithm name/category that have been configured in L1Menu to be used for setting the parameters
+   // Loop over boards in L1Menu and skip the ones that are not TOPO. Use Run-2 boards if legacy flag is on
+   for (const string & boardName : l1menu.boardNames() ){
+     
+     auto & l1board = l1menu.board(boardName);
+
+     if (l1board.type() != "TOPO") continue;
+     if (l1board.legacy() != legacy) continue;
+
+     // Access the connectors in the boards
+
+     for (const string & connName : l1board.connectorNames() ){
+
+       auto & l1conn = l1menu.connector(connName);
+
+       // All topo decision algorithms are configured in boards with electrical connection to CTP - Add optical connectors when adding multiplicity algorithms
+       // Look at all Topo algorithms in each connector, and get inputs from each algorithm to configure SortingConnectors
+       if ( ! (l1conn.connectorType() == TrigConf::L1Connector::ConnectorType::ELECTRICAL ) ) continue;
+
+       for( size_t fpga : { 0, 1} ) {
+	 for( size_t clock : { 0, 1} ) {
+	   for( auto & tl : l1conn.triggerLines(fpga, clock) ) {
+	     
+	     const string & tlName = tl.name();
+	     auto & algo = l1menu.algorithmFromTriggerline(tlName);
+
+	     // One algorithm can have multiple trigger lines. Check the connector/algorithm has not been stored already
+	     auto it = find(storedConn.begin(), storedConn.end(), algo.name());
+	     if (it == storedConn.end()) { // Algorithm/Connector does not exist: create and store it
+
+	       storedConn.push_back(algo.name());
+	       vector<string> inputNames;
+	       for( auto & input : algo.inputs() ) {
+		 if( sortingConnector(input) == 0 ) { // if connector does not exist, create it
+		   if(debug) 
+		     cout << "L1TopoSteering: Decision algo( " << algo.name() << " ) input is not defined: " << input << ". Creating sortingConnector" << endl;
+		   
+		   auto & sortAlgo = l1menu.algorithm(input, algo.category());
+		   if(!(sortAlgo.type() == TrigConf::L1TopoAlgorithm::AlgorithmType::SORTING ) )
+		     TCS_EXCEPTION("L1TopoSteering: Decision algo " << algo.name() << ") has as input " << input << " which is not associated to a sorting algorithm");
+
+		   //		   TCS::inputTOBType_t en = inputType(sortAlgo.inputs().at(0));
+		   //		   neededInputs.insert(en);
+
+		   // Create connector
+		   SortingConnector * sortConn = new SortingConnector(sortAlgo.inputs().at(0), sortAlgo.klass()+"/"+input, sortAlgo.outputs().at(0));
+		   if(debug)
+		     cout << "Adding sorting connector " << "[" << *sortConn << "]" << endl;
+		   addSortingConnector( sortConn );
+		   confAlgorithms.push_back({sortAlgo.name(), sortAlgo.category()});
+
+		 } // if connector does not exist
+		 
+		 inputNames.push_back(input);
+
+	       } // loop over inputs
+
+	       DecisionConnector * conn = new DecisionConnector(algo.name(), inputNames, algo.klass()+"/"+algo.name(), algo.outputs());
+	       conn->m_decision.setNBits( algo.outputs().size() );
+
+	       if(tl.name() != "UNDEF")
+		 conn->m_triggers.push_back(tl);
+
+	       if(debug)
+		 cout << "Adding decision connector " << "[" << *conn << "]" << endl;
+	       addDecisionConnector( conn );
+	       confAlgorithms.push_back({algo.name(), algo.category()});
+
+	     } else { // Connector already exists: look for it and add the trigger line
+	       for(auto out : algo.outputs()){
+		 auto c = m_outputLookup.find(out);
+		 if (c != m_outputLookup.end()){
+		   auto conn = c->second;
+		   if(tl.name() != "UNDEF")
+		     conn->m_triggers.push_back(tl);
+		   break;
+		 }
+	       }
+	     }
+
+	   } // Trigger Line
+
+	 } // Clock
+
+       } // FPGA
+       
+     } // Connector in l1board
 
+   } // Board in l1menu
 
+   /*
    if(debug)
-      cout << "... building output connectors" << endl;
-   for( const TXC::L1TopoConfigAlg & configalgo: menu.getL1TopoConfigAlgs() ) {     
+     cout << "... building sorting connectors" << endl;
 
-      if(!configalgo.isDecAlg()) continue;
+   std::string categories[] = { "TOPO" };
 
-      for( const TXC::InputElement & input : configalgo.getInputs() ) {
-         if( sortingConnector(input.value) == 0 ) {
-            TCS_EXCEPTION("L1TopoSteering: Decision algo ( " << configalgo.fullname() << " ) input is not defined: " << input.value);
-         }
-      }
-
-      DecisionConnector * conn = new DecisionConnector(configalgo.name(), configalgo.getInputNames(), configalgo.fullname(), configalgo.getOutputNames());
-      conn->m_decision.setNBits( configalgo.getOutputs().size() );
-
-      for(const std::string & output: conn->outputNames()) {
-         const TXC::TriggerLine & trigger = menu.getL1TopoConfigOutputList().getTrigger(output);
-         if(trigger.name()!="UNDEF")
-            conn->m_triggers.push_back(trigger);
-      }
-      if(debug)
-         cout << "Adding decision connector " << "[" << *conn << "]" << endl;
-      addDecisionConnector( conn );
+   for( auto & category : categories ){
+   
+     for( auto & name : l1menu.topoAlgorithmNames(category)) {
+       
+       auto & algo = l1menu.algorithm(name, category);
+       
+       if(!(algo.type() == TrigConf::L1TopoAlgorithm::AlgorithmType::SORTING ) ) continue;
+       
+       TCS::inputTOBType_t en = inputType(algo.inputs().at(0));
+       neededInputs.insert(en);
+       
+       // create connector
+       SortingConnector * conn = new SortingConnector(algo.inputs().at(0), algo.klass()+"/"+name, algo.outputs().at(0));
+       if(debug)
+	 cout << "Adding sorting connector " << "[" << *conn << "]" << endl;
+       addSortingConnector( conn );
+     }
 
    }
+     
 
+   
+   if(debug)
+     cout << "... building output connectors" << endl;
+
+   // All topo decision algorithms are configured in boards with electrical connection to CTP
+   // Create all DecisionConnectors from L1Connectors of type ELECTRICAL
+   std::vector<std::string> storedConn;
+   for ( const string & connName : l1menu.connectorNames() ){
+
+     auto & l1conn = l1menu.connector(connName);
+
+     if ( ! (l1conn.type() == TrigConf::L1Connector::ConnectorType::ELECTRICAL ) ) continue;
+     if ( l1conn.isLegacy() ) continue;
+
+     for( size_t fpga : { 0 ,1 } ) {
+       for( size_t clock : { 0 ,1 } ) {
+	 for( auto & tl : l1conn.triggerLines(fpga, clock) ) {
+	   
+	   const string & tlName = tl.name();
+	   auto & algo = l1menu.algorithmFromTriggerline(tlName);
+	   
+	   // One algorithm can have multiple trigger lines. Check the connector/algorithm has not been stored already
+	   auto it = std::find(storedConn.begin(), storedConn.end(), algo.name());
+	   if (it == storedConn.end()) { // Algorithm/Connector do not exist: create and store it
+
+	     storedConn.push_back(algo.name());
+
+	     std::vector<std::string> inputNames;
+	     for( auto & input : algo.inputs() ) {
+	       if( sortingConnector(input) == 0 ) {
+		 TCS_EXCEPTION("L1TopoSteering: Decision algo ( " << algo.name() << " ) input is not defined: " << input);
+	       }
+	       inputNames.push_back(input);
+	     }
+
+	     DecisionConnector * conn = new DecisionConnector(algo.name(), inputNames, algo.klass()+"/"+algo.name(), algo.outputs());
+	     conn->m_decision.setNBits( algo.outputs().size() );
+	   
+	     if(tl.name() != "UNDEF")
+	       conn->m_triggers.push_back(tl);
+
+	     if(debug)
+	       cout << "Adding decision connector " << "[" << *conn << "]" << endl;
+	     addDecisionConnector( conn );
+
+	   } else { // Connector already exists: look for it and add the trigger line
+	     for(auto out : algo.outputs()){
+	       auto c = m_outputLookup.find(out);
+	       if (c != m_outputLookup.end()){
+		 auto conn = c->second;
+		 if(tl.name() != "UNDEF")
+		   conn->m_triggers.push_back(tl);
+		 break;
+	       }
+	     }
+	   }
+	 } // Trigger Line
+       } // Clock
+     } // FPGA
+   } // L1Connectors
+
+   */
 
    if(debug)
-      cout << "... building input connectors" << endl;
+     cout << "... building input connectors" << endl;
    for(auto sortConn : m_sortedLookup) {
-      const string & in = sortConn.second->inputNames()[0]; // name of input
-
-      if( m_inputLookup.count(in) > 0 ) continue; // InputConnector already exists
-
-      InputConnector * conn = new InputConnector(in);
-      m_connectors.push_back(conn);
-      m_inputLookup[in] = conn;
-      if(debug)
-         cout << "Adding input connector " << "[" << *conn << "]" << endl;
+     const string & in = sortConn.second->inputNames()[0]; // name of input
+     
+     if( m_inputLookup.count(in) > 0 ) continue; // InputConnector already exists
+
+     InputConnector * conn = new InputConnector(in);
+     m_connectors.push_back(conn);
+     m_inputLookup[in] = conn;
+     if(debug)
+       cout << "Adding input connector " << "[" << *conn << "]" << endl;
    }
 
-   
    // link the connector objects together
-   StatusCode sc = linkConnectors();
-   
+   TCS::StatusCode sc = linkConnectors();
+
    // instantiate the algorithms from the algorithm names in the connectors
    if(debug)
-      cout << "... instantiating algorithms" << endl;
+     cout << "... instantiating algorithms" << endl;
    sc &= instantiateAlgorithms(debug);
-   
 
-   // iterate through OutputList elements
-   if(debug) {
-      cout << "... checking output list" << endl;
-      cout << menu.getL1TopoConfigOutputList().getOutputList().size() << " output algorithms for " 
-           << menu.getL1TopoConfigOutputList().getTriggerLines().size() << " trigger lines." << endl;
-   }
-   
+
    // set algorithm parameters
    if(debug)
-      cout << "... setting algorithm parameters" << endl;
-   
-   for( const TXC::L1TopoConfigAlg & configalgo: menu.getL1TopoConfigAlgs() ) {
+     cout << "... setting algorithm parameters" << endl;
 
-      ConfigurableAlg * alg = AlgFactory::instance().algorithm(configalgo.name());
-
-      alg->setAlgoId( configalgo.algoID() );
-
-      if(debug)
-         cout << "Algorithm " << alg->name() << endl << "  (reading parameters)" << endl;
-
-      if(alg->isDecisionAlg())
-         ((DecisionAlg *) alg)->setNumberOutputBits(configalgo.getOutputs().size());
-
-      // create ParameterSpace for this algorithm
-      ParameterSpace * ps = new ParameterSpace(alg->name());
-
-      for(TXC::RegisterParameter pe: configalgo.getParameters()) {
-         
-         string   name = pe.name;
-         uint32_t val = lexical_cast<uint32_t, string>(pe.value);
-         uint32_t pos  = pe.position;
-         uint32_t sel  = pe.selection;
-         
-         if(debug)
-            cout << "  parameter " << pos << ": " << setw(20) << left << name << " value = " << setw(3) << left << val << " (selection " << sel << ")" << endl;
-         ps->addParameter( name, val, sel);
-      }
-
-
-      for(TXC::FixedParameter pe: configalgo.getFixedParameters()) {
-         
-         string   name = pe.name;
-         uint32_t val = interpretGenericParam(pe.value);
-         if(name=="NumResultBits") {
-            if(val != configalgo.getOutputs().size()) {
-               TCS_EXCEPTION("Algorithm " << name << " parameter OutputBits (" << val << ") is different from output size (" << configalgo.getOutputs().size() << ")");
-            }
-            continue; // ignore this, because it is defined through the output list
-         }
-         if(debug)
-            cout << "  fixed parameter : " << setw(20) << left << name << " value = " << setw(3) << left << val << endl;
-         ps->addParameter( name, val);
-      }
-
-
-      if(debug)
-         cout << "  (setting parameters)" << endl;
-      alg->setParameters( *ps );
-
-      if( alg->isDecisionAlg() ) {
-         if( m_parameters[alg->algoId()] != nullptr ) {
-            TCS_EXCEPTION("Decision algorithm " << alg->name() << " has algoId " << alg->algoId() << " which is already used");
-         }
-         m_parameters[alg->algoId()] = ps;
-      } else if( alg->isSortingAlg() ) {
-         if( m_parameters[alg->algoId() + LayoutConstraints::maxComponents()] != nullptr ) {
-            TCS_EXCEPTION("Sorting algorithm " << alg->name() << " has algoId " << alg->algoId() << " which is already used");
-         }
-         m_parameters[alg->algoId() + LayoutConstraints::maxComponents()] = ps;
-      } else {
-	// newed parameters unused so delete to avoid memory leak
-	delete ps;
-	ps=0;
-      }
+   for ( auto & confAlgo : confAlgorithms ) {
+     
+     auto & l1algo = l1menu.algorithm(confAlgo.at(0), confAlgo.at(1));
+       
+     ConfigurableAlg * alg = AlgFactory::instance().algorithm(l1algo.name());
+     alg->setAlgoId( l1algo.algId() );
+     
+     if(debug)
+       cout << "Algorithm " << alg->name() << " has algoId " << alg->algoId() <<  endl << " (reading parameters)" << endl;
+     
+     if(alg->isDecisionAlg())
+       ((DecisionAlg *) alg)->setNumberOutputBits(l1algo.outputs().size());
+
+     // create ParameterSpace for this algorithm
+     ParameterSpace * ps = new ParameterSpace(alg->name());
+
+     for(auto & pe : l1algo.parameters()) {
+	 
+       auto & pname = pe.name();
+       uint32_t val = pe.value();
+       uint32_t sel = pe.selection();
+
+       if(debug)
+	 cout << " parameter " << ": " << setw(20) << left << pname << " value = " << setw(3) << left << val << " (selection " << sel << ")" << endl;
+       ps->addParameter( pname, val, sel);
+	 
+     }
+       
+     for(auto & gen : l1algo.generics().getKeys()) {
+	 
+       auto pe = l1algo.generics().getObject(gen);
+       string pname = gen;
+       uint32_t val = interpretGenericParam(pe.getAttribute("value"));
+       if (pname == "NumResultBits"){
+	 if(val != l1algo.outputs().size()) {
+	   TCS_EXCEPTION("Algorithm " << pname << " parameter OutputBits (" << val << ") is different from output size (" << l1algo.outputs().size() << ")");
+	 }
+	 continue; // ignore this, because it is defined through the output list
+       }
+       if(debug)
+	 cout << " fixed parameter : " << setw(20) << left << pname << " value = " << setw(3) << left << val << endl;
+       ps->addParameter( pname, val );
+	 
+     }
+       
+       
+     if(debug)
+       cout << " (setting parameters)";
+     alg->setParameters( *ps );
+       
+     if(debug)
+       cout << " --> (parameters set)";
+       
+     if( alg->isDecisionAlg() ) {
+       if( m_parameters[alg->algoId()] != nullptr ) {
+	 //	   TCS_EXCEPTION("Decision algorithm " << alg->name() << " has algoId " << alg->algoId() << " which is already used");
+       }
+       m_parameters[alg->algoId()] = ps;
+     } else if (alg->isSortingAlg() ) {
+       if( m_parameters[alg->algoId() + LayoutConstraints::maxComponents()] != nullptr ) {
+	 //	   TCS_EXCEPTION("Sorting algorithm " << alg->name() << " has algoId " << alg->algoId() << " which is already used");
+       }
+       m_parameters[alg->algoId() + LayoutConstraints::maxComponents()] = ps;
+     } else {
+       // newed parameters usued so delete to avoid memory leak
+       delete ps;
+       ps=0;
+     }
+
+     if(debug)
+       cout << " --> (parameters stored)" << endl;
    }
-
+   
    m_isConfigured = true;
-
+   
    if(debug)
-      cout << "... L1TopoSteering successfully configured" << endl;
+     cout << "... L1TopoSteering successfully configured" << endl;
    
    return sc;
 }
 
+
 TCS::StatusCode
 TopoSteeringStructure::addSortingConnector(SortingConnector * conn) {
    m_connectors.push_back(conn);
    for( const string & output : conn->outputNames() )
       m_sortedLookup[output] = conn;
-   return StatusCode::SUCCESS;
+   return TCS::StatusCode::SUCCESS;
 }
 
 TCS::StatusCode
 TopoSteeringStructure::addDecisionConnector(DecisionConnector * conn) {
-   m_connectors.push_back(conn);
+   m_connectors.push_back(conn); 
    for( const string & output : conn->outputNames() )
-      m_outputLookup[output] = conn;
-   return StatusCode::SUCCESS;
+     m_outputLookup[output] = conn;     
+   return TCS::StatusCode::SUCCESS;
 }
 
 
@@ -310,7 +442,7 @@ TopoSteeringStructure::linkConnectors() {
       for(const std::string & inconn: conn->inputNames())
          conn->inputConnectors().push_back( connector(inconn) );
 
-   return StatusCode::SUCCESS;
+   return TCS::StatusCode::SUCCESS;
 }
 
 
@@ -340,7 +472,7 @@ TCS::TopoSteeringStructure::instantiateAlgorithms(bool debug) {
       }
       conn->setAlgorithm(algInstance);
    }
-   return StatusCode::SUCCESS;
+   return TCS::StatusCode::SUCCESS;
 }
 
 
@@ -366,9 +498,7 @@ TopoSteeringStructure::sortingConnector(const std::string & connectorName) const
          }
       }
    }
-   if(sc==nullptr) {
-      TCS_EXCEPTION("TopoSteeringStructure: can not find SortingConnector of name " << connectorName << ". Need to abort!");
-   }
+   
    return sc;
 }
 
diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/src/test/TopoStandAlone.cxx b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/src/test/TopoStandAlone.cxx
index 64eb5b92b03507b1627fb32ba354b9982ac8a122..bb8081cf36834acbb3b0bf536d205407a1b73cad 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/src/test/TopoStandAlone.cxx
+++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/src/test/TopoStandAlone.cxx
@@ -7,6 +7,8 @@
 #include <stdint.h>
 
 #include "TrigConfBase/TrigConfMessaging.h"
+#include "TrigConfIO/JsonFileLoader.h"
+#include "TrigConfData/L1Menu.h"
 
 #include "L1TopoConfig/L1TopoXMLParser.h"
 #include "L1TopoCoreSim/TopoSteering.h"
@@ -27,7 +29,7 @@ using namespace std;
 
 int printHelp(const char * exeName) {
    cout << "Please specify menu and data file and optionally the message levels for the framework and the algorithms:" << endl << endl;
-   cout << exeName << " <menu.xml> <data.txt> [INFO|DEBUG|WARNING] [INFO|DEBUG|WARNING] [filename.root] [optional arguments]" << endl << endl;
+   cout << exeName << " <menu.json> <data.txt> [INFO|DEBUG|WARNING] [INFO|DEBUG|WARNING] [filename.root] [optional arguments]" << endl << endl;
    cout << "optional arguments:" << endl
         << "   -o|--outfile <filename.root>" << endl
         << "   -n|--nevt <#events>" << endl
@@ -97,15 +99,14 @@ int run(int argc, const char* argv[]) {
    msg.setLevel( msgLvl );
 
    // read the menu
-   TXC::L1TopoXMLParser XMLParser;
-   XMLParser.msg().setLevel( msgLvl );
-   XMLParser.readConfiguration(argv[1]);
-   XMLParser.parseConfiguration();
-
-   //XMLParser.menu().print();
+   TrigConf::L1Menu l1menu;
+   TrigConf::JsonFileLoader fileLoader;
+fileLoader.loadFile(argv[1], l1menu);
 
 
    //TFile *f = new TFile(argc>=4 ? argv[3] : "L1TopoSimulation.root","RECREATE");
+
+   /* Change once the final number of bits per module is fixed
    TH1* h[3];
    h[0] = new TH1F("Decision/DecisionModule1", "L1 Topo Decision (Module 1)", 64, 0, 64);
    h[1] = new TH1F("Decision/DecisionModule2", "L1 Topo Decision (Module 2)", 64, 0, 64);
@@ -117,21 +118,21 @@ int run(int argc, const char* argv[]) {
    }
    for(uint i=0; i<3; ++i)
       h[i]->SetLabelSize(0.025);
-
+   */
 
    // instantiate steering
    TCS::TopoSteering steering;
    steering.setUseBitwise(false);
-   steering.setupFromConfiguration(XMLParser.takeMenu());
+   steering.setupFromConfiguration(l1menu);
 
    steering.setMsgLevel( msgLvl );
 
    steering.setAlgMsgLevel( algMsgLvl );
 
    std::shared_ptr<IL1TopoHistSvc> topoHistSvc = std::shared_ptr<IL1TopoHistSvc>( new StandaloneL1TopoHistSvc() );
-   topoHistSvc->setBaseDir("L1TopoSimulation.root:");
-   for(int i = 0; i < 3; i++ )
-      topoHistSvc->registerHist(h[i]);
+   //   topoHistSvc->setBaseDir("L1TopoSimulation.root:");
+   //   for(int i = 0; i < 3; i++ )
+   //      topoHistSvc->registerHist(h[i]);
 
    steering.setHistSvc(topoHistSvc);
 
@@ -164,14 +165,15 @@ int run(int argc, const char* argv[]) {
 
       steering.executeEvent();
 
-      const TCS::GlobalDecision & globalDec = steering.simulationResult().globalDecision();
-
+      // const TCS::GlobalDecision & globalDec = 
+      steering.simulationResult().globalDecision();
+      /*
       for(unsigned int module=0; module<3; ++module)
          for(unsigned int trigger=0; trigger<64; ++trigger)
             if( globalDec.passed(module, trigger) ) h[module]->Fill(trigger);
-
+      */
       steering.reset();
-
+     
    }
    msg << TrigConf::MSGTC::INFO << "=======================================================" << TrigConf::endmsgtc;
   
diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/src/test/TopoTestSteeringConfig.cxx b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/src/test/TopoTestSteeringConfig.cxx
index 7717d75645ef69cbeda12b55af88836be201ff8a..4f6a5ef500895d07c718d7dab06ece7e681c2e77 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/src/test/TopoTestSteeringConfig.cxx
+++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/src/test/TopoTestSteeringConfig.cxx
@@ -8,36 +8,37 @@
 #include "L1TopoCoreSim/TopoSteering.h"
 #include "L1TopoConfig/L1TopoXMLParser.h"
 
+#include "TrigConfIO/JsonFileLoader.h"
+#include "TrigConfData/L1Menu.h"
+
 using namespace std;
 
 int run(int argc, const char * argv[]) {
 
    if(argc<2) {
-      cout << "Please specify topo menu input XML file:\n" << argv[0] << " -v <menu.xml>" << endl;
+      cout << "Please specify topo menu input JSON file:\n" << argv[0] << " -v <menu.json>" << endl;
       return 1;
    }
 
    bool verbose = (string(argv[1])=="-v");
 
+   TrigConf::L1Menu l1menu;
+   TrigConf::JsonFileLoader fileLoader;
 
-   TXC::L1TopoXMLParser parser;
-   parser.readConfiguration(argv[argc-1]);
    try {
-      parser.parseConfiguration();
+      fileLoader.loadFile( argv[0], l1menu);
    }
    catch(std::exception & e) {
-      cout << "TopoTestSteeringConfig: Caught exception from the topo menu parser, no topo menu will be available! Exception message: " << e.what() << endl;
+      cout << "TopoTestSteeringConfig: Caught exception from the topo menu loader, no topo menu will be available! Exception message: " << e.what() << endl;
       return 1;
    }
 
-   TXC::L1TopoMenu menu = parser.takeMenu();  // since parser goes out of scope, we take the menu
-
    if (verbose)
-      menu.print();
+      l1menu.printMenu(true);
 
    TCS::TopoSteering steering;
    try {
-      steering.setupFromConfiguration( menu );
+      steering.setupFromConfiguration(l1menu);
    } catch(exception & e) {
       cerr << "TopoTestSteeringConfig: Caught exception when configuring topo steering from menu: " << endl << e.what() << endl;
       return 1;
diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoSimulation/CMakeLists.txt
index 44e9340ac2e1ead1fb1f4680610360e8830e1663..f6b3339bd028099c90146d29b9f63546906b9c66 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/CMakeLists.txt
@@ -24,7 +24,7 @@ atlas_add_component( L1TopoSimulation
 atlas_add_component( L1TopoSimulationTest
    src/test/*.h src/test/*.cxx src/test/components/*.cxx src/AthenaL1TopoHistSvc.h src/AthenaL1TopoHistSvc.cxx
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-   LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthenaMonitoringLib GaudiKernel L1TopoConfig L1TopoCoreSim L1TopoEvent L1TopoInterfaces StoreGateLib TrigConfBase TrigConfInterfaces )
+   LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthenaMonitoringLib GaudiKernel L1TopoConfig L1TopoCoreSim L1TopoEvent L1TopoInterfaces StoreGateLib TrigConfBase TrigConfInterfaces TrigConfData TrigConfIO)
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/python/L1TopoSimulationConfig.py b/Trigger/TrigT1/L1Topo/L1TopoSimulation/python/L1TopoSimulationConfig.py
index 8339ca2dacb0ad342c44ca27036ba7ad875d98ec..2ac3701a60a78a30c9d6df19d637e6c608f5f606 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/python/L1TopoSimulationConfig.py
+++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/python/L1TopoSimulationConfig.py
@@ -9,7 +9,12 @@ class L1TopoSimulation ( LVL1__L1TopoSimulation ):
 
         from L1TopoSimulation.L1TopoSimulationMonitoring import L1TopoSimulationMonitoring
         self.AthenaMonTools += [ L1TopoSimulationMonitoring() ]
-
+        enableDebugOutput = False
+        if enableDebugOutput:
+            from AthenaCommon.Constants import DEBUG
+            self.OutputLevel = DEBUG
+            self.TopoOutputLevel = DEBUG
+            self.TopoSteeringOutputLevel = DEBUG
 
 class RoiB2TopoInputDataCnv ( LVL1__RoiB2TopoInputDataCnv ):
 
diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/share/L1TopoSimulationTest.py b/Trigger/TrigT1/L1Topo/L1TopoSimulation/share/L1TopoSimulationTest.py
index b9a4f1ddca2b3876c6ef608352691fd36e5ad5c7..ada857a13518b1dfd61963fdf6db66ca670789c2 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/share/L1TopoSimulationTest.py
+++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/share/L1TopoSimulationTest.py
@@ -8,8 +8,10 @@ from AthenaCommon.Logging import logging
 log = logging.getLogger('L1TopoSimulationTest.py')
          
 fmenu ,fTOBs = 'L1Topoconfig_MC_pp_v8_NewNaming.xml','eventdump_new.txt'
+fjson = 'L1Menu_LS2_v1_22.0.17.json'
 
 print ('File for menu :',fmenu)
+print ('File for menu (json):', fjson)
 print ('File for TOBs :',fTOBs)
    
 from AthenaCommon.AppMgr import ServiceMgr as svcMgr, theApp
@@ -61,6 +63,8 @@ from L1TopoSimulation.L1TopoSimulationTestConfig import L1TopoSimulationTest
 topSequence += L1TopoSimulationTest()
 topSequence.L1TopoSimulationTest.InputASCIIFile = fTOBs
 topSequence.L1TopoSimulationTest.InputXMLFile = fmenu
+topSequence.L1TopoSimulationTest.InputJSONFile = fjson
+
 
 from GaudiSvc.GaudiSvcConf import THistSvc
 svcMgr += THistSvc()
@@ -71,15 +75,16 @@ svcMgr.THistSvc.Output += ["EXPERT DATAFILE='expert-monitoring.root' OPT='RECREA
 
 #  set algCardinality = 1 to disable cloning for all Algs
 algCardinality = nThreads
+
 #  Cloning can be disable for any alg  
 
-if (algCardinality > 1):
+if (algCardinality > 1):   
    for alg in topSequence:      
       name = alg.name()
-      if name in ["L1TopoSimulation"] :
+      if name in ["SGInputLoader"] :
          # suppress INFO message about Alg unclonability
          # set alg.Cardinality = 1 to disable cloning for specific Alg
-         alg.Cardinality = 1
+         alg.Cardinality = nThreads
       else:
          alg.Cardinality = algCardinality
 
diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx
index c3578f93e54c46f597df1147f1c4425ef2b74be9..bd46c92c83a0e1f4a6186b2cdc31e4eab9d51d82 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx
+++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx
@@ -3,22 +3,11 @@
 */
 
 #include "./L1TopoSimulation.h"
-#include "./AthenaL1TopoHistSvc.h"
-
-#include "TH1F.h"
 
-#include "AthenaMonitoring/IMonitorToolBase.h"
-
-#include "L1TopoCoreSim/TopoSteering.h"
 #include "L1TopoConfig/L1TopoMenu.h"
 #include "L1TopoEvent/TopoInputEvent.h"
 
-#include "L1TopoSimulation/IInputTOBConverter.h"
-#include "TrigConfInterfaces/IL1TopoConfigSvc.h"
-#include "GaudiKernel/ITHistSvc.h"
-
 #include "L1TopoInterfaces/IL1TopoHistSvc.h"
-#include "TrigT1Interfaces/TrigT1StoreGateKeys.h"
 #include "TrigT1Interfaces/TrigT1CaloDefs.h"
 #include "TrigT1CaloEvent/EmTauROI_ClassDEF.h"
 
@@ -28,93 +17,61 @@
 #include "L1TopoRDO/L1TopoTOB.h"
 #include "L1TopoRDO/L1TopoRDOCollection.h"
 
-#include "./PeriodicScaler.h"
-
+#include "./AthenaL1TopoHistSvc.h"
 
-using namespace std;
+// using namespace std;
 using namespace LVL1;
 
-
 namespace {
    // needed for monitoring
    class TopoResultBit : public IMonitoredAlgo::IGetter {
    public:
     
       //! constructor
-      TopoResultBit(const TCS::GlobalDecision & decision, unsigned int module) :
+      TopoResultBit(const TCS::GlobalDecision & decision, std::string connName) :
          m_decision(decision),
-         m_module(module)
+         m_connName(connName)
       {}
 
       //! return size of data
-      virtual unsigned int size() const { return 64; }
+      virtual unsigned int size() const { return 64; } // Change this when implementing multiplicity algorithms (size could change for Topo1)
 
       //! indexed access to data
-      virtual double get(unsigned pos) const { return m_decision.passed(m_module, pos) ? pos : -1.; }
+      virtual double get(unsigned pos) const { return m_decision.passed(m_connName, pos) ? pos : -1.; }
 
    private:
       const TCS::GlobalDecision & m_decision;
-      unsigned int m_module;
+      std::string m_connName;
    };
 }
 
 
-
 L1TopoSimulation::L1TopoSimulation(const std::string &name, ISvcLocator *pSvcLocator) :
    AthAlgorithm(name, pSvcLocator),
-   m_l1topoConfigSvc("TrigConf::TrigConfigSvc/TrigConfigSvc", name),
-   m_histSvc( "THistSvc/THistSvc", name),
-   m_monitors(this),
-   m_emtauInputProvider("LVL1::EMTauInputProvider/EMTauInputProvider", this),
-   m_jetInputProvider("LVL1::JetInputProvider/JetInputProvider", this),
-   m_energyInputProvider("LVL1::EnergyInputProvider/EnergyInputProvider", this),
-   m_muonInputProvider("LVL1::MuonInputProvider/MuonInputProvider", this),
-   m_topoSteering( unique_ptr<TCS::TopoSteering>(new TCS::TopoSteering()) )
+   m_topoSteering( std::make_unique<TCS::TopoSteering>() ),
+   m_scaler( std::make_unique<LVL1::PeriodicScaler>() )
 {
-   declareProperty( "TrigConfigSvc", m_l1topoConfigSvc, "Service to provide the L1Topo menu");
-   declareProperty( "HistSvc", m_histSvc, "Histogramming service for L1Topo algorithms");
-   declareProperty( "EMTAUInputProvider", m_emtauInputProvider, "Tool to fill the EMTAU TOBs of the topo input event");
-   declareProperty( "JetInputProvider", m_jetInputProvider, "Tool to fill the Jet TOBs of the topo input event");
-   declareProperty( "EnergyInputProvider", m_energyInputProvider, "Tool to fill the energy and MET TOBs of the topo input event");
-   declareProperty( "MuonInputProvider", m_muonInputProvider, "Tool to fill the muon TOBs of the topo input event");
-   declareProperty( "AthenaMonTools", m_monitors, "List of monitoring tools to be run with this instance, if incorrect then tool is silently skipped.");
-   declareProperty( "MonHistBaseDir", m_histBaseDir = "L1TopoAlgorithms", "Base directory for monitoring histograms will be /EXPERT/<MonHistBaseDir>" );
-   declareProperty( "EnableInputDump", m_enableInputDump, "Boolean to enable writing of input data for standalone running");
-   declareProperty( "UseBitwise", m_enableBitwise, "Boolean to enable the bitwise version of software algorithms");
-   declareProperty("FillHistoBasedOnHardware", m_fillHistogramsBasedOnHardwareDecision=true,
-                   "Boolean to fill accept/reject histograms based on hdw; default based on sim");
-   declareProperty( "InputDumpFile", m_inputDumpFile, "File name for dumping input data");
-   declareProperty( "TopoCTPLocation", m_topoCTPLocation = LVL1::DEFAULT_L1TopoCTPLocation, "StoreGate key of topo decision output for CTP" );
-   declareProperty( "TopoOverflowCTPLocation", m_topoOverflowCTPLocation = LVL1::DEFAULT_L1TopoOverflowCTPLocation, "StoreGate key of topo overflow output for CTP" );
-   declareProperty( "TopoOutputLevel", m_topoOutputLevel, "OutputLevel for L1Topo algorithms" );
-   declareProperty( "TopoSteeringOutputLevel", m_topoSteeringOutputLevel, "OutputLevel for L1Topo steering" );
-   declareProperty("Prescale", m_prescale = 1, "Internal prescale factor for this algorithm, implemented with a periodic scaler: so 1 means run every time, N means run every 1 in N times it is called; the other times it will exit without doing anything");
-   declareProperty("PrescaleDAQROBAccess", m_prescaleForDAQROBAccess = 4, "Prescale factor for requests for DAQ ROBs: can be used to avoid overloading ROS. Zero means disabled, 1 means always, N means sample only 1 in N events");
-
-
-   const TCS::GlobalDecision & dec = m_topoSteering->simulationResult().globalDecision();
-   declareMonitoredCustomVariable("DecisionModule1", new TopoResultBit(dec, 0));
-   declareMonitoredCustomVariable("DecisionModule2", new TopoResultBit(dec, 1));
-   declareMonitoredCustomVariable("DecisionModule3", new TopoResultBit(dec, 2));
-   m_scaler = new LVL1::PeriodicScaler();
-   
+   // const TCS::GlobalDecision & dec = m_topoSteering->simulationResult().globalDecision();
+   // declareMonitoredCustomVariable("DecisionModule1", new TopoResultBit(dec, 0));
+   // declareMonitoredCustomVariable("DecisionModule2", new TopoResultBit(dec, 1));
+   // declareMonitoredCustomVariable("DecisionModule3", new TopoResultBit(dec, 2));
 }
 
 
-LVL1::L1TopoSimulation::~L1TopoSimulation()
+L1TopoSimulation::~L1TopoSimulation()
 {}
 
 bool
-LVL1::L1TopoSimulation::isClonable() const
+L1TopoSimulation::isClonable() const
 {
    return true;
 }
 
 StatusCode
-LVL1::L1TopoSimulation::initialize() {
+L1TopoSimulation::initialize() {
    ATH_MSG_INFO("initialize");
 
-   m_topoSteering->setMsgLevel( TrigConf::MSGTC::Level(m_topoSteeringOutputLevel) );
+   m_topoSteering->setMsgLevel( TrigConf::MSGTC::Level((int)m_topoSteeringOutputLevel) );
 
    ATH_MSG_DEBUG("retrieving " << m_monitors);
    CHECK( m_monitors.retrieve() );
@@ -154,26 +111,22 @@ LVL1::L1TopoSimulation::initialize() {
    ATH_MSG_DEBUG("Output trigger key property " << m_topoCTPLocation);
    ATH_MSG_DEBUG("Output overflow key property " << m_topoOverflowCTPLocation);
 
-   const TXC::L1TopoMenu* menu = m_l1topoConfigSvc->menu();
-   if(menu == nullptr) {
-      ATH_MSG_FATAL("No L1 Topo menu from " << m_l1topoConfigSvc->name());
-      return StatusCode::FAILURE;
-   }
+   const TrigConf::L1Menu * l1menu = nullptr;
+   ATH_CHECK( detStore()->retrieve(l1menu) ); 
+   ATH_MSG_INFO( "initialize(): retrieving new-style L1 trigger menu from Detector Store" );
 
    m_topoSteering->setUseBitwise(m_enableBitwise);
-   std::cout << "Calling m_topoSteering->setupFromConfiguration(*menu)" << endl;
    try {
-      m_topoSteering->setupFromConfiguration(*menu);
+      m_topoSteering->setupFromConfiguration(*l1menu);
    }
-   catch(exception & e) {
+   catch(std::exception & e) {
       ATH_MSG_FATAL("Caught exception when configuring topo steering from menu: " << e.what() );
       return StatusCode::FAILURE;
    }
 
-   m_topoSteering->setAlgMsgLevel( TrigConf::MSGTC::Level(m_topoOutputLevel) );
+   m_topoSteering->setAlgMsgLevel( TrigConf::MSGTC::Level((int)m_topoOutputLevel) );
    m_topoSteering->setOutputAlgosFillBasedOnHardware(m_fillHistogramsBasedOnHardwareDecision);
 
-
    std::shared_ptr<IL1TopoHistSvc> topoHistSvc = std::shared_ptr<IL1TopoHistSvc>( new AthenaL1TopoHistSvc(m_histSvc) );
    topoHistSvc->setBaseDir("/EXPERT/" + m_histBaseDir.value());
 
@@ -184,34 +137,33 @@ LVL1::L1TopoSimulation::initialize() {
 
 // Exectued once per offline job and for every new run online
 StatusCode
-LVL1::L1TopoSimulation::stop() {
+L1TopoSimulation::stop() {
    ATH_MSG_DEBUG("stop");
 
    // monitoring
    for (auto mt : m_monitors )
       mt->finalHists().ignore();
 
-
    return StatusCode::SUCCESS;
 }
                            
 
 // Exectued once per offline job and for every new run online
 StatusCode
-LVL1::L1TopoSimulation::start() {
+L1TopoSimulation::start() {
    ATH_MSG_DEBUG("start");
 
    m_scaler->reset();
 
-   // monitoring : book histogram
-   for (auto mt : m_monitors )
-      CHECK( mt->bookHists() );
+   // TODO monitoring : book histogram
+   //   for (auto mt : m_monitors )
+   //      CHECK( mt->bookHists() );
 
 
    try {
       m_topoSteering->initializeAlgorithms();
    }
-   catch(exception & e) {
+   catch(std::exception & e) {
       ATH_MSG_FATAL("Caught exception when initializing topo algorithms" << e.what() );
       return StatusCode::FAILURE;
    }
@@ -227,7 +179,7 @@ LVL1::L1TopoSimulation::start() {
 
 
 StatusCode
-LVL1::L1TopoSimulation::execute() {
+L1TopoSimulation::execute() {
    const EventContext& ctx = Gaudi::Hive::currentContext();
 
    if (m_prescale>1 && not m_scaler->decision(m_prescale)){
@@ -282,7 +234,7 @@ LVL1::L1TopoSimulation::execute() {
    // execute the toposteering
    m_topoSteering->executeEvent();
 
-   ATH_MSG_DEBUG("" << m_topoSteering->simulationResult().globalDecision());
+   ATH_MSG_DEBUG("Global Decision:\n" << m_topoSteering->simulationResult().globalDecision());
    
 
    /**
@@ -294,49 +246,60 @@ LVL1::L1TopoSimulation::execute() {
     *
     */
 
+   // Format for CTP still undecided
+
    const TCS::GlobalDecision & dec = m_topoSteering->simulationResult().globalDecision();
    auto topoDecision2CTP = std::make_unique< LVL1::FrontPanelCTP >();
    auto topoOverflow2CTP = std::make_unique< LVL1::FrontPanelCTP >();
-   for(unsigned int clock=0; clock<2; ++clock) {
-      topoDecision2CTP->setCableWord0( clock, 0 ); // ALFA
-      topoDecision2CTP->setCableWord1( clock, dec.decision( 0, clock) );  // TOPO 0
-      topoDecision2CTP->setCableWord2( clock, dec.decision( 1, clock) );  // TOPO 1
-      topoOverflow2CTP->setCableWord0( clock, 0 ); // ALFA
-      topoOverflow2CTP->setCableWord1( clock, dec.overflow( 0, clock) );  // TOPO 0
-      topoOverflow2CTP->setCableWord2( clock, dec.overflow( 1, clock) );  // TOPO 1
-   } 
+
+   const TrigConf::L1Menu * l1menu = nullptr;
+   ATH_CHECK( detStore()->retrieve(l1menu) );
+
+   if( m_isLegacyTopo ) {
+      // to be implemented
+   } else {
+      // set electrical connectors
+      std::string conn1 = l1menu->board("Topo2").connectorNames()[0];
+      std::string conn2 = l1menu->board("Topo3").connectorNames()[0];
+      for(unsigned int clock=0; clock<2; ++clock) {
+         topoDecision2CTP->setCableWord0( clock, 0 ); // ALFA
+         ATH_MSG_DEBUG("Word 1 " << conn1 << " clock " << clock << "  " << dec.decision_field( conn1, clock) );
+         topoDecision2CTP->setCableWord1( clock, dec.decision_field( conn1, clock) );  // TOPO 0
+         ATH_MSG_DEBUG("Word 2 " << conn2 << " clock " << clock << "  " << dec.decision_field( conn2, clock) );
+         topoDecision2CTP->setCableWord2( clock, dec.decision_field( conn2, clock) );  // TOPO 1
+         // topoOverflow2CTP->setCableWord0( clock, 0 ); // ALFA
+         // topoOverflow2CTP->setCableWord1( clock, dec.overflow( 0, clock) );  // TOPO 0
+         // topoOverflow2CTP->setCableWord2( clock, dec.overflow( 1, clock) );  // TOPO 1
+      }    
+   }
+
    
    CHECK(SG::makeHandle(m_topoCTPLocation)        .record(std::move(topoDecision2CTP)));
    CHECK(SG::makeHandle(m_topoOverflowCTPLocation).record(std::move(topoOverflow2CTP)));
-   
+
 
    // TODO: get the output combination data and put into SG
 
    // fill histograms
    // Commenting out temporarily to avoid crash 
-   //when L1TopoSimulation run without menu confifuration.
-   //for (auto mt : m_monitors )
-   //   if ( ! mt->preSelector() ) 
-   //      mt->fillHists().ignore();
+   // when L1TopoSimulation run without menu confifuration. 
+   //   for (auto mt : m_monitors )
+   //      if ( ! mt->preSelector() ) 
+   //         mt->fillHists().ignore();
 
    return StatusCode::SUCCESS;
 }
 
 
-
-
 StatusCode
-LVL1::L1TopoSimulation::finalize() {
+L1TopoSimulation::finalize() {
    m_topoSteering->inputEvent().dumpFinish();
-
-   delete m_scaler;
-   m_scaler=0;
-
    return StatusCode::SUCCESS;
 }
 
+
 StatusCode
-LVL1::L1TopoSimulation::retrieveHardwareDecision()
+L1TopoSimulation::retrieveHardwareDecision()
 {
     // some duplication with L1TopoRDO::Helpers
     // getDecisionAndOverflowBits() ?
diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.h
index c49166093cbbe1b4e9966c5ded451ce76da7ec54..909c66cf4c25b6b4140d054da17ad61e8945601c 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.h
+++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.h
@@ -5,41 +5,32 @@
 #ifndef L1Topo_L1TopoSimulation
 #define L1Topo_L1TopoSimulation
 
-#include "TrigConfBase/MsgStream.h"
+#include "L1TopoCoreSim/TopoSteering.h"
 
+#include "L1TopoSimulation/IInputTOBConverter.h"
 
-#include "AthenaBaseComps/AthAlgorithm.h"
+#include "PeriodicScaler.h"
+#include "TrigConfBase/MsgStream.h"
 #include "TrigInterfaces/IMonitoredAlgo.h"
-
-#include "GaudiKernel/ServiceHandle.h"
-#include "GaudiKernel/ToolHandle.h"
-
-#include <memory>
-
+#include "TrigConfInterfaces/IL1TopoConfigSvc.h"
+#include "TrigT1Interfaces/TrigT1StoreGateKeys.h"
+#include "TrigConfData/L1Menu.h"
 #include "TrigT1Interfaces/FrontPanelCTP.h"
 
 #include "StoreGate/ReadHandleKey.h"
 
-class TH1;
-class IMonitorToolBase;
-class ITHistSvc;
-
-namespace LVL1 {
-   class PeriodicScaler;
-}
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "AthenaMonitoring/IMonitorToolBase.h"
 
-namespace TCS {
-   class TopoSteering;
-}
+#include "GaudiKernel/ServiceHandle.h"
+#include "GaudiKernel/ToolHandle.h"
+#include "GaudiKernel/ITHistSvc.h"
 
-namespace TrigConf {
-   class IL1TopoConfigSvc;
-}
+#include "TH1F.h"
+#include <memory>
 
 namespace LVL1 {
 
-   class IInputTOBConverter;
-
    class L1TopoSimulation : public AthAlgorithm, public IMonitoredAlgo {
    public:
       L1TopoSimulation(const std::string &name, ISvcLocator *pSvcLocator);
@@ -68,41 +59,37 @@ namespace LVL1 {
 
    private:
 
-      //! \brief Alg handles to tools and services
-      //! @{
-      ServiceHandle<TrigConf::IL1TopoConfigSvc> m_l1topoConfigSvc;
-
-      ServiceHandle<ITHistSvc> m_histSvc;
-
-      ToolHandleArray < IMonitorToolBase > m_monitors;
-
-      ToolHandle<IInputTOBConverter> m_emtauInputProvider;
-
-      ToolHandle<IInputTOBConverter> m_jetInputProvider;
-
-      ToolHandle<IInputTOBConverter> m_energyInputProvider;
-
-      ToolHandle<IInputTOBConverter> m_muonInputProvider;
-
-      //! @}
-
-      BooleanProperty m_enableInputDump { false }; // for enabling input dumping
-      BooleanProperty m_enableBitwise { false }; // for enabling bitwise algorithms
-      StringProperty  m_inputDumpFile { "inputdump.txt" }; // input dump file
-      SG::WriteHandleKey<LVL1::FrontPanelCTP>  m_topoCTPLocation { "" }; ///< SG key of decision bits for CTP
-      SG::WriteHandleKey<LVL1::FrontPanelCTP>  m_topoOverflowCTPLocation { "" }; ///< SG key of overflow bits for CTP
-      int m_topoOutputLevel{TrigConf::MSGTC::WARNING};                                  // property to set the outputlevel of the topo algorithms
-      int m_topoSteeringOutputLevel{TrigConf::MSGTC::WARNING};                          // property to set the outputlevel of the topo steering
-
-      std::unique_ptr<TCS::TopoSteering>  m_topoSteering; //!< the topo steering 
-
-      BooleanProperty m_fillHistogramsBasedOnHardwareDecision { false }; // default: fill based on simulation
-      UnsignedIntegerProperty m_prescaleForDAQROBAccess {4}; ///< read hdw bits every N events (used only when m_fillHistogramsBasedOnHardwareDecision is true)
-      UnsignedIntegerProperty m_prescale; //! property for prescale factor
-      LVL1::PeriodicScaler* m_scaler; //! prescale decision tool
-
-      StringProperty m_histBaseDir; //! sets base dir for monitoring histograms
-  };
+      std::unique_ptr<TCS::TopoSteering>  m_topoSteering; //!< the topo steering
+      std::unique_ptr<LVL1::PeriodicScaler> m_scaler {nullptr}; //! prescale decision tool
+
+
+      // Services and input tools
+      ServiceHandle<TrigConf::IL1TopoConfigSvc> m_l1topoConfigSvc { this, "TrigConfigSvc", "TrigConf::TrigConfigSvc/TrigConfigSvc", "Service to provide the L1Topo menu" };
+      ServiceHandle<ITHistSvc> m_histSvc { this, "HistSvc", "THistSvc/THistSvc", "Histogramming service for L1Topo algorithms" };
+
+      ToolHandleArray < IMonitorToolBase > m_monitors { this, "AthenaMonTools", {}, "Monitoring tools"};
+      ToolHandle<IInputTOBConverter> m_emtauInputProvider  { this, "EMTAUInputProvider",  "LVL1::EMTauInputProvider/EMTauInputProvider",   "Tool to fill the EMTAU TOBs of the topo input event"         };
+      ToolHandle<IInputTOBConverter> m_jetInputProvider    { this, "JetInputProvider",    "LVL1::JetInputProvider/JetInputProvider",       "Tool to fill the Jet TOBs of the topo input event"           };
+      ToolHandle<IInputTOBConverter> m_energyInputProvider { this, "EnergyInputProvider", "LVL1::EnergyInputProvider/EnergyInputProvider", "Tool to fill the energy and MET TOBs of the topo input event"};
+      ToolHandle<IInputTOBConverter> m_muonInputProvider   { this, "MuonInputProvider",   "LVL1::MuonInputProvider/MuonInputProvider",     "Tool to fill the muon TOBs of the topo input event"          };
+
+      // outputs
+      SG::WriteHandleKey<LVL1::FrontPanelCTP>  m_topoCTPLocation { this, "TopoCTPLocation", LVL1::DEFAULT_L1TopoCTPLocation, "StoreGate key of topo decision output for CTP"}; ///< SG key of decision bits for CTP
+      SG::WriteHandleKey<LVL1::FrontPanelCTP>  m_topoOverflowCTPLocation { this, "TopoOverflowCTPLocation", LVL1::DEFAULT_L1TopoOverflowCTPLocation, "StoreGate key of topo overflow output for CTP"}; ///< SG key of overflow bits for CTP
+
+      Gaudi::Property<bool> m_isLegacyTopo { this, "IsLegacyTopo", false, "Simulation of Legacy L1Topo boards" };
+      Gaudi::Property<bool> m_enableInputDump { this, "EnableInputDump", false, "Enable writing of input data for standalone running" };
+      Gaudi::Property<bool> m_enableBitwise { this, "UseBitwise", false, "Boolean to enable the bitwise version of software algorithms"}; 
+      Gaudi::Property<std::string> m_inputDumpFile { this, "InputDumpFile", "inputdump.txt", "File name for dumping input data" };
+      Gaudi::Property<int> m_topoOutputLevel { this, "TopoOutputLevel", TrigConf::MSGTC::WARNING, "OutputLevel for L1Topo algorithms"};
+      Gaudi::Property<int> m_topoSteeringOutputLevel { this, "TopoSteeringOutputLevel", TrigConf::MSGTC::WARNING, "OutputLevel for L1Topo steering"};
+
+      // Properties for hardware monitoring
+      Gaudi::Property<bool> m_fillHistogramsBasedOnHardwareDecision { this, "FillHistoBasedOnHardware", true, "Fill accept/reject histograms based on hdw; default based on sim" };
+      Gaudi::Property<unsigned int> m_prescaleForDAQROBAccess { this, "PrescaleDAQROBAccess", 4, "Prescale factor for requests for DAQ ROBs: can be used to avoid overloading ROS. Zero means disabled, 1 means always, N means sample only 1 in N events"}; 
+      Gaudi::Property<unsigned int> m_prescale { this, "Prescale", 1, "Internal prescale factor for this algorithm, implemented with a periodic scaler: so 1 means run every time, N means run every 1 in N times it is called; the other times it will exit without doing anything"};
+      Gaudi::Property<std::string> m_histBaseDir { this, "MonHistBaseDir", "L1/L1TopoAlgorithms", "Base directory for monitoring histograms will be /EXPERT/<MonHistBaseDir>"}; 
+   };
 
 }
 #endif
diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/L1TopoSimulationTest.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/L1TopoSimulationTest.cxx
index e801348c30e768adf05357d959c93f0ceb991e41..b3aa08ef47f5b094dd88aaa0505cbfee17689238 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/L1TopoSimulationTest.cxx
+++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/L1TopoSimulationTest.cxx
@@ -13,6 +13,11 @@
 
 #include "GaudiKernel/ITHistSvc.h"
 
+// Dependencies for new menu format
+#include "TrigConfIO/JsonFileLoader.h"
+#include "TrigConfData/L1Menu.h"
+#include "TrigConfData/L1Threshold.h"
+#include "TrigConfData/L1Connector.h"
 
 using namespace std;
 
@@ -23,6 +28,7 @@ LVL1::L1TopoSimulationTest::L1TopoSimulationTest(const std::string &name, ISvcLo
    m_OfftopoSteering( unique_ptr<TCS::TopoSteering>(new TCS::TopoSteering()) )
 {
    declareProperty( "InputXMLFile", m_OffinputXMLFile, "File name for menu XML");
+   declareProperty( "InputJSONFile", m_OffinputJSONFile, "File name for menu JSON");
    declareProperty( "InputASCIIFile", m_OffinputASCIIFile, "File name for ASCII TOB vector");
    declareProperty( "HistSvc", m_OffhistSvc, "Histogramming service for L1Topo algorithms");
    declareProperty( "MonHistBaseDir", m_OffhistBaseDir = "L1TopoAlgorithms", "Base directory for monitoring histograms will be /EXPERT/<MonHistBaseDir>" );
@@ -43,22 +49,27 @@ LVL1::L1TopoSimulationTest::isClonable() const
 
 StatusCode
 LVL1::L1TopoSimulationTest::initialize() {
-   m_OfftopoSteering->setMsgLevel( TrigConf::MSGTC::Level(m_OfftopoSteeringOutputLevel) );
 
-   if (m_OffinputXMLFile.empty()){
-      ATH_MSG_FATAL("No L1 Topo menu from XML " << m_OffinputXMLFile);
-      return StatusCode::FAILURE;
-   }
-   TXC::L1TopoXMLParser XMLParser;
-   XMLParser.msg().setLevel( TrigConf::MSGTC::Level(m_OfftopoOutputLevel) );
-   XMLParser.readConfiguration(m_OffinputXMLFile);
-   XMLParser.parseConfiguration();
+  m_OfftopoSteering->setMsgLevel( TrigConf::MSGTC::Level(m_OfftopoSteeringOutputLevel) );
+
+  ATH_MSG_INFO("initialize");
+
+  if (m_OffinputXMLFile.empty() || m_OffinputJSONFile.empty()){
+    ATH_MSG_FATAL("No L1 Topo menu from JSON " << m_OffinputJSONFile);
+    return StatusCode::FAILURE;
+  }
+
+  TrigConf::L1Menu l1menu;
+  TrigConf::JsonFileLoader fileLoader;
+  fileLoader.loadFile( m_OffinputJSONFile, l1menu);
+  m_OfftopoSteering->setupFromConfiguration(l1menu);
+    
 
-   m_OfftopoSteering->setupFromConfiguration(XMLParser.takeMenu());
-   m_OfftopoSteering->setAlgMsgLevel( TrigConf::MSGTC::Level(m_OfftopoOutputLevel) );
+  // ----------------------------------------------------
+  m_OfftopoSteering->setAlgMsgLevel( TrigConf::MSGTC::Level(m_OfftopoOutputLevel) );
 
   
-   std::shared_ptr<IL1TopoHistSvc> topoHistSvc = std::shared_ptr<IL1TopoHistSvc>( new AthenaL1TopoHistSvc(m_OffhistSvc) );
+  std::shared_ptr<IL1TopoHistSvc> topoHistSvc = std::shared_ptr<IL1TopoHistSvc>( new AthenaL1TopoHistSvc(m_OffhistSvc) );
    topoHistSvc->setBaseDir("/EXPERT/" + m_OffhistBaseDir.value());
   
    
@@ -88,15 +99,25 @@ LVL1::L1TopoSimulationTest::initialize() {
 StatusCode
 LVL1::L1TopoSimulationTest::execute() {
 
+  cout << "Reseting TopoSteering" << endl;
+
    // reset input and internal state
    m_OfftopoSteering->reset();
 
+   cout << "Getting next event from dump txt" << endl;
+
    // Obtain next events in the dump txt
    m_Offreader.getNextEvent();
 
+   cout << "Executing even in TopoSteering" << endl;
+
    // execute the toposteering
    m_OfftopoSteering->executeEvent();
 
+   // Printout the decision bits
+   cout << "Printing out decisions" << endl;
+   cout << m_OfftopoSteering->simulationResult().globalDecision();
+
    return StatusCode::SUCCESS;
 }
 
diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/L1TopoSimulationTest.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/L1TopoSimulationTest.h
index 21360f1df2fd124575a1980efa7d6a60cfbd7b7c..cb84a5bfaaf7f91887fc49bda28b99b6d45da00c 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/L1TopoSimulationTest.h
+++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/L1TopoSimulationTest.h
@@ -43,6 +43,7 @@ namespace LVL1 {
     // make algorithm is clonable
     virtual bool isClonable() const override;
 
+
   private:
 
     TCS::TopoASCIIReader m_Offreader;
@@ -55,6 +56,7 @@ namespace LVL1 {
     StringProperty  m_OffhistBaseDir; //! sets base dir for monitoring histograms
     StringProperty  m_OffinputASCIIFile { "" }; // input dump file
     StringProperty  m_OffinputXMLFile { "" }; // XML file can be register in case of enabling the ASCII file read for validation purposes
+    StringProperty  m_OffinputJSONFile { "" }; // JSON file for menu
 
     std::unique_ptr<TCS::TopoSteering>  m_OfftopoSteering; //!< the topo steering
      
diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPSimulation.cxx b/Trigger/TrigT1/TrigT1CTP/src/CTPSimulation.cxx
index 355395511b13ccbc7afa71122bf2089fb05b5e65..23c408107df9307e092dbe70ab5945ad5e4d4c4a 100644
--- a/Trigger/TrigT1/TrigT1CTP/src/CTPSimulation.cxx
+++ b/Trigger/TrigT1/TrigT1CTP/src/CTPSimulation.cxx
@@ -47,7 +47,7 @@ const std::function< CLHEP::HepRandomEngine*(void) > CTPSimRanluxFactory = [](vo
 
 
 LVL1CTP::CTPSimulation::CTPSimulation( const std::string& name, ISvcLocator* pSvcLocator ) :
-   AthReentrantAlgorithm ( name, pSvcLocator ), 
+   AthReentrantAlgorithm ( name, pSvcLocator ),
    m_RNGEngines( CTPSimRanluxFactory, SG::getNSlots() ),
    m_decoder( new LVL1::CPRoIDecoder() ),
    m_jetDecoder( new LVL1::JEPRoIDecoder() )
@@ -103,14 +103,14 @@ LVL1CTP::CTPSimulation::start() {
 
    const TrigConf::L1Menu * l1menu = nullptr;
    if( m_useNewConfig ) {
-      ATH_CHECK( m_detStore->retrieve(l1menu) ); 
-      ATH_MSG_INFO( "start(): use L1 trigger menu from detector store" );
+      ATH_CHECK( detStore()->retrieve(l1menu) );
+      ATH_MSG_INFO( "start(): use new-style L1 menu (json)" );
       if(l1menu == nullptr) { // if no L1 configuration is available yet
          delayConfig = true;
       }
    } else {
-      ATH_MSG_INFO( "start(): use L1 trigger menu from L1ConfigSvc" );
-      if( (m_configSvc->ctpConfig()==nullptr) || 
+      ATH_MSG_INFO( "start(): use old-style L1 menu (xml))" );
+      if( (m_configSvc->ctpConfig()==nullptr) ||
           (m_configSvc->ctpConfig()->menu().itemVector().size() == 0) ) { // if no L1 configuration is available yet
          delayConfig = true;
       }
@@ -120,7 +120,7 @@ LVL1CTP::CTPSimulation::start() {
    if( ! delayConfig ) {
       // configure the CTP ResultBuilder
       // currently both types of configuration can be given (transition period towards Run 3)
-      std::call_once(m_onceflag, [this, l1menu]{ 
+      std::call_once(m_onceflag, [this, l1menu]{
             m_resultBuilder->setConfiguration( m_configSvc->ctpConfig(), l1menu ).ignore();
             setHistLabels().ignore();
          });
@@ -137,7 +137,7 @@ LVL1CTP::CTPSimulation::execute( const EventContext& context ) const {
    std::call_once(m_onceflag, [this]{
          const TrigConf::L1Menu * l1menu = nullptr;
          if( m_useNewConfig ) {
-            m_detStore->retrieve(l1menu).ignore(); 
+            detStore()->retrieve(l1menu).ignore();
          }
          m_resultBuilder->setConfiguration( m_configSvc->ctpConfig(), l1menu ).ignore();
          setHistLabels().ignore();
@@ -154,8 +154,6 @@ LVL1CTP::CTPSimulation::execute( const EventContext& context ) const {
    return StatusCode::SUCCESS;
 }
 
-
-
 StatusCode
 LVL1CTP::CTPSimulation::createMultiplicityHist(const std::string & type, unsigned int maxMult ) const {
 
@@ -186,7 +184,6 @@ LVL1CTP::CTPSimulation::createMultiplicityHist(const std::string & type, unsigne
    return sc;
 }
 
-
 StatusCode
 LVL1CTP::CTPSimulation::setMultiplicityHistLabels(const ConfigSource & cfgSrc, const std::string & type, TrigConf::L1DataDef::TriggerType tt ) const {
    StatusCode sc;
@@ -305,7 +302,7 @@ LVL1CTP::CTPSimulation::setHistLabels() const {
 
    const TrigConf::L1Menu * l1menu = nullptr;
    if( m_useNewConfig ) {
-      ATH_CHECK( m_detStore->retrieve(l1menu) ); 
+      ATH_CHECK( detStore()->retrieve(l1menu) );
       ATH_MSG_DEBUG("setHistLabels(). L1 menu " << l1menu->size() << " items" );
    } else {
       ATH_MSG_DEBUG("setHistLabels(). ConfigSvc with " << m_configSvc->ctpConfig()->menu().itemVector().size() << " items");
@@ -321,24 +318,21 @@ LVL1CTP::CTPSimulation::setHistLabels() const {
    ATH_CHECK ( setMultiplicityHistLabels( cfgSrc, "tau",  L1DataDef::TAU ) );
 
    // Topo
-   auto hTopo0 = *get1DHist("/input/topo/l1topo0");
-   auto hTopo1 = *get1DHist("/input/topo/l1topo1");
    if ( l1menu ) {
-      // to be implemented
-   } else {
-      for(const TIP * tip : m_configSvc->ctpConfig()->menu().tipVector() ) {
-         if ( tip->tipNumber() < 384 )
+      std::vector<std::string> connNames = l1menu->connectorNames();
+      for( const std::string connName : {"LegacyTopo0", "LegacyTopo1", "Topo1El", "Topo2El", "Topo3El"}) {
+         if( find(connNames.begin(), connNames.end(), connName) == connNames.end() ) {
             continue;
-         unsigned int tipNumber = (unsigned int) ( tip->tipNumber() - 384 );
-         switch(tipNumber / 64) {
-         case 0:
-            hTopo0->GetXaxis()->SetBinLabel(1+ tipNumber % 64, tip->thresholdName().c_str() );
-            break;
-         case 1:
-            hTopo1->GetXaxis()->SetBinLabel(1+ tipNumber % 64, tip->thresholdName().c_str() );
-            break;
-         default:
-            break;
+         }
+         auto hTopo = *get1DHist("/input/topo/" + connName);
+         for(uint fpga : {0,1}) {
+            for(uint clock : {0,1}) {
+               for(auto & tl : l1menu->connector(connName).triggerLines(fpga,clock)) {
+                  //uint flatIndex = 32*tl.fpga() + 2*tl.startbit() + tl.clock(); // activate later
+                  uint flatIndex = 32*tl.fpga() + tl.startbit() + 16*tl.clock();
+                  hTopo->GetXaxis()->SetBinLabel(flatIndex+1,tl.name().c_str());
+               }         
+            }
          }
       }
    }
@@ -385,7 +379,6 @@ LVL1CTP::CTPSimulation::setHistLabels() const {
    return StatusCode::SUCCESS;
 }
 
-
 StatusCode
 LVL1CTP::CTPSimulation::bookHists() const {
 
@@ -426,10 +419,10 @@ LVL1CTP::CTPSimulation::bookHists() const {
    ATH_CHECK ( hbook( "/input/counts/", std::make_unique<TH1I>("jJets","Number of jets (jJ)", 40, 0, 40) ));
    ATH_CHECK ( hbook( "/input/counts/", std::make_unique<TH1I>("jLJets","Number of jets (jLJ)", 40, 0, 40) ));
    ATH_CHECK ( hbook( "/input/counts/", std::make_unique<TH1I>("gJets","Number of jets (gJ)", 40, 0, 40) ));
-   ATH_CHECK ( hbook( "/input/counts/", std::make_unique<TH1I>("muons","Number of muons", 10, 0, 10) ));  
+   ATH_CHECK ( hbook( "/input/counts/", std::make_unique<TH1I>("muons","Number of muons", 10, 0, 10) ));
    ATH_CHECK ( hbook( "/input/counts/", std::make_unique<TH1I>("emcluster","Number of EM clusters", 20, 0, 20) ));
    ATH_CHECK ( hbook( "/input/counts/", std::make_unique<TH1I>("taus","Number of TAU candidates", 20, 0, 20) ));
- 
+
    // threshold multiplicities
    ATH_CHECK ( createMultiplicityHist( "muon" ) );
    ATH_CHECK ( createMultiplicityHist( "jet" ) );
@@ -443,8 +436,12 @@ LVL1CTP::CTPSimulation::bookHists() const {
    ATH_CHECK ( hbook( "/multi/all", (std::unique_ptr<TH2>)std::make_unique<TH2I>("R3Mult", "New thresholds multiplicity", 1, 0, 1, 10, 0, 10) ));
 
    // Topo
-   ATH_CHECK( hbook( "/input/topo/", std::make_unique<TH1I>("l1topo0","L1Topo Decision Cable 0", 64, 0, 64) ));
-   ATH_CHECK( hbook( "/input/topo/", std::make_unique<TH1I>("l1topo1","L1Topo Decision Cable 1", 64, 0, 64) ));
+   ATH_CHECK( hbook( "/input/topo/", std::make_unique<TH1I>("LegacyTopo0","L1Topo Decision (Legacy 0)", 64, 0, 64) ));
+   ATH_CHECK( hbook( "/input/topo/", std::make_unique<TH1I>("LegacyTopo1","L1Topo Decision (Legacy 1)", 64, 0, 64) ));
+   ATH_CHECK( hbook( "/input/topo/", std::make_unique<TH1I>("Topo1El","L1Topo Decision (Topo 1 electrical)", 64, 0, 64) ));
+   ATH_CHECK( hbook( "/input/topo/", std::make_unique<TH1I>("Topo2El","L1Topo Decision (Topo 2 electrical)", 64, 0, 64) ));
+   ATH_CHECK( hbook( "/input/topo/", std::make_unique<TH1I>("Topo3El","L1Topo Decision (Topo 3 electrical)", 64, 0, 64) ));
+   ATH_CHECK( hbook( "/input/topo/", std::make_unique<TH1I>("Topo1Opt0","L1Topo Decision (Topo 1 optical 0)", 90, 0, 90) ));
 
    // item decision
    ATH_CHECK ( hbook( "/output/", std::make_unique<TH1I>("tbpById", "Items decision (tbp)", 512, 0, 512) ));
@@ -461,7 +458,6 @@ LVL1CTP::CTPSimulation::bookHists() const {
    return StatusCode::SUCCESS;
 }
 
-
 StatusCode
 LVL1CTP::CTPSimulation::fillInputHistograms(const EventContext& context) const {
 
@@ -581,24 +577,43 @@ LVL1CTP::CTPSimulation::fillInputHistograms(const EventContext& context) const {
    }
 
    // topo
+   auto legacyTopoInput = SG::makeHandle( m_iKeyLegacyTopo, context );
+   if(legacyTopoInput.isValid()) {
+      ATH_MSG_DEBUG("Retrieved input from L1Topo from StoreGate with key " << m_iKeyTopo);
+      ATH_MSG_DEBUG("L1TopoLegacy0 word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << legacyTopoInput->cableWord1(0));
+      ATH_MSG_DEBUG("L1TopoLegacy0 word 1 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << legacyTopoInput->cableWord1(1));
+      ATH_MSG_DEBUG("L1TopoLegacy1 word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << legacyTopoInput->cableWord2(0));
+      ATH_MSG_DEBUG("L1TopoLegacy1 word 1 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << legacyTopoInput->cableWord2(1));
+      auto h0 = *get1DHist("/input/topo/LegacyTopo0");
+      auto h1 = *get1DHist("/input/topo/LegacyTopo1");
+      for(unsigned int i=0; i<32; ++i) {
+         uint32_t mask = 0x1; mask <<= i;
+         if( (legacyTopoInput->cableWord1(0) & mask) != 0 ) h0->Fill(i); // cable 0, clock 0
+         if( (legacyTopoInput->cableWord1(1) & mask) != 0 ) h0->Fill(32 + i); // cable 0, clock 1
+         if( (legacyTopoInput->cableWord2(0) & mask) != 0 ) h1->Fill(i); // cable 1, clock 0
+         if( (legacyTopoInput->cableWord2(1) & mask) != 0 ) h1->Fill(32 + i); // cable 1, clock 1
+      }
+   }
+
    auto topoInput = SG::makeHandle( m_iKeyTopo, context );
    if(topoInput.isValid()) {
       ATH_MSG_DEBUG("Retrieved input from L1Topo from StoreGate with key " << m_iKeyTopo);
-      ATH_MSG_DEBUG("L1Topo0 word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << topoInput->cableWord1(0));
-      ATH_MSG_DEBUG("L1Topo0 word 1 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << topoInput->cableWord1(1));
-      ATH_MSG_DEBUG("L1Topo1 word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << topoInput->cableWord2(0));
-      ATH_MSG_DEBUG("L1Topo1 word 1 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << topoInput->cableWord2(1));
-      auto h0 = *get1DHist("/input/topo/l1topo0");
-      auto h1 = *get1DHist("/input/topo/l1topo1");
+      ATH_MSG_DEBUG("L1Topo 2 word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << topoInput->cableWord1(0));
+      ATH_MSG_DEBUG("L1Topo 2 word 1 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << topoInput->cableWord1(1));
+      ATH_MSG_DEBUG("L1Topo 3 word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << topoInput->cableWord2(0));
+      ATH_MSG_DEBUG("L1Topo 3 word 1 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << topoInput->cableWord2(1));
+      auto h0 = *get1DHist("/input/topo/Topo1El");
+      auto h1 = *get1DHist("/input/topo/Topo2El");
+      auto h2 = *get1DHist("/input/topo/Topo3El");
       for(unsigned int i=0; i<32; ++i) {
          uint32_t mask = 0x1; mask <<= i;
-         if( (topoInput->cableWord1(0) & mask) != 0 ) h0->Fill(i); // cable 0, clock 0
-         if( (topoInput->cableWord1(1) & mask) != 0 ) h0->Fill(32 + i); // cable 0, clock 1
-         if( (topoInput->cableWord2(0) & mask) != 0 ) h1->Fill(i); // cable 1, clock 0
-         if( (topoInput->cableWord2(1) & mask) != 0 ) h1->Fill(32 + i); // cable 1, clock 1
+         if( (topoInput->cableWord0(0) & mask) != 0 ) h0->Fill(i); // cable 0, clock 0
+         if( (topoInput->cableWord0(1) & mask) != 0 ) h0->Fill(32 + i); // cable 0, clock 1
+         if( (topoInput->cableWord1(0) & mask) != 0 ) h1->Fill(i); // cable 0, clock 0
+         if( (topoInput->cableWord1(1) & mask) != 0 ) h1->Fill(32 + i); // cable 0, clock 1
+         if( (topoInput->cableWord2(0) & mask) != 0 ) h2->Fill(i); // cable 1, clock 0
+         if( (topoInput->cableWord2(1) & mask) != 0 ) h2->Fill(32 + i); // cable 1, clock 1
       }
-   } else {
-      ATH_MSG_DEBUG("No collection " << m_iKeyTopo);
    }
 
    // bcid
@@ -619,13 +634,66 @@ LVL1CTP::CTPSimulation::extractMultiplicities(std::map<std::string, unsigned int
 
    const TrigConf::L1Menu * l1menu = nullptr;
    if( m_useNewConfig ) {
-      ATH_CHECK( m_detStore->retrieve(l1menu) );
+      ATH_CHECK( detStore()->retrieve(l1menu) );
    }
 
    thrMultiMap.clear();
 
    if( l1menu ) {
+      std::vector<std::string> connNames = l1menu->connectorNames();
+      for( const std::string connName : {"LegacyTopo0", "LegacyTopo1", "Topo1El", "Topo2El", "Topo3El"}) {
+         if( find(connNames.begin(), connNames.end(), connName) == connNames.end() ) {
+            continue;
+         }
+         uint64_t cable {0};
+         if (connName.find("Legacy")==0) { // legacy topo
+            auto topoInput = SG::makeHandle( m_iKeyLegacyTopo, context );
+            if (not topoInput.isValid()) {
+               continue;
+            }
+            if(connName == "LegacyTopo0") {
+               cable = ( (uint64_t)topoInput->cableWord1( 1 ) << 32) + topoInput->cableWord1( 0 );
+            } else if (connName == "LegacyTopo1") {
+               cable = ( (uint64_t)topoInput->cableWord2( 1 ) << 32) + topoInput->cableWord2( 0 );
+            }
+         } else { // new topo
+            auto topoInput = SG::makeHandle( m_iKeyTopo, context );
+            if (not topoInput.isValid()) {
+               continue;
+            }
+            if(connName == "Topo1El") {
+               cable = ( (uint64_t)topoInput->cableWord0( 1 ) << 32) + topoInput->cableWord0( 0 );
+            } else if(connName == "Topo2El") {
+               cable = ( (uint64_t)topoInput->cableWord1( 1 ) << 32) + topoInput->cableWord1( 0 );
+            } else if (connName == "Topo3El") {
+               cable = ( (uint64_t)topoInput->cableWord2( 1 ) << 32) + topoInput->cableWord2( 0 );
+            }
+         }
+         auto & conn = l1menu->connector(connName);
+         for(uint fpga : {0,1}) {
+            for(uint clock : {0,1}) {
+               for(auto & tl : conn.triggerLines(fpga,clock)) {
+                  //uint flatIndex = 32*tl.fpga() + 2*tl.startbit() + tl.clock(); // activate later
+                  uint flatIndex = 32*tl.fpga() + tl.startbit() + 16*tl.clock();
+                  uint pass = (cable & (uint64_t(0x1) << flatIndex)) == 0 ? 0 : 1;
+                  if(size_t pos = tl.name().find('['); pos == std::string::npos) {
+                     thrMultiMap[tl.name()] = pass;
+                     ATH_MSG_DEBUG(tl.name() << " MULT calculated mult for topo " << pass);
+                  } else {
+                     auto thrName = tl.name().substr(0,pos);
+                     int bit = std::stoi(tl.name().substr(pos+1));
+                     thrMultiMap.try_emplace(thrName, 0);
+                     thrMultiMap[thrName] += (pass << bit);
+                     ATH_MSG_DEBUG(thrName << " MULT updated mult for topo " << pass);
+                  }
+               }
+            }
+         }
+      }
       for ( auto & thr : l1menu->thresholds() ) {
+         if(thr->type() == "TOPO" or thr->type()== "R2TOPO" or thr->type() == "MULTTOPO" or thr->type() == "MUTOPO") {
+            continue; 
+         }
          // get the multiplicity for each threshold
          unsigned int multiplicity = calculateMultiplicity( *thr, l1menu, context );
          // and record in threshold--> multiplicity map (to be used for item decision)
@@ -672,7 +740,6 @@ LVL1CTP::CTPSimulation::extractMultiplicities(std::map<std::string, unsigned int
 }
 
 
-
 unsigned int
 LVL1CTP::CTPSimulation::calculateJetMultiplicity( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const {
    unsigned int multiplicity = 0;
@@ -740,7 +807,6 @@ LVL1CTP::CTPSimulation::calculateJetMultiplicity( const TrigConf::L1Threshold &
 }
 
 
-
 unsigned int
 LVL1CTP::CTPSimulation::calculateJetMultiplicity( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const {
    unsigned int multiplicity = 0;
@@ -752,7 +818,7 @@ LVL1CTP::CTPSimulation::calculateJetMultiplicity( const TrigConf::TriggerThresho
          } else if ( confThr->cableName() == "JEP2" || confThr->cableName() == "JET2" ) {
             multiplicity = CTPUtil::getMult( ctpinJet->cableWord1(), confThr->cableStart(), confThr->cableEnd() );
          }
-      } 
+      }
    } else {
       // Run-3 threshold
       const SG::ReadHandleKey< xAOD::JetRoIContainer > * rhk { nullptr };
@@ -831,11 +897,10 @@ LVL1CTP::CTPSimulation::calculateEMMultiplicity( const TrigConf::L1Threshold & c
 }
 
 
-
 unsigned int
 LVL1CTP::CTPSimulation::calculateEMMultiplicity( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const {
    unsigned int multiplicity (0);
-   if ( confThr->name()[0]=='e' ) { 
+   if ( confThr->name()[0]=='e' ) {
       // new EM threshold from eFEX
       auto eFexCluster = SG::makeHandle( m_iKeyEFexCluster, context );
       for ( const auto & cl : *eFexCluster ) {
@@ -904,7 +969,7 @@ LVL1CTP::CTPSimulation::calculateTauMultiplicity( const TrigConf::L1Threshold &
 unsigned int
 LVL1CTP::CTPSimulation::calculateTauMultiplicity( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const {
    unsigned int multiplicity = 0;
-   if ( confThr->name()[0]=='e' ) { 
+   if ( confThr->name()[0]=='e' ) {
       // new TAU threshold from eFEX
       auto eFexTaus  = SG::makeHandle( m_iKeyEFexTau, context );
       const static SG::AuxElement::ConstAccessor<float> accR3ClET ("R3ClusterET");
@@ -938,7 +1003,6 @@ LVL1CTP::CTPSimulation::calculateTauMultiplicity( const TrigConf::TriggerThresho
 }
 
 
-
 unsigned int
 LVL1CTP::CTPSimulation::calculateMETMultiplicity( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const {
    unsigned int multiplicity = 0;
@@ -987,7 +1051,6 @@ LVL1CTP::CTPSimulation::calculateMETMultiplicity( const TrigConf::L1Threshold &
 }
 
 
-
 unsigned int
 LVL1CTP::CTPSimulation::calculateMETMultiplicity( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const {
    unsigned int multiplicity = 0;
@@ -1002,7 +1065,7 @@ LVL1CTP::CTPSimulation::calculateMETMultiplicity( const TrigConf::TriggerThresho
          }
       }
    } else if ( confThr->name().find("TE")==0 ) {
-      // old TE 
+      // old TE
       auto ctpinEnergy = SG::makeHandle( m_iKeyCtpinXE, context );
       if ( ctpinEnergy.isValid() ) {
          if ( confThr->cableName() == "JEP3" || confThr->cableName() == "EN1") {
@@ -1128,10 +1191,10 @@ LVL1CTP::CTPSimulation::calculateTopoMultiplicity( const TrigConf::TriggerThresh
 unsigned int
 LVL1CTP::CTPSimulation::calculateMultiplicity( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const {
    unsigned int multiplicity = 0;
-   if( confThr->cableName() == "CTPCAL" || 
-       confThr->cableName() == "ALFA" || 
-       confThr->cableName() == "NIM1" || 
-       confThr->cableName() == "NIM2" || 
+   if( confThr->cableName() == "CTPCAL" ||
+       confThr->cableName() == "ALFA" ||
+       confThr->cableName() == "NIM1" ||
+       confThr->cableName() == "NIM2" ||
        confThr->type() == "NIM") {
       return 0;
    }
@@ -1168,8 +1231,6 @@ LVL1CTP::CTPSimulation::calculateMultiplicity( const TrigConf::L1Threshold & con
          multiplicity = calculateJetMultiplicity( confThr, l1menu, context );
       } else if ( confThr.type() == "MU" ) {
          multiplicity = calculateMuonMultiplicity( confThr, l1menu, context );
-      } else if ( confThr.type() == "TOPO" ) {
-         multiplicity = calculateTopoMultiplicity( confThr, l1menu, context );
       }
    }
    catch(std::exception & ex) {
@@ -1238,7 +1299,7 @@ LVL1CTP::CTPSimulation::finalize() {
 
    const TrigConf::L1Menu * l1menu = nullptr;
    if( m_useNewConfig ) {
-      ATH_CHECK( m_detStore->retrieve(l1menu) );
+      ATH_CHECK( detStore()->retrieve(l1menu) );
    }
 
    constexpr unsigned int sizeOfCTPOutput = 512;
@@ -1297,7 +1358,7 @@ LVL1CTP::CTPSimulation::finalize() {
       } else {
          thrHists = { "em/em", "muon/muon", "tau/tau", "jet/jet", "xe/xe", "te/te", "xs/xs" };
       }
-      auto hist = * get2DHist( "/multi/all/LegacyMult" ); 
+      auto hist = * get2DHist( "/multi/all/LegacyMult" );
       for(const std::string & histpath : thrHists) {
          auto h = * get2DHist( "/multi/" + histpath + "Mult" );
          auto xaxis = h->GetXaxis();
@@ -1319,7 +1380,7 @@ LVL1CTP::CTPSimulation::finalize() {
    {
       // run 3 thresholds
       if( l1menu ) {
-         auto hist = * get2DHist( "/multi/all/R3Mult" ); 
+         auto hist = * get2DHist( "/multi/all/R3Mult" );
          std::vector<std::string> thrHists = { "em/eEM", "muon/MU", "tau/eTAU", "jet/jJ", "jet/gJ", "xe/gXE", "xe/jXE" };
          for(const std::string & histpath : thrHists) {
             auto h = * get2DHist( "/multi/" + histpath + "Mult" );
diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPSimulation.h b/Trigger/TrigT1/TrigT1CTP/src/CTPSimulation.h
index d6efae27b3bf51d375cc5c22e685f2c80e4434d5..efb96d9222337b94d88899a391018f4a6db54b93 100644
--- a/Trigger/TrigT1/TrigT1CTP/src/CTPSimulation.h
+++ b/Trigger/TrigT1/TrigT1CTP/src/CTPSimulation.h
@@ -133,7 +133,7 @@ namespace LVL1CTP {
       // Needed services and tools
       ServiceHandle<ITHistSvc> m_histSvc { this, "THistSvc", "THistSvc/THistSvc", "Histogramming svc" };
       ServiceHandle<TrigConf::ILVL1ConfigSvc> m_configSvc { this, "TrigConfigSvc", "TrigConf::TrigConfigSvc/TrigConfigSvc", "Trigger configuration service" };
-      ServiceHandle<StoreGateSvc> m_detStore { this, "DetectorStore", "StoreGateSvc/DetectorStore", "Detector store to get the menu" };
+      // ServiceHandle<StoreGateSvc> m_detStore { this, "DetectorStore", "StoreGateSvc/DetectorStore", "Detector store to get the menu" };
       ToolHandle<LVL1CTP::ResultBuilder> m_resultBuilder { this, "ResultBuilder", "LVL1CTP__ResultBuilder/ResultBuilder", "Builds the CTP result" };
 
       // random engine for calculating prescales
diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerItem.cxx b/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerItem.cxx
index b3456445b6fc9a02677b397dbb5442a001c1ebba..253c69230d239446b828b8a0dd0f735522a5eb33 100644
--- a/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerItem.cxx
+++ b/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerItem.cxx
@@ -2,12 +2,11 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
+#include "./CTPTriggerItem.h"
 #include "TrigConfData/LogicParser.h"
-
 #include "TrigConfL1Data/TriggerItem.h"
 
-#include "./CTPTriggerItem.h"
-
+#include <exception>
 
 LVL1CTP::CTPTriggerItem::CTPTriggerItem()
 {}
@@ -88,8 +87,13 @@ LVL1CTP::CTPTriggerItem::evaluate( const std::map<std::string, unsigned int> & t
       if( dec && (! m_bunchGroups.empty()) ) {
          // apply bunchgroups, if set (if not set, it is part of the logic)
          for( auto & bgName : m_bunchGroups ) {
-            if( thrDecMap.at(bgName) == 0 ) {
-               dec = false; break;
+            try {
+               if( thrDecMap.at(bgName) == 0 ) {
+                  dec = false; break;
+               }
+            }
+            catch(std::exception &) {
+               throw std::runtime_error( "Problem accessing decision for bunchgroup " + bgName);
             }
          }
       }
diff --git a/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.cxx b/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.cxx
index e277d51d9127104ed1660d8d91140fc6e2109a01..890651d8809413cd852e3b32e6741f3ad622525a 100644
--- a/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.cxx
+++ b/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.cxx
@@ -118,7 +118,6 @@ StatusCode
 LVL1CTP::ResultBuilder::constructTIPVector( const std::map<std::string, unsigned int> & thrMultiMap,
                                             std::vector<uint32_t> & tip ) const
 {
-
    tip.resize( m_ctpDataFormat->getTIPwords(), 0 );
    
    for( auto & entry : thrMultiMap ) {
@@ -184,7 +183,7 @@ LVL1CTP::ResultBuilder::buildItemDecision( const std::map<std::string, unsigned
    itemDecisionMap.clear();
 
    try {
-      for( auto itemName : m_itemConfigMap->itemNames() ) {
+      for( const auto & itemName : m_itemConfigMap->itemNames() ) {
          auto ctpItem = m_itemConfigMap->getItem(itemName);
 
          bool pass_beforePrescale =  ctpItem->evaluate(thrMultiMap);
@@ -246,7 +245,7 @@ LVL1CTP::ResultBuilder::constructResultVectors( const std::map<std::string, unsi
       ATH_MSG_DEBUG( "  --> Trigger item " << itemName << 
                      " is " << ( !passBP ? "INACTIVE" : ( passAV ? "ACTIVE" : "ACTIVE (but PRESCALED)" ) ) );
    }
-   ATH_MSG_DEBUG( "REGTEST - " << "TriggerType byte is: 0x" << std::hex << std::setw( 2 ) << std::setfill( '0' ) << triggerType );
+   ATH_MSG_DEBUG( "REGTEST - " << "TriggerType byte is: 0x" << std::setw( 2 ) << std::setfill( '0' ) << std::hex << int(triggerType) );
 
    return StatusCode::SUCCESS;
 }
diff --git a/Trigger/TrigT1/TrigT1CTP/src/ThresholdMap.cxx b/Trigger/TrigT1/TrigT1CTP/src/ThresholdMap.cxx
index 4d40dadc4bc0523c0d606cb20f8eab8ec92b38d3..901103b9f5cfeb6b585219e956eaffc73849270c 100644
--- a/Trigger/TrigT1/TrigT1CTP/src/ThresholdMap.cxx
+++ b/Trigger/TrigT1/TrigT1CTP/src/ThresholdMap.cxx
@@ -98,6 +98,11 @@ LVL1CTP::ThresholdMap::getThresholdNames() const {
 
 const LVL1CTP::CTPTriggerThreshold &
 LVL1CTP::ThresholdMap::getCTPThreshold( const std::string & thrName ) const {
-   return * m_mapByName.at( thrName );
+   try {
+      return * m_mapByName.at( thrName );
+   }
+   catch(std::exception&) {
+      throw std::runtime_error("Threshold " + thrName + " not present in CTPSimulation's internal threshold map");
+   }
 }
 
diff --git a/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetPriVtxConfig.py b/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetPriVtxConfig.py
index f6ddd7958963b88420e80f6d50146b973123f471..b06c7ba7312909768a58fb58be9ef6f7e9e83c82 100644
--- a/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetPriVtxConfig.py
+++ b/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetPriVtxConfig.py
@@ -1,6 +1,6 @@
 #  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-__author__ =   "Mark Sutton"
+__author__ =   "Mark Sutton and Lukas Novotny"
 __doc__    =   "vertexFinder_builder"
 __all__    = [ "vertexFinder_builder", "makeVertices" ]
 
@@ -12,11 +12,65 @@ __all__    = [ "vertexFinder_builder", "makeVertices" ]
 # 
 #     vertexFinder_builder() 
 #
-#  function at the end - the rest are just helper 
+#  the rest are just helper 
 #  functions to create the relevant tools that are 
 #  needed along the way 
 
 
+# old function for backwards compatability
+#TODO inputTrackCollection is obsolete, remove in the next MR iteration
+def makeVertices( whichSignature, inputTrackCollection, outputVtxCollection, config, adaptiveVertexing=False ) :
+
+    return vertexFinder_builder( signature         = whichSignature, 
+                                 inputTracks       = config.FT.tracksFTF(),
+                                 outputVertices    = outputVtxCollection,
+                                 adaptiveVertexing = adaptiveVertexing )
+
+
+
+
+# actual function to create the vertex finder instance
+# needs the tool to actually create the vertices, plus the 
+# tool to sort them into the desired order, and some monitoring
+# here the vertex finder tool is chosen (iterative vs adaptive)
+def vertexFinder_builder( signature, inputTracks, outputVertices, adaptiveVertexing ) :
+
+    from AthenaCommon.Logging import logging
+    log = logging.getLogger("InDetVtx")
+
+    from TrigEDMConfig.TriggerEDMRun3 import recordable
+
+    # create the three subtools for use by the vertexFinder itself ...
+    
+    # the actual tool which finds the vertices ...
+    # and actual place which choose between iterative and adaptive vertex finder tools
+    if adaptiveVertexing :
+        vertexFinderTool = adaptiveMultiVertexFinderTool_builder( signature ) 
+    else :   
+        vertexFinderTool = iterativeVertexFinderTool_builder( signature ) 
+
+    # which are then sorted ...
+    vertexSortingTool = vertexSortingTool_builder( signature )
+
+    # and finally some monitoring ...
+    vertexMonitoringTool = vertexMonitoringTool_builder( signature )
+
+    # no create the vertex finder ...
+    from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxFinder
+
+    vertexFinder = InDet__InDetPriVxFinder( name                        = "InDetTrigPriVxFinder" + signature,
+                                            VertexFinderTool            = vertexFinderTool,
+                                            TracksName                  = recordable(inputTracks), 
+                                            VxCandidatesOutputName      = recordable(outputVertices), 
+                                            VertexCollectionSortingTool = vertexSortingTool,
+                                            doVertexSorting             = True,
+                                            PriVxMonTool                = vertexMonitoringTool )
+    
+    log.debug(vertexFinder)
+    
+    return  [ vertexFinder ]
+
+
 # linearised track factory, whatever that does, for the vertex finder
 
 def  linearTrackFactory_builder( signature, extrapolator ) :
@@ -35,7 +89,7 @@ def  linearTrackFactory_builder( signature, extrapolator ) :
 
 # vertex fitter for the vertex finder 
 
-def  vertexFitterTool_builder( signature, linearTrackFactory, extrapolator ) :
+def  iterativeVertexFitterTool_builder( signature, linearTrackFactory, extrapolator ) :
 
     from AthenaCommon.AppMgr import ToolSvc
     
@@ -132,7 +186,7 @@ def  trackDensitySeedFinder_builder( signature ) :
 
 # create the actual vertex finder tool ...
 
-def vertexFinderTool_builder( signature ) : 
+def iterativeVertexFinderTool_builder( signature ) : 
 
     from AthenaCommon.AppMgr import ToolSvc
 
@@ -141,7 +195,6 @@ def vertexFinderTool_builder( signature ) :
    
     # the track summary tool, and extrapolator will be needed by multiple 
     # tools so create them once and pass them into the builders ...  
-
     trackSummaryTool = TrackingCommon.getInDetTrackSummaryTool()
     extrapolator     = TrackingCommon.getInDetExtrapolator()
 
@@ -152,12 +205,11 @@ def vertexFinderTool_builder( signature ) :
 
     
     # now create the five sub tools needed ...
-
-    linearTrackFactory     =     linearTrackFactory_builder( signature, extrapolator )
-    vertexFitterTool       =       vertexFitterTool_builder( signature, linearTrackFactory, extrapolator )
-    impactEstimator        =        impactEstimator_builder( signature, extrapolator )
-    trackSelectorTool      =      trackSelectorTool_builder( signature, trackSummaryTool, extrapolator, vtxcuts )
-    trackDensitySeedFinder = trackDensitySeedFinder_builder( signature )
+    linearTrackFactory     =        linearTrackFactory_builder( signature, extrapolator )
+    vertexFitterTool       = iterativeVertexFitterTool_builder( signature, linearTrackFactory, extrapolator )
+    impactEstimator        =           impactEstimator_builder( signature, extrapolator )
+    trackSelectorTool      =         trackSelectorTool_builder( signature, trackSummaryTool, extrapolator, vtxcuts )
+    trackDensitySeedFinder =    trackDensitySeedFinder_builder( signature )
     
     # now create the actual vertex finder tool ...
     # this is the main part of the actual working part of the code - 
@@ -182,38 +234,6 @@ def vertexFinderTool_builder( signature ) :
                                                              MaxTracks                = vtxcuts.MaxTracks() )
                                                            
     
- # InDetAdaptiveMultiPriVxFinderTool job options for later 
- #  verxtexFinderTool = InDet__InDetAdaptiveMultiPriVxFinderTool( name = "InDetTrigPriVxFinderTool" + signature,
- #                                                             VertexFitterTool         = vertexFitterTool,
- #  ...
-
- # VertexFitterTool  = vertexFitterTool,
- # TrackSelector     = trackSelectorTool,
- # SeedFinder        = trackDensitySeedFinder,
- 
- # IPEstimator       = Trk::ITrackToVertexIPEstimator  : impactEstimator is different type than for IterativeFinder 
- # BeamSpotKey       = InDet::BeamSpotData  : what is this ??
-
- # TracksMaxZinterval = 
- # maxVertexChi2 = 
- # finalCutMaxVertexChi2 = 
- # cutVertexDependence = 
- # MinWeight = 
- # realMultiVertex = 
- # useFastCompatibility = 
- # useBeamConstraint = 
- # addSingleTrackVertices = 
- # tracksMaxSignificance = 
- # m_useSeedConstraint = 
- # selectiontype = 
- # //==0 for sum p_t^2
- # //==1 for NN
- # //==2 for min bias compatibility estimation (in the future)
- # maxIterations = 
- # do3dSplitting = 
- # zBfieldApprox = 
- # maximumVertexContamination = 
-
     ToolSvc += vertexFinderTool
    
     return vertexFinderTool
@@ -221,7 +241,6 @@ def vertexFinderTool_builder( signature ) :
 
 
 
-
 # create the vertex sorting tool - this is to sort the vertex candidates into 
 # some order so clients can pick the best one off the front and so on ...
 
@@ -245,64 +264,120 @@ def vertexSortingTool_builder( signature ) :
     
     return vertexSortingTool
     
-
-
-
 # create online vertex monitoring histograms
-
 def vertexMonitoringTool_builder( signature ) : 
     from InDetPriVxFinder.InDetPriVxFinderMonitoring import InDetPriVxFinderMonitoringTool
     return  InDetPriVxFinderMonitoringTool()
 
 
 
+#------------------------------------------------------------------------------------------------------------------
+#                         BUILDERS FOR ADAPTIVE MULTI VERTEX TOOL
+#------------------------------------------------------------------------------------------------------------------
 
+# create the actual vertex finder tool ...
+def adaptiveMultiVertexFinderTool_builder( signature ) : 
 
-# actual function to create the vertex finder instance
-# needs the tool to actually create the vertices, plus the 
-# tool to sort them into the desired order, and some monitoring
-
-def vertexFinder_builder( signature, inputTracks, outputVertices ) :
+    from AthenaCommon.AppMgr import ToolSvc
 
-    from AthenaCommon.Logging import logging
-    log = logging.getLogger("InDetVtx")
+    # use the getters from TrackingCommon ... 
+    import InDetRecExample.TrackingCommon as TrackingCommon
+   
+    # the track summary tool, and extrapolator will be needed by multiple 
+    # tools so create them once and pass them into the builders ...  
+    trackSummaryTool = TrackingCommon.getInDetTrackSummaryTool()
+    extrapolator     = TrackingCommon.getInDetExtrapolator()
+    doVtx3DFinding   = True # TODO!!!! InDetFlags.doPrimaryVertex3DFinding()
 
-    from TrigEDMConfig.TriggerEDMRun3 import recordable
+    # get the selection cuts use to select the actual tracks in the tool ...
+    from InDetTrigRecExample.TrigInDetConfiguredVtxCuts import ConfiguredTrigVtxCuts 
+    vtxcuts = ConfiguredTrigVtxCuts() 
+    vtxcuts.printInfo()
 
-    # create the three subtools for use by the vertexFinder itself ...
     
-    # the actual tool which finde the vertices ... 
-    vertexFinderTool = vertexFinderTool_builder( signature ) 
+    # now create the five sub tools needed ...
+    linearTrackFactory     =            linearTrackFactory_builder( signature, extrapolator )
+    impactEstimator        =               impactEstimator_builder( signature, extrapolator )
+    vertexFitterTool       =      adaptiveVertexFitterTool_builder( signature, linearTrackFactory, extrapolator,impactEstimator )
+    trackSelectorTool      =             trackSelectorTool_builder( signature, trackSummaryTool, extrapolator, vtxcuts )
+    seedFinder             = adaptiveMultiVertexSeedFinder_builder( signature, doVtx3DFinding)
+    
+    # now create the actual vertex finder tool ...
+    # this is the main part of the actual working part of the code - 
+    # the vertoces are found by this class, in this instance it includes
+    # a beam line constraint - it we want this to allow this constrain 
+    # to be disabled we can add a flag and some additional logic 
+    from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetAdaptiveMultiPriVxFinderTool
+    vertexFinderTool = InDet__InDetAdaptiveMultiPriVxFinderTool(name              = "InDetTrigAdaptiveMultiPriVxFinderTool" + signature,
+                                                                        SeedFinder        = seedFinder,
+                                                                        VertexFitterTool  = vertexFitterTool,
+                                                                        TrackSelector     = trackSelectorTool,
+                                                                        useBeamConstraint = True,
+                                                                        selectiontype     = 0, # what is this?
+                                                                        do3dSplitting     = doVtx3DFinding)
+    
+    ToolSvc += vertexFinderTool
+   
+    return vertexFinderTool
 
-    # which are then sorted ...
-    vertexSortingTool = vertexSortingTool_builder( signature )
 
-    # and finally some monitoring ...
-    vertexMonitoringTool = vertexMonitoringTool_builder( signature )
 
-    # no create the vertex finder ...
+# annealing for adaptive vertex finder
+def annealingMaker_builder(signature) :
 
-    from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxFinder
+    from AthenaCommon.AppMgr import ToolSvc
 
-    vertexFinder = InDet__InDetPriVxFinder( name                        = "InDetTrigPriVxFinder" + signature,
-                                            VertexFinderTool            = vertexFinderTool,
-                                            TracksName                  = recordable(inputTracks), 
-                                            VxCandidatesOutputName      = recordable(outputVertices), 
-                                            VertexCollectionSortingTool = vertexSortingTool,
-                                            doVertexSorting             = True,
-                                            PriVxMonTool                = vertexMonitoringTool )
+    from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__DetAnnealingMaker
+    annealingMaker = Trk__DetAnnealingMaker(name = "InDetTrigAnnealingMaker" + signature,
+                                                     SetOfTemperatures = [1.]) 
+    ToolSvc += annealingMaker
     
-    log.debug(vertexFinder)
+    return annealingMaker
+
+
+
+# vertex fitter for the vertex finder 
+# this one is for adaptive vertex finder tool
+def  adaptiveVertexFitterTool_builder( signature, linearTrackFactory, extrapolator,impactEstimator ) :
+
+    from AthenaCommon.AppMgr import ToolSvc
+
+    annealingMaker  = annealingMaker_builder ( signature )
+    from TrkVertexFitters.TrkVertexFittersConf import Trk__AdaptiveMultiVertexFitter
+    vertexFitterTool = Trk__AdaptiveMultiVertexFitter(name                         = "InDetTrigAdaptiveMultiVertexFitterTool" + signature,
+                                                      LinearizedTrackFactory       = linearTrackFactory,
+                                                      ImpactPoint3dEstimator       = impactEstimator,
+                                                      AnnealingMaker               = annealingMaker,
+                                                      DoSmoothing                  = True) # false is default 
+ 
+    ToolSvc += vertexFitterTool
     
-    return  [ vertexFinder ]
+    return vertexFitterTool
+
 
 
-# old function for backwards compatability
-#TODO inputTrackCollection is obsolete, remove in the next MR iteration
-def makeVertices( whichSignature, inputTrackCollection, outputVtxCollection, config ) :
 
-    return vertexFinder_builder( signature      = whichSignature, 
-                                 inputTracks    = config.FT.tracksFTF(),
-                                 outputVertices = outputVtxCollection )
+def adaptiveMultiVertexSeedFinder_builder( signature , doVtx3DFinding):
+
+    from AthenaCommon.AppMgr import ToolSvc
     
+    if (doVtx3DFinding): #InDetFlags.doPrimaryVertex3DFinding()
+
+        from TrkVertexSeedFinderTools.TrkVertexSeedFinderToolsConf import Trk__CrossDistancesSeedFinder
+        seedFinder = Trk__CrossDistancesSeedFinder( name              = "InDetTrigCrossDistancesSeedFinder" + signature,
+                                                    trackdistcutoff   = 1.,
+                                                    trackdistexppower = 2)
+    
+    else:
+    
+        from TrkVertexSeedFinderTools.TrkVertexSeedFinderToolsConf import Trk__ZScanSeedFinder
+        seedFinder = Trk__ZScanSeedFinder(name = "InDetTrigZScanSeedFinder" + signature
+                                                      # Mode1dFinder = # default, no setting needed
+                                                     )
+    ToolSvc += seedFinder
+
+    return seedFinder
+
+
+
 
diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/TrigInDetPattRecoTools/TrigCombinatorialSettings.h b/Trigger/TrigTools/TrigInDetPattRecoTools/TrigInDetPattRecoTools/TrigCombinatorialSettings.h
index 978a922b51ad91ff03c775e54a0008db73ca20d7..35f7cf986adf3669ad91342b0480f7133069977c 100644
--- a/Trigger/TrigTools/TrigInDetPattRecoTools/TrigInDetPattRecoTools/TrigCombinatorialSettings.h
+++ b/Trigger/TrigTools/TrigInDetPattRecoTools/TrigInDetPattRecoTools/TrigCombinatorialSettings.h
@@ -26,6 +26,7 @@ public:
     m_tripletD0_PPS_Max = 1.7; 
     m_tripletPtMin      = 2500.0;//was 1000.0
     m_tripletDoPSS      = false; // Allow Pixel SCT SCT seeds?
+    m_tripletDoPPS      = true; // Allow Pixel Pixel SCT seeds?
     m_doubletFilterRZ   = true;
     m_tripletDtCut      = 3.0;//in sigmas of mult.scattering for m_tripletPtMin track at eta=0
     m_magFieldZ = 2.0;//switch to configured value
@@ -47,6 +48,7 @@ public:
   float m_tripletPtMin;
   float m_seedRadBinWidth;
   bool  m_tripletDoPSS;
+  bool  m_tripletDoPPS;
   bool  m_doubletFilterRZ;
   float m_tripletDtCut;
   int m_nMaxPhiSlice;
diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigTrackSeedGenerator.cxx b/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigTrackSeedGenerator.cxx
index 39ed69e03c03197f580386a1c217073dd5eada80..c437be3d577d327f664e946529560be8a5206e80 100644
--- a/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigTrackSeedGenerator.cxx
+++ b/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigTrackSeedGenerator.cxx
@@ -161,10 +161,15 @@ void TrigTrackSeedGenerator::createSeeds(const IRoiDescriptor* roiDescriptor) {
 	m_outerMarkers.clear();
 
 	for(int layerJ=0;layerJ<nLayers;layerJ++) {
-	    
-	  if(!validateLayerPairNew(layerI, layerJ, rm, zm)) continue; 
-	  
+
 	  bool isPixel2 = (m_settings.m_layerGeometry[layerJ].m_subdet == 1);
+
+	  if((!m_settings.m_tripletDoPSS) && (!m_settings.m_tripletDoPPS)) {//no mixed seeds allowed
+	    if(isSct && isPixel2) continue;//no PSx
+	    if((!isSct) && (!isPixel2)) continue;//no xPS
+	  }
+	  
+	  if(!validateLayerPairNew(layerI, layerJ, rm, zm)) continue; 
 	    
 	  bool checkPSS = (!m_settings.m_tripletDoPSS) && (isSct && isPixel2);
 
@@ -270,9 +275,15 @@ void TrigTrackSeedGenerator::createSeeds(const IRoiDescriptor* roiDescriptor, co
 
 	    for(int layerJ=0;layerJ<nLayers;layerJ++) {//loop over other layers
 
-	      if(!validateLayerPairNew(layerI, layerJ, rm, zm)) continue; 
-
 	      bool isPixel2 = (m_settings.m_layerGeometry[layerJ].m_subdet == 1);
+
+	      if((!m_settings.m_tripletDoPSS) && (!m_settings.m_tripletDoPPS)) {//no mixed seeds allowed
+		if(isSct && isPixel2) continue;//no PSx
+		if((!isSct) && (!isPixel2)) continue;//no xPS
+	      }
+
+	      if(!validateLayerPairNew(layerI, layerJ, rm, zm)) continue; 
+	      
 	      bool checkPSS = (!m_settings.m_tripletDoPSS) && (isSct && isPixel2);
 
 	      for(auto phiJ : phiVec) {
diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/test/mockSeeds.cxx b/Trigger/TrigTools/TrigInDetPattRecoTools/test/mockSeeds.cxx
index ccceccd706934fe4be1d52bb0bdbca44edd90683..3e57974f1711101906f56bec19e78df43032149c 100644
--- a/Trigger/TrigTools/TrigInDetPattRecoTools/test/mockSeeds.cxx
+++ b/Trigger/TrigTools/TrigInDetPattRecoTools/test/mockSeeds.cxx
@@ -50,6 +50,7 @@ int main()
   tcs.m_nMaxPhiSlice = 53;
   tcs.m_maxTripletBufferLength = 3;
   tcs.m_tripletDoPSS = false;
+  tcs.m_tripletDoPPS = true;
   tcs.m_tripletDtCut      = 10.0;
   tcs.m_zvError = 10.0;
   tcs.m_maxBarrelPix    = -1;
diff --git a/Trigger/TrigTools/TrigMuonBackExtrapolator/src/BackExtrapolator.cxx b/Trigger/TrigTools/TrigMuonBackExtrapolator/src/BackExtrapolator.cxx
index 3c52ed6533aeac7c6e5ecad8f355bd69cbae248a..7aa26941629a89f82ad47077a7172820e8970957 100644
--- a/Trigger/TrigTools/TrigMuonBackExtrapolator/src/BackExtrapolator.cxx
+++ b/Trigger/TrigTools/TrigMuonBackExtrapolator/src/BackExtrapolator.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include <iostream>
@@ -847,13 +847,13 @@ MuonBackExtrapolator::give_eta_phi_at_vertex(
              double pt, double eta, double phi,
              bool barrel,bool triggerST,bool /*aligned*/,bool dataset, double& extEta,
              double& sigmaEta,double& extPhi,double& sigmaPhi,double PT,
-             double data_Barrel_Param[2][2][2],
-             double data_Barrel_Sigmas[2][2][2][2],
-             double data_Endcap_TriggerST_Param[4][12][2][2][2][2],
-             double data_Endcap_TriggerST_Sigmas[4][12][2][2][2][2],
-             double data_Endcap_InnerST_Param[4][12][2][2][2],
-             double data_Endcap_InnerST_PhiSigmas[4][12][2][2][2],
-             double data_Endcap_InnerST_EtaSigmas[2][2][2][2][2])
+             const double data_Barrel_Param[2][2][2],
+             const double data_Barrel_Sigmas[2][2][2][2],
+             const double data_Endcap_TriggerST_Param[4][12][2][2][2][2],
+             const double data_Endcap_TriggerST_Sigmas[4][12][2][2][2][2],
+             const double data_Endcap_InnerST_Param[4][12][2][2][2],
+             const double data_Endcap_InnerST_PhiSigmas[4][12][2][2][2],
+             const double data_Endcap_InnerST_EtaSigmas[2][2][2][2][2])
 {
 
     pt = retune_pt(pt, dataset);
@@ -870,8 +870,8 @@ MuonBackExtrapolator::give_eta_phi_at_vertex(
     
     // BARREL
     if (barrel) {
-        double (*param)[2][2]     = 0;
-        double (*sigmas)[2][2][2] = 0;
+        const double (*param)[2][2]     = 0;
+        const double (*sigmas)[2][2][2] = 0;
 
         param  = data_Barrel_Param;
         sigmas = data_Barrel_Sigmas;
@@ -925,8 +925,8 @@ MuonBackExtrapolator::give_eta_phi_at_vertex(
     
     if(triggerST) {
     
-        double (*param)[12][2][2][2][2] = 0;
-        double (*sigmas)[12][2][2][2][2] = 0;
+        const double (*param)[12][2][2][2][2] = 0;
+        const double (*sigmas)[12][2][2][2][2] = 0;
     
         param =  data_Endcap_TriggerST_Param;
 	sigmas = data_Endcap_TriggerST_Sigmas;
@@ -938,9 +938,9 @@ MuonBackExtrapolator::give_eta_phi_at_vertex(
     
     } else {
     
-        double (*param)[12][2][2][2] = 0;
-        double (*sigmaP)[12][2][2][2] = 0;
-	double (*sigmaE)[2][2][2][2] = 0;
+        const double (*param)[12][2][2][2] = 0;
+        const double (*sigmaP)[12][2][2][2] = 0;
+	const double (*sigmaE)[2][2][2][2] = 0;
 
         param  = data_Endcap_InnerST_Param;
         sigmaP = data_Endcap_InnerST_PhiSigmas;
@@ -969,13 +969,13 @@ MuonBackExtrapolator::give_eta_phi_at_tuned_vertex(
     double pt,double zetaId,double zetaMu,double eta,double phi, 
     bool barrel,bool triggerST,bool /*aligned*/, bool dataset,
     double& extEta,double& sigmaEta,double& extPhi,double& sigmaPhi,double PT,
-             double data_Barrel_Param[2][2][2],
-             double data_Barrel_Sigmas[2][2][2][2],
-             double data_Endcap_TriggerST_Param[4][12][2][2][2][2],
-             double data_Endcap_TriggerST_Sigmas[4][12][2][2][2][2],
-             double data_Endcap_InnerST_Param[4][12][2][2][2],
-             double data_Endcap_InnerST_PhiSigmas[4][12][2][2][2],
-             double data_Endcap_InnerST_EtaSigmas[2][2][2][2][2])
+    const double data_Barrel_Param[2][2][2],
+    const double data_Barrel_Sigmas[2][2][2][2],
+    const double data_Endcap_TriggerST_Param[4][12][2][2][2][2],
+    const double data_Endcap_TriggerST_Sigmas[4][12][2][2][2][2],
+    const double data_Endcap_InnerST_Param[4][12][2][2][2],
+    const double data_Endcap_InnerST_PhiSigmas[4][12][2][2][2],
+    const double data_Endcap_InnerST_EtaSigmas[2][2][2][2][2])
 {
 
     pt = retune_pt(pt, dataset);
@@ -991,8 +991,8 @@ MuonBackExtrapolator::give_eta_phi_at_tuned_vertex(
     
     // BARREL
     if (barrel) {
-        double (*param)[2][2] = 0;
-        double (*sigmas)[2][2][2] = 0;
+        const double (*param)[2][2] = 0;
+        const double (*sigmas)[2][2][2] = 0;
 
         param  = data_Barrel_Param;
         sigmas = data_Barrel_Sigmas;
@@ -1048,8 +1048,8 @@ MuonBackExtrapolator::give_eta_phi_at_tuned_vertex(
     
     if(triggerST) {
     
-        double (*param)[12][2][2][2][2] = 0;
-        double (*sigmas)[12][2][2][2][2] = 0;
+        const double (*param)[12][2][2][2][2] = 0;
+        const double (*sigmas)[12][2][2][2][2] = 0;
 
         param =  data_Endcap_TriggerST_Param;
 	sigmas = data_Endcap_TriggerST_Sigmas;
@@ -1061,9 +1061,9 @@ MuonBackExtrapolator::give_eta_phi_at_tuned_vertex(
     
     } else {
     
-        double (*param)[12][2][2][2] = 0;
-        double (*sigmaP)[12][2][2][2] = 0;
-	double (*sigmaE)[2][2][2][2] = 0;
+        const double (*param)[12][2][2][2] = 0;
+        const double (*sigmaP)[12][2][2][2] = 0;
+	const double (*sigmaE)[2][2][2][2] = 0;
     
         param  = data_Endcap_InnerST_Param;
 	sigmaP = data_Endcap_InnerST_PhiSigmas;
diff --git a/Trigger/TrigTools/TrigMuonBackExtrapolator/src/BackExtrapolator.h b/Trigger/TrigTools/TrigMuonBackExtrapolator/src/BackExtrapolator.h
index 8fdc09cc6713de704dd06bb1f9c48266202345e4..8972025860903e2afaaa5efb30ccea51d7836d7c 100644
--- a/Trigger/TrigTools/TrigMuonBackExtrapolator/src/BackExtrapolator.h
+++ b/Trigger/TrigTools/TrigMuonBackExtrapolator/src/BackExtrapolator.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 BACKEXTRAPOLATOR_H
@@ -10,24 +10,24 @@ namespace MuonBackExtrapolator {
 
     bool give_eta_phi_at_vertex( double, double, double, bool,bool,bool,bool,
                                  double&, double&, double&, double&,double, 
-                                 double data_Barrel_Param[2][2][2],
-                                 double data_Barrel_Sigmas[2][2][2][2],
-                                 double data_Endcap_TriggerST_Param[4][12][2][2][2][2],
-                                 double data_Endcap_TriggerST_Sigmas[4][12][2][2][2][2],
-                                 double data_Endcap_InnerST_Param[4][12][2][2][2],
-                                 double data_Endcap_InnerST_PhiSigmas[4][12][2][2][2],
-                                 double data_Endcap_InnerST_EtaSigmas[2][2][2][2][2]);
+                                 const double data_Barrel_Param[2][2][2],
+                                 const double data_Barrel_Sigmas[2][2][2][2],
+                                 const double data_Endcap_TriggerST_Param[4][12][2][2][2][2],
+                                 const double data_Endcap_TriggerST_Sigmas[4][12][2][2][2][2],
+                                 const double data_Endcap_InnerST_Param[4][12][2][2][2],
+                                 const double data_Endcap_InnerST_PhiSigmas[4][12][2][2][2],
+                                 const double data_Endcap_InnerST_EtaSigmas[2][2][2][2][2]);
 
     bool give_eta_phi_at_tuned_vertex( double, double, double, double, double, 
                                        bool, bool, bool, bool, double&, double&, 
 				       double&, double&, double,
-                                 double data_Barrel_Param[2][2][2],
-                                 double data_Barrel_Sigmas[2][2][2][2],
-                                 double data_Endcap_TriggerST_Param[4][12][2][2][2][2],
-                                 double data_Endcap_TriggerST_Sigmas[4][12][2][2][2][2],
-                                 double data_Endcap_InnerST_Param[4][12][2][2][2],
-                                 double data_Endcap_InnerST_PhiSigmas[4][12][2][2][2],
-                                 double data_Endcap_InnerST_EtaSigmas[2][2][2][2][2]);
+                                 const double data_Barrel_Param[2][2][2],
+                                 const double data_Barrel_Sigmas[2][2][2][2],
+                                 const double data_Endcap_TriggerST_Param[4][12][2][2][2][2],
+                                 const double data_Endcap_TriggerST_Sigmas[4][12][2][2][2][2],
+                                 const double data_Endcap_InnerST_Param[4][12][2][2][2],
+                                 const double data_Endcap_InnerST_PhiSigmas[4][12][2][2][2],
+                                 const double data_Endcap_InnerST_EtaSigmas[2][2][2][2][2]);
 		       
     bool idTrack_in_loose_window ( double, int, double, double, double, 
                                    double, double, bool, bool, double, double,
diff --git a/Trigger/TrigTools/TrigMuonBackExtrapolator/src/TrigMuonBackExtrapolator.cxx b/Trigger/TrigTools/TrigMuonBackExtrapolator/src/TrigMuonBackExtrapolator.cxx
index a63dcc3922f5c6f8ab8c5ed4782f3c35fce5015d..d37773bf09dc81f367f8351b5e0f71727edcee81 100644
--- a/Trigger/TrigTools/TrigMuonBackExtrapolator/src/TrigMuonBackExtrapolator.cxx
+++ b/Trigger/TrigTools/TrigMuonBackExtrapolator/src/TrigMuonBackExtrapolator.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include <iostream>
@@ -49,7 +49,7 @@ TrigMuonBackExtrapolator::finalize()
 
 StatusCode 
 TrigMuonBackExtrapolator::give_eta_phi_at_vertex (const MuonFeature* feature,
-     double& extEta,double& sigmaEta,double& extPhi,double& sigmaPhi,double PT)
+     double& extEta,double& sigmaEta,double& extPhi,double& sigmaPhi,double PT) const
 {
     bool result = MuonBackExtrapolator::give_eta_phi_at_vertex(
                                                      feature->pt(), 
@@ -80,7 +80,7 @@ TrigMuonBackExtrapolator::give_eta_phi_at_vertex (const MuonFeature* feature,
 StatusCode 
 TrigMuonBackExtrapolator::give_eta_phi_at_vertex (double pt,
     const MuonFeature* feature, double& extEta, double& sigmaEta,
-    double& extPhi, double& sigmaPhi, double PT)
+    double& extPhi, double& sigmaPhi, double PT) const
 {
     bool result = MuonBackExtrapolator::give_eta_phi_at_vertex(
                                                      pt, 
@@ -111,7 +111,7 @@ TrigMuonBackExtrapolator::give_eta_phi_at_vertex (double pt,
 StatusCode 
 TrigMuonBackExtrapolator::give_eta_phi_at_vertex( const MuonFeature* feature,
                                double ZetaID,double& extEta,double& sigmaEta,
-                                   double& extPhi,double& sigmaPhi,double PT)
+                                   double& extPhi,double& sigmaPhi,double PT) const
 {
      bool result = MuonBackExtrapolator::give_eta_phi_at_tuned_vertex(
                                                      feature->pt(),
@@ -143,7 +143,7 @@ TrigMuonBackExtrapolator::give_eta_phi_at_vertex( const MuonFeature* feature,
 StatusCode 
 TrigMuonBackExtrapolator::give_eta_phi_at_vertex( double pt,
     const MuonFeature* feature, double ZetaID, double& extEta, double& sigmaEta,
-    double& extPhi, double& sigmaPhi, double PT)
+    double& extPhi, double& sigmaPhi, double PT) const
 {
      bool result = MuonBackExtrapolator::give_eta_phi_at_tuned_vertex(
                                                      pt,
@@ -309,7 +309,7 @@ TrigMuonBackExtrapolator::give_tight_chi2  (const MuonFeature*,const TrigInDetTr
 
 StatusCode 
 TrigMuonBackExtrapolator::give_eta_phi_at_vertex (const xAOD::L2StandAloneMuon* muonSA,
-     double& extEta,double& sigmaEta,double& extPhi,double& sigmaPhi,double PT)
+     double& extEta,double& sigmaEta,double& extPhi,double& sigmaPhi,double PT) const
 {
     bool result = MuonBackExtrapolator::give_eta_phi_at_vertex(
                                                      muonSA->pt(), 
@@ -340,7 +340,7 @@ TrigMuonBackExtrapolator::give_eta_phi_at_vertex (const xAOD::L2StandAloneMuon*
 StatusCode 
 TrigMuonBackExtrapolator::give_eta_phi_at_vertex (double pt,
     const xAOD::L2StandAloneMuon* muonSA, double& extEta, double& sigmaEta,
-    double& extPhi, double& sigmaPhi, double PT)
+    double& extPhi, double& sigmaPhi, double PT) const
 {
     bool result = MuonBackExtrapolator::give_eta_phi_at_vertex(
                                                      pt, 
@@ -371,7 +371,7 @@ TrigMuonBackExtrapolator::give_eta_phi_at_vertex (double pt,
 StatusCode 
 TrigMuonBackExtrapolator::give_eta_phi_at_vertex( const xAOD::L2StandAloneMuon* muonSA,
                                double ZetaID,double& extEta,double& sigmaEta,
-                                   double& extPhi,double& sigmaPhi,double PT)
+                                   double& extPhi,double& sigmaPhi,double PT) const
 {
      bool result = MuonBackExtrapolator::give_eta_phi_at_tuned_vertex(
                                                      muonSA->pt(),
@@ -403,7 +403,7 @@ TrigMuonBackExtrapolator::give_eta_phi_at_vertex( const xAOD::L2StandAloneMuon*
 StatusCode 
 TrigMuonBackExtrapolator::give_eta_phi_at_vertex( double pt,
     const xAOD::L2StandAloneMuon* muonSA, double ZetaID, double& extEta, double& sigmaEta,
-    double& extPhi, double& sigmaPhi, double PT)
+    double& extPhi, double& sigmaPhi, double PT) const
 {
      bool result = MuonBackExtrapolator::give_eta_phi_at_tuned_vertex(
                                                      pt,
diff --git a/Trigger/TrigTools/TrigMuonBackExtrapolator/src/TrigMuonBackExtrapolator.h b/Trigger/TrigTools/TrigMuonBackExtrapolator/src/TrigMuonBackExtrapolator.h
index 13c0b7855daf993f9775b3b46f628881b2a1c269..fc0e5c63e0f47d07e4119e4af82459fd8cb67fc1 100644
--- a/Trigger/TrigTools/TrigMuonBackExtrapolator/src/TrigMuonBackExtrapolator.h
+++ b/Trigger/TrigTools/TrigMuonBackExtrapolator/src/TrigMuonBackExtrapolator.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 TRIGMUONBACKEXTRAPOLATOR_H
@@ -30,7 +30,7 @@ class TrigMuonBackExtrapolator: public AthAlgTool,
 				       double& sigmaEta,   // sigma vertex eta
 				       double& extPhi,     // vertex phi
 				       double& sigmaPhi,   // sigma vertex phi
-				       double PT);         // PT of the window
+				       double PT) const;   // PT of the window
 
     StatusCode give_eta_phi_at_vertex (double pt,          // pt of muon track
                                        const MuonFeature*, // input muon track
@@ -38,7 +38,7 @@ class TrigMuonBackExtrapolator: public AthAlgTool,
 				       double& sigmaEta,   // sigma vertex eta
 				       double& extPhi,     // vertex phi
 				       double& sigmaPhi,   // sigma vertex phi
-				       double PT);         // PT of the window
+				       double PT) const;   // PT of the window
 
 
     StatusCode give_eta_phi_at_vertex( const MuonFeature*, // input muon track
@@ -47,7 +47,7 @@ class TrigMuonBackExtrapolator: public AthAlgTool,
 				       double& sigmaEta,   // sigma vertex eta
 				       double& extPhi,     // vertex phi
 				       double& sigmaPhi,   // sigma vertex phi
-				       double PT);         // PT of the window
+				       double PT) const;   // PT of the window
 
     StatusCode give_eta_phi_at_vertex( double pt,          // pt of muon track
                                        const MuonFeature*, // input muon track
@@ -56,7 +56,7 @@ class TrigMuonBackExtrapolator: public AthAlgTool,
 				       double& sigmaEta,   // sigma vertex eta
 				       double& extPhi,     // vertex phi
 				       double& sigmaPhi,   // sigma vertex phi
-				       double PT);         // PT of the window
+				       double PT) const;   // PT of the window
 
 
     StatusCode loose_window_match (const MuonFeature*,     // input muon track  
@@ -95,7 +95,7 @@ class TrigMuonBackExtrapolator: public AthAlgTool,
 				       double& sigmaEta,   // sigma vertex eta
 				       double& extPhi,     // vertex phi
 				       double& sigmaPhi,   // sigma vertex phi
-				       double PT);         // PT of the window
+				       double PT) const;   // PT of the window
 
     StatusCode give_eta_phi_at_vertex (double pt,          // pt of muon track
                                        const xAOD::L2StandAloneMuon*, // input muon track
@@ -103,7 +103,7 @@ class TrigMuonBackExtrapolator: public AthAlgTool,
 				       double& sigmaEta,   // sigma vertex eta
 				       double& extPhi,     // vertex phi
 				       double& sigmaPhi,   // sigma vertex phi
-				       double PT);         // PT of the window
+				       double PT) const;   // PT of the window
 
 
     StatusCode give_eta_phi_at_vertex( const xAOD::L2StandAloneMuon*, // input muon track
@@ -112,7 +112,7 @@ class TrigMuonBackExtrapolator: public AthAlgTool,
 				       double& sigmaEta,   // sigma vertex eta
 				       double& extPhi,     // vertex phi
 				       double& sigmaPhi,   // sigma vertex phi
-				       double PT);         // PT of the window
+				       double PT) const;   // PT of the window
 
     StatusCode give_eta_phi_at_vertex( double pt,          // pt of muon track
                                        const xAOD::L2StandAloneMuon*, // input muon track
@@ -121,7 +121,7 @@ class TrigMuonBackExtrapolator: public AthAlgTool,
 				       double& sigmaEta,   // sigma vertex eta
 				       double& extPhi,     // vertex phi
 				       double& sigmaPhi,   // sigma vertex phi
-				       double PT);         // PT of the window
+				       double PT) const;   // PT of the window
 
 
     StatusCode loose_window_match (const xAOD::L2StandAloneMuon*,     // input muon track  
diff --git a/Trigger/TrigTools/TrigMuonToolInterfaces/TrigMuonToolInterfaces/ITrigMuonBackExtrapolator.h b/Trigger/TrigTools/TrigMuonToolInterfaces/TrigMuonToolInterfaces/ITrigMuonBackExtrapolator.h
index 8d6c7f0eab9f1701b66ce2ba144c079a4186811b..007a57972954752308e6bb255f9177931840940e 100644
--- a/Trigger/TrigTools/TrigMuonToolInterfaces/TrigMuonToolInterfaces/ITrigMuonBackExtrapolator.h
+++ b/Trigger/TrigTools/TrigMuonToolInterfaces/TrigMuonToolInterfaces/ITrigMuonBackExtrapolator.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 __ITRIGMUONBACKEXTRAPOLATOR_H__ 
@@ -24,41 +24,41 @@ class ITrigMuonBackExtrapolator: virtual public IAlgTool
 
   // extrapolate without using the ID vertex measurement
   virtual 
-  StatusCode give_eta_phi_at_vertex (const MuonFeature*, // input muon track
-				     double& extEta,     // vertex eta
-				     double& sigmaEta,   // sigma vertex eta
-				     double& extPhi,     // vertex phi
-				     double& sigmaPhi,   // sigma vertex phi
-				     double PT) = 0;     // PT of the window
+  StatusCode give_eta_phi_at_vertex (const MuonFeature*,   // input muon track
+				     double& extEta,       // vertex eta
+				     double& sigmaEta,     // sigma vertex eta
+				     double& extPhi,       // vertex phi
+				     double& sigmaPhi,     // sigma vertex phi
+				     double PT) const = 0; // PT of the window
 
   virtual
-  StatusCode give_eta_phi_at_vertex (double pt,          // pt of muon track
-                                     const MuonFeature*, // input muon track
-				     double& extEta,     // vertex eta
-				     double& sigmaEta,   // sigma vertex eta
-				     double& extPhi,     // vertex phi
-				     double& sigmaPhi,   // sigma vertex phi
-				     double PT) = 0;     // PT of the window
+  StatusCode give_eta_phi_at_vertex (double pt,            // pt of muon track
+                                     const MuonFeature*,   // input muon track
+				     double& extEta,       // vertex eta
+				     double& sigmaEta,     // sigma vertex eta
+				     double& extPhi,       // vertex phi
+				     double& sigmaPhi,     // sigma vertex phi
+				     double PT) const = 0; // PT of the window
 
   // extrapolate using the ID vertext measurement
   virtual 
-  StatusCode give_eta_phi_at_vertex( const MuonFeature*, // input muon track
-                                     double ZetaID,      // Z vertex from ID
-				     double& extEta,     // vertex eta
-				     double& sigmaEta,   // sigma vertex eta
-				     double& extPhi,     // vertex phi
-				     double& sigmaPhi,   // sigma vertex phi
-				     double PT) = 0;     // PT of the window
+  StatusCode give_eta_phi_at_vertex( const MuonFeature*,   // input muon track
+                                     double ZetaID,        // Z vertex from ID
+				     double& extEta,       // vertex eta
+				     double& sigmaEta,     // sigma vertex eta
+				     double& extPhi,       // vertex phi
+				     double& sigmaPhi,     // sigma vertex phi
+				     double PT) const = 0; // PT of the window
 
   virtual 
-  StatusCode give_eta_phi_at_vertex( double pt,          // pt of muon track
-                                     const MuonFeature*, // input muon track
-                                     double ZetaID,      // Z vertex from ID
-				     double& extEta,     // vertex eta
-				     double& sigmaEta,   // sigma vertex eta
-				     double& extPhi,     // vertex phi
-				     double& sigmaPhi,   // sigma vertex phi
-				     double PT) = 0;     // PT of the window
+  StatusCode give_eta_phi_at_vertex( double pt,            // pt of muon track
+                                     const MuonFeature*,   // input muon track
+                                     double ZetaID,        // Z vertex from ID
+				     double& extEta,       // vertex eta
+				     double& sigmaEta,     // sigma vertex eta
+				     double& extPhi,       // vertex phi
+				     double& sigmaPhi,     // sigma vertex phi
+				     double PT) const = 0; // PT of the window
 
 
   // match ID track and Muon track applying a loose cut window
@@ -106,40 +106,40 @@ class ITrigMuonBackExtrapolator: virtual public IAlgTool
   // extrapolate without using the ID vertex measurement
   virtual 
   StatusCode give_eta_phi_at_vertex (const xAOD::L2StandAloneMuon*, // input muon track
-				     double& extEta,     // vertex eta
-				     double& sigmaEta,   // sigma vertex eta
-				     double& extPhi,     // vertex phi
-				     double& sigmaPhi,   // sigma vertex phi
-				     double PT) = 0;     // PT of the window
+				     double& extEta,                // vertex eta
+				     double& sigmaEta,              // sigma vertex eta
+				     double& extPhi,                // vertex phi
+				     double& sigmaPhi,              // sigma vertex phi
+				     double PT) const = 0;          // PT of the window
 
   virtual
-  StatusCode give_eta_phi_at_vertex (double pt,          // pt of muon track
+  StatusCode give_eta_phi_at_vertex (double pt,                     // pt of muon track
                                      const xAOD::L2StandAloneMuon*, // input muon track
-				     double& extEta,     // vertex eta
-				     double& sigmaEta,   // sigma vertex eta
-				     double& extPhi,     // vertex phi
-				     double& sigmaPhi,   // sigma vertex phi
-				     double PT) = 0;     // PT of the window
+				     double& extEta,                // vertex eta
+				     double& sigmaEta,              // sigma vertex eta
+				     double& extPhi,                // vertex phi
+				     double& sigmaPhi,              // sigma vertex phi
+				     double PT) const = 0;          // PT of the window
 
   // extrapolate using the ID vertext measurement
   virtual 
   StatusCode give_eta_phi_at_vertex( const xAOD::L2StandAloneMuon*, // input muon track
-                                     double ZetaID,      // Z vertex from ID
-				     double& extEta,     // vertex eta
-				     double& sigmaEta,   // sigma vertex eta
-				     double& extPhi,     // vertex phi
-				     double& sigmaPhi,   // sigma vertex phi
-				     double PT) = 0;     // PT of the window
+                                     double ZetaID,                 // Z vertex from ID
+				     double& extEta,                // vertex eta
+				     double& sigmaEta,              // sigma vertex eta
+				     double& extPhi,                // vertex phi
+				     double& sigmaPhi,              // sigma vertex phi
+				     double PT) const = 0;          // PT of the window
 
   virtual 
-  StatusCode give_eta_phi_at_vertex( double pt,          // pt of muon track
+  StatusCode give_eta_phi_at_vertex( double pt,                     // pt of muon track
                                      const xAOD::L2StandAloneMuon*, // input muon track
-                                     double ZetaID,      // Z vertex from ID
-				     double& extEta,     // vertex eta
-				     double& sigmaEta,   // sigma vertex eta
-				     double& extPhi,     // vertex phi
-				     double& sigmaPhi,   // sigma vertex phi
-				     double PT) = 0;     // PT of the window
+                                     double ZetaID,                 // Z vertex from ID
+				     double& extEta,                // vertex eta
+				     double& sigmaEta,              // sigma vertex eta
+				     double& extPhi,                // vertex phi
+				     double& sigmaPhi,              // sigma vertex phi
+				     double PT) const = 0;          // PT of the window
 
 
   // match ID track and Muon track applying a loose cut window
diff --git a/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx b/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx
index 9775277e6baa053339b7cab695e591148689bf54..53ce67c108193bf718c504cb176ed3904d4ef714 100644
--- a/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx
+++ b/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx
@@ -22,6 +22,7 @@
 #include "GeneratorObjectsTPCnv/initMcEventCollection.h"
 #include "AtlasHepMC/GenParticle.h"
 #include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/Operators.h"
 
 void compare (const TrigIDHitStats& p1,
               const TrigIDHitStats& p2)
@@ -94,6 +95,7 @@ void test1(std::vector<HepMC::GenParticlePtr>& genPartVector)
   auto particle = genPartVector.at(0);
   // Create HepMcParticleLink outside of leak check.
   HepMcParticleLink dummyHMPL(HepMC::barcode(particle),particle->parent_event()->event_number());
+
   assert(dummyHMPL.cptr()==particle);
   Athena_test::Leakcheck check;
 
diff --git a/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthMapCnv_p1_test.cxx b/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthMapCnv_p1_test.cxx
index e8a93cfa45d9748e448d47310ca14fa87b784806..4137636034a5e29eb2283811633840ddd54e4a6b 100644
--- a/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthMapCnv_p1_test.cxx
+++ b/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthMapCnv_p1_test.cxx
@@ -23,6 +23,7 @@
 #include "GeneratorObjectsTPCnv/initMcEventCollection.h"
 #include "AtlasHepMC/GenParticle.h"
 #include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/Operators.h"
 
 
 void compare (const TrigIDHitStats& p1,
@@ -107,6 +108,7 @@ void test1(std::vector<HepMC::GenParticlePtr>& genPartVector)
   auto particle = genPartVector.at(0);
   // Create HepMcParticleLink outside of leak check.
   HepMcParticleLink dummyHMPL(HepMC::barcode(particle),particle->parent_event()->event_number());
+
   assert(dummyHMPL.cptr()==particle);
 
   SG::WriteHandle<TrigInDetTrackCollection> coll{"coll"};
diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
index 45ca473f70dd75582ec997220a49024b07c6a5bb..f1300dfd45bf850ba32dc91932d6fc0878d29d01 100644
--- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
+++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
@@ -473,7 +473,7 @@ HLT_JetDS_j0_L1J100:
     1: 3
     2: 3
   stepFeatures:
-    0: 81
+    0: 137
     1: 32
     2: 3
 HLT_alfacalib_AlfaPEB_L1ALFA_ANY:
@@ -536,6 +536,20 @@ HLT_e17_lhvloose_nod0_L1EM15VH:
     2: 7
     3: 5
     4: 5
+HLT_e17_lhvloose_nod0_L1EM15VHI:
+  eventCount: 4
+  stepCounts:
+    0: 5
+    1: 4
+    2: 4
+    3: 4
+    4: 4
+  stepFeatures:
+    0: 5
+    1: 6
+    2: 6
+    3: 4
+    4: 4
 HLT_e20_lhmedium_e15_lhmedium_Zee_L12EM3:
   eventCount: 0
   stepCounts:
@@ -581,19 +595,19 @@ HLT_e26_etcut_L1EM22VHI:
     2: 6
     3: 6
 HLT_e26_lhloose_L1EM15VH:
-  eventCount: 4
+  eventCount: 5
   stepCounts:
-    0: 5
-    1: 4
-    2: 4
-    3: 4
-    4: 4
+    0: 6
+    1: 5
+    2: 5
+    3: 5
+    4: 5
   stepFeatures:
-    0: 5
-    1: 6
-    2: 6
-    3: 4
-    4: 4
+    0: 6
+    1: 7
+    2: 7
+    3: 5
+    4: 5
 HLT_e26_lhloose_L1EM22VHI:
   eventCount: 4
   stepCounts:
@@ -789,46 +803,46 @@ HLT_e5_etcut_L1EM3:
     2: 173
     3: 102
 HLT_e5_lhloose_L1EM3:
-  eventCount: 4
+  eventCount: 6
   stepCounts:
     0: 18
     1: 15
     2: 15
     3: 15
-    4: 4
+    4: 6
   stepFeatures:
-    0: 55
-    1: 110
-    2: 72
-    3: 40
-    4: 5
+    0: 60
+    1: 145
+    2: 78
+    3: 44
+    4: 7
 HLT_e5_lhloose_noringer_L1EM3:
-  eventCount: 5
+  eventCount: 6
   stepCounts:
     0: 17
     1: 15
     2: 15
     3: 15
-    4: 5
+    4: 6
   stepFeatures:
     0: 56
     1: 128
     2: 88
     3: 46
-    4: 6
+    4: 7
 HLT_e5_lhmedium_L1EM3:
   eventCount: 4
   stepCounts:
     0: 18
-    1: 14
-    2: 14
-    3: 14
+    1: 15
+    2: 15
+    3: 15
     4: 4
   stepFeatures:
-    0: 54
-    1: 107
-    2: 70
-    3: 39
+    0: 58
+    1: 131
+    2: 76
+    3: 42
     4: 5
 HLT_e5_lhmedium_noringer_L1EM3:
   eventCount: 4
@@ -848,29 +862,29 @@ HLT_e5_lhtight_L1EM3:
   eventCount: 4
   stepCounts:
     0: 18
-    1: 14
-    2: 14
-    3: 14
+    1: 15
+    2: 15
+    3: 15
     4: 4
   stepFeatures:
-    0: 52
-    1: 103
-    2: 66
-    3: 37
+    0: 57
+    1: 128
+    2: 74
+    3: 41
     4: 5
 HLT_e5_lhtight_nod0_L1EM3:
   eventCount: 4
   stepCounts:
     0: 18
-    1: 14
-    2: 14
-    3: 14
+    1: 15
+    2: 15
+    3: 15
     4: 4
   stepFeatures:
-    0: 52
-    1: 103
-    2: 66
-    3: 37
+    0: 57
+    1: 128
+    2: 74
+    3: 41
     4: 5
 HLT_e5_lhtight_noringer_L1EM3:
   eventCount: 4
@@ -1371,7 +1385,7 @@ HLT_j0_aggSEP500htSEP30etSEP0eta320_L1J20:
   stepCounts:
     0: 1
   stepFeatures:
-    0: 28
+    0: 50
 HLT_j0_perf_L1J12_EMPTY:
   eventCount: 0
 HLT_j0_vbenfSEP30etSEP34mass35SEP50fbet_L1J20:
@@ -1379,7 +1393,7 @@ HLT_j0_vbenfSEP30etSEP34mass35SEP50fbet_L1J20:
   stepCounts:
     0: 15
   stepFeatures:
-    0: 402
+    0: 398
 HLT_j225_subjesgscIS_ftf_bmv2c1040_split_L1J100:
   eventCount: 0
   stepCounts:
@@ -1487,21 +1501,21 @@ HLT_j45_cssktc_nojcalib_L1J20:
   stepFeatures:
     0: 27
 HLT_j45_ftf_L1J15:
-  eventCount: 18
+  eventCount: 19
   stepCounts:
     0: 20
-    1: 18
+    1: 19
   stepFeatures:
     0: 20
-    1: 45
-HLT_j45_ftf_preselj45_L1J20:
-  eventCount: 18
+    1: 54
+HLT_j45_ftf_preselj20_L1J20:
+  eventCount: 19
   stepCounts:
     0: 19
-    1: 18
+    1: 19
   stepFeatures:
     0: 19
-    1: 45
+    1: 54
 HLT_j45_nojcalib_L1J20:
   eventCount: 17
   stepCounts:
@@ -1509,21 +1523,21 @@ HLT_j45_nojcalib_L1J20:
   stepFeatures:
     0: 39
 HLT_j45_pf_ftf_L1J20:
-  eventCount: 18
+  eventCount: 19
   stepCounts:
     0: 19
-    1: 18
+    1: 19
   stepFeatures:
     0: 19
-    1: 50
-HLT_j45_pf_ftf_preselj45_L1J20:
-  eventCount: 18
+    1: 56
+HLT_j45_pf_ftf_preselj20_L1J20:
+  eventCount: 19
   stepCounts:
     0: 19
-    1: 18
+    1: 19
   stepFeatures:
     0: 19
-    1: 50
+    1: 56
 HLT_j45_pf_nojcalib_ftf_L1J20:
   eventCount: 18
   stepCounts:
@@ -1566,7 +1580,7 @@ HLT_j45_sktc_nojcalib_L1J20:
     0: 15
   stepFeatures:
     0: 26
-HLT_j45_subjesIS_ftf_preselj45_L1J20:
+HLT_j45_subjesIS_ftf_preselj20_L1J20:
   eventCount: 19
   stepCounts:
     0: 19
@@ -1583,13 +1597,13 @@ HLT_j45_subjesgscIS_ftf_011jvt_L1J15:
     0: 20
     1: 44
 HLT_j45_subjesgscIS_ftf_015jvt_L1J15:
-  eventCount: 18
+  eventCount: 17
   stepCounts:
     0: 20
-    1: 18
+    1: 17
   stepFeatures:
     0: 20
-    1: 44
+    1: 42
 HLT_j45_subjesgscIS_ftf_059jvt_L1J15:
   eventCount: 17
   stepCounts:
@@ -1637,13 +1651,13 @@ HLT_j45_subjesgscIS_ftf_boffperf_split_L1J20:
     1: 47
     2: 47
 HLT_j45_subresjesgscIS_ftf_L1J15:
-  eventCount: 18
+  eventCount: 19
   stepCounts:
     0: 20
-    1: 18
+    1: 19
   stepFeatures:
     0: 20
-    1: 45
+    1: 54
 HLT_j460_a10_lcw_subjes_L1J100:
   eventCount: 0
 HLT_j460_a10_lcw_subjes_L1J20:
@@ -1711,7 +1725,7 @@ HLT_j85_ftf_L1J20:
     1: 13
   stepFeatures:
     0: 19
-    1: 21
+    1: 22
 HLT_j85_pf_ftf_L1J20:
   eventCount: 13
   stepCounts:
@@ -1719,7 +1733,7 @@ HLT_j85_pf_ftf_L1J20:
     1: 13
   stepFeatures:
     0: 19
-    1: 21
+    1: 22
 HLT_mb_sptrk_L1RD0_FILLED:
   eventCount: 0
 HLT_mu0_muoncalib_L1MU20:
@@ -2495,19 +2509,19 @@ HLT_tau25_idperf_tracktwo_L1TAU12IM:
     4: 14
     5: 14
 HLT_tau25_looseRNN_tracktwoMVA_L1TAU12IM:
-  eventCount: 8
+  eventCount: 9
   stepCounts:
     0: 12
     1: 10
     2: 10
     3: 10
-    4: 8
+    4: 9
   stepFeatures:
     0: 22
     1: 14
     2: 12
     3: 12
-    4: 9
+    4: 11
 HLT_tau25_looseRNN_tracktwo_L1TAU12IM:
   eventCount: 0
   stepCounts:
@@ -2553,19 +2567,19 @@ HLT_tau25_medium1_tracktwo_L1TAU12IM:
     1: 14
     2: 12
 HLT_tau25_mediumRNN_tracktwoMVA_L1TAU12IM:
-  eventCount: 5
+  eventCount: 8
   stepCounts:
     0: 12
     1: 10
     2: 10
     3: 10
-    4: 5
+    4: 8
   stepFeatures:
     0: 22
     1: 14
     2: 12
     3: 12
-    4: 5
+    4: 9
 HLT_tau25_mediumRNN_tracktwo_L1TAU12IM:
   eventCount: 0
   stepCounts:
@@ -2607,19 +2621,19 @@ HLT_tau25_perf_tracktwo_L1TAU12IM:
     4: 14
     5: 14
 HLT_tau25_tightRNN_tracktwoMVA_L1TAU12IM:
-  eventCount: 4
+  eventCount: 7
   stepCounts:
     0: 12
     1: 10
     2: 10
     3: 10
-    4: 4
+    4: 7
   stepFeatures:
     0: 22
     1: 14
     2: 12
     3: 12
-    4: 4
+    4: 7
 HLT_tau25_tightRNN_tracktwo_L1TAU12IM:
   eventCount: 0
   stepCounts:
@@ -2655,41 +2669,43 @@ HLT_tau25_verylooseRNN_tracktwo_L1TAU12IM:
     1: 14
     2: 12
 HLT_tau35_mediumRNN_tracktwoMVA_L1TAU12IM:
-  eventCount: 4
+  eventCount: 7
   stepCounts:
     0: 11
     1: 9
     2: 9
     3: 9
-    4: 4
+    4: 7
   stepFeatures:
     0: 20
     1: 13
     2: 11
     3: 11
-    4: 4
+    4: 8
 HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_L1DR-TAU20ITAU12I-J25:
-  eventCount: 0
+  eventCount: 1
   stepCounts:
     0: 6
     1: 3
     2: 2
     3: 2
+    4: 1
   stepFeatures:
     0: 15
     1: 6
     2: 4
     3: 4
+    4: 2
 HLT_tau80_medium1_tracktwo_L1TAU60:
   eventCount: 0
   stepCounts:
     0: 4
-    1: 2
-    2: 2
+    1: 1
+    2: 1
   stepFeatures:
-    0: 5
-    1: 2
-    2: 2
+    0: 4
+    1: 1
+    2: 1
 HLT_tau80_mediumRNN_tracktwoMVA_tau35_mediumRNN_tracktwoMVA_L1TAU60_DR-TAU20ITAU12I:
   eventCount: 0
   stepCounts:
@@ -2733,11 +2749,11 @@ HLT_xe100_cvfpufit_L1XE50:
     0: 10
     1: 6
 HLT_xe100_mht_L1XE50:
-  eventCount: 9
+  eventCount: 7
   stepCounts:
-    0: 9
+    0: 7
   stepFeatures:
-    0: 9
+    0: 7
 HLT_xe100_mhtpufit_em_subjesgscIS_L1XE50:
   eventCount: 6
   stepCounts:
@@ -2777,13 +2793,13 @@ HLT_xe100_tcpufit_L1XE50:
   stepFeatures:
     0: 6
 HLT_xe100_trkmht_L1XE50:
-  eventCount: 7
+  eventCount: 8
   stepCounts:
     0: 10
-    1: 7
+    1: 8
   stepFeatures:
     0: 10
-    1: 7
+    1: 8
 HLT_xe100_trkmht_xe85_tcpufit_xe65_cell_L1XE50:
   eventCount: 5
   stepCounts:
@@ -2793,11 +2809,11 @@ HLT_xe100_trkmht_xe85_tcpufit_xe65_cell_L1XE50:
     0: 6
     1: 5
 HLT_xe110_mht_L1XE50:
-  eventCount: 7
+  eventCount: 6
   stepCounts:
-    0: 7
+    0: 6
   stepFeatures:
-    0: 7
+    0: 6
 HLT_xe110_pfsum_L1XE50:
   eventCount: 5
   stepCounts:
diff --git a/Trigger/TrigValidation/TrigInDetValidation/CMakeLists.txt b/Trigger/TrigValidation/TrigInDetValidation/CMakeLists.txt
index 80bc59b6fef0e28732a66f65198c45f7fb59f9fa..0afca4f193c9344195a626696d1930bfaee20e19 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/CMakeLists.txt
+++ b/Trigger/TrigValidation/TrigInDetValidation/CMakeLists.txt
@@ -1,6 +1,4 @@
-################################################################################
-# Package: TrigInDetValidation
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TrigInDetValidation )
@@ -9,10 +7,10 @@ atlas_subdir( TrigInDetValidation )
 find_package( requests )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/*.py)
 atlas_install_data( share/*.json )
-atlas_install_runtime( test/TrigInDetValidation_TestConfiguration.xml share/TrigInDetValidation_*.py TIDAbuild )
+atlas_install_runtime( share/TrigInDetValidation_*.py TIDAbuild )
 
 atlas_install_scripts( scripts/TIDA*.py test/test*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=ATL902 )
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py
index 5abf3a639ff7dfe93e7b37a90fe4374e3d66251b..ac024978f5920afa136abeded50083e9e53ba1a9 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py
@@ -218,7 +218,7 @@ class TrigInDetCompStep(RefComparisonStep):
 
         self.args += self.input_file + ' ' 
 
-        if (self.reference == None):
+        if (self.reference is None):
             # if no reference found, use input file as reference - athout it doesn't matter - could use --noref
             self.args += self.input_file + ' ' 
         else:
@@ -252,7 +252,7 @@ class TrigInDetCpuCostStep(RefComparisonStep):
     
     def configure(self, test):
         #self.args += self.input_file+' '+self.ref_file+' '+' -o '+self.output_dir
-        if (self.reference == None):
+        if (self.reference is None):
             ## if not reference found, run with "--noref" option
             self.args += ' {} --noref -o {} -p TIME'.format(self.input_file,self.output_dir)
         else:
diff --git a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetNewArtSteps.py b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetNewArtSteps.py
new file mode 100644
index 0000000000000000000000000000000000000000..82d2a11168f63c8386369661669b877b3a5ad83e
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetNewArtSteps.py
@@ -0,0 +1,243 @@
+#
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+#
+
+'''
+Definitions of additional validation steps in Trigger ART tests relevant only for TrigInDetValidation
+The main common check steps are defined in the TrigValSteering.CheckSteps module.
+'''
+
+import os
+import json
+
+from TrigValTools.TrigValSteering.ExecStep import ExecStep
+from TrigAnalysisTest.TrigAnalysisSteps import AthenaCheckerStep
+from TrigValTools.TrigValSteering.Step import Step
+from TrigValTools.TrigValSteering.CheckSteps import RefComparisonStep
+from AthenaCommon.Utils.unixtools import FindFile
+
+##################################################
+# Exec (athena) steps for Reco_tf
+##################################################
+
+class TrigInDetReco(ExecStep):
+
+    def __init__(self, name='TrigInDetReco', postinclude_file='' ):
+        ExecStep.__init__(self, name)
+##        super(TrigInDetReco, self).__init__(name)
+        self.type = 'Reco_tf'
+        self.max_events=-1
+        self.required = True
+        self.threads = 1 # TODO: change to 4
+        self.concurrent_events = 1 # TODO: change to 4
+        self.perfmon = False
+        self.timeout = 18*3600
+        self.slices = []
+        self.preexec_trig = ' '
+        self.postinclude_trig = postinclude_file
+        self.preexec_reco =  ';'.join([
+            'from RecExConfig.RecFlags import rec',
+            'rec.doForwardDet=False',
+            'rec.doEgamma=False',
+            'rec.doMuonCombined=False',
+            'rec.doJetMissingETTag=False',
+            'rec.doTau=False'
+        ])
+
+        self.preexec_aod = ';'.join([
+            self.preexec_reco,
+            'from ParticleBuilderOptions.AODFlags import AODFlags',
+            'AODFlags.ThinGeantTruth.set_Value_and_Lock(False)',
+            'AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False)',
+            'AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False)',
+            'AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False)'
+        ])
+
+        self.preexec_all = ';'.join([
+            'from TriggerJobOpts.TriggerFlags import TriggerFlags',
+            'TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\")',
+        ])
+        self.postexec_trig = "from AthenaCommon.AppMgr import ServiceMgr; ServiceMgr.AthenaPoolCnvSvc.MaxFileSizes=['tmp.RDO_TRIG=100000000000']"
+
+
+        # get the cuttent atlas base release, and the previous base release
+        import os
+        DVERSION=os.getenv('Athena_VERSION')
+        if ( DVERSION == None ) : 
+            AVERSION = "22.0.20"
+        else :
+            BASE=DVERSION[:5]
+            SUB=int(DVERSION[5:])
+            SUB -= 1
+            AVERSION=BASE+str(SUB)
+
+        print( "remapping athena base release version: ", DVERSION, " -> ", AVERSION )
+
+        self.postexec_reco = "from AthenaCommon.AppMgr import ServiceMgr; ServiceMgr.AthenaPoolCnvSvc.MaxFileSizes=['tmp.ESD=100000000000']"
+        self.args = '--outputAODFile=AOD.pool.root --steering="doRDO_TRIG" --asetup "RAWtoESD:Athena,'+AVERSION+'" "ESDtoAOD:Athena,'+AVERSION+'" '
+
+
+    def configure(self, test):
+        chains = '['
+        flags = ''
+        for i in self.slices:
+            if (i=='muon') :
+                chains += "'HLT_mu6_idperf_L1MU6',"
+                chains += "'HLT_mu24_idperf_L1MU20',"
+                chains += "'HLT_mu26_ivarmedium_L1MU20',"
+                chains += "'HLT_mu28_ivarmedium_L1MU20',"
+                flags += 'doMuonSlice=True;'
+            if (i=='electron') :
+                chains +=  "'HLT_e5_etcut_L1EM3',"  ## need an idperf chain once one is in the menu
+                chains +=  "'HLT_e17_lhvloose_nod0_L1EM15VH'," 
+                flags += 'doEgammaSlice=True;'
+            if (i=='tau') :
+                chains +=  "'HLT_tau25_idperf_tracktwo_L1TAU12IM',"
+                chains +=  "'HLT_tau25_idperf_tracktwoMVA_L1TAU12IM',"
+                flags += 'doTauSlice=True;'
+            if (i=='bjet') :
+                chains += "'HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20','HLT_j45_subjesgscIS_ftf_boffperf_split_L1J20',"
+                flags  += 'doBjetSlice=True;'
+            if ( i=='fsjet' or i=='fs' or i=='jet' ) :
+                chains += "'HLT_j45_ftf_L1J15',"
+                flags  += 'doJetSlice=True;'
+            if (i=='beamspot') :
+                chains += "'HLT_beamspot_allTE_trkfast_BeamSpotPEB_L1J15','HLT_beamspot_trkFS_trkfast_BeamSpotPEB_L1J15',"
+                flags  += 'doBeamspotSlice=True;'
+            if (i=='minbias') :
+                chains += "'HLT_mb_sptrk_L1RD0_FILLED',"
+                flags  += 'doMinBiasSlice=True;'
+
+        if ( flags=='' ) : 
+            print( "ERROR: no chains configured" )
+
+        chains += ']'
+        self.preexec_trig = 'doEmptyMenu=True;'+flags+'selectChains='+chains
+
+
+        self.args += ' --preExec "RDOtoRDOTrigger:{:s};" "all:{:s};" "RAWtoESD:{:s};" "ESDtoAOD:{:s};"'.format(
+            self.preexec_trig, self.preexec_all, self.preexec_reco, self.preexec_aod)
+        if (self.postexec_trig != ' '):
+            self.args += ' --postExec "RDOtoRDOTrigger:{:s};" "RAWtoESD:{:s};" '.format(self.postexec_trig, self.postexec_reco)
+        if (self.postinclude_trig != ''):
+            self.args += ' --postInclude "RDOtoRDOTrigger:{:s}" '.format(self.postinclude_trig)
+        super(TrigInDetReco, self).configure(test)
+
+
+##################################################
+# Additional exec (athena) steps - AOD to TrkNtuple
+##################################################
+
+class TrigInDetAna(AthenaCheckerStep):
+    def __init__(self, name='TrigInDetAna', in_file='AOD.pool.root'):
+        AthenaCheckerStep.__init__(self, name, 'TrigInDetValidation/TrigInDetValidation_AODtoTrkNtuple.py')
+        self.max_events=-1
+        self.required = True
+        self.depends_on_previous = False
+        self.input_file = in_file
+
+##################################################
+# Additional post-processing steps
+##################################################
+
+class TrigInDetRdictStep(Step):
+    '''
+    Execute TIDArdict for TrkNtuple files.
+    '''
+    def __init__(self, name='TrigInDetdict', args=None ):
+        super(TrigInDetRdictStep, self).__init__(name)
+        self.args=args + "  -b Test_bin.dat "
+        self.auto_report_result = True
+        self.required = True
+        self.executable = 'TIDArdict'
+
+    def configure(self, test):
+        os.system( 'get_files -data TIDAbeam.dat &> /dev/null' )
+        os.system( 'get_files -data Test_bin.dat &> /dev/null' )
+        os.system( 'get_files -data TIDAdata-chains-run3.dat &> /dev/null' )
+        os.system( 'get_files -data TIDAhisto-panel.dat &> /dev/null' )
+        os.system( 'get_files -data TIDAhisto-panel-vtx.dat &> /dev/null' )
+        os.system( 'get_files -data TIDAhistos-vtx.dat &> /dev/null' )
+        os.system( 'get_files -data TIDAdata-run3.dat &> /dev/null' )
+        os.system( 'get_files -data TIDAdata_cuts.dat &> /dev/null' )
+        os.system( 'get_files -data TIDAdata-run3-offline.dat &> /dev/null' )
+        os.system( 'get_files -data TIDAdata-run3-offline-vtx.dat &> /dev/null' )
+        os.system( 'get_files -data TIDAdata_cuts-offline.dat &> /dev/null' )
+        os.system( 'get_files -jo   TIDAml_extensions.py &> /dev/null' )
+        super(TrigInDetRdictStep, self).configure(test)
+
+
+def json_chains( slice ) : 
+    json_file     = 'TrigInDetValidation/comparitor.json'
+    json_fullpath = FindFile(json_file, os.environ['DATAPATH'].split(os.pathsep), os.R_OK)
+
+    if not json_fullpath:
+        print('Failed to determine full path for input JSON %s', json_file)
+        return None
+        
+    with open(json_fullpath) as f:
+        data = json.load(f)
+       
+    chainmap = data[slice]
+
+    return chainmap['chains']
+
+
+
+class TrigInDetCompStep(RefComparisonStep):
+    '''
+    Execute TIDAcomparitor for data.root files.
+    '''
+    def __init__( self, name='TrigInDetComp', slice=None, args=None, file=None, reference=None ):
+        super(TrigInDetCompStep, self).__init__(name)
+        if reference == None : 
+            self.reference  = file # do we need this any more ??? 
+            self.args  = args + " " + file + "  " + file + " --noref --oldrms "
+        else:
+            self.reference = reference
+            self.args  = args + " " + file + "  " + reference + " --oldrms "
+        self.slice = slice 
+        self.auto_report_result = True
+        self.required   = True
+
+        self.executable = 'TIDAcomparitor'
+    
+
+    def configure(self, test):
+        self.chains = json_chains( self.slice )
+        self.args += " " + self.chains
+        print( "\033[0;32mTIDAcomparitor "+self.args+" \033[0m" )
+        super(TrigInDetCompStep, self).configure(test)
+
+
+
+class TrigInDetCpuCostStep(RefComparisonStep):
+    '''
+    Execute TIDAcpucost for expert-monitoring.root files.
+    '''
+    def __init__(self, name='TrigInDetCpuCost', ftf_times=True):
+        super(TrigInDetCpuCostStep, self).__init__(name)
+        self.input_file = 'expert-monitoring.root'
+##      self.ref_file = 'expert-monitoring.root'   #### need to add reference file here 
+        self.output_dir = 'times'
+        self.args = '--auto '
+        self.auto_report_result = True
+        self.required = True
+        self.executable = 'TIDAcpucost'
+
+        if ftf_times:
+            self.args += ' -d TrigFastTrackFinder_'
+            self.output_dir = 'times-FTF'
+    
+    def configure(self, test):
+        #self.args += self.input_file+' '+self.ref_file+' '+' -o '+self.output_dir
+        if (self.reference == None):
+            ## if not reference found, run with "--noref" option
+            self.args += ' {} --noref -o {} -p TIME'.format(self.input_file,self.output_dir)
+        else:
+            self.args += ' {} {} -o {} -p TIME'.format(self.input_file,self.reference,self.output_dir)
+
+        print( "TIDAcpucost " + self.args )    
+
+        super(TrigInDetCpuCostStep, self).configure(test)
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_NewBase.py b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_NewBase.py
new file mode 100755
index 0000000000000000000000000000000000000000..afbbee8fe1517ac2b4ab9d19595a00183dc151a5
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_NewBase.py
@@ -0,0 +1,137 @@
+###  #!/usr/bin/env python
+
+# Slices = ['fsjet']
+# RunEF  = False
+# Events = 10
+# Threads = 1
+# Slots = 1
+# Input = 'ttbar'    # defined in TrigValTools/share/TrigValInputs.json   
+# TrackReference = 'Truth'
+
+import re
+
+from TrigValTools.TrigValSteering import Test
+from TrigValTools.TrigValSteering import CheckSteps
+
+from TrigInDetValidation.TrigInDetNewArtSteps import TrigInDetReco
+from TrigInDetValidation.TrigInDetNewArtSteps import TrigInDetAna
+from TrigInDetValidation.TrigInDetNewArtSteps import TrigInDetRdictStep
+from TrigInDetValidation.TrigInDetNewArtSteps import TrigInDetCompStep
+from TrigInDetValidation.TrigInDetNewArtSteps import TrigInDetCpuCostStep
+
+
+import sys,getopt
+
+try:
+    opts, args = getopt.getopt(sys.argv[1:],"lcxpn:",["local","config"])
+except getopt.GetoptError:
+    print("Usage:  ")
+    print("-l(--local)    run locally with input file from art eos grid-input")
+    print("-x             don't run athena or post post-processing, only plotting")
+    print("-p             run post-processing, even if -x is set")
+    print("-n  N          run only on N events per job")
+    print("-c(--config)   run with config_only and print to a pkl file")
+    print("")
+
+
+Events_local  = 0
+local         = False
+exclude       = False
+postproc      = False
+testconfig    = False
+
+
+try: GridFiles
+except NameError: GridFiles=False
+
+if GridFiles==True :
+    use_gridfiles = True
+else:
+    use_gridfiles = False
+
+for opt,arg in opts:
+    if opt in ("-l", "--local"):
+        local=True
+    if opt=="-x":
+        exclude=True
+    if opt=="-p":
+        postproc=True
+    if opt=="-n":
+        Events_local=arg
+    if opt in ("-c", "--config"):
+        testconfig = True
+
+
+if 'postinclude_file' in dir() :
+    rdo2aod = TrigInDetReco( postinclude_file = postinclude_file )
+else :
+    rdo2aod = TrigInDetReco()
+
+# test specific variables ...
+
+rdo2aod.slices            = Slices
+rdo2aod.threads           = Threads
+rdo2aod.concurrent_events = Slots 
+rdo2aod.config_only       = testconfig
+
+
+
+if "Args" not in locals() : 
+    Args = " "
+
+
+# allow command line to override programed number of events to process
+
+if Events_local != 0 : 
+    rdo2aod.max_events        = Events_local 
+else :
+    rdo2aod.max_events        = Events 
+
+
+rdo2aod.perfmon = False
+rdo2aod.timeout = 18*3600
+rdo2aod.input   = Input    # defined in TrigValTools/share/TrigValInputs.json  
+
+if use_gridfiles: 
+    if local:
+#   rdo2aod.input = 'Single_el_larged0'    # defined in TrigValTools/share/TrigValInputs.json  
+       rdo2aod.input = Input   # should match definition in TrigValTools/share/TrigValInputs.json  
+    else:
+       rdo2aod.input = ''
+       rdo2aod.args += ' --inputRDOFile=$ArtInFile '
+
+
+
+# Run athena analysis to produce TrkNtuple
+
+test = Test.Test()
+test.art_type = 'grid'
+if (not exclude):
+    test.exec_steps = [rdo2aod]
+    test.exec_steps.append(TrigInDetAna())
+    test.check_steps = CheckSteps.default_check_steps(test)
+
+# Run TIDArdict
+
+
+if ((not exclude) or postproc ):
+    for job in Jobs : 
+        rdict = TrigInDetRdictStep( name=job[0], args=job[1] )
+        print( "\n\033[0;32m TIDArdict "+job[1]+" \033[0m" )
+        test.check_steps.append(rdict)
+       
+        
+for _slice in Comp :
+    compstep = TrigInDetCompStep( name=_slice[0], slice=_slice[1], file=_slice[2], args=_slice[3] ) 
+    test.check_steps.append(compstep)
+
+# CPU cost steps
+
+cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
+test.check_steps.append(cpucost)
+
+cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
+test.check_steps.append(cpucost2)
+
+import sys
+sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/comparitor.json b/Trigger/TrigValidation/TrigInDetValidation/share/comparitor.json
index 219c8ba82878ed4a47a7e872432813929ca3e178..8d51554860cc3451781bf67525d80a3b95e32998 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/share/comparitor.json
+++ b/Trigger/TrigValidation/TrigInDetValidation/share/comparitor.json
@@ -41,6 +41,9 @@
     "L2fsjet":{ 
         "chains" : "HLT_j45_ftf_L1J15:HLT_IDTrack_FS_FTF:HLT_FSRoI:HLT_IDVertex_FS"
     },
+    "L2fsjetvtx":{ 
+        "chains" : "HLT_j45_ftf_L1J15:HLT_IDTrack_FS_FTF:HLT_FSRoI:HLT_IDVertex_FS/HLT_IDVertex_FS"
+    },
     "L2minbias":{ 
         "chains" : "HLT_mb_sptrk_L1RD0_FILLED:HLT_IDTrack_MinBias_FTF"
     },
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu40_new.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu40_new.py
new file mode 100755
index 0000000000000000000000000000000000000000..65623557b83d2a53f8c2e41c9d2d65e89af9f97d
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu40_new.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+
+# art-description: art job for all_ttbar_pu40_new
+# art-type: grid
+# art-include: master/Athena
+# art-athena-mt: 8
+# art-memory: 4096
+# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
+# art-output: *.txt
+# art-output: *.log
+# art-output: log.*
+# art-output: *.out
+# art-output: *.err
+# art-output: *.log.tar.gz
+# art-output: *.new
+# art-output: *.json
+# art-output: *.root
+# art-output: *.check*
+# art-output: HLT*
+# art-output: times*
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-output: *.dat 
+
+
+Slices  = ['muon','electron','tau','bjet','fsjet']
+RunEF   = False
+Events  = 4000
+Threads = 8 
+Slots   = 8
+Input   = 'ttbar_ID'    # defined in TrigValTools/share/TrigValInputs.json  
+
+Jobs = [ ( "Offline",  " TIDAdata-run3-offline.dat -o data-hists.root" ) ]
+
+
+Comp = [ ( "L2muon",       "L2muon",      "data-hists.root",          " -c TIDAhisto-panel.dat  -d HLTL2-plots-muon " ),
+         ( "L2electron",   "L2electron",  "data-hists.root",          " -c TIDAhisto-panel.dat  -d HLTL2-plots-electron " ),
+         ( "L2tau",        "L2tau",       "data-hists.root",          " -c TIDAhisto-panel.dat  -d HLTL2-plots-tau " ),
+         ( "L2bjet",       "L2bjet",      "data-hists.root",          " -c TIDAhisto-panel.dat  -d HLTL2-plots-bjet " ),   
+         ( "FSjetoffline", "L2fsjet",     "data-hists.root",          " -c TIDAhisto-panel.dat  -d HLTL2-plots-FS " ),
+         ( "FSvtx",        "L2fsjetvtx",  "data-hists.root",          " -c TIDAhistos-vtx.dat   -d HLTL2-plots-vtx " ),
+ 
+         ( "EFmuon",       "EFmuon",      "data-hists.root",          " -c TIDAhisto-panel.dat  -d HLTEF-plots-muon " ),
+         ( "EFelectron",   "EFelectron",  "data-hists.root",          " -c TIDAhisto-panel.dat  -d HLTEF-plots-electron " ),
+         ( "EFtau",        "EFtau",       "data-hists.root",          " -c TIDAhisto-panel.dat  -d HLTEF-plots-tau " ),
+         ( "EFbjet",       "EFmuon",      "data-hists.root",          " -c TIDAhisto-panel.dat  -d HLTEF-plots-bjet " ) ]
+   
+from AthenaCommon.Include import include 
+include("TrigInDetValidation/TrigInDetValidation_NewBase.py")
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_bjet_pu40.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_bjet_pu40.py
index 3a9992acd16570b7a236adf060cfa170f61b99a7..3a9b964b4f7961912c0001bc930c87d0c1c6d985 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_bjet_pu40.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_bjet_pu40.py
@@ -26,14 +26,15 @@
 # art-output: *.dat 
 
 Slices = ['bjet']
-RunEF   = False
-Events = 4000
-Threads = 4 
-Slots   = 4
+RunEF   = True
+Events  = 4000
+Threads = 8 
+Slots   = 8
 Input = 'ttbar_ID'    # defined in TrigValTools/share/TrigValInputs.json  
 
-TrackReference = [ 'Truth' ]
+TrackReference = [ 'Truth', 'Offline' ]
 
 
 from AthenaCommon.Include import include 
-include("TrigInDetValidation/TrigInDetValidation_Base.py")
\ No newline at end of file
+include("TrigInDetValidation/TrigInDetValidation_Base.py")
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_pu40_new.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_pu40_new.py
new file mode 100755
index 0000000000000000000000000000000000000000..0e0eb8d1d45902bddb07736bd0d1e2e71f1554ec
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_pu40_new.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+# art-description: art job for fsjet_pu40_new
+# art-type: grid
+# art-include: master/Athena
+# art-input-nfiles: 3
+# art-athena-mt: 8
+# art-memory: 4096
+# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
+# art-output: *.txt
+# art-output: *.log
+# art-output: log.*
+# art-output: *.out
+# art-output: *.err
+# art-output: *.log.tar.gz
+# art-output: *.new
+# art-output: *.json
+# art-output: *.root
+# art-output: *.check*
+# art-output: HLT*
+# art-output: times*
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-output: *.dat 
+
+
+Slices  = ['fsjet']
+RunEF   = False
+Events  = 2000 
+Threads = 8 
+Slots   = 8
+Input   = 'ttbar'    # defined in TrigValTools/share/TrigValInputs.json  
+
+Jobs = [ ( "Truth",       " TIDAdata-run3.dat              -o data-hists.root" ), 
+         ( "Offline",     " TIDAdata-run3-offline.dat      -o data-hists-offline.root" ),
+         ( "OfflineVtx",  " TIDAdata-run3-offline-vtx.dat  -o data-hists-offline-vtx.root" ) ]
+
+
+Comp = [ ( "FSjet",        "L2fsjet",     "data-hists.root",              " -c TIDAhisto-panel.dat      -d HLTL2-plots " ),
+         ( "FSjetoffline", "L2fsjet",     "data-hists-offline.root",      " -c TIDAhisto-panel.dat      -d HLTL2-plots-offline " ),
+         ( "FSvtx",        "L2fsjetvtx",  "data-hists-offline-vtx.root",  " -c TIDAhisto-panel-vtx.dat  -d HLTL2-plots-vtx     --ncols 3" ),
+         ( "FSvtxall",     "L2fsjetvtx",  "data-hists-offline.root",      " -c TIDAhisto-panel-vtx.dat  -d HLTL2-plots-vtxall  --ncols 3" ) ]
+
+
+from AthenaCommon.Include import include 
+include("TrigInDetValidation/TrigInDetValidation_NewBase.py")
+
+
+ 
diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1PhysP1_runStopRun_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1PhysP1_runStopRun_build.py
index e8d225401a358d699b6fbc7153108c45ca8fcc26..8913ff814c5c873023b3b0dd9afbf9bd26b03778 100755
--- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1PhysP1_runStopRun_build.py
+++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1PhysP1_runStopRun_build.py
@@ -7,14 +7,14 @@
 # Skipping art-output which has no effect for build tests.
 # If you create a grid version, check art-output in existing grid tests.
 
-from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps
+from TrigValTools.TrigValSteering import Test, ExecStep
 from TrigP1Test import TrigP1TestSteps
 
 ex = ExecStep.ExecStep()
 ex.type = 'athenaHLT'
 ex.job_options = 'TriggerJobOpts/runHLT_standalone.py'
 ex.input = 'data'
-ex.args = '-i -M -ul -c "setMenu=\'PhysicsP1_pp_run3_v1\';"'
+ex.args = '-i -M -ul -c "setMenu=\'PhysicsP1_pp_run3_v1\';enableCostMonitoring=False;"'
 ex.perfmon = False # perfmon currently not fully supported with athenaHLT -M
 
 # Pass the transitions file into athenaHLT -i
@@ -29,14 +29,12 @@ test.check_steps = TrigP1TestSteps.default_check_steps_OHMon(test, 'run_2.root')
 logmerge = test.get_step("LogMerge")
 logmerge.extra_log_regex = 'athenaHLT-.*-.*(.out|.err)'
 
-# Extra step comparing histograms between the two runs
-rc = CheckSteps.RootCompStep("RootComp_runStopRun")
+# Change RootComp step to compare histograms between the two runs
+rc = test.get_step("RootComp")
 rc.input_file = 'run_2.root'
 rc.reference = 'run_1.root'
-rc.args += ' --output=rootcomp_runStopRun'
 rc.explicit_reference = True  # Don't check if reference exists at configuration time
 rc.required = True  # Final exit code depends on this step
-test.check_steps.append(rc)
 
 import sys
 sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py b/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py
index d90b6afcf43ac5300da951d4661a3fcfb3a704f0..f65e1d943e70771a8b627bfdf123a22df8f5a4cb 100644
--- a/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py
+++ b/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py
@@ -30,7 +30,7 @@ class RefComparisonStep(Step):
         if self.reference and self.ref_test_name:
             self.misconfig_abort('Both options "reference" and "ref_test_name" used. Use at most one of them.')
 
-        if not self.ref_test_name:
+        if not self.reference and not self.ref_test_name:
             self.ref_test_name = test.name
 
         if self.reference is not None:
diff --git a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
index 4a0b0fb8a4f79a708e67221d65ea58f016935063..96e60e9bb18223058f7c3223666d9e933fd2ce23 100644
--- a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
+++ b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
@@ -292,6 +292,8 @@ HLT_e17_lhloose_mu14_L1EM15VH_MU10:
   eventCount: 0
 HLT_e17_lhvloose_nod0_L1EM15VH:
   eventCount: 0
+HLT_e17_lhvloose_nod0_L1EM15VHI:
+  eventCount: 0
 HLT_e20_lhmedium_e15_lhmedium_Zee_L12EM3:
   eventCount: 0
 HLT_e24_lhmedium_2g12_loose_L1EM20VH_3EM10VH:
@@ -647,7 +649,7 @@ HLT_j0_perf_L1J12_EMPTY:
   stepCounts:
     0: 8
   stepFeatures:
-    0: 117
+    0: 127
 HLT_j0_vbenfSEP30etSEP34mass35SEP50fbet_L1J20:
   eventCount: 2
   stepCounts:
@@ -716,7 +718,7 @@ HLT_j45_ftf_L1J15:
   stepFeatures:
     0: 7
     1: 7
-HLT_j45_ftf_preselj45_L1J20:
+HLT_j45_ftf_preselj20_L1J20:
   eventCount: 5
   stepCounts:
     0: 5
@@ -738,7 +740,7 @@ HLT_j45_pf_ftf_L1J20:
   stepFeatures:
     0: 5
     1: 5
-HLT_j45_pf_ftf_preselj45_L1J20:
+HLT_j45_pf_ftf_preselj20_L1J20:
   eventCount: 5
   stepCounts:
     0: 5
@@ -786,7 +788,7 @@ HLT_j45_sktc_nojcalib_L1J20:
     0: 3
   stepFeatures:
     0: 3
-HLT_j45_subjesIS_ftf_preselj45_L1J20:
+HLT_j45_subjesIS_ftf_preselj20_L1J20:
   eventCount: 5
   stepCounts:
     0: 5
@@ -1743,13 +1745,13 @@ HLT_xe30_mht_L1XE10:
   stepFeatures:
     0: 14
 HLT_xe30_mhtpufit_em_subjesgscIS_L1XE10:
-  eventCount: 5
+  eventCount: 2
   stepCounts:
     0: 20
-    1: 5
+    1: 2
   stepFeatures:
     0: 20
-    1: 5
+    1: 2
 HLT_xe30_mhtpufit_pf_subjesgscIS_L1XE10:
   eventCount: 2
   stepCounts:
@@ -1797,13 +1799,13 @@ HLT_xe30_tcpufit_L1XE10:
   stepFeatures:
     0: 6
 HLT_xe30_trkmht_L1XE10:
-  eventCount: 7
+  eventCount: 6
   stepCounts:
     0: 20
-    1: 7
+    1: 6
   stepFeatures:
     0: 20
-    1: 7
+    1: 6
 HLT_xe65_cell_L1XE50:
   eventCount: 0
 HLT_xe65_cell_xe110_tcpufit_L1XE50:
diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py
index 97d157309544005369f79c0f7828f76a2fcd8b4d..eea35e3b5fe82d5ae5f84c98d44a9b978b43097d 100644
--- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py
+++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py
@@ -62,9 +62,18 @@ JetVarsToKeep = ['ActiveArea', 'ActiveArea4vec_eta', 'ActiveArea4vec_m', 'Active
                  'JetPileupScaleMomentum_eta', 'JetPileupScaleMomentum_m', 'JetPileupScaleMomentum_phi', 'JetPileupScaleMomentum_pt',
                  'JetEtaJESScaleMomentum_eta', 'JetEtaJESScaleMomentum_m', 'JetEtaJESScaleMomentum_phi', 'JetEtaJESScaleMomentum_pt',
                  'JetGSCScaleMomentum_eta', 'JetGSCScaleMomentum_m', 'JetGSCScaleMomentum_phi', 'JetGSCScaleMomentum_pt',
-                 'Jvt', 'JVFCorr', 'NumTrkPt500', 'NumTrkPt1000', 'SizeParameter', 'SumPtTrkPt500', 'SumPtTrkPt1000', 'TrackWidthPt1000', 'SumPtChargedPFOPt500',]
+                 'Jvt', 'JVFCorr', 'NumTrkPt500', 'NumTrkPt1000', 'SizeParameter', 'SumPtTrkPt500', 'SumPtTrkPt1000', 'TrackWidthPt1000', 'SumPtChargedPFOPt500',
+]
 JetVars = '.'.join(JetVarsToKeep)
 
+JetCopyVarsToKeep = ['pt', 'eta', 'phi', 'm',
+                     'JetPileupScaleMomentum_eta', 'JetPileupScaleMomentum_m', 'JetPileupScaleMomentum_phi', 'JetPileupScaleMomentum_pt',
+                     'JetEtaJESScaleMomentum_eta', 'JetEtaJESScaleMomentum_m', 'JetEtaJESScaleMomentum_phi', 'JetEtaJESScaleMomentum_pt',
+                     'JetGSCScaleMomentum_eta', 'JetGSCScaleMomentum_m', 'JetGSCScaleMomentum_phi', 'JetGSCScaleMomentum_pt',
+                     'Jvt'
+                 ]
+JetCopyVars = '.'.join(JetCopyVarsToKeep)
+
 BTagOutput = ['jetLink','BTagTrackToJetAssociator','minimumTrackRelativeEta','maximumTrackRelativeEta','averageTrackRelativeEta','trkSum_ntrk','trkSum_SPt','trkSum_VPt','trkSum_VEta','Muons',]
 BTagOutput_IP2D = ['IP2D_TrackParticleLinks','IP2D_gradeOfTracks','IP2D_weightBofTracks','IP2D_weightCofTracks','IP2D_weightUofTracks','IP2D_sigD0wrtPVofTracks','IP2D_flagFromV0ofTracks','IP2D_nTrks','IP2D_isDefaults','IP2D_cu','IP2D_bu','IP2D_bc',]
 BTagOutput_IP3D = ['IP3D_TrackParticleLinks','IP3D_gradeOfTracks','IP3D_weightBofTracks','IP3D_weightCofTracks','IP3D_weightUofTracks','IP3D_valD0wrtPVofTracks','IP3D_sigD0wrtPVofTracks','IP3D_valZ0wrtPVofTracks','IP3D_sigZ0wrtPVofTracks','IP3D_flagFromV0ofTracks','IP3D_nTrks','IP3D_isDefaults','IP3D_cu','IP3D_bu','IP3D_bc',]
@@ -277,20 +286,23 @@ TriggerHLTListRun3 = [
     ('xAOD::JetAuxContainer#HLT_jet_seedAux.',                  'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Tau'),
 
     # Jet
-    ('xAOD::JetContainer#HLT_AntiKt4EMTopoJets_subjesIS',                      'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet'),
-    ('xAOD::JetAuxContainer#HLT_AntiKt4EMTopoJets_subjesISAux.'+JetVars,       'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet'),
+    ('xAOD::JetContainer#HLT_AntiKt4EMTopoJets_subjesIS',                        'BS ESD AODFULL', 'Jet', 'alias:JetContainerShallowCopy'),
+    ('xAOD::ShallowAuxContainer#HLT_AntiKt4EMTopoJets_subjesISAux.'+JetCopyVars, 'BS ESD AODFULL', 'Jet'),
 
-    ('xAOD::JetContainer#HLT_AntiKt4EMTopoJets_subjesIS_ftf',                  'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet'),
-    ('xAOD::JetAuxContainer#HLT_AntiKt4EMTopoJets_subjesIS_ftfAux.'+JetVars,   'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet'),
+    ('xAOD::JetContainer#HLT_AntiKt4EMTopoJets_nojcalib_ftf',                  'BS ESD AODFULL', 'Jet'),
+    ('xAOD::JetAuxContainer#HLT_AntiKt4EMTopoJets_nojcalib_ftfAux.'+JetVars,   'BS ESD AODFULL', 'Jet'),
 
-    ('xAOD::JetContainer#HLT_AntiKt4EMTopoJets_subjesgscIS_ftf',                'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet'),
-    ('xAOD::JetAuxContainer#HLT_AntiKt4EMTopoJets_subjesgscIS_ftfAux.'+JetVars, 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet'),
-
-    ('xAOD::JetContainer#HLT_AntiKt4EMTopoJets_subresjesgscIS_ftf',                'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet'),
-    ('xAOD::JetAuxContainer#HLT_AntiKt4EMTopoJets_subresjesgscIS_ftfAux.'+JetVars, 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet'),
+    ('xAOD::JetContainer#HLT_AntiKt4EMTopoJets_subjesIS_ftf',                        'BS ESD AODFULL', 'Jet', 'alias:JetContainerShallowCopy'),
+    ('xAOD::ShallowAuxContainer#HLT_AntiKt4EMTopoJets_subjesIS_ftfAux.'+JetCopyVars, 'BS ESD AODFULL', 'Jet'),
+                    
+    ('xAOD::JetContainer#HLT_AntiKt4EMTopoJets_subjesgscIS_ftf',                        'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet', 'alias:JetContainerShallowCopy'),
+    ('xAOD::ShallowAuxContainer#HLT_AntiKt4EMTopoJets_subjesgscIS_ftfAux.'+JetCopyVars, 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet'),
+    
+    ('xAOD::JetContainer#HLT_AntiKt4EMTopoJets_subresjesgscIS_ftf',                        'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet', 'alias:JetContainerShallowCopy'),
+    ('xAOD::ShallowAuxContainer#HLT_AntiKt4EMTopoJets_subresjesgscIS_ftfAux.'+JetCopyVars, 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet'),
 
-    ('xAOD::JetContainer#HLT_AntiKt4EMTopoJets_subjes',                        'BS ESD AODFULL', 'Jet'),
-    ('xAOD::JetAuxContainer#HLT_AntiKt4EMTopoJets_subjesAux.'+JetVars,         'BS ESD AODFULL', 'Jet'),
+    ('xAOD::JetContainer#HLT_AntiKt4EMTopoJets_subjes',                        'BS ESD AODFULL', 'Jet', 'alias:JetContainerShallowCopy'),
+    ('xAOD::ShallowAuxContainer#HLT_AntiKt4EMTopoJets_subjesAux.'+JetCopyVars, 'BS ESD AODFULL', 'Jet'),
 
     ('xAOD::JetContainer#HLT_AntiKt4EMTopoJets_nojcalib',                      'BS ESD AODFULL', 'Jet'),
     ('xAOD::JetAuxContainer#HLT_AntiKt4EMTopoJets_nojcalibAux.'+JetVars,       'BS ESD AODFULL', 'Jet'),
@@ -301,8 +313,8 @@ TriggerHLTListRun3 = [
     ('xAOD::JetContainer#HLT_AntiKt4EMTopoCSSKJets_nojcalib',                  'BS ESD AODFULL', 'Jet'),
     ('xAOD::JetAuxContainer#HLT_AntiKt4EMTopoCSSKJets_nojcalibAux.'+JetVars,   'BS ESD AODFULL', 'Jet'),
 
-    ('xAOD::JetContainer#HLT_AntiKt10LCTopoJets_subjes',                       'BS ESD AODFULL', 'Jet'),
-    ('xAOD::JetAuxContainer#HLT_AntiKt10LCTopoJets_subjesAux.'+JetVars,        'BS ESD AODFULL', 'Jet'),
+    ('xAOD::JetContainer#HLT_AntiKt10LCTopoJets_subjes',                        'BS ESD AODFULL', 'Jet', 'alias:JetContainerShallowCopy'),
+    ('xAOD::ShallowAuxContainer#HLT_AntiKt10LCTopoJets_subjesAux.'+JetCopyVars, 'BS ESD AODFULL', 'Jet'),
 
     ('xAOD::JetContainer#HLT_AntiKt10LCTopoJets_nojcalib',                     'BS ESD AODFULL', 'Jet'),
     ('xAOD::JetAuxContainer#HLT_AntiKt10LCTopoJets_nojcalibAux.'+JetVars,      'BS ESD AODFULL', 'Jet'),
@@ -331,17 +343,17 @@ TriggerHLTListRun3 = [
     ('xAOD::JetContainer#HLT_AntiKt10EMPFlowCSSKSoftDropBeta100Zcut10Jets_nojcalib_ftf',                'BS ESD AODFULL', 'Jet'),
     ('xAOD::JetAuxContainer#HLT_AntiKt10EMPFlowCSSKSoftDropBeta100Zcut10Jets_nojcalib_ftfAux.'+JetVars, 'BS ESD AODFULL', 'Jet'),
 
-    ('xAOD::JetContainer#HLT_AntiKt10EMPFlowCSSKSoftDropBeta100Zcut10Jets_jes_ftf',                'BS ESD AODFULL', 'Jet'),
-    ('xAOD::JetAuxContainer#HLT_AntiKt10EMPFlowCSSKSoftDropBeta100Zcut10Jets_jes_ftfAux.'+JetVars, 'BS ESD AODFULL', 'Jet'),
+    ('xAOD::JetContainer#HLT_AntiKt10EMPFlowCSSKSoftDropBeta100Zcut10Jets_jes_ftf',                    'BS ESD AODFULL', 'Jet'),
+    ('xAOD::ShallowAuxContainer#HLT_AntiKt10EMPFlowCSSKSoftDropBeta100Zcut10Jets_jes_ftfAux.'+JetVars, 'BS ESD AODFULL', 'Jet'),
 
-    ('xAOD::JetContainer#HLT_AntiKt4EMPFlowJets_subjesIS_ftf',                'BS ESD AODFULL', 'Jet'),
-    ('xAOD::JetAuxContainer#HLT_AntiKt4EMPFlowJets_subjesIS_ftfAux.'+JetVars, 'BS ESD AODFULL', 'Jet'),
+    ('xAOD::JetContainer#HLT_AntiKt4EMPFlowJets_subjesIS_ftf',                        'BS ESD AODFULL', 'Jet', 'alias:JetContainerShallowCopy'),
+    ('xAOD::ShallowAuxContainer#HLT_AntiKt4EMPFlowJets_subjesIS_ftfAux.'+JetCopyVars, 'BS ESD AODFULL', 'Jet'),
 
-    ('xAOD::JetContainer#HLT_AntiKt4EMPFlowJets_subjesgscIS_ftf',                'BS ESD AODFULL', 'Jet'),
-    ('xAOD::JetAuxContainer#HLT_AntiKt4EMPFlowJets_subjesgscIS_ftfAux.'+JetVars, 'BS ESD AODFULL', 'Jet'),
+    ('xAOD::JetContainer#HLT_AntiKt4EMPFlowJets_subjesgscIS_ftf',                        'BS ESD AODFULL', 'Jet', 'alias:JetContainerShallowCopy'),
+    ('xAOD::ShallowAuxContainer#HLT_AntiKt4EMPFlowJets_subjesgscIS_ftfAux.'+JetCopyVars, 'BS ESD AODFULL', 'Jet'),
 
-    ('xAOD::JetContainer#HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf',                'BS ESD AODFULL', 'Jet'),
-    ('xAOD::JetAuxContainer#HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftfAux.'+JetVars, 'BS ESD AODFULL', 'Jet'),
+    ('xAOD::JetContainer#HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf',                        'BS ESD AODFULL', 'Jet', 'alias:JetContainerShallowCopy'),
+    ('xAOD::ShallowAuxContainer#HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftfAux.'+JetCopyVars, 'BS ESD AODFULL', 'Jet'),
 
     ('xAOD::JetContainer#HLT_AntiKt4EMPFlowJets_nojcalib_ftf',                'BS ESD AODFULL', 'Jet'),
     ('xAOD::JetAuxContainer#HLT_AntiKt4EMPFlowJets_nojcalib_ftfAux.'+JetVars, 'BS ESD AODFULL', 'Jet'),
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py
index 463e2b07dc49a51b16cc79034d277f38d06a2582..82621efbf171ea2ff96da622cac87d84ba973e8e 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py
@@ -213,7 +213,7 @@ def Lvl1SimulationSequence( flags = None ):
     ctp.DoLUCID     = False
     ctp.DoBCM       = False
     ctp.DoL1Topo    = not flags.Trigger.enableL1Phase1
-    ctp.UseCondL1Menu = False
+    ctp.UseNewConfig = True
     ctp.TrigConfigSvc = svcMgr.LVL1ConfigSvc
     ctpSim      = seqAND("ctpSim", [ctp])
 
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py
index 495b9234cb360cf9560262e10974046c2a131d2c..db719bd2be261ed9e0e3e4039e7f142b90c24c20 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py
@@ -296,7 +296,13 @@ def createTriggerFlags():
     # muon offline reco flags varaint for trigger
     def __muon():
         from MuonConfig.MuonConfigFlags import createMuonConfigFlags
-        return createMuonConfigFlags()
+        muonflags = createMuonConfigFlags()
+        muonflags.Muon.useTGCPriorNextBC=True
+        muonflags.Muon.enableErrorTuning=False
+        muonflags.Muon.MuonTrigger=True
+        muonflags.Muon.SAMuonTrigger=True
+        return muonflags 
+
     flags.addFlagsCategory('Trigger.Offline', __muon, prefix=True)
 
     from TrigInDetConfig.TrigTrackingCutFlags import createTrigTrackingFlags
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetTrackingConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetTrackingConfiguration.py
index c8f1c48a584bbfd3ba517bd8b2f64a4be2a121de..a4fc83070d1f8282d56b3984493bc7ec06bf91d3 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetTrackingConfiguration.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetTrackingConfiguration.py
@@ -1,6 +1,6 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from AthenaCommon.CFElements import seqAND
+from AthenaCommon.CFElements import parOR, seqAND
 #from AthenaCommon.Constants import DEBUG
 
 def getSecondStageBjetTracking( inputRoI, dataObjects ):
@@ -25,7 +25,7 @@ def getSecondStageBjetTracking( inputRoI, dataObjects ):
       viewVerify.DataObjects += [( 'TRT_RDO_Container' , 'StoreGateSvc+TRT_RDOs' )]
       topSequence.SGInputLoader.Load += [( 'TRT_RDO_Container' , 'StoreGateSvc+TRT_RDOs' )]
 
-    algSequence.append( seqAND("SecondStageFastTrackingSequence",viewAlgs) )
+    algSequence.append( parOR("SecondStageFastTrackingSequence",viewAlgs) )
 
     # Precision Tracking
     from TrigInDetConfig.InDetPT import makeInDetPrecisionTracking
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py
index c1cd7911254bb0f0d54d86323009c87ada44ca60..a597710ea80610fcbf7fb347fda2579037bdd18a 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py
@@ -8,7 +8,7 @@ from TriggerMenuMT.HLTMenuConfig.Menu.ChainConfigurationBase import ChainConfigu
 from TrigStreamerHypo.TrigStreamerHypoConfigMT import StreamerHypoToolMTgenerator
 from TrigStreamerHypo.TrigStreamerHypoConf import TrigStreamerHypoAlgMT
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence
-from AthenaCommon.CFElements import seqAND
+from AthenaCommon.CFElements import seqAND, parOR
 from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
 from DecisionHandling.DecisionHandlingConf import ViewCreatorInitialROITool
 
@@ -53,7 +53,7 @@ def allTE_trkfast( signature="FS" ):
         topSequence = AlgSequence()
         topSequence.SGInputLoader.Load += [( 'TagInfo' , 'DetectorStore+ProcessingTags' )]
 
-        beamspotSequence = seqAND( "beamspotSequence_"+signature, viewAlgs+[vertexAlg] )
+        beamspotSequence = parOR( "beamspotSequence_"+signature, viewAlgs+[vertexAlg] )
         inputMakerAlg.ViewNodeName = beamspotSequence.name()
         beamspotViewsSequence = seqAND( "beamspotViewsSequence"+signature, [ inputMakerAlg, beamspotSequence ])
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionTrackSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionTrackSequences.py
index 23a68d142cf5dba8780bb416a107223713156c1a..8def5b7ff4c3b750cc893c0884bbdf1def216a16 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionTrackSequences.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionTrackSequences.py
@@ -24,7 +24,7 @@ def precisionTracking(RoIs, precisionCaloClusters):
     ViewVerifyTrk.DataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+precisionEtcut' ),
                                  ( 'xAOD::CaloClusterContainer' , 'StoreGateSvc+' + precisionCaloClusters ),
                                  ( 'CaloCellContainer' , 'StoreGateSvc+CaloCells' ),
-                                 ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.AveIntPerXDecor' ),
+                                 ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.averageInteractionsPerCrossing' ),
                                  ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_FlaggedCondData_TRIG' ),
                                  ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+precisionElectron' ),
                                  ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+PixelByteStreamErrs' ),
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetChainConfiguration.py
index 41b77d34c2f90bfde544ce78ae02ed1bfc89b802..cda41f8bb6545fc8f979844ef8119e9ffa7035dc 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetChainConfiguration.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetChainConfiguration.py
@@ -68,7 +68,7 @@ class JetChainConfiguration(ChainConfigurationBase):
             if self.recoDict["trkpresel"]=="nopresel":
                 clustersKey, caloRecoStep = self.getJetCaloRecoChainStep()
                 chainSteps.append( caloRecoStep )
-            elif self.recoDict["trkpresel"]=="preselj45":
+            else:
                 clustersKey, jetPreselStep = self.getJetCaloPreselChainStep()
                 chainSteps.append( jetPreselStep )
             jetCollectionName, jetTrackingHypoStep = self.getJetTrackingHypoChainStep(clustersKey)
@@ -133,6 +133,10 @@ class JetChainConfiguration(ChainConfigurationBase):
             'trkpresel': 'nopresel'
         }
         preselJetParts = dict(preselRecoDict)
+        preselParts    = self.recoDict["trkpresel"].split('j')
+        multiplicity   = preselParts[0].split('presel')[1] if preselParts[0] != 'presel' else '1'
+        threshold      = preselParts[1]
+        chainPartName  = multiplicity+'j'+threshold if multiplicity != '1' else 'j'+threshold
         preselJetParts.update(
             {'L1threshold': 'NOL1SEED',
              'TLA': '',
@@ -141,7 +145,7 @@ class JetChainConfiguration(ChainConfigurationBase):
              'bMatching': [],
              'bTag': '',
              'bTracking': '',
-             'chainPartName': 'j45',
+             'chainPartName': chainPartName,
              'cleaning': 'noCleaning',
              'dataScouting': '',
              'etaRange': '0eta320',
@@ -149,11 +153,11 @@ class JetChainConfiguration(ChainConfigurationBase):
              'hypoScenario': 'simple',
              'jvt': '',
              'momCuts': '',
-             'multiplicity': '1',
+             'multiplicity': multiplicity,
              'scan': 'FS',
              'signature': 'Jet',
              'smc': 'nosmc',
-             'threshold': '20',
+             'threshold': threshold,
              'topo': [],
              'trigType': 'j'}
         )
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py
index df72ad99fc2bf6364009904ac03bf6857f7737aa..1f91b6668fff7de7ab9e72a799b63f4bcdc2b40d 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py
@@ -202,9 +202,12 @@ def defineTrackMods(trkopt):
     ]
     return trkmods
 
+def getFilterCut(recoAlg):
+    return {"a4":5000, "a10":50000, "a10r": 50000, "a10t":50000, "a10sd":50000}[recoAlg]
+
 # Translate calib specification into something understood by
 # the calibration config helper
-def defineCalibFilterMods(jetRecoDict,dataSource,rhoKey="auto"):
+def defineCalibMods(jetRecoDict,dataSource,rhoKey="auto"):
 
     # Minimum modifier set for calibration w/o track GSC
     # Should eventually build in more mods, depend on track info etc
@@ -220,7 +223,7 @@ def defineCalibFilterMods(jetRecoDict,dataSource,rhoKey="auto"):
 
         if jetRecoDict["dataType"].endswith("tc"):
             calibContext,calibSeq = {
-                ("a4","subjes"):   ("TrigRun2","JetArea_EtaJES_GSC"),        # Calo GSC only
+                ("a4","subjes"):   ("TrigRun2","JetArea_EtaJES_GSC"), # Calo GSC only
                 ("a4","subjesIS"): ("TrigRun2","JetArea_EtaJES_GSC"), # Calo GSC only
                 ("a4","subjesgscIS"): ("TrigRun2GSC","JetArea_EtaJES_GSC"), # Calo+Trk GSC
                 ("a4","subresjesgscIS"): ("TrigRun2GSC","JetArea_Residual_EtaJES_GSC"), # pu residual + calo+trk GSC
@@ -254,12 +257,9 @@ def defineCalibFilterMods(jetRecoDict,dataSource,rhoKey="auto"):
         if jetalg=="a4":
             calibMods = ["ConstitFourMom_copy",
                          "CaloEnergies", # Needed for GSC
-                         "Calib:"+calibSpec,
-                         "Sort"]
+                         "Calib:"+calibSpec]
         else:
             calibMods = ["ConstitFourMom_copy",
-                         "Calib:"+calibSpec,
-                         "Sort"]
+                         "Calib:"+calibSpec]
 
-    filtercut = {"a4":7000, "a10":50000, "a10r": 50000, "a10t":50000, "a10sd":50000}[jetalg]
-    return calibMods + ["Filter:"+str(filtercut)]
+    return calibMods
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py
index 3ff27580630c7028523bcae9c8235c71e04c3398..97d40f5a0de1e22e94b2605009fb046dde463195 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py
@@ -74,9 +74,9 @@ def jetRecoSequence( configFlags, clustersKey, **jetRecoDict ):
             clustersKey=clustersKey, **jetRecoDict)
 
 # Normal jet reconstruction, no reclustering or grooming
-def standardJetRecoSequence( configFlags, dataSource, clustersKey, **jetRecoDict ):
+def standardJetBuildSequence( configFlags, dataSource, clustersKey, **jetRecoDict ):
     jetDefString = jetRecoDictToString(jetRecoDict)
-    recoSeq = parOR( "JetRecSeq_"+jetDefString, [])
+    buildSeq = parOR( "JetBuildSeq_"+jetDefString, [])
     trkcolls = getTrkColls(jetRecoDict) if jetRecoDict["trkopt"]!="notrk" else {}
 
     # Add particle flow reconstruction if needed
@@ -87,10 +87,10 @@ def standardJetRecoSequence( configFlags, dataSource, clustersKey, **jetRecoDict
         (pfseq, pfoPrefix) = RecoFragmentsPool.retrieve(
             PFHLTSequence,
             configFlags, clustersin=clustersKey, tracktype=jetRecoDict["trkopt"])
-        recoSeq += pfseq
-        jetDef = JetRecoConfiguration.defineJets(jetRecoDict,pfoPrefix=pfoPrefix, prefix=jetNamePrefix)
+        buildSeq += pfseq
+        jetDef = JetRecoConfiguration.defineJets(jetRecoDict,pfoPrefix=pfoPrefix,prefix=jetNamePrefix)
     else:
-        jetDef = JetRecoConfiguration.defineJets(jetRecoDict,clustersKey=clustersKey, prefix=jetNamePrefix)
+        jetDef = JetRecoConfiguration.defineJets(jetRecoDict,clustersKey=clustersKey,prefix=jetNamePrefix)
 
     # chosen jet collection
     jetsFullName = jetDef.fullname()
@@ -105,12 +105,12 @@ def standardJetRecoSequence( configFlags, dataSource, clustersKey, **jetRecoDict
         from JetRecConfig.ConstModHelpers import getConstitModAlg
         constitModAlg = getConstitModAlg(jetDef.inputdef, monTool=monJetRecTool)
         if constitModAlg:
-            recoSeq += constitModAlg
+            buildSeq += constitModAlg
 
     # Add the PseudoJetGetter alg to the sequence
     constitPJAlg = getConstitPJGAlg( jetDef.inputdef )
     constitPJKey = str(constitPJAlg.OutputContainer)
-    recoSeq += conf2toConfigurable( constitPJAlg )
+    buildSeq += conf2toConfigurable( constitPJAlg )
     # Basic list of PseudoJets is just the constituents
     # Append ghosts (tracks) if desired
     pjs = [constitPJKey]
@@ -122,21 +122,8 @@ def standardJetRecoSequence( configFlags, dataSource, clustersKey, **jetRecoDict
         trkMods = JetRecoConfiguration.defineTrackMods(jetRecoDict["trkopt"])
         jetModList += trkMods
 
-    rhoKey = "auto"
-    if "sub" in jetRecoDict["jetCalib"]:
-        # Add the event shape alg if needed for area subtraction
-        eventShapeAlg = JetInputConfig.buildEventShapeAlg( jetDef,  "HLT_" )
-        recoSeq += conf2toConfigurable(eventShapeAlg)
-        # Not currently written because impossible to merge
-        # across event views, which is maybe a concern in
-        # the case of regional PFlow
-        rhoKey = str(eventShapeAlg.EventDensityTool.OutputContainer)
-
-    # Import the standard jet modifiers as defined for offline
-    # We can add/configure these differently if desired. 
-    calibMods = JetRecoConfiguration.defineCalibFilterMods(jetRecoDict,dataSource, rhoKey)
-    jetModList += calibMods
-
+    # Sort and filter
+    jetModList += ["Sort", "Filter:"+str(JetRecoConfiguration.getFilterCut(jetRecoDict["recoAlg"]))]
 
     # Get online monitoring tool
     from JetRec import JetOnlineMon
@@ -153,7 +140,47 @@ def standardJetRecoSequence( configFlags, dataSource, clustersKey, **jetRecoDict
     # Generate a JetAlgorithm to run the jet finding and modifiers
     # (via a JetRecTool instance).
     jetRecAlg = JetRecConfig.getJetAlgorithm(jetsFullName, jetDef, pjs, monTool)
-    recoSeq += conf2toConfigurable( jetRecAlg )
+    buildSeq += conf2toConfigurable( jetRecAlg )
+    
+    return buildSeq, jetsOut, jetDef
+
+def standardJetRecoSequence( configFlags, dataSource, clustersKey, **jetRecoDict ):
+    jetDefString = jetRecoDictToString(jetRecoDict)
+
+    if jetRecoDict["jetCalib"]=="nojcalib":
+        return RecoFragmentsPool.retrieve( standardJetBuildSequence, configFlags, dataSource=dataSource,
+                                           clustersKey=clustersKey,**jetRecoDict)
+
+    # Schedule reconstruction w/o calibration
+    # This is just a starting point -- will change so that
+    # the calibration is only ever done at the end for ungroomed
+    _jetRecoDictNoJCalib = dict(jetRecoDict)
+    _jetRecoDictNoJCalib["jetCalib"] = "nojcalib"
+
+    buildSeq, jetsNoCalib, jetDefNoCalib = RecoFragmentsPool.retrieve( standardJetBuildSequence, configFlags, dataSource=dataSource,
+                                                            clustersKey=clustersKey, **_jetRecoDictNoJCalib)
+
+    recoSeq = parOR( "JetRecSeq_"+jetDefString, [buildSeq])
+    # Get the calibration tool if desired. 
+    jetDef = jetDefNoCalib.clone()
+    jetDef.suffix = jetDefNoCalib.suffix.replace("nojcalib",jetRecoDict["jetCalib"])
+    jetsOut = jetDef.fullname()
+
+    rhoKey = "auto"
+    if "sub" in jetRecoDict["jetCalib"]:
+        # Add the event shape alg if needed for area subtraction
+        eventShapeAlg = JetInputConfig.buildEventShapeAlg( jetDef, jetNamePrefix )
+        recoSeq += conf2toConfigurable(eventShapeAlg)
+        # Not currently written because impossible to merge
+        # across event views, which is maybe a concern in
+        # the case of regional PFlow
+        rhoKey = str(eventShapeAlg.EventDensityTool.OutputContainer)
+
+    jetDef.modifiers = JetRecoConfiguration.defineCalibMods(jetRecoDict,dataSource,rhoKey)
+    jetDef.modifiers += jetDefNoCalib.modifiers[:-2] # Leave off sort + filter
+    copyCalibAlg = JetRecConfig.getJetCopyAlg(jetsin=jetsNoCalib,jetsoutdef=jetDef)
+
+    recoSeq += copyCalibAlg
 
     # End of basic jet reco
     return recoSeq, jetsOut, jetDef
@@ -168,17 +195,20 @@ def groomedJetRecoSequence( configFlags, dataSource, clustersKey, **jetRecoDict
     ungroomedJetRecoDict["recoAlg"] = ungroomedJetRecoDict["recoAlg"].rstrip("tsd") # Drop grooming spec
     ungroomedJetRecoDict["jetCalib"] = "nojcalib" # No need to calibrate
 
-    (ungroomedJetRecoSequence,ungroomedJetsName, ungroomedDef) = RecoFragmentsPool.retrieve(
-        standardJetRecoSequence,
+    # Only jet building -- we do jet calib in a larger sequence via copy+calib
+    (ungroomedJetBuildSequence,ungroomedJetsName,ungroomedDef) = RecoFragmentsPool.retrieve(
+        standardJetBuildSequence,
         configFlags, dataSource=dataSource, clustersKey=clustersKey,
         **ungroomedJetRecoDict)
-    recoSeq += conf2toConfigurable( ungroomedJetRecoSequence )
+    recoSeq += ungroomedJetBuildSequence
     # Need to forward the pseudojets of the parents to the groomer
-    parentpjs = getattr(ungroomedJetRecoSequence,"jetalg_{}".format(ungroomedJetsName)).Tools[0].InputPseudoJets
+    # Should try to do this in a nicer way...
+    parentpjs = getattr(ungroomedJetBuildSequence,"jetalg_{}".format(ungroomedJetsName)).Tools[0].InputPseudoJets
 
     groomDef = JetRecoConfiguration.defineGroomedJets(jetRecoDict,ungroomedDef)
     groomedJetsFullName = groomDef.fullname()
-    groomDef.modifiers = JetRecoConfiguration.defineCalibFilterMods(jetRecoDict,dataSource)
+    groomDef.modifiers = JetRecoConfiguration.defineCalibMods(jetRecoDict,dataSource)
+    groomDef.modifiers += ["Sort","Filter:"+str(JetRecoConfiguration.getFilterCut(jetRecoDict["recoAlg"]))]
     # Can add substructure mods here
 
     # Get online monitoring tool
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
index 3010ba64162c359f3f60a639ada9126d27e6d715..0ff9e92cc19ffc895d5209b35b566b08209f0ff9 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
@@ -118,6 +118,7 @@ def setupMenu():
 
         # Primary
         ChainProp(name='HLT_e17_lhvloose_nod0_L1EM15VH',  groups=SingleElectronGroup),
+        ChainProp(name='HLT_e17_lhvloose_nod0_L1EM15VHI',  groups=SingleElectronGroup),
         ChainProp(name='HLT_e24_lhvloose_L1EM20VH', groups=SingleElectronGroup),
         ChainProp(name='HLT_e26_lhloose_L1EM15VH', groups=SingleElectronGroup),
         ChainProp(name='HLT_e26_lhmedium_L1EM15VH', groups=SingleElectronGroup),
@@ -246,9 +247,9 @@ def setupMenu():
         ChainProp(name='HLT_j85_ftf_L1J20', groups=SingleJetGroup),
 
         ChainProp(name='HLT_j45_pf_ftf_L1J20', groups=SingleJetGroup),
-        ChainProp(name='HLT_j45_pf_ftf_preselj45_L1J20', groups=SingleJetGroup),
-        ChainProp(name='HLT_j45_ftf_preselj45_L1J20', groups=SingleJetGroup),
-        ChainProp(name='HLT_j45_subjesIS_ftf_preselj45_L1J20', groups=SingleJetGroup),
+        ChainProp(name='HLT_j45_pf_ftf_preselj20_L1J20', groups=SingleJetGroup),
+        ChainProp(name='HLT_j45_ftf_preselj20_L1J20', groups=SingleJetGroup),
+        ChainProp(name='HLT_j45_subjesIS_ftf_preselj20_L1J20', groups=SingleJetGroup),
         ChainProp(name='HLT_j45_pf_subjesgscIS_ftf_L1J20', groups=SingleJetGroup),
         ChainProp(name='HLT_j85_pf_ftf_L1J20', groups=SingleJetGroup),
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
index 22cb4f5be5a7d7df402402e4b0305a0aa93b5782..8567c63455710134a2b0a16912eaa6838863f6b0 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
@@ -133,7 +133,7 @@ JetChainParts = {
     'bConfig'      : ['split',],
     'bMatching'    : ['antimatchdr05mu'],
     'trkopt'       : ['notrk','ftk','ftkrefit','ftf'],
-    'trkpresel'    : ['nopresel','preselj45'],
+    'trkpresel'    : ['nopresel','preselj20'],
     'hypoScenario' : ['simple', 'vbenf',
                       'vbenfSEP30etSEP34mass35SEP50fbet',
                       'dijetSEP80j1etSEP0j1eta240SEP80j2etSEP0j2eta240SEP700djmass',
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py
index 8a67bee635ff1b8fc0cfcbccd308b5a83abd4ccc..6f4b973e7e032b22cfa2f07c368502fad1af5227 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py
@@ -267,11 +267,6 @@ def generateChains( flags, chainDict ):
 
     #Clone and replace offline flags so we can set muon trigger specific values
     muonflags = flags.cloneAndReplace('Muon', 'Trigger.Offline.Muon')
-    muonflags.Muon.useTGCPriorNextBC=True
-    muonflags.Muon.enableErrorTuning=False
-    muonflags.Muon.MuonTrigger=True
-    muonflags.Muon.SAMuonTrigger=True
-    muonflags.lock()
 
     accMS = ComponentAccumulator()
     accMS.addSequence(stepEFMSView)
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py
index 9fdeff5037dba97ec50db24fe565ead3a9a1ae23..8593e99dc6892021fc3225ddfa3238caece0dc3b 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py
@@ -179,8 +179,8 @@ def tauCaloSequence(ConfigFlags):
     tauCaloRecoVDV.DataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+TAUCaloRoIs' ),
                                   ( 'CaloBCIDAverage' , 'StoreGateSvc+CaloBCIDAverage' ),
                                   ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ),
-                                  ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.ActIntPerXDecor' ),
-                                  ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.AveIntPerXDecor' )]
+                                  ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.actualInteractionsPerCrossing' ),
+                                  ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.averageInteractionsPerCrossing' )]
     tauCaloInViewSequence += tauCaloRecoVDV
 
     tauCaloSequence = seqAND("tauCaloSequence", [tauCaloViewsMaker, tauCaloInViewSequence ])
@@ -205,8 +205,8 @@ def tauCaloMVASequence(ConfigFlags):
     tauCaloMVARecoVDV.DataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+TAUCaloRoIs' ),
                                      ( 'CaloBCIDAverage' , 'StoreGateSvc+CaloBCIDAverage' ),
                                      ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ),
-                                     ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.ActIntPerXDecor' ),
-                                     ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.AveIntPerXDecor' )]
+                                     ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.actualInteractionsPerCrossing' ),
+                                     ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.averageInteractionsPerCrossing' )]
     tauCaloMVAInViewSequence += tauCaloMVARecoVDV
 
     tauCaloMVASequence = seqAND("tauCaloMVASequence", [tauCaloMVAViewsMaker, tauCaloMVAInViewSequence ])
@@ -224,7 +224,7 @@ def preSelSequence( RoIs, name):
     ViewVerifyPreSel.DataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+TAUCaloRoIs'    ),
                                     ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+RoiForTau'      ),
                                     ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+RoiForTauIso'   ),
-                                    ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.AveIntPerXDecor'   ),
+                                    ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.averageInteractionsPerCrossing'   ),
                                     ( 'xAOD::TauTrackContainer' , 'StoreGateSvc+HLT_tautrack_dummy' ),
                                     ( 'xAOD::TauJetContainer' , 'StoreGateSvc+HLT_TrigTauRecMerged_CaloOnly' ),
                                     ( 'xAOD::TrackParticleContainer' , 'StoreGateSvc+HLT_IDTrack_Tau_FTF' ),
@@ -258,7 +258,7 @@ def tauIdSequence( RoIs, name):
                                 ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+%s' % RoIs      ),
                                 ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+RoiForTauCore'  ),
                                 ( 'xAOD::TauTrackContainer' , 'StoreGateSvc+HLT_tautrack_Presel'),  
-                                ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.AveIntPerXDecor'   ),
+                                ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.averageInteractionsPerCrossing'   ),
                                 ( 'xAOD::TauTrackContainer' , 'StoreGateSvc+HLT_tautrack_dummy' ),
                                 ( 'xAOD::TauJetContainer' , 'StoreGateSvc+HLT_TrigTauRecMerged_CaloOnly' ),
                                 ( 'xAOD::TauJetContainer' , 'StoreGateSvc+HLT_TrigTauRecMerged_Presel' ),          
@@ -295,7 +295,7 @@ def precTrackSequence( RoIs , name):
 
     ViewVerifyTrk = CfgMgr.AthViews__ViewDataVerifier("tauViewDataVerifier_"+signatureName)
     ViewVerifyTrk.DataObjects = [( 'xAOD::TrackParticleContainer' , 'StoreGateSvc+%s' % IDTrigConfig.FT.tracksFTF() ),
-                                 ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.AveIntPerXDecor' ),
+                                 ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.averageInteractionsPerCrossing' ),
                                  ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+%s' % RoIs ),
                                  ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+TAUCaloRoIs' ),
                                  ( 'xAOD::TauTrackContainer' , 'StoreGateSvc+HLT_tautrack_dummy' ),
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/UnconventionalTracking/UnconventionalTrackingChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/UnconventionalTracking/UnconventionalTrackingChainConfiguration.py
index f400f129a253ce0a4e74ae6947b8e73ad8772c2b..8748c672f2a7a546858229f8d10dad173bcc89f7 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/UnconventionalTracking/UnconventionalTrackingChainConfiguration.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/UnconventionalTracking/UnconventionalTrackingChainConfiguration.py
@@ -6,7 +6,7 @@ log = logging.getLogger("TriggerMenuMT.HLTMenuConfig.UnconventionalTracking.Unco
 
 from TriggerMenuMT.HLTMenuConfig.Menu.ChainConfigurationBase import ChainConfigurationBase
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence, RecoFragmentsPool
-from AthenaCommon.CFElements import seqAND
+from AthenaCommon.CFElements import parOR
 from ..CommonSequences.FullScanDefs import caloFSRoI
 
 def unconventionalTrackingChainParts(chainParts):
@@ -101,7 +101,7 @@ def IsoHPtTrackTriggerSequence(ConfigFlags):
     prmVtx = vtxAlgs[-1]
 
 
-    TrkSeq = seqAND("UncTrkrecoSeq", [InputMakerAlg,TrkInputNoViewAlg, prmVtx])
+    TrkSeq = parOR("UncTrkrecoSeq", [InputMakerAlg,TrkInputNoViewAlg, prmVtx])
     sequenceOut = IDTrigConfig.FT.tracksFTF( doRecord = IDTrigConfig.isRecordable ) 
 
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ItemDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ItemDef.py
index 8cb186e920ff2b57a94352b2f0d4afa7c1f5e211..404df6fa2ad0396890bc0aa7c69d70b9a58ab620 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ItemDef.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ItemDef.py
@@ -1654,12 +1654,8 @@ class ItemDef:
             MenuItem('L1_LFV-MU6').setLogic( d.TOPO_0DR15_2MU6ab & d.MU6.x(2) & physcond)
             MenuItem('L1_LFV-MU').setLogic( d.R2TOPO_0DR10_MU10ab_MU6ab & d.MU10 & d.MU6.x(2) & physcond)
 
-            if isV8 or isHIV5 or isPhaseII:
-                MenuItem('L1_LFV-EM8I').setLogic( d.TOPO_0DETA04_EM8abi_MU10ab & d.TOPO_0DPHI03_EM8abi_MU10ab & d.MU10 & physcond) #ATR-14282
-                MenuItem('L1_LFV-EM15I').setLogic( d.TOPO_0DETA04_EM15abi_MUab & d.TOPO_0DPHI03_EM15abi_MUab & physcond) #ATR-14282
-            else:
-                MenuItem('L1_LFV-EM8I').setLogic( d.TOPO_0DETA04_0DPHI03_EM8abi_MU10ab & physcond)
-                MenuItem('L1_LFV-EM15I').setLogic( d.TOPO_0DETA04_0DPHI03_EM15abi_MUab & physcond)
+            MenuItem('L1_LFV-EM8I').setLogic( d.TOPO_0DETA04_EM8abi_MU10ab & d.TOPO_0DPHI03_EM8abi_MU10ab & d.MU10 & physcond) #ATR-14282
+            MenuItem('L1_LFV-EM15I').setLogic( d.TOPO_0DETA04_EM15abi_MUab & d.TOPO_0DPHI03_EM15abi_MUab & physcond) #ATR-14282
                 
             MenuItem('L1_DPHI-J20s2XE50').setLogic( d.TOPO_10MINDPHI_J20s2_XE50 & physcond)
             MenuItem('L1_DPHI-J20XE50').setLogic( d.R2TOPO_10MINDPHI_J20ab_XE50 & physcond)
@@ -1708,10 +1704,7 @@ class ItemDef:
             MenuItem('L1_DR-TAU20ITAU12I').setLogic( d.TOPO_0DR28_TAU20abi_TAU12abi & physcond)
             MenuItem('L1_BOX-TAU20ITAU12I').setLogic( d.R2TOPO_0DETA20_0DPHI20_TAU20abi_TAU12abi & physcond)
 
-            if isV8:
-                MenuItem('L1_DR-TAU20ITAU12I-J25').setLogic( d.TOPO_2DISAMB_J25ab_0DR28_TAU20abi_TAU12abi & physcond)
-            else:
-                MenuItem('L1_DR-TAU20ITAU12I-J25').setLogic( d.TOPO_1DISAMB_J25ab_0DR28_TAU20abi_TAU12abi & physcond)
+            MenuItem('L1_DR-TAU20ITAU12I-J25').setLogic( d.TOPO_2DISAMB_J25ab_0DR28_TAU20abi_TAU12abi & physcond)
 
             MenuItem('L1_DR25-TAU20ITAU12I-J25').setLogic( d.R2TOPO_1DISAMB_J25ab_0DR25_TAU20abi_TAU12abi & physcond)
             MenuItem('L1_LAR-EM').setLogic( d.R2TOPO_LAR_EM20shi1 & physcond).setTriggerType( TT.lardemo ) # LAr demo (ATR-11897)
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Menu/MenuMapping.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Menu/MenuMapping.py
index a2a7168ed4754013eca87245e159e6a5aa7e8e88..0b641377b92cc9a4f4009f5775bf6cb4da8df81c 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Menu/MenuMapping.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Menu/MenuMapping.py
@@ -8,6 +8,7 @@ The resolved name is also being used in the L1/Config/ItemDef.py and L1/Config/T
 """
 
 menuMap = {
+    "Physics_pp_v7" : "MC_pp_v8",
     "LS2_v1" : "MC_pp_v8",
     "Physics_pp_run3_v1" : "MC_pp_v8",
     "MC_pp_run3_v1" : "MC_pp_v8",
diff --git a/graphics/VP1/VP1Base/src/PhiSectionWidget.cxx b/graphics/VP1/VP1Base/src/PhiSectionWidget.cxx
index 9fbff1d81051e0ddfb3da4e1a7a455d76bb5d7cb..7206c60577941d2945bfeeff464d912bc12341a3 100644
--- a/graphics/VP1/VP1Base/src/PhiSectionWidget.cxx
+++ b/graphics/VP1/VP1Base/src/PhiSectionWidget.cxx
@@ -9,7 +9,6 @@
 #include <QCursor>
 #include <QDrag>
 #include <QMenu>
-#include <QMouseEvent>
 #include <QDragEnterEvent>
 #include <QDropEvent>
 #include <QApplication>
diff --git a/graphics/VP1/VP1Base/src/VP1CustomTourEditor.cxx b/graphics/VP1/VP1Base/src/VP1CustomTourEditor.cxx
index 8bbc68ca0a75800a10f22e758c23f1d97ae36044..05c5e264d4ca4892d17acc13aee6a803501e0171 100644
--- a/graphics/VP1/VP1Base/src/VP1CustomTourEditor.cxx
+++ b/graphics/VP1/VP1Base/src/VP1CustomTourEditor.cxx
@@ -31,7 +31,6 @@
 #include <QShortcut>
 #include <QCloseEvent>
 #include <QScrollBar>
-#include <QAction>
 
 #include <iostream>
 
diff --git a/graphics/VP1/VP1Base/src/VP1QtInventorUtils.cxx b/graphics/VP1/VP1Base/src/VP1QtInventorUtils.cxx
index 3ad0dd37918f415893ac03386271591bdf885670..9036eec4b192117b52ab60201b3ac71f79a70003 100644
--- a/graphics/VP1/VP1Base/src/VP1QtInventorUtils.cxx
+++ b/graphics/VP1/VP1Base/src/VP1QtInventorUtils.cxx
@@ -17,8 +17,6 @@
 #include "VP1Base/VP1ExaminerViewer.h"
 #include "VP1Base/VP1Msg.h"
 
-
-//#include "Inventor/nodes/SoNode.h"
 #include "Inventor/nodes/SoMaterial.h"
 #include <Inventor/nodes/SoPerspectiveCamera.h>
 #include <Inventor/nodes/SoOrthographicCamera.h>
@@ -1512,8 +1510,6 @@ void VP1QtInventorUtils::getPointSizeRanges(double& min, double& max, double& gr
 	granularity = Imp::allowedPointSizeGranularity;
 }
 
-#include "VP1Base/VP1ExaminerViewer.h"
-
 //_____________________________________________________________________________________
 void VP1QtInventorUtils::ensureInitLineWidthAndPointSize(  SoQtRenderArea * ra )
 {
diff --git a/graphics/VP1/VP1Gui/src/VP1ExecutionScheduler.cxx b/graphics/VP1/VP1Gui/src/VP1ExecutionScheduler.cxx
index 632ee96b095bef25add2132c9bc92e42f4eda41f..c4e15299b49b09d443bd52aa78019f19026cd9bf 100644
--- a/graphics/VP1/VP1Gui/src/VP1ExecutionScheduler.cxx
+++ b/graphics/VP1/VP1Gui/src/VP1ExecutionScheduler.cxx
@@ -49,7 +49,6 @@
 
 #include "VP1Base/VP1QtUtils.h"
 #include "VP1Base/IVP1System.h"
-#include "VP1Base/VP1QtUtils.h"
 #include "VP1Base/IVP1ChannelWidget.h"
 #include "VP1Base/VP1Msg.h"
 #include "VP1Base/VP1HelperClassBase.h"
@@ -113,7 +112,6 @@ std::vector<std::string> qstringlistToVecString(QStringList list)
 	#include <QDebug>
 	#include "xAODRootAccessInterfaces/TActiveEvent.h"
 	#include "xAODRootAccessInterfaces/TVirtualEvent.h"
-	#include <TTree.h>
 	#include <regex>
 	#include <QString>
 
diff --git a/graphics/VP1/VP1Gui/src/VP1MainWindow.cxx b/graphics/VP1/VP1Gui/src/VP1MainWindow.cxx
index 7ff375982e1679e01a19c25edada5b09f5715d85..3b0ca973284ae2ce37adf5e195521aa4937fa727 100644
--- a/graphics/VP1/VP1Gui/src/VP1MainWindow.cxx
+++ b/graphics/VP1/VP1Gui/src/VP1MainWindow.cxx
@@ -65,7 +65,6 @@
 #include <QGraphicsView>
 #include <QGraphicsScene>
 #include <QtGui>
-#include <QSettings>
 #include <QScrollBar>
 
 
diff --git a/graphics/VP1/VP1HEPVis/src/VP1HEPVisUtils.cxx b/graphics/VP1/VP1HEPVis/src/VP1HEPVisUtils.cxx
index d8cdf1297a0bd3a32ee2b7d59b0c4ae0cddf23ab..14e44db51a8854618fb011e4902143b17703e993 100644
--- a/graphics/VP1/VP1HEPVis/src/VP1HEPVisUtils.cxx
+++ b/graphics/VP1/VP1HEPVis/src/VP1HEPVisUtils.cxx
@@ -32,7 +32,6 @@
 #include "VP1HEPVis/nodes/SoTubs.h"
 #include "VP1HEPVis/nodes/SoTessellated.h"
 
-#include <Inventor/nodes/SoSeparator.h>
 #include <Inventor/nodes/SoIndexedFaceSet.h>
 #include <Inventor/nodes/SoVertexProperty.h>
 #include <VP1HEPVis/SbPolyhedron.h>
diff --git a/graphics/VP1/VP1Systems/VP1AODSystems/src/AODCollHandleBase.cxx b/graphics/VP1/VP1Systems/VP1AODSystems/src/AODCollHandleBase.cxx
index c8ead88e7301fbf9648a0ceec9bd424b93439d67..0929f586de01e76f3f8a029da1c6c467510f78ce 100644
--- a/graphics/VP1/VP1Systems/VP1AODSystems/src/AODCollHandleBase.cxx
+++ b/graphics/VP1/VP1Systems/VP1AODSystems/src/AODCollHandleBase.cxx
@@ -13,7 +13,6 @@
 ////////////////////////////////////////////////////////////////
 
 //Local includes
-//#include "AODCollHandleBase.h"
 #include "AODHandleBase.h"
 #include "AODCollHandleBase.h"
 
diff --git a/graphics/VP1/VP1Systems/VP1AODSystems/src/CaloClusterCollectionSettingsButton.cxx b/graphics/VP1/VP1Systems/VP1AODSystems/src/CaloClusterCollectionSettingsButton.cxx
index a7c10c3b0a8284ccb91e15b6edcde72ffbba5ff8..52124088af16b42960b897083b309f37c80b6220 100644
--- a/graphics/VP1/VP1Systems/VP1AODSystems/src/CaloClusterCollectionSettingsButton.cxx
+++ b/graphics/VP1/VP1Systems/VP1AODSystems/src/CaloClusterCollectionSettingsButton.cxx
@@ -7,16 +7,13 @@
 #include "VP1AODSystems/CaloClusterCollectionSettingsButton.h"
 #include "IParticleCollHandle_CaloCluster.h"
 // UIs
-//#include "ui_perjetcollectionsettings_form.h"
 #include "ui_periparticlecollectionsettings_form.h"
 #include "ui_percaloclustercollectionsettings_form.h"
-//#include "ui_jet_settings_display_form.h"
 
 //VP1
 #include "VP1Base/VP1QtInventorUtils.h"
 #include "VP1Base/VP1Serialise.h"
 #include "VP1Base/VP1Deserialise.h"
-#include "VP1Base/VP1QtInventorUtils.h"
 #include "VP1Base/VP1Msg.h"
 
 //Coin3D
diff --git a/graphics/VP1/VP1Systems/VP1AODSystems/src/ElectronCollectionSettingsButton.cxx b/graphics/VP1/VP1Systems/VP1AODSystems/src/ElectronCollectionSettingsButton.cxx
index bb7a2f724097f82221bdc5a921d98c9bc9ee8d6c..f75a8c295af6691ee90af3f3c41a959c0d001453 100644
--- a/graphics/VP1/VP1Systems/VP1AODSystems/src/ElectronCollectionSettingsButton.cxx
+++ b/graphics/VP1/VP1Systems/VP1AODSystems/src/ElectronCollectionSettingsButton.cxx
@@ -12,7 +12,6 @@
 #include "VP1Base/VP1QtInventorUtils.h"
 #include "VP1Base/VP1Serialise.h"
 #include "VP1Base/VP1Deserialise.h"
-#include "VP1Base/VP1QtInventorUtils.h"
 
 //SoCoin
 
diff --git a/graphics/VP1/VP1Systems/VP1AODSystems/src/JetCollectionSettingsButton.cxx b/graphics/VP1/VP1Systems/VP1AODSystems/src/JetCollectionSettingsButton.cxx
index 6af326e5b3486dc50ceddcc1c98fc050dcbddb20..efd31bb03b29fbbfffa657c16a1704d79a4163e0 100644
--- a/graphics/VP1/VP1Systems/VP1AODSystems/src/JetCollectionSettingsButton.cxx
+++ b/graphics/VP1/VP1Systems/VP1AODSystems/src/JetCollectionSettingsButton.cxx
@@ -6,7 +6,6 @@
 #include "VP1Base/VP1ColorSelectButton.h"
 #include "VP1AODSystems/JetCollectionSettingsButton.h"
 // UIs
-//#include "ui_perjetcollectionsettings_form.h"
 #include "ui_periparticlecollectionsettings_form.h"
 #include "ui_jet_settings_display_form.h"
 
@@ -14,7 +13,6 @@
 #include "VP1Base/VP1QtInventorUtils.h"
 #include "VP1Base/VP1Serialise.h"
 #include "VP1Base/VP1Deserialise.h"
-#include "VP1Base/VP1QtInventorUtils.h"
 #include "VP1Base/VP1Msg.h"
 
 //Coin3D
diff --git a/graphics/VP1/VP1Systems/VP1AODSystems/src/MissingEtCollectionSettingsButton.cxx b/graphics/VP1/VP1Systems/VP1AODSystems/src/MissingEtCollectionSettingsButton.cxx
index e02d9089fefd1b33aad5fd47bd20870c07e69c9b..c17338ef6510b09904793b56c77003029412f94f 100644
--- a/graphics/VP1/VP1Systems/VP1AODSystems/src/MissingEtCollectionSettingsButton.cxx
+++ b/graphics/VP1/VP1Systems/VP1AODSystems/src/MissingEtCollectionSettingsButton.cxx
@@ -12,7 +12,6 @@
 #include "VP1Base/VP1QtInventorUtils.h"
 #include "VP1Base/VP1Serialise.h"
 #include "VP1Base/VP1Deserialise.h"
-#include "VP1Base/VP1QtInventorUtils.h"
 #include "VP1Base/VP1Interval.h"
 
 //SoCoin
diff --git a/graphics/VP1/VP1Systems/VP1AODSystems/src/MuonCollectionSettingsButton.cxx b/graphics/VP1/VP1Systems/VP1AODSystems/src/MuonCollectionSettingsButton.cxx
index 9b6538b3f96cf77dcd475e579e022d876b0386a4..048ad1510120e3bc13d447b951a66a28f6b2073d 100644
--- a/graphics/VP1/VP1Systems/VP1AODSystems/src/MuonCollectionSettingsButton.cxx
+++ b/graphics/VP1/VP1Systems/VP1AODSystems/src/MuonCollectionSettingsButton.cxx
@@ -13,7 +13,6 @@
 #include "VP1Base/VP1QtInventorUtils.h"
 #include "VP1Base/VP1Serialise.h"
 #include "VP1Base/VP1Deserialise.h"
-#include "VP1Base/VP1QtInventorUtils.h"
 
 //SoCoin
 
diff --git a/graphics/VP1/VP1Systems/VP1AODSystems/src/TrackParticleCollectionSettingsButton.cxx b/graphics/VP1/VP1Systems/VP1AODSystems/src/TrackParticleCollectionSettingsButton.cxx
index e0ed3d2f26df19653e9b73940e6e59ccf9e51bf7..c7b47b1499b94d423e680cef0cb6f0501c698753 100644
--- a/graphics/VP1/VP1Systems/VP1AODSystems/src/TrackParticleCollectionSettingsButton.cxx
+++ b/graphics/VP1/VP1Systems/VP1AODSystems/src/TrackParticleCollectionSettingsButton.cxx
@@ -12,7 +12,6 @@
 #include "VP1Base/VP1QtInventorUtils.h"
 #include "VP1Base/VP1Serialise.h"
 #include "VP1Base/VP1Deserialise.h"
-#include "VP1Base/VP1QtInventorUtils.h"
 
 //SoCoin
 
diff --git a/graphics/VP1/VP1Systems/VP1AODSystems/src/VertexCollectionSettingsButton.cxx b/graphics/VP1/VP1Systems/VP1AODSystems/src/VertexCollectionSettingsButton.cxx
index 468a4a0eb1af93055f0e555260db861f2fb32dee..366558f4d9bbac4bccbecbc81e260dec73200aeb 100644
--- a/graphics/VP1/VP1Systems/VP1AODSystems/src/VertexCollectionSettingsButton.cxx
+++ b/graphics/VP1/VP1Systems/VP1AODSystems/src/VertexCollectionSettingsButton.cxx
@@ -11,7 +11,6 @@
 #include "VP1Base/VP1QtInventorUtils.h"
 #include "VP1Base/VP1Serialise.h"
 #include "VP1Base/VP1Deserialise.h"
-#include "VP1Base/VP1QtInventorUtils.h"
 #include "VP1Base/VP1Interval.h"
 
 //SoCoin
diff --git a/graphics/VP1/VP1Systems/VP1BPhysSystems/src/VP1BPhysSystem.cxx b/graphics/VP1/VP1Systems/VP1BPhysSystems/src/VP1BPhysSystem.cxx
index 1b33858d438dedb5324c23f7ce39469d8afec241..b14968761879ffa577cb22307a529a672c4ec35c 100644
--- a/graphics/VP1/VP1Systems/VP1BPhysSystems/src/VP1BPhysSystem.cxx
+++ b/graphics/VP1/VP1Systems/VP1BPhysSystems/src/VP1BPhysSystem.cxx
@@ -40,15 +40,11 @@
 #include "TrkTrack/Track.h"
 #include "TrkTrack/TrackCollection.h"
 #include "TrkParameters/TrackParameters.h"
-//#include "TrkParameters/MeasuredPerigee.h"
-#include "TrkParameters/TrackParameters.h"
 #include "TrkExInterfaces/IExtrapolator.h"
 
 #include "Particle/TrackParticle.h"
 #include "Particle/TrackParticleContainer.h"
 
-//#include "CLHEP/Units/SystemOfUnits.h"
-
 #include "GeoPrimitives/GeoPrimitives.h"
 
 #include "TFile.h"
diff --git a/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VisAttributes.cxx b/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VisAttributes.cxx
index 566983cb26e0e6caaa92bb17ddf5fdf8c42986c8..71407856e5be574bf9b0b06d078fee657d7feb03 100644
--- a/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VisAttributes.cxx
+++ b/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VisAttributes.cxx
@@ -7,13 +7,11 @@
 #include "VP1Base/VP1QtInventorUtils.h"
 #include <Inventor/nodes/SoMaterial.h>
 #include <iostream>
+#include <map>
 #include <QBuffer>
 
 /////////////////////////////////////// Base class ///////////////////////////////////////
 
-#include <map>
-#include <iostream>
-
 class VisAttributes::Imp {
 public:
   // The material map is here:
diff --git a/graphics/VP1/VP1Systems/VP1LegoSystems/src/VP1CaloHitLegoSystem.cxx b/graphics/VP1/VP1Systems/VP1LegoSystems/src/VP1CaloHitLegoSystem.cxx
index 4fe99f80900bc234efa04ff6aa876e5901d82375..ec29f35aa4264c6982a62801b9ee381de7fc5bd4 100755
--- a/graphics/VP1/VP1Systems/VP1LegoSystems/src/VP1CaloHitLegoSystem.cxx
+++ b/graphics/VP1/VP1Systems/VP1LegoSystems/src/VP1CaloHitLegoSystem.cxx
@@ -18,8 +18,6 @@
 #include <Inventor/nodes/SoSeparator.h>
 #include <Inventor/nodes/SoTranslation.h>
 #include <Inventor/nodes/SoCube.h>
-#include <Inventor/nodes/SoTranslation.h>
-#include <Inventor/nodes/SoSeparator.h>
 
 #include <QMap>
 
diff --git a/graphics/VP1/VP1Systems/VP1LegoSystems/src/VP1CaloLegoSystem.cxx b/graphics/VP1/VP1Systems/VP1LegoSystems/src/VP1CaloLegoSystem.cxx
index 98904a59c32523030100de02dcb3c2ae83ce6d80..0dfff2521b82a44f5865e2174dc2db4e2ee26386 100755
--- a/graphics/VP1/VP1Systems/VP1LegoSystems/src/VP1CaloLegoSystem.cxx
+++ b/graphics/VP1/VP1Systems/VP1LegoSystems/src/VP1CaloLegoSystem.cxx
@@ -15,13 +15,9 @@
 #include <Inventor/nodes/SoLineSet.h>
 #include <Inventor/nodes/SoLightModel.h>
 #include <Inventor/nodes/SoDrawStyle.h>
-#include <Inventor/nodes/SoSwitch.h>
-#include <Inventor/nodes/SoSeparator.h>
-#include <Inventor/nodes/SoMaterial.h>
 
 #include "LArReadoutGeometry/FCALDetectorManager.h"
 #include "LArReadoutGeometry/FCALModule.h"
-//#include "LArReadoutGeometry/FCALTile.h"
 
 #include "LArReadoutGeometry/HECDetectorManager.h"
 #include "LArReadoutGeometry/HECDetectorRegion.h"
diff --git a/graphics/VP1/VP1Systems/VP1LegoSystems/src/VP1HVLegoSystem.cxx b/graphics/VP1/VP1Systems/VP1LegoSystems/src/VP1HVLegoSystem.cxx
index 0fab337f43dfb2bbda3138b7016d10ad515d64ae..0ed5feca4cb1f4c593043d6ee0cb95f2e084caa4 100755
--- a/graphics/VP1/VP1Systems/VP1LegoSystems/src/VP1HVLegoSystem.cxx
+++ b/graphics/VP1/VP1Systems/VP1LegoSystems/src/VP1HVLegoSystem.cxx
@@ -10,10 +10,6 @@
 #include <Inventor/nodes/SoSwitch.h>
 #include <Inventor/nodes/SoSeparator.h>
 #include <Inventor/nodes/SoTranslation.h>
-#include <Inventor/nodes/SoSwitch.h>
-#include <Inventor/nodes/SoSeparator.h>
-
-//#include "LArReadoutGeometry/FCALTile.h"
 
 #include "VP1Base/VP1Serialise.h"
 #include "VP1Base/VP1Deserialise.h"
diff --git a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandleBase.cxx b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandleBase.cxx
index 390d56ecd54398fe48eca6defeba0e4e8c0eecfc..c3c5aec211a6ad6dd9e400b44f65b641458d7213 100644
--- a/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandleBase.cxx
+++ b/graphics/VP1/VP1Systems/VP1PRDSystems/src/PRDCollHandleBase.cxx
@@ -13,7 +13,6 @@
 #include "VP1Base/VP1ExtraSepLayerHelper.h"
 #include "VP1Base/VP1Serialise.h"
 #include "VP1Base/VP1QtInventorUtils.h"
-#include "VP1Base/VP1Serialise.h"
 #include "VP1Base/VP1Deserialise.h"
 #include "VP1Base/VP1Msg.h"
 
diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/SimHitHandle_ForwardHit.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/SimHitHandle_ForwardHit.cxx
index 7215207018d64cbd56604694c46730867426e994..a691cd7efd6d81992d5e61c0e1dd97d99dbe034a 100644
--- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/SimHitHandle_ForwardHit.cxx
+++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/SimHitHandle_ForwardHit.cxx
@@ -21,8 +21,6 @@
 #include "ForwardRegion_SimEv/SimulationHit.h"
 #include "InDetIdentifier/PixelID.h"
 #include "InDetIdentifier/SCT_ID.h"
-// #include "TrkSurfaces/PlaneSurface.h"
-// #include "TrkSurfaces/Surface.h"
 #include "TrkSurfaces/StraightLineSurface.h"
 #include "TrkSurfaces/Surface.h"
 
diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_TrkTrack.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_TrkTrack.cxx
index 512e2561097e6c3d5e131e9de61ef66700bea802..03e0a5c47be4d447a7666fdeecdf5911a1dbe420 100644
--- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_TrkTrack.cxx
+++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackCollHandle_TrkTrack.cxx
@@ -16,7 +16,6 @@
 #include "VP1TrackSystems/TrackHandle_TrkTrack.h"
 #include "VP1Base/IVP1System.h"
 #include "VP1TrackSystems/TrackSystemController.h"
-#include "VP1Base/IVP1System.h"
 #include "VP1Base/VP1QtUtils.h"
 #include "VP1Utils/VP1JobConfigInfo.h"
 #include "VP1Utils/VP1SGContentsHelper.h"
diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_SimulationTrack.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_SimulationTrack.cxx
index 9569c6286af869d01032b2c95ba0d4d1b63ec61e..57c90ac377ac381b38e4a5a6f038ce40cb528541 100644
--- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_SimulationTrack.cxx
+++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_SimulationTrack.cxx
@@ -16,7 +16,6 @@
 #include "VP1TrackSystems/AscObj_TruthPoint.h"
 #include "VP1Base/VP1Msg.h"
 
-#include "TrkTrack/Track.h"
 #include "AtlasHepMC/GenParticle.h"
 #include "AtlasHepMC/GenVertex.h"
 #include "CLHEP/Vector/LorentzVector.h"
@@ -24,7 +23,6 @@
 #include "AthContainers/DataVector.h"
 #include "TrkParameters/TrackParameters.h"
 #include "TrkSurfaces/PlaneSurface.h"
-#include "AtlasHepMC/GenParticle.h"
 
 //____________________________________________________________________
 class TrackHandle_SimulationTrack::Imp {
diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TrkTrack.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TrkTrack.cxx
index 96225bc4670aebef4cf17f4793756fb837119815..0bc60e70f4c0bb717ff974fa707de3498b113e22 100644
--- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TrkTrack.cxx
+++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TrkTrack.cxx
@@ -28,7 +28,6 @@
 #include "VP1Base/VP1Msg.h"//fixme
 #include "VP1TrackSystems/VP1TrackSummary.h"
 #include "VP1TrackSystems/AscObj_TSOS.h"
-#include "VP1TrackSystems/TrkObjToString.h"
 #include <Inventor/nodes/SoSeparator.h>
 #include <Inventor/nodes/SoNode.h>
 
diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TruthTrack.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TruthTrack.cxx
index 361191f6e9cd36d323882a9fdece265ac58a4355..1416ea225bfa6a2666bdbfa46b18d5c0e4cc0b3d 100644
--- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TruthTrack.cxx
+++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackHandle_TruthTrack.cxx
@@ -16,8 +16,6 @@
 #include "VP1TrackSystems/AscObj_TruthPoint.h"
 #include "VP1Base/VP1Msg.h"
 
-#include "TrkTrack/Track.h"
-#include "AtlasHepMC/GenParticle.h"
 #include "AtlasHepMC/GenVertex.h"
 #include "CLHEP/Vector/LorentzVector.h"
 #include "TrkTrack/Track.h"
diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/VP1TrackSystem.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/VP1TrackSystem.cxx
index 91eb346e5955ad32f9aab87c82883e21732189c2..5c40646166fda6ff0c7a869deca87177dd15b911 100644
--- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/VP1TrackSystem.cxx
+++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/VP1TrackSystem.cxx
@@ -79,7 +79,6 @@
 #include "MuonReadoutGeometry/CscReadoutElement.h"
 #include "MuonReadoutGeometry/MdtReadoutElement.h"
 #include "MuonReadoutGeometry/MuonClusterReadoutElement.h"
-#include "MuonReadoutGeometry/MdtReadoutElement.h"
 #include "StoreGate/StoreGateSvc.h"
 
 ////////////////////////////////////////////////////////
diff --git a/graphics/VP1/VP1Systems/VP1TrackingGeometrySystems/src/TrackingVolumeToSoNode.cxx b/graphics/VP1/VP1Systems/VP1TrackingGeometrySystems/src/TrackingVolumeToSoNode.cxx
index 559a76663a6f9f492d62dd82103c5993669a321f..b82a54655c8671d2ac45180dc7ce8c34c2675d8f 100755
--- a/graphics/VP1/VP1Systems/VP1TrackingGeometrySystems/src/TrackingVolumeToSoNode.cxx
+++ b/graphics/VP1/VP1Systems/VP1TrackingGeometrySystems/src/TrackingVolumeToSoNode.cxx
@@ -45,8 +45,6 @@
 #include "GeoModelKernel/GeoSimplePolygonBrep.h"
 #include "GeoModelKernel/GeoDefinitions.h"
 
-#include "GeoPrimitives/GeoPrimitives.h"
-
 #include "GaudiKernel/SystemOfUnits.h"
 
 
diff --git a/graphics/VP1/VP1Systems/VP1TriggerSystems/src/VP1TriggerHandleEF.cxx b/graphics/VP1/VP1Systems/VP1TriggerSystems/src/VP1TriggerHandleEF.cxx
index 33e501e8e99241e9ce118fcf904a86002e925727..1fcf7aed4818777ad21bd6e807939c7ef5acbb29 100644
--- a/graphics/VP1/VP1Systems/VP1TriggerSystems/src/VP1TriggerHandleEF.cxx
+++ b/graphics/VP1/VP1Systems/VP1TriggerSystems/src/VP1TriggerHandleEF.cxx
@@ -21,7 +21,6 @@
 #include "TrigMuonEvent/TrigMuonEFTrack.h"
 #include "TrigMuonEvent/TrigMuonEFCbTrack.h"
 #include "TrigMuonEvent/MuonFeature.h"
-#include "TrigMuonEvent/TrigMuonEFInfoContainer.h"
 #include "TrigMuonEvent/TrigMuonEFInfoTrackContainer.h"
 #include "TrigMuonEvent/TrigMuonEFInfoTrack.h"
 #include "TrigMuonEvent/TrigMuonEFIsolationContainer.h"
diff --git a/graphics/VP1/VP1Systems/VP1TriggerSystems/src/VP1TriggerHandleL2.cxx b/graphics/VP1/VP1Systems/VP1TriggerSystems/src/VP1TriggerHandleL2.cxx
index 50904833684468f26c09b611306e81cadc94e4e2..64e6027f654fa02ecda14b3959b5ec2c4b7ea7cd 100644
--- a/graphics/VP1/VP1Systems/VP1TriggerSystems/src/VP1TriggerHandleL2.cxx
+++ b/graphics/VP1/VP1Systems/VP1TriggerSystems/src/VP1TriggerHandleL2.cxx
@@ -22,7 +22,6 @@
 #include "TrigMuonEvent/TrigMuonEFTrack.h"
 #include "TrigMuonEvent/TrigMuonEFCbTrack.h"
 #include "TrigMuonEvent/MuonFeature.h"
-#include "TrigMuonEvent/TrigMuonEFInfoContainer.h"
 #include "TrigMuonEvent/TrigMuonEFInfoTrackContainer.h"
 #include "TrigMuonEvent/TrigMuonEFInfoTrack.h"
 #include "TrigMuonEvent/TrigMuonEFIsolationContainer.h"
diff --git a/graphics/VP1/VP1Systems/VP1TriggerSystems/src/VP1TriggerSystem.cxx b/graphics/VP1/VP1Systems/VP1TriggerSystems/src/VP1TriggerSystem.cxx
index cc0a324ea1c34d47e7edd4fa6a5c5d98c50958b4..3ebba4c4de258ce584646151b8c6539e34be8b7a 100644
--- a/graphics/VP1/VP1Systems/VP1TriggerSystems/src/VP1TriggerSystem.cxx
+++ b/graphics/VP1/VP1Systems/VP1TriggerSystems/src/VP1TriggerSystem.cxx
@@ -17,7 +17,6 @@
 //L1 includes
 
 // check the include of the Chain.h file here below, maybe it's obsolete because it seems it's not used
-//#include "TrigSteering/Chain.h" // OLD include
 #include "TrigSteeringEvent/Chain.h" // NEW include - Requested by Francesca Pastore, 13 Sep 2013
 
 #include "TrigDecisionTool/TrigDecisionTool.h"
@@ -34,7 +33,6 @@
 #include "TrigMuonEvent/TrigMuonEFTrack.h"
 #include "TrigMuonEvent/TrigMuonEFCbTrack.h"
 #include "TrigMuonEvent/MuonFeature.h"
-#include "TrigMuonEvent/TrigMuonEFInfoContainer.h"
 #include "TrigMuonEvent/TrigMuonEFInfoTrackContainer.h"
 #include "TrigMuonEvent/TrigMuonEFInfoTrack.h"
 #include "TrigMuonEvent/TrigMuonEFIsolationContainer.h"
diff --git a/graphics/VP1/VP1Utils/src/VP1ErrorUtils.cxx b/graphics/VP1/VP1Utils/src/VP1ErrorUtils.cxx
index d3911f41a0aa795c97d759cfeb8e907c67bda505..1aba50f75482f5358facf1e7b2f9ededb7c8ab0c 100644
--- a/graphics/VP1/VP1Utils/src/VP1ErrorUtils.cxx
+++ b/graphics/VP1/VP1Utils/src/VP1ErrorUtils.cxx
@@ -33,14 +33,9 @@
 #include <Inventor/nodes/SoVertexProperty.h>
 #include <Inventor/nodes/SoCylinder.h>
 #include <Inventor/nodes/SoComplexity.h>
-#include <Inventor/nodes/SoVertexProperty.h>
-#include <Inventor/nodes/SoLineSet.h>
 #include <Inventor/nodes/SoDrawStyle.h>
 #include "VP1HEPVis/nodes/SoGenericBox.h"
 
-//#include "TrkParameters/AtaStraightLine.h"
-//#include "TrkParameters/Perigee.h"
-
 #include "TrkSurfaces/Surface.h"
 #include "TrkSurfaces/RectangleBounds.h"
 
diff --git a/graphics/VP1/VP1UtilsBase/src/VP1TimeUtilities.cxx b/graphics/VP1/VP1UtilsBase/src/VP1TimeUtilities.cxx
index ab983a1936fd7bc2fdad6e11a71459ee5b42e042..04396113a6c29ac09feb5cc49011815fef45accf 100644
--- a/graphics/VP1/VP1UtilsBase/src/VP1TimeUtilities.cxx
+++ b/graphics/VP1/VP1UtilsBase/src/VP1TimeUtilities.cxx
@@ -18,7 +18,6 @@
 #include <iostream>
 #include <iomanip>
 #include <string>
-#include <iostream>
 #include <sstream> // for std::ostringstream