From e486a103559e359870437e91f549005365357720 Mon Sep 17 00:00:00 2001
From: Scott Snyder <scott.snyder@cern.ch>
Date: Fri, 16 Dec 2016 20:36:24 +0100
Subject: [PATCH] 'Fix running ATN test.' (TauAnalysisTools-00-02-33-03)

- Fix running ATN test.
TauAnalysisTools-00-02-33-02 [2016/12/16] sss
- tag previous changes on branch.

TauAnalysisTools-00-02-34 [2016/11/20] <dirk.duschinger@cern.ch>
- fixed athena compile issue

TauAnalysisTools-00-02-33 [2016/11/17] <dirk.duschinger@cern.ch>
- CommonSmearingTool: fixed MVATES
- TauOverlappingElectronLLHDecorator and TauEfficiencyCorrectionsTool: fixes for ATLASG-843

TauAnalysisTools-00-02-32 [2016/11/05] <dirk.duschinger@cern.ch>
- Fixed athena compilation due to missing muons

TauAnalysisTools-00-02-31 [2016/11/01] <ligang.xia@cern.ch>
- Add new muon veto (pt > 2 GeV, not calo-tagged)

TauAnalysisTools-00-02-30 [2016/10/19] <Attila.Krasznahorkay@cern.ch>
- Taught the package how to build in standalone mode with CMake.
- At the same time fixed some configuration problems for the full
...
(Long ChangeLog diff - truncated)
---
 .../TauID/TauAnalysisTools/CMakeLists.txt     | 105 +-
 .../TauID/TauAnalysisTools/README.rst         |   8 +-
 .../Root/CommonEfficiencyTool.cxx             | 203 +++-
 .../Root/CommonSmearingTool.cxx               | 183 +++-
 .../TauAnalysisTools/Root/HelperFunctions.cxx |  12 +-
 .../TauAnalysisTools/Root/SelectionCuts.cxx   | 111 +-
 .../Root/TauEfficiencyContJetIDTool.cxx       |  18 +-
 .../Root/TauEfficiencyCorrectionsTool.cxx     | 962 +++++++++++++-----
 .../Root/TauEfficiencyEleIDTool.cxx           |  56 +-
 .../Root/TauEfficiencyJetIDTool.cxx           |  18 +-
 .../Root/TauEfficiencyTriggerTool.cxx         | 352 +------
 .../TauOverlappingElectronLLHDecorator.cxx    |  87 +-
 .../Root/TauSelectionTool.cxx                 | 168 +--
 .../Root/TauSmearingRun1Tool.cxx              |  12 +-
 .../TauAnalysisTools/Root/TauSmearingTool.cxx |  69 +-
 .../Root/TauTruthMatchingTool.cxx             | 123 ++-
 .../Root/TauTruthTrackMatchingTool.cxx        | 133 ++-
 .../TauAnalysisTools/CommonEfficiencyTool.h   |  32 +-
 .../TauAnalysisTools/CommonSmearingTool.h     |  31 +-
 .../ITauEfficiencyCorrectionsTool.h           |   2 +
 .../ITauOverlappingElectronLLHDecorator.h     |   5 +-
 .../TauAnalysisTools/ITauSelectionTool.h      |   3 +
 .../TauAnalysisTools/ITauTruthMatchingTool.h  |   4 +
 .../ITauTruthTrackMatchingTool.h              |   9 +-
 .../TauAnalysisTools/SelectionCuts.h          |  32 +-
 .../TauAnalysisTools/SharedFilesVersion.h     |   2 +-
 .../TauEfficiencyContJetIDTool.h              |   2 +
 .../TauEfficiencyCorrectionsTool.h            |  56 +-
 .../TauAnalysisTools/TauEfficiencyEleIDTool.h |  22 +-
 .../TauAnalysisTools/TauEfficiencyJetIDTool.h |   6 +-
 .../TauEfficiencyTriggerTool.h                |  63 +-
 .../TauOverlappingElectronLLHDecorator.h      |  15 +-
 .../TauAnalysisTools/TauSelectionTool.h       |  41 +-
 .../TauAnalysisTools/TauSmearingRun1Tool.h    |   7 +-
 .../TauAnalysisTools/TauSmearingTool.h        |  14 +-
 .../TauAnalysisTools/TauTruthMatchingTool.h   |  59 +-
 .../TauTruthTrackMatchingTool.h               |  26 +-
 .../TauAnalysisTools/selection.xml            |   2 +
 .../TauAnalysisTools/cmt/Makefile.RootCore    |   2 +-
 .../TauID/TauAnalysisTools/cmt/requirements   |  18 +-
 .../README-TauEfficiencyCorrectionsTool.rst   | 167 ++-
 ...E-TauEfficiencyCorrectionsTool_Trigger.rst | 156 ++-
 .../doc/README-TauSmearingTool.rst            | 107 +-
 .../components/TauAnalysisTools_entries.cxx   |  22 +
 .../test/TauAnalysisTools.xml                 |  16 +
 .../test/ut_TauAnalysisTools_test.cxx         | 184 ++++
 .../util/TauAnalysisToolsExample.cxx          | 111 +-
 47 files changed, 2446 insertions(+), 1390 deletions(-)
 create mode 100644 PhysicsAnalysis/TauID/TauAnalysisTools/test/TauAnalysisTools.xml
 create mode 100644 PhysicsAnalysis/TauID/TauAnalysisTools/test/ut_TauAnalysisTools_test.cxx

diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/CMakeLists.txt b/PhysicsAnalysis/TauID/TauAnalysisTools/CMakeLists.txt
index 8cf6f6775c2..4e6a204ec60 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/CMakeLists.txt
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/CMakeLists.txt
@@ -1,3 +1,4 @@
+# $Id: CMakeLists.txt 785220 2016-11-18 20:53:10Z dduschin $
 ################################################################################
 # Package: TauAnalysisTools
 ################################################################################
@@ -5,46 +6,84 @@
 # Declare the package name:
 atlas_subdir( TauAnalysisTools )
 
+# Extra dependencies, based on the build environment:
+set( extra_deps )
+if( XAOD_STANDALONE )
+   set( extra_deps Control/xAODRootAccess )
+else()
+   set( extra_deps GaudiKernel
+      PhysicsAnalysis/POOLRootAccess
+      Control/AthenaBaseComps
+      Control/AthAnalysisBaseComps )
+endif()
+
 # Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthLinks
-                          Control/AthToolSupport/AsgTools
-                          Event/xAOD/xAODEgamma
-                          Event/xAOD/xAODJet
-                          Event/xAOD/xAODTau
-                          Event/xAOD/xAODTracking
-                          Event/xAOD/xAODTruth
-                          Generators/TruthUtils
-                          PhysicsAnalysis/AnalysisCommon/PATCore
-                          PhysicsAnalysis/AnalysisCommon/PATInterfaces
-                          PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Event/xAOD/xAODCore
-                          Event/xAOD/xAODEventInfo
-                          GaudiKernel
-                          Tools/PathResolver )
+atlas_depends_on_subdirs(
+   PUBLIC
+   Control/AthToolSupport/AsgTools
+   Event/xAOD/xAODEgamma
+   Event/xAOD/xAODMuon
+   Event/xAOD/xAODJet
+   Event/xAOD/xAODTau
+   Event/xAOD/xAODTracking
+   Event/xAOD/xAODTruth
+   Generators/TruthUtils
+   InnerDetector/InDetRecTools/InDetTrackSelectionTool
+   PhysicsAnalysis/AnalysisCommon/PATCore
+   PhysicsAnalysis/AnalysisCommon/PATInterfaces
+   PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools
+   PhysicsAnalysis/MCTruthClassifier
+   Reconstruction/tauRecTools
+   PRIVATE
+   Control/AthLinks
+   Event/xAOD/xAODCore
+   Event/xAOD/xAODEventInfo
+   Tools/PathResolver
+   ${extra_deps} )
 
 # External dependencies:
-find_package( Boost COMPONENTS filesystem thread system )
-find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
+find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO )
 
+# Libraries in the package:
+atlas_add_library( TauAnalysisToolsLib
+   TauAnalysisTools/*.h Root/*.cxx
+	PUBLIC_HEADERS TauAnalysisTools
+   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+   LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODEgamma xAODMuon xAODJet
+   xAODTau xAODTracking xAODTruth TruthUtils PATCoreLib PATInterfaces
+   ElectronPhotonSelectorToolsLib tauRecToolsLib 
+   InDetTrackSelectionToolLib MCTruthClassifierLib
+   PRIVATE_LINK_LIBRARIES AthLinks xAODEventInfo PathResolver )
 
+if( NOT XAOD_STANDALONE )
+   atlas_add_component( TauAnalysisTools
+      src/*.cxx src/components/*.cxx		     
+      LINK_LIBRARIES AthenaBaseComps AsgTools xAODTau GaudiKernel
+      TauAnalysisToolsLib )
+endif()
 
-# Component(s) in the package:
-atlas_add_library( TauAnalysisToolsLib
-                     Root/*.cxx
-		     PUBLIC_HEADERS TauAnalysisTools
-                     INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthLinks AsgTools xAODEgamma xAODJet xAODTau xAODTracking xAODTruth TruthUtils PATCoreLib PATInterfaces ElectronPhotonSelectorToolsLib AthenaBaseComps xAODCore xAODEventInfo GaudiKernel PathResolver )
+atlas_add_dictionary( TauAnalysisToolsDict
+   TauAnalysisTools/TauAnalysisToolsDict.h
+   TauAnalysisTools/selection.xml
+   LINK_LIBRARIES TauAnalysisToolsLib )
 
-atlas_add_component( TauAnalysisTools
-		     src/*.cxx
-                     src/components/*.cxx		     
-                     INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthLinks AsgTools xAODEgamma xAODJet xAODTau xAODTracking xAODTruth TruthUtils PATCoreLib PATInterfaces ElectronPhotonSelectorToolsLib AthenaBaseComps xAODCore xAODEventInfo GaudiKernel PathResolver TauAnalysisToolsLib )
+# Executable(s) in the package:
+if( XAOD_STANDALONE )
+   atlas_add_executable( TauAnalysisToolsExample
+      util/TauAnalysisToolsExample.cxx
+      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+      LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess xAODCore xAODEventInfo
+      xAODTau AsgTools  TauAnalysisToolsLib )
+endif()
+
+# Test(s) in the package:
+if( NOT XAOD_STANDALONE )
+   atlas_add_test( ut_TauAnalysisTools_test
+      SOURCES test/ut_TauAnalysisTools_test.cxx
+      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+      LINK_LIBRARIES ${ROOT_LIBRARIES} AthAnalysisBaseCompsLib POOLRootAccess
+      GaudiKernel AsgTools xAODTau TauAnalysisToolsLib )
+endif()
 
 # Install files from the package:
-atlas_install_headers( TauAnalysisTools )
 atlas_install_joboptions( share/*.py )
-
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/README.rst b/PhysicsAnalysis/TauID/TauAnalysisTools/README.rst
index 34b27bc4e70..4b248dab1db 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/README.rst
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/README.rst
@@ -52,8 +52,8 @@ First start with a clean shell and setup ATHENA, for example via::
 
   setupATLAS
 
-  #use 2.3.20 or higher
-  asetup AthAnalysisBase,2.3.20,here
+  #use 2.4.19 or higher
+  asetup AthAnalysisBase,2.4.19,here
 
 Where X stands for a release number. Get the package and setup environment::
   
@@ -73,8 +73,8 @@ First start with a clean shell and setup RootCore via::
 
   setupATLAS
 
-  #use 2.3.20 or higher
-  rcSetup Base,2.3.20
+  #use 2.4.19 or higher
+  rcSetup Base,2.4.19
   rc find_packages
 
 and compile with::
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonEfficiencyTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonEfficiencyTool.cxx
index 5a5f2e49d27..201dc4fd85f 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonEfficiencyTool.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonEfficiencyTool.cxx
@@ -15,32 +15,84 @@
 
 using namespace TauAnalysisTools;
 
+/*
+  This tool acts as a common tool to apply efficiency scale factors and
+  uncertainties. By default, only nominal scale factors without systematic
+  variations are applied. Unavailable systematic variations are ignored, meaning
+  that the tool only returns the nominal value. In case the one available
+  systematic is requested, the smeared scale factor is computed as:
+    - sf = sf_nominal +/- n * uncertainty
+
+  where n is in general 1 (representing a 1 sigma smearing), but can be any
+  arbitrary value. In case multiple systematic variations are passed they are
+  added in quadrature. Note that it's currently only supported if all are up or
+  down systematics.
+
+  The tool reads in root files including TH2 histograms which need to fullfil a
+  predefined structure:
+
+  scale factors:
+    - sf_<workingpoint>_<prongness>p
+  uncertainties:
+    - <NP>_<up/down>_<workingpoint>_<prongness>p (for asymmetric uncertainties)
+    - <NP>_<workingpoint>_<prongness>p (for symmetric uncertainties)
+
+  where the <workingpoint> (e.g. loose/medium/tight) fields may be
+  optional. <prongness> represents either 1 or 3, whereas 3 is currently used
+  for multiprong in general. The <NP> fields are names for the type of nuisance
+  parameter (e.g. STAT or SYST), note the tool decides whethe the NP is a
+  recommended or only an available systematic based on the first character:
+    - uppercase -> recommended
+    - lowercase -> available
+  This magic happens here:
+    - CommonEfficiencyTool::generateSystematicSets()
+
+  In addition the root input file can also contain objects of type TF1 that can
+  be used to provide kind of unbinned scale factors or systematics. The major
+  usecase for now is the high-pt uncertainty for the tau ID and tau
+  reconstruction.
+
+  The files may also include TNamed objects which is used to define how x and
+  y-axes should be treated. By default the x-axis is given in units of tau-pT in
+  GeV and the y-axis is given as tau-eta. If there is for example a TNamed
+  object with name "Yaxis" and title "|eta|" the y-axis is treated in units of
+  absolute tau eta. All this is done in:
+    - void CommonEfficiencyTool::ReadInputs(TFile* fFile)
+
+  Other tools for scale factors may build up on this tool and overwrite or add
+  praticular functionality (one example is the TauEfficiencyTriggerTool).
+*/
+
 //______________________________________________________________________________
 CommonEfficiencyTool::CommonEfficiencyTool(std::string sName)
   : asg::AsgTool( sName )
   , m_mSF(0)
-  , m_tTECT(0)
   , m_sSystematicSet(0)
   , m_fX(&tauPt)
   , m_fY(&tauEta)
-  , m_sInputFilePath("")
-  , m_sWP("")
-  , m_sVarName("")
-  , m_bSkipTruthMatchCheck(false)
   , m_sSFHistName("sf")
-  , m_eCheckTruth(TauAnalysisTools::Unknown)
   , m_bNoMultiprong(false)
+  , m_eCheckTruth(TauAnalysisTools::Unknown)
   , m_bSFIsAvailable(false)
   , m_bSFIsAvailableChecked(false)
 {
   m_mSystematics = {};
 
-  declareProperty( "InputFilePath", m_sInputFilePath );
-  declareProperty( "VarName", m_sVarName );
-  declareProperty( "SkipTruthMatchCheck", m_bSkipTruthMatchCheck );
-  declareProperty( "WP", m_sWP );
+  declareProperty( "InputFilePath",       m_sInputFilePath       = "" );
+  declareProperty( "VarName",             m_sVarName             = "" );
+  declareProperty( "WP",                  m_sWP                  = "" );
+  declareProperty( "UseHighPtUncert",     m_bUseHighPtUncert     = false );
+  declareProperty( "SkipTruthMatchCheck", m_bSkipTruthMatchCheck = false );
+  declareProperty( "UseInclusiveEta",     m_bUseInclusiveEta     = false );
+  declareProperty( "IDLevel",             m_iIDLevel             = (int)JETIDBDTTIGHT );
+  declareProperty( "EVLevel",             m_iEVLevel             = (int)ELEIDBDTLOOSE );
+  declareProperty( "OLRLevel",            m_iOLRLevel            = (int)TAUELEOLR );
+  declareProperty( "ContSysType",         m_iContSysType         = (int)TOTAL );
 }
 
+/*
+  need to clear the map of histograms cause we have the ownership, not ROOT
+*/
 CommonEfficiencyTool::~CommonEfficiencyTool()
 {
   if (m_mSF)
@@ -49,6 +101,13 @@ CommonEfficiencyTool::~CommonEfficiencyTool()
   delete m_mSF;
 }
 
+/*
+  - Find the root files with scale factor inputs on afs/cvmfs using PathResolver
+    (more info here:
+    https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/PathResolver)
+  - Call further functions to process and define NP strings and so on
+  - Configure to provide nominal scale factors by default
+*/
 StatusCode CommonEfficiencyTool::initialize()
 {
   ATH_MSG_INFO( "Initializing CommonEfficiencyTool" );
@@ -69,9 +128,11 @@ StatusCode CommonEfficiencyTool::initialize()
     delete fSF;
   }
 
+  // needed later on in generateSystematicSets(), maybe move it there
   std::vector<std::string> vInputFilePath;
   split(m_sInputFilePath,'/',vInputFilePath);
   m_sInputFileName = vInputFilePath.back();
+
   generateSystematicSets();
 
   if (m_sWP.length()>0)
@@ -84,6 +145,11 @@ StatusCode CommonEfficiencyTool::initialize()
   return StatusCode::SUCCESS;
 }
 
+/*
+  Retrieve the scale factors and if requested the values for the NP's and add
+  this stuff in quadrature. Finally return sf_nom +/- n*uncertainty
+*/
+
 //______________________________________________________________________________
 CP::CorrectionCode CommonEfficiencyTool::getEfficiencyScaleFactor(const xAOD::TauJet& xTau,
     double& dEfficiencyScaleFactor)
@@ -164,6 +230,15 @@ CP::CorrectionCode CommonEfficiencyTool::getEfficiencyScaleFactor(const xAOD::Ta
   return CP::CorrectionCode::Ok;
 }
 
+/*
+  Get scale factor from getEfficiencyScaleFactor and decorate it to the
+  tau. Note that this can only be done if the variable name is not already used,
+  e.g. if the variable was already decorated on a previous step (enured by the
+  m_bSFIsAvailableChecked check).
+
+  Technical note: cannot use `static SG::AuxElement::Decorator` as we will have
+  multiple instances of this tool with different decoration names.
+*/
 //______________________________________________________________________________
 CP::CorrectionCode CommonEfficiencyTool::applyEfficiencyScaleFactor(const xAOD::TauJet& xTau)
 {
@@ -190,6 +265,9 @@ CP::CorrectionCode CommonEfficiencyTool::applyEfficiencyScaleFactor(const xAOD::
   return tmpCorrectionCode;
 }
 
+/*
+  standard check if a systematic is available
+*/
 //______________________________________________________________________________
 bool CommonEfficiencyTool::isAffectedBySystematic( const CP::SystematicVariation& systematic ) const
 {
@@ -197,24 +275,35 @@ bool CommonEfficiencyTool::isAffectedBySystematic( const CP::SystematicVariation
   return sys.find (systematic) != sys.end ();
 }
 
+/*
+  standard way to return systematics that are available (including recommended
+  systematics)
+*/
 //______________________________________________________________________________
 CP::SystematicSet CommonEfficiencyTool::affectingSystematics() const
 {
   return m_sAffectingSystematics;
 }
 
+/*
+  standard way to return systematics that are recommended
+*/
 //______________________________________________________________________________
 CP::SystematicSet CommonEfficiencyTool::recommendedSystematics() const
 {
   return m_sRecommendedSystematics;
 }
 
-//______________________________________________________________________________
-void CommonEfficiencyTool::setParent(TauEfficiencyCorrectionsTool* tTECT)
-{
-  m_tTECT = tTECT;
-}
-
+/*
+  Configure the tool to use a systematic variation for further usage, until the
+  tool is reconfigured with this function. The passed systematic set is checked
+  for sanity:
+    - unsupported systematics are skipped
+    - only combinations of up or down supported systematics is allowed
+    - don't mix recommended systematics with other available systematics, cause
+      sometimes recommended are a quadratic sum of the other variations,
+      e.g. TOTAL=(SYST^2 + STAT^2)^0.5
+*/
 //______________________________________________________________________________
 CP::SystematicCode CommonEfficiencyTool::applySystematicVariation ( const CP::SystematicSet& sSystematicSet)
 {
@@ -266,6 +355,10 @@ CP::SystematicCode CommonEfficiencyTool::applySystematicVariation ( const CP::Sy
 }
 
 //=================================PRIVATE-PART=================================
+/*
+  prongness converter, note that it returns "_3p" for all values, except
+  fProngness==1, i.e. for 0, 2, 3, 4, 5...
+ */
 //______________________________________________________________________________
 std::string CommonEfficiencyTool::ConvertProngToString(const int& fProngness)
 {
@@ -276,6 +369,15 @@ std::string CommonEfficiencyTool::ConvertProngToString(const int& fProngness)
   return prong;
 }
 
+/*
+  Read in a root file and store all objects to a map of this type:
+  std::map<std::string, tTupleObjectFunc > (see header) It's basically a map of
+  the histogram name and a function pointer based on the TObject type (TH1F,
+  TH1D, TF1). This is resolved in the function:
+  - CommonEfficiencyTool::addHistogramToSFMap
+  Further this function figures out the axis definition (see description on the
+  top)
+*/
 //______________________________________________________________________________
 void CommonEfficiencyTool::ReadInputs(TFile* fFile)
 {
@@ -322,15 +424,15 @@ void CommonEfficiencyTool::ReadInputs(TFile* fFile)
       continue;
     }
 
-    std::vector<std::string> m_vSplitName = {};
-    split(sKeyName,'_',m_vSplitName);
-    if (m_vSplitName[0] == "sf")
+    std::vector<std::string> vSplitName = {};
+    split(sKeyName,'_',vSplitName);
+    if (vSplitName[0] == "sf")
     {
       addHistogramToSFMap(kKey, sKeyName);
     }
     else
     {
-      // std::string sDirection = m_vSplitName[1];
+      // std::string sDirection = vSplitName[1];
       if (sKeyName.find("_up_") != std::string::npos or sKeyName.find("_down_") != std::string::npos)
         addHistogramToSFMap(kKey, sKeyName);
       else
@@ -344,6 +446,10 @@ void CommonEfficiencyTool::ReadInputs(TFile* fFile)
   ATH_MSG_INFO("data loaded from " << fFile->GetName());
 }
 
+/*
+  Create the tuple objects for the map
+*/
+//______________________________________________________________________________
 void CommonEfficiencyTool::addHistogramToSFMap(TKey* kKey, const std::string& sKeyName)
 {
   // handling for the 3 different input types TH1F/TH1D/TF1, function pointer
@@ -371,14 +477,27 @@ void CommonEfficiencyTool::addHistogramToSFMap(TKey* kKey, const std::string& sK
   }
 }
 
+/*
+  This function parses the names of the obejects from the input file and
+  generates the systematic sets and defines which ones are recommended or only
+  available. It also checks, based on the root file name, on which tau it needs
+  to be applied, e.g. only on reco taus coming from true taus or on those faked
+  by true electrons...
+
+  Examples:
+  filename: Reco_TrueHadTau_2016-ichep.root -> apply only to true taus
+  histname: sf_1p -> nominal 1p scale factor
+  histname: TOTAL_3p -> "total" 3p NP, recommended
+  histname: afii_1p -> "total" 3p NP, not recommended, but available
+*/
 //______________________________________________________________________________
 void CommonEfficiencyTool::generateSystematicSets()
 {
   // creation of basic string for all NPs, e.g. "TAUS_TRUEHADTAU_EFF_RECO_"
-  std::vector<std::string> m_vSplitInputFilePath = {};
-  split(m_sInputFileName,'_',m_vSplitInputFilePath);
-  std::string sEfficiencyType = m_vSplitInputFilePath.at(0);
-  std::string sTruthType = m_vSplitInputFilePath.at(1);
+  std::vector<std::string> vSplitInputFilePath = {};
+  split(m_sInputFileName,'_',vSplitInputFilePath);
+  std::string sEfficiencyType = vSplitInputFilePath.at(0);
+  std::string sTruthType = vSplitInputFilePath.at(1);
   std::transform(sEfficiencyType.begin(), sEfficiencyType.end(), sEfficiencyType.begin(), toupper);
   std::transform(sTruthType.begin(), sTruthType.end(), sTruthType.begin(), toupper);
   std::string sSystematicBaseString = "TAUS_"+sTruthType+"_EFF_"+sEfficiencyType+"_";
@@ -393,10 +512,10 @@ void CommonEfficiencyTool::generateSystematicSets()
   for (auto mSF : *m_mSF)
   {
     // parse for nuisance parameter in histogram name
-    std::vector<std::string> m_vSplitNP = {};
-    split(mSF.first,'_',m_vSplitNP);
-    std::string sNP = m_vSplitNP.at(0);
-    std::string sNPUppercase = m_vSplitNP.at(0);
+    std::vector<std::string> vSplitNP = {};
+    split(mSF.first,'_',vSplitNP);
+    std::string sNP = vSplitNP.at(0);
+    std::string sNPUppercase = vSplitNP.at(0);
 
     // skip nominal scale factors
     if (sNP == "sf") continue;
@@ -427,6 +546,10 @@ void CommonEfficiencyTool::generateSystematicSets()
   }
 }
 
+/*
+  return value from the tuple map object based on the pt/eta values (or the
+  corresponding value in case of configuration)
+*/
 //______________________________________________________________________________
 CP::CorrectionCode CommonEfficiencyTool::getValue(const std::string& sHistName,
     const xAOD::TauJet& xTau,
@@ -453,6 +576,11 @@ CP::CorrectionCode CommonEfficiencyTool::getValue(const std::string& sHistName,
   return  (std::get<1>(tTuple))(std::get<0>(tTuple), dEfficiencyScaleFactor, dPt, dEta);
 }
 
+/*
+  find the particular value in TH2F depending on pt and eta (or the
+  corresponding value in case of configuration)
+  Note: In case values are outside of bin ranges, the closest bin value is used
+*/
 //______________________________________________________________________________
 CP::CorrectionCode CommonEfficiencyTool::getValueTH2F(const TObject* oObject,
     double& dEfficiencyScaleFactor,
@@ -474,12 +602,17 @@ CP::CorrectionCode CommonEfficiencyTool::getValueTH2F(const TObject* oObject,
   dPt = std::min(dPt,hHist->GetXaxis()->GetXmax() * .999);
   dEta = std::min(dEta,hHist->GetYaxis()->GetXmax() * .999);
 
-  // get bin from TH2 depending in x and y values; finally set the scale factor
+  // get bin from TH2 depending on x and y values; finally set the scale factor
   int iBin = hHist->FindFixBin(dPt,dEta);
   dEfficiencyScaleFactor = hHist->GetBinContent(iBin);
   return CP::CorrectionCode::Ok;
 }
 
+/*
+  find the particular value in TH2D depending on pt and eta (or the
+  corresponding value in case of configuration)
+  Note: In case values are outside of bin ranges, the closest bin value is used
+*/
 //______________________________________________________________________________
 CP::CorrectionCode CommonEfficiencyTool::getValueTH2D(const TObject* oObject,
     double& dEfficiencyScaleFactor,
@@ -501,12 +634,16 @@ CP::CorrectionCode CommonEfficiencyTool::getValueTH2D(const TObject* oObject,
   dPt = std::min(dPt,hHist->GetXaxis()->GetXmax() * .999);
   dEta = std::min(dEta,hHist->GetYaxis()->GetXmax() * .999);
 
-  // get bin from TH2 depending in x and y values; finally set the scale factor
+  // get bin from TH2 depending on x and y values; finally set the scale factor
   int iBin = hHist->FindFixBin(dPt,dEta);
   dEfficiencyScaleFactor = hHist->GetBinContent(iBin);
   return CP::CorrectionCode::Ok;
 }
 
+/*
+  Find the particular value in TF1 depending on pt and eta (or the corresponding
+  value in case of configuration)
+*/
 //______________________________________________________________________________
 CP::CorrectionCode CommonEfficiencyTool::getValueTF1(const TObject* oObject,
     double& dEfficiencyScaleFactor,
@@ -526,9 +663,15 @@ CP::CorrectionCode CommonEfficiencyTool::getValueTF1(const TObject* oObject,
   return CP::CorrectionCode::Ok;
 }
 
+/*
+  Check the type of truth particle, previously matched with the
+  TauTruthMatchingTool. The type to match was parsed from the input file in
+  CommonEfficiencyTool::generateSystematicSets()
+*/
 //______________________________________________________________________________
 e_TruthMatchedParticleType CommonEfficiencyTool::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"))
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonSmearingTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonSmearingTool.cxx
index 639500ea1e8..6e61ececd78 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonSmearingTool.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonSmearingTool.cxx
@@ -13,29 +13,83 @@
 // ROOT include(s)
 #include "TF1.h"
 
+// tauRecTools include(s)
+#include "tauRecTools/MvaTESVariableDecorator.h"
+#include "tauRecTools/MvaTESEvaluator.h"
+
 using namespace TauAnalysisTools;
+/*
+  This tool acts as a common tool to apply tau energy smearing and
+  uncertainties. By default, only nominal smearings without systematic
+  variations are applied. Unavailable systematic variations are ignored, meaning
+  that the tool only returns the nominal value. In case the one available
+  systematic is requested, the smeared scale factor is computed as:
+    - pTsmearing = pTsmearing_nominal +/- n * uncertainty
+
+  where n is in general 1 (representing a 1 sigma smearing), but can be any
+  arbitrary value. In case multiple systematic variations are passed they are
+  added in quadrature. Note that it's currently only supported if all are up or
+  down systematics.
+
+  The tool reads in root files including TH2 histograms which need to fulfill a
+  predefined structure:
+
+  nominal smearing:
+    - sf_<workingpoint>_<prongness>p
+  uncertainties:
+    - <NP>_<up/down>_<workingpoint>_<prongness>p (for asymmetric uncertainties)
+    - <NP>_<workingpoint>_<prongness>p (for symmetric uncertainties)
+
+  where the <workingpoint> (e.g. loose/medium/tight) fields may be
+  optional. <prongness> represents either 1 or 3, whereas 3 is currently used
+  for multiprong in general. The <NP> fields are names for the type of nuisance
+  parameter (e.g. STAT or SYST), note the tool decides whether the NP is a
+  recommended or only an available systematic based on the first character:
+    - uppercase -> recommended
+    - lowercase -> available
+  This magic happens here:
+    - CommonSmearingTool::generateSystematicSets()
+
+  In addition the root input file can also contain objects of type TF1 that can
+  be used to provide kind of unbinned smearings or systematics. Currently there
+  is no usecase for tau energy smearing
+
+  The files may also include TNamed objects which is used to define how x and
+  y-axes should be treated. By default the x-axis is given in units of tau-pT in
+  GeV and the y-axis is given as tau-eta. If there is for example a TNamed
+  object with name "Yaxis" and title "|eta|" the y-axis is treated in units of
+  absolute tau eta. All this is done in:
+    - void CommonSmearingTool::ReadInputs(TFile* fFile)
+
+  Other tools for scale factors may build up on this tool and overwrite or add
+  particular functionality.
+*/
 
 //______________________________________________________________________________
 CommonSmearingTool::CommonSmearingTool(std::string sName)
-  : asg::AsgTool( sName )
+  : asg::AsgMetadataTool( sName )
   , m_mSF(0)
-  , m_tTST(0)
   , m_sSystematicSet(0)
   , m_fX(&tauPt)
   , m_fY(&tauEta)
-  , m_sInputFilePath("")
-  , m_bSkipTruthMatchCheck(false)
-  , m_bApplyFading(true)
+  , m_bIsData(false)
+  , m_bIsConfigured(false)
+  , m_tMvaTESVariableDecorator("MvaTESVariableDecorator", this)
+  , m_tMvaTESEvaluator("MvaTESEvaluator", this)
   , m_eCheckTruth(TauAnalysisTools::Unknown)
   , m_bNoMultiprong(false)
 {
   m_mSystematics = {};
 
-  declareProperty("InputFilePath", m_sInputFilePath);
-  declareProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck);
-  declareProperty("ApplyFading", m_bApplyFading);
+  declareProperty("InputFilePath",       m_sInputFilePath       = "" );
+  declareProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck = false );
+  declareProperty("ApplyFading",         m_bApplyFading         = true );
+  declareProperty("ApplyMVATES",         m_bApplyMVATES         = false );
 }
 
+/*
+  need to clear the map of histograms cause we have the ownership, not ROOT
+*/
 CommonSmearingTool::~CommonSmearingTool()
 {
   if (m_mSF)
@@ -44,9 +98,17 @@ CommonSmearingTool::~CommonSmearingTool()
   delete m_mSF;
 }
 
+/*
+  - Find the root files with smearing inputs on afs/cvmfs using PathResolver
+    (more info here:
+    https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/PathResolver)
+  - Call further functions to process and define NP strings and so on
+  - Configure to provide nominal smearings by default
+*/
 StatusCode CommonSmearingTool::initialize()
 {
   ATH_MSG_INFO( "Initializing CommonSmearingTool" );
+
   // only read in histograms once
   if (m_mSF==nullptr)
   {
@@ -73,12 +135,48 @@ StatusCode CommonSmearingTool::initialize()
   if (applySystematicVariation(CP::SystematicSet()) != CP::SystematicCode::Ok )
     return StatusCode::FAILURE;
 
+  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", "LC.pantau.interpolPt250GeV_mediumTaus_BDTG.weights.xml"));
+    ATH_CHECK(m_tMvaTESVariableDecorator.initialize());
+    ATH_CHECK(m_tMvaTESEvaluator.initialize());
+  }
+
   return StatusCode::SUCCESS;
 }
 
+/*
+  Retrieve the smearing value and if requested the values for the NP's and add
+  this stuff in quadrature. Finally apply the correction to the tau pt of the
+  non-const tau.
+*/
 //______________________________________________________________________________
 CP::CorrectionCode CommonSmearingTool::applyCorrection( xAOD::TauJet& xTau )
 {
+  if (m_bApplyMVATES)
+  {
+    // 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;
+    if (xTau.nTracks() > 0 and xTau.nTracks() < 6)
+      xTau.setP4(xTau.auxdecor<float>("ptFinalCalib"),
+                 xTau.auxdecor<float>("etaFinalCalib"),
+                 xTau.auxdecor<float>("phiFinalCalib"),
+                 xTau.auxdecor<float>("mFinalCalib"));
+
+  }
+
+  // step out here if we run on data
+  if (m_bIsData)
+    return CP::CorrectionCode::Ok;
+
   // check which true state is requestet
   if (!m_bSkipTruthMatchCheck and checkTruthMatch(xTau) != m_eCheckTruth)
   {
@@ -142,6 +240,10 @@ CP::CorrectionCode CommonSmearingTool::applyCorrection( xAOD::TauJet& xTau )
   return CP::CorrectionCode::Ok;
 }
 
+/*
+  Create a non-const copy of the passed const xTau object and apply the
+  correction to the non-const copy.
+ */
 //______________________________________________________________________________
 CP::CorrectionCode CommonSmearingTool::correctedCopy( const xAOD::TauJet& xTau,
     xAOD::TauJet*& xTauCopy )
@@ -162,6 +264,9 @@ CP::CorrectionCode CommonSmearingTool::correctedCopy( const xAOD::TauJet& xTau,
   return applyCorrection( *xTauCopy );
 }
 
+/*
+  standard check if a systematic is available
+*/
 //______________________________________________________________________________
 bool CommonSmearingTool::isAffectedBySystematic( const CP::SystematicVariation& systematic ) const
 {
@@ -169,24 +274,35 @@ bool CommonSmearingTool::isAffectedBySystematic( const CP::SystematicVariation&
   return sys.find (systematic) != sys.end ();
 }
 
+/*
+  standard way to return systematics that are available (including recommended
+  systematics)
+*/
 //______________________________________________________________________________
 CP::SystematicSet CommonSmearingTool::affectingSystematics() const
 {
   return m_sAffectingSystematics;
 }
 
+/*
+  standard way to return systematics that are recommended
+*/
 //______________________________________________________________________________
 CP::SystematicSet CommonSmearingTool::recommendedSystematics() const
 {
   return m_sRecommendedSystematics;
 }
 
-//______________________________________________________________________________
-void CommonSmearingTool::setParent(TauSmearingTool* tTST)
-{
-  m_tTST = tTST;
-}
-
+/*
+  Configure the tool to use a systematic variation for further usage, until the
+  tool is reconfigured with this function. The passed systematic set is checked
+  for sanity:
+    - unsupported systematics are skipped
+    - only combinations of up or down supported systematics is allowed
+    - don't mix recommended systematics with other available systematics, cause
+      sometimes recommended are a quadratic sum of the other variations,
+      e.g. TOTAL=(SYST^2 + STAT^2)^0.5
+*/
 //______________________________________________________________________________
 CP::SystematicCode CommonSmearingTool::applySystematicVariation ( const CP::SystematicSet& sSystematicSet)
 {
@@ -238,6 +354,29 @@ CP::SystematicCode CommonSmearingTool::applySystematicVariation ( const CP::Syst
 }
 
 //=================================PRIVATE-PART=================================
+/*
+  Executed at the beginning of each event. Checks if the tool is used on data or
+  MC, which is necessary in some cases, wher taus on data are corrected as
+  well. (e.g. when using the MVA TES)
+*/
+//______________________________________________________________________________
+StatusCode CommonSmearingTool::beginEvent()
+{
+  if (m_bIsConfigured)
+    return StatusCode::SUCCESS;
+
+  const xAOD::EventInfo* xEventInfo = 0;
+  ATH_CHECK(evtStore()->retrieve(xEventInfo,"EventInfo"));
+  m_bIsData = !(xEventInfo->eventType( xAOD::EventInfo::IS_SIMULATION));
+  m_bIsConfigured=true;
+
+  return StatusCode::SUCCESS;
+}
+
+/*
+  prongness converter, note that it returns "_3p" for all values, except
+  fProngness==1, i.e. for 0, 2, 3, 4, 5...
+ */
 //______________________________________________________________________________
 std::string CommonSmearingTool::ConvertProngToString(const int& fProngness)
 {
@@ -305,10 +444,10 @@ void CommonSmearingTool::ReadInputs(TFile* fFile, std::map<std::string, T>* mMap
 void CommonSmearingTool::generateSystematicSets()
 {
   // creation of basic string for all NPs, e.g. "TAUS_TRUEHADTAU_SME_TES_"
-  std::vector<std::string> m_vSplitInputFilePath = {};
-  split(m_sInputFileName,'_',m_vSplitInputFilePath);
-  std::string sEfficiencyType = m_vSplitInputFilePath.at(0);
-  std::string sTruthType = m_vSplitInputFilePath.at(1);
+  std::vector<std::string> vSplitInputFilePath = {};
+  split(m_sInputFileName,'_',vSplitInputFilePath);
+  std::string sEfficiencyType = vSplitInputFilePath.at(0);
+  std::string sTruthType = vSplitInputFilePath.at(1);
   std::transform(sEfficiencyType.begin(), sEfficiencyType.end(), sEfficiencyType.begin(), toupper);
   std::transform(sTruthType.begin(), sTruthType.end(), sTruthType.begin(), toupper);
   std::string sSystematicBaseString = "TAUS_"+sTruthType+"_SME_"+sEfficiencyType+"_";
@@ -323,10 +462,10 @@ void CommonSmearingTool::generateSystematicSets()
   for (auto mSF : *m_mSF)
   {
     // parse for nuisance parameter in histogram name
-    std::vector<std::string> m_vSplitNP = {};
-    split(mSF.first,'_',m_vSplitNP);
-    std::string sNP = m_vSplitNP.at(0);
-    std::string sNPUppercase = m_vSplitNP.at(0);
+    std::vector<std::string> vSplitNP = {};
+    split(mSF.first,'_',vSplitNP);
+    std::string sNP = vSplitNP.at(0);
+    std::string sNPUppercase = vSplitNP.at(0);
 
     // skip nominal scale factors
     if (sNP == "sf") continue;
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx
index c9abb0b3008..632e2930c0e 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx
@@ -94,7 +94,7 @@ double TauAnalysisTools::tauEta(const xAOD::TauJet& xTau)
 double TauAnalysisTools::tauAbsEta(const xAOD::TauJet& xTau)
 {
   // return absolute tau eta
-  return fabs(xTau.eta());
+  return std::abs(xTau.eta());
 }
 
 //______________________________________________________________________________
@@ -157,9 +157,6 @@ void TauAnalysisTools::createPi0Vectors(const xAOD::TauJet* xTau, std::vector<TL
   // reset the pi0s
   vPi0s.clear();
 
-  // // not needed
-  // xAOD::Vertex xPrimaryVertex = *xTau->vertex();
-
   // Since the PFO links as they come out of reconstruction, only correspond to
   // calorimeter clusters, whereas we want the consts_pi0 vectors to correspond
   // to real pi0s, we need to be careful to collect the PFOs correctly to pi0s
@@ -167,7 +164,12 @@ void TauAnalysisTools::createPi0Vectors(const xAOD::TauJet* xTau, std::vector<TL
   size_t iNumPi0PFO = xTau->nPi0PFOs();
 
   int iDecayMode = -1;
-  xTau->panTauDetail(PANTAU_DECAYMODE, iDecayMode);
+
+  if (!(xTau->panTauDetail(PANTAU_DECAYMODE, iDecayMode)))
+  {
+    std::cerr <<"Failed to retrieve panTauDetail decay mode\n";
+    return;
+  }
 
   if (iDecayMode == xAOD::TauJetParameters::DecayMode::Mode_1p1n && iNumPi0PFO > 1)
   {
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/SelectionCuts.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/SelectionCuts.cxx
index 1845c5da2f9..269cd7256d9 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/SelectionCuts.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/SelectionCuts.cxx
@@ -436,11 +436,13 @@ bool SelectionCutEleBDTWP::accept(const xAOD::TauJet& xTau)
 //______________________________________________________________________________
 SelectionCutEleOLR::SelectionCutEleOLR(TauSelectionTool* tTST)
   : SelectionCut("CutEleOLR", tTST)
-  , m_tTOELLHDecorator(0)
+#ifndef XAODTAU_VERSIONS_TAUJET_V3_H
   , m_bCheckEleMatchPassAvailable(true)
   , m_bEleMatchPassAvailable(true)
+#endif // not XAODTAU_VERSIONS_TAUJET_V3_H
+  , m_sEleOlrPassDecorationName("ele_olr_pass_fix")
 #ifndef XAODTAU_VERSIONS_TAUJET_V3_H
-  , m_sEleOlrLhScoreDecorationName("ele_match_lhscore")
+  , m_sEleOlrLhScoreDecorationName("ele_match_lhscore_fix")
 #else
   , m_sEleOlrLhScoreDecorationName("EleMatchLikelihoodScore")
 #endif
@@ -452,11 +454,6 @@ SelectionCutEleOLR::SelectionCutEleOLR(TauSelectionTool* tTST)
 
 SelectionCutEleOLR::~SelectionCutEleOLR()
 {
-#ifdef ROOTCORE
-  if (m_tTOELLHDecorator and asg::ToolStore::remove(m_tTOELLHDecorator).isFailure())
-    m_tTST->msg() << MSG::ERROR << "An error occured while trying to remove "<<m_tTOELLHDecorator->name()<<" from tool store";
-#endif  // ROOTCORE
-  delete m_tTOELLHDecorator;
 }
 
 //______________________________________________________________________________
@@ -491,20 +488,6 @@ bool SelectionCutEleOLR::accept(const xAOD::TauJet& xTau)
   return false;
 }
 
-//______________________________________________________________________________
-StatusCode SelectionCutEleOLR::createTOELLHDecorator()
-{
-  if (!m_tTOELLHDecorator)
-  {
-    m_tTOELLHDecorator = new TauOverlappingElectronLLHDecorator(m_tTST->name()+"_TOELLHDecorator");
-    m_tTOELLHDecorator->msg().setLevel( m_tTST->msg().level() );
-    if (m_tTOELLHDecorator->setProperty( "EleOLRFilePath", m_tTST->m_sEleOLRFilePath ).isFailure())
-      return StatusCode::FAILURE;
-    return m_tTOELLHDecorator->initialize();
-  }
-  return StatusCode::SUCCESS;
-}
-
 //______________________________________________________________________________
 bool SelectionCutEleOLR::getEvetoPass(const xAOD::TauJet& xTau)
 {
@@ -513,34 +496,22 @@ bool SelectionCutEleOLR::getEvetoPass(const xAOD::TauJet& xTau)
   if (m_bCheckEleMatchPassAvailable)
   {
     m_bCheckEleMatchPassAvailable = false;
-    if (!xTau.isAvailable<char>("ele_olr_pass"))
+    if (!xTau.isAvailable<char>(m_sEleOlrPassDecorationName))
     {
       m_bEleMatchPassAvailable = false;
-      if (createTOELLHDecorator().isFailure())
-        throw std::runtime_error ("TOELLHDecorator constructor failed\n");
     }
   }
   if (!m_bEleMatchPassAvailable)
-    if (m_tTOELLHDecorator->decorate(xTau).isFailure())
+    if (m_tTST->m_tTOELLHDecorator->decorate(xTau).isFailure())
       throw std::runtime_error ("TOELLHDecorator decoration failed\n");
-  static SG::AuxElement::ConstAccessor<char> accEleOlrPass("ele_olr_pass");
+  static SG::AuxElement::ConstAccessor<char> accEleOlrPass(m_sEleOlrPassDecorationName.c_str());
   return (bool)accEleOlrPass(xTau);
 #else
   return xTau.isTau(xAOD::TauJetParameters::PassEleOLR);
-#endif
+#endif // not XAODTAU_VERSIONS_TAUJET_V3_H
 
 }
 
-//______________________________________________________________________________
-StatusCode SelectionCutEleOLR::beginEvent()
-{
-  if (createTOELLHDecorator().isFailure())
-    return StatusCode::FAILURE;
-  if (m_tTOELLHDecorator->beginEvent().isFailure())
-    return StatusCode::FAILURE;
-  return StatusCode::SUCCESS;
-}
-
 //____________________________SelectionCutMuonVeto______________________________
 //______________________________________________________________________________
 SelectionCutMuonVeto::SelectionCutMuonVeto(TauSelectionTool* tTST)
@@ -583,3 +554,69 @@ bool SelectionCutMuonVeto::accept(const xAOD::TauJet& xTau)
   m_tTST->msg() << MSG::VERBOSE << "Tau failed MuonVeto requirement" << endmsg;
   return false;
 }
+
+//added by Li-Gang Xia < ligang.xia@cern.ch >
+//____________________________SelectionCutMuonOLR______________________________
+//______________________________________________________________________________
+SelectionCutMuonOLR::SelectionCutMuonOLR(TauSelectionTool* tTST)
+  : SelectionCut("CutMuonOLR", tTST)
+  , m_bTauMuonOLR(true)
+  , m_xMuonContainer(0)
+{
+  //ATH_MSG_INFO("Construct SelectionCutMuonOLR");
+  m_hHistCutPre = CreateControlPlot("hMuonOLR_pre","MuonOLR_pre;; events",2,-.5,1.5);
+  m_hHistCut = CreateControlPlot("hMuonOLR_cut","MuonOLR_cut;; events",2,-.5,1.5);
+  // only proceed if histograms are defined
+  if (!m_hHistCutPre or !m_hHistCut)
+    return;
+  m_hHistCutPre->GetXaxis()->SetBinLabel(1,"!MuonOLR");
+  m_hHistCutPre->GetXaxis()->SetBinLabel(2,"MuonOLR");
+  m_hHistCut->GetXaxis()->SetBinLabel(1,"!MuonOLR");
+  m_hHistCut->GetXaxis()->SetBinLabel(2,"MuonOLR");
+}
+
+//______________________________________________________________________________
+void SelectionCutMuonOLR::fillHistogram(const xAOD::TauJet& xTau, TH1F& hHist)
+{
+  (void)xTau;
+  hHist.Fill(m_bTauMuonOLR);
+}
+
+//______________________________________________________________________________
+bool SelectionCutMuonOLR::accept(const xAOD::TauJet& xTau)
+{
+  m_tTST->m_aAccept.addCut( "MuonOLR",
+                            "Selection of taus according to their MuonOLR" );
+  if (!m_tTST->m_bMuonOLR)
+  {
+    m_tTST->m_aAccept.setCutResult( "MuonOLR", true );
+    return true;
+  }
+  // MuonOLR : removing tau overlapped with muon satisfying pt>2GeV and not calo-tagged
+  m_bTauMuonOLR = true;
+  if(!m_tTST->evtStore()->contains<xAOD::MuonContainer>(m_tTST->m_sMuonContainerName))
+    m_tTST->msg() << MSG::FATAL << "Muon container with name " << m_tTST->m_sMuonContainerName << " is not available" << endmsg;
+  else if(m_tTST->evtStore()->retrieve(m_xMuonContainer,m_tTST->m_sMuonContainerName).isFailure())
+    m_tTST->msg() << MSG::FATAL << "Muon container with name " << m_tTST->m_sMuonContainerName << " could not be retrieved from event store" << endmsg;
+  if(!m_xMuonContainer)
+    return false;
+
+  for( auto xMuon : *(m_xMuonContainer) )
+  {
+    if(xMuon->pt() < 2000.) continue;// pt > 2GeV
+    if(xMuon->muonType() == xAOD::Muon::CaloTagged) continue; // not calo-tagged
+    if(xMuon->p4().DeltaR( xTau.p4() ) > 0.2 ) continue; //delta R < 0.2
+    m_bTauMuonOLR = false;// muon-tau overlapped
+    break;
+  }
+  if(m_bTauMuonOLR == true)
+  {
+    m_tTST->m_aAccept.setCutResult( "MuonOLR", true );
+    return true;
+  }
+
+  m_tTST->msg() << MSG::VERBOSE << "Tau failed MuonOLR requirement" << endmsg;
+  return false;
+}
+
+
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyContJetIDTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyContJetIDTool.cxx
index c69e69e66de..d9001447035 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyContJetIDTool.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyContJetIDTool.cxx
@@ -40,7 +40,7 @@ CP::CorrectionCode TauEfficiencyContJetIDTool::getEfficiencyScaleFactor(const xA
     double& dEfficiencyScaleFactor)
 {
   // obtain ID SF value
-  if (!m_tTECT->m_bUseInclusiveEta)
+  if (!m_bUseInclusiveEta)
     return getTotalSF(xTau, dEfficiencyScaleFactor);
   // else
   return getTotalSFInclusiveEta(xTau, dEfficiencyScaleFactor);
@@ -54,7 +54,7 @@ CP::CorrectionCode TauEfficiencyContJetIDTool::applyEfficiencyScaleFactor(const
   CP::CorrectionCode tmpCorrectionCode = getEfficiencyScaleFactor(xTau, sf);
   // adding scale factor
   xTau.auxdecor<double>(m_sVarName) = sf;
-  ATH_MSG_VERBOSE("Stored value " << sf << " as " << m_tTECT->m_sVarNameBase << " in auxdecor");
+  ATH_MSG_VERBOSE("Stored value " << sf << " as " << m_sVarName << " in auxdecor");
 
   return tmpCorrectionCode;
 }
@@ -117,7 +117,7 @@ CP::CorrectionCode TauEfficiencyContJetIDTool::getTotalSF(const xAOD::TauJet& xT
         continue;
       }
 
-      if (fabs(syst.parameter()) != 1)
+      if (std::abs(syst.parameter()) != 1)
       {
         ATH_MSG_WARNING("systematic variation other than 1 sigma is not supported, skipping this one");
         continue;
@@ -158,7 +158,7 @@ CP::CorrectionCode TauEfficiencyContJetIDTool::getTotalSFInclusiveEta(const xAOD
         continue;
       }
 
-      if (fabs(syst.parameter()) != 1)
+      if (std::abs(syst.parameter()) != 1)
       {
         ATH_MSG_WARNING("systematic variation other than 1 sigma is not supported, skipping this one");
         continue;
@@ -204,7 +204,7 @@ CP::CorrectionCode TauEfficiencyContJetIDTool::getBDTbinnedSFSysUnc(double& val,
     int prongness,
     const double& BDT)
 {
-  std::string workingPoint = "ID_SF_sys" + ConvertSystematicToString(m_tTECT->m_iContSysType) + ConvertDirectionToString(m_iSysDirection) + ConvertProngToString(prongness);
+  std::string workingPoint = "ID_SF_sys" + ConvertSystematicToString(m_iContSysType) + ConvertDirectionToString(m_iSysDirection) + ConvertProngToString(prongness);
   return this->GetIDValue(val, workingPoint, BDT);
 }
 
@@ -215,7 +215,7 @@ CP::CorrectionCode TauEfficiencyContJetIDTool::getBDTbinnedSFSysUnc(double& val,
     const double& eta,
     const double& BDT)
 {
-  std::string workingPoint = "ID_SF_sys" + ConvertSystematicToString(m_tTECT->m_iContSysType) + ConvertDirectionToString(m_iSysDirection) + ConvertProngToString(prongness) + ConvertEtaToString(eta);
+  std::string workingPoint = "ID_SF_sys" + ConvertSystematicToString(m_iContSysType) + ConvertDirectionToString(m_iSysDirection) + ConvertProngToString(prongness) + ConvertEtaToString(eta);
   return this->GetIDValue(val, workingPoint, BDT);
 }
 
@@ -285,11 +285,11 @@ std::string TauEfficiencyContJetIDTool::ConvertDirectionToString(const int iSysD
 //______________________________________________________________________________
 std::string TauEfficiencyContJetIDTool::ConvertEtaToString(const float& fEta)
 {
-  if(m_tTECT->m_bUseInclusiveEta)
+  if(m_bUseInclusiveEta)
     return "";
-  if(fabs(fEta) <= 1.5)
+  if(std::abs(fEta) <= 1.5)
     return "_barrel";
-  else if(fabs(fEta) > 1.5)
+  else if(std::abs(fEta) > 1.5)
     return "_endcap";
   else
   {
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyCorrectionsTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyCorrectionsTool.cxx
index 8e3fe55ec96..e98989486c7 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyCorrectionsTool.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyCorrectionsTool.cxx
@@ -4,99 +4,87 @@
 
 // EDM include(s):
 #include "PATInterfaces/SystematicRegistry.h"
+#include "xAODEventInfo/EventInfo.h"
 
 // Local include(s):
 #include "TauAnalysisTools/TauEfficiencyCorrectionsTool.h"
+#include "TauAnalysisTools/Enums.h"
 #include "TauAnalysisTools/SharedFilesVersion.h"
 
+
 namespace TauAnalysisTools
 {
 
 //______________________________________________________________________________
 TauEfficiencyCorrectionsTool::TauEfficiencyCorrectionsTool( const std::string& sName )
-  : asg::AsgTool( sName ),
-    m_iEfficiencyCorrectionType(SFJetID),
-    m_vEfficiencyCorrectionTypes(),
-    m_vCommonEfficiencyTools(),
-    m_sInputFilePath(""),
-    m_sInputFilePathRecoHadTau(""),
-    m_sInputFilePathEleOLRHadTau(""),
-    m_sInputFilePathEleOLRElectron(""),
-    m_sInputFilePathJetIDHadTau(""),
-    m_sInputFilePathContJetIDHadTau(""),
-    m_sInputFilePathEleIDHadTau(""),
-    m_sInputFilePathTriggerHadTau(""),
-    m_sVarNameBase(""),
-    m_sVarNameRecoHadTau(""),
-    m_sVarNameEleOLRHadTau(""),
-    m_sVarNameEleOLRElectron(""),
-    m_sVarNameJetIDHadTau(""),
-    m_sVarNameContJetIDHadTau(""),
-    m_sVarNameEleIDHadTau(""),
-    m_sVarNameTriggerHadTau(""),
-    m_sRecommendationTag("mc15-moriond"),
-    m_sTriggerName(""),
-    m_bSkipTruthMatchCheck(false),
-    m_bNoMultiprong(false),
-    m_bUseIDExclusiveSF(false),
-    m_bUseInclusiveEta(false),
-    m_bUseTriggerInclusiveEta(true),
-    m_bUsePtBinnedSF(false),
-    m_bUseHighPtUncert(false),
-    m_iIDLevel(JETIDBDTTIGHT),
-    m_iEVLevel(ELEIDBDTLOOSE),
-    m_iOLRLevel(TAUELEOLR),
-    m_iContSysType(TOTAL),
-    m_iTriggerPeriodBinning(PeriodBinningAll),
-    m_tTauSelectionTool(0)
+  : asg::AsgMetadataTool( sName )
+  , m_vCommonEfficiencyTools()
+  , m_vTriggerEfficiencyTools()
+  //, m_bNoMultiprong(false)
+  , m_bIsData(false)
+  , m_bIsConfigured(false)
+  , m_iRunNumber(0)
+  , m_tTauSelectionToolHandle("")
+#ifdef TAUANALYSISTOOLS_PRWTOOL_AVAILABLE
+  , m_tPRWTool("")
+#endif // TAUANALYSISTOOLS_PRWTOOL_AVAILABLE
+  , m_tTauSelectionTool(0)
 {
-  declareProperty( "EfficiencyCorrectionTypes", m_vEfficiencyCorrectionTypes );
-  declareProperty( "InputFilePathRecoHadTau", m_sInputFilePathRecoHadTau );
-  declareProperty( "InputFilePathEleOLRHadTau", m_sInputFilePathEleOLRHadTau );
-  declareProperty( "InputFilePathEleOLRElectron", m_sInputFilePathEleOLRElectron );
-  declareProperty( "InputFilePathJetIDHadTau", m_sInputFilePathJetIDHadTau );
-  declareProperty( "InputFilePathContJetIDHadTau", m_sInputFilePathContJetIDHadTau );
-  declareProperty( "InputFilePathEleIDHadTau", m_sInputFilePathEleIDHadTau );
-  declareProperty( "InputFilePathTriggerHadTau", m_sInputFilePathTriggerHadTau );
-  declareProperty( "VarNameRecoHadTau", m_sVarNameRecoHadTau );
-  declareProperty( "VarNameEleOLRHadTau", m_sVarNameEleOLRHadTau );
-  declareProperty( "VarNameEleOLRElectron", m_sVarNameEleOLRElectron );
-  declareProperty( "VarNameJetIDHadTau", m_sVarNameJetIDHadTau );
-  declareProperty( "VarNameContJetIDHadTau", m_sVarNameContJetIDHadTau );
-  declareProperty( "VarNameEleIDHadTau", m_sVarNameEleIDHadTau );
-  declareProperty( "VarNameTriggerHadTau", m_sVarNameTriggerHadTau );
-  declareProperty( "RecommendationTag", m_sRecommendationTag );
-  declareProperty( "TriggerName", m_sTriggerName );
-
-  declareProperty( "UseIDExclusiveSF", m_bUseIDExclusiveSF );
-  declareProperty( "UseInclusiveEta", m_bUseInclusiveEta );
-  declareProperty( "UseTriggerInclusiveEta", m_bUseTriggerInclusiveEta );
-  declareProperty( "UsePtBinnedSF", m_bUsePtBinnedSF );
-  declareProperty( "UseHighPtUncert", m_bUseHighPtUncert );
-  declareProperty( "IDLevel", m_iIDLevel );
-  declareProperty( "EVLevel", m_iEVLevel );
-  declareProperty( "OLRLevel", m_iOLRLevel );
-  declareProperty( "ContSysType", m_iContSysType );
-  declareProperty( "TriggerPeriodBinning", m_iTriggerPeriodBinning );
-
-  declareProperty( "SkipTruthMatchCheck", m_bSkipTruthMatchCheck );
-
-  // deprecated properties
-  declareProperty( "EfficiencyCorrectionType", m_iEfficiencyCorrectionType );
-  declareProperty( "InputFilePath", m_sInputFilePath );
-  declareProperty( "VarNameBase", m_sVarNameBase );
+  declareProperty( "EfficiencyCorrectionTypes",    m_vEfficiencyCorrectionTypes    = {} );
+  declareProperty( "InputFilePathRecoHadTau",      m_sInputFilePathRecoHadTau      = "" );
+  declareProperty( "InputFilePathEleOLRHadTau",    m_sInputFilePathEleOLRHadTau    = "" );
+  declareProperty( "InputFilePathEleOLRElectron",  m_sInputFilePathEleOLRElectron  = "" );
+  declareProperty( "InputFilePathJetIDHadTau",     m_sInputFilePathJetIDHadTau     = "" );
+  declareProperty( "InputFilePathContJetIDHadTau", m_sInputFilePathContJetIDHadTau = "" );
+  declareProperty( "InputFilePathEleIDHadTau",     m_sInputFilePathEleIDHadTau     = "" );
+  declareProperty( "InputFilePathTriggerHadTau",   m_sInputFilePathTriggerHadTau   = "" );
+  declareProperty( "VarNameRecoHadTau",            m_sVarNameRecoHadTau            = "" );
+  declareProperty( "VarNameEleOLRHadTau",          m_sVarNameEleOLRHadTau          = "" );
+  declareProperty( "VarNameEleOLRElectron",        m_sVarNameEleOLRElectron        = "" );
+  declareProperty( "VarNameJetIDHadTau",           m_sVarNameJetIDHadTau           = "" );
+  declareProperty( "VarNameContJetIDHadTau",       m_sVarNameContJetIDHadTau       = "" );
+  declareProperty( "VarNameEleIDHadTau",           m_sVarNameEleIDHadTau           = "" );
+  declareProperty( "VarNameTriggerHadTau",         m_sVarNameTriggerHadTau         = "" );
+  declareProperty( "RecommendationTag",            m_sRecommendationTag            = "2016-fall" );
+  declareProperty( "TriggerName",                  m_sTriggerName                  = "" );
+  declareProperty( "TriggerYear",                  m_sTriggerYear                  = "2016" );
+
+  declareProperty( "UseIDExclusiveSF",             m_bUseIDExclusiveSF             = false );
+  declareProperty( "UseInclusiveEta",              m_bUseInclusiveEta              = false );
+  declareProperty( "UseTriggerInclusiveEta",       m_bUseTriggerInclusiveEta       = true );
+  declareProperty( "UsePtBinnedSF",                m_bUsePtBinnedSF                = false );
+  declareProperty( "UseHighPtUncert",              m_bUseHighPtUncert              = false );
+  declareProperty( "IDLevel",                      m_iIDLevel                      = (int)JETIDBDTTIGHT );
+  declareProperty( "EVLevel",                      m_iEVLevel                      = (int)ELEIDBDTLOOSE );
+  declareProperty( "OLRLevel",                     m_iOLRLevel                     = (int)TAUELEOLR );
+  declareProperty( "ContSysType",                  m_iContSysType                  = (int)TOTAL );
+  declareProperty( "TriggerPeriodBinning",         m_iTriggerPeriodBinning         = (int)PeriodBinningAll );
+
+  declareProperty( "SkipTruthMatchCheck",          m_bSkipTruthMatchCheck          = false );
+
+  declareProperty( "TauSelectionTool",             m_tTauSelectionToolHandle );
+#ifdef TAUANALYSISTOOLS_PRWTOOL_AVAILABLE
+  declareProperty( "PileupReweightingTool",        m_tPRWTool);
+#endif // TAUANALYSISTOOLS_PRWTOOL_AVAILABLE
+
+  declareProperty( "EventInfoName",                m_sEventInfoName                = "EventInfo" );
 }
 
 //______________________________________________________________________________
 TauEfficiencyCorrectionsTool::TauEfficiencyCorrectionsTool( const std::string& sName, TauSelectionTool* tTauSelectionTool )
   : TauEfficiencyCorrectionsTool( sName)
 {
+  ATH_MSG_WARNING("It is deprecated to pass the TauSelectionTool via the TauEfficiencyCorrectionsTool contructor. This functionality will be removed in the future without further notice. Please pass the TauSelectionTool as a ToolHandle via the property \"TauSelectionTool\".\nFor further information please refer to the README:\nhttps://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/trunk/doc/README-TauEfficiencyCorrectionsTool.rst");
   m_tTauSelectionTool = tTauSelectionTool;
 }
 
 //______________________________________________________________________________
 TauEfficiencyCorrectionsTool::~TauEfficiencyCorrectionsTool()
 {
+  for (auto tTool : m_vCommonEfficiencyTools)
+    delete tTool;
+  for (auto tTool : m_vTriggerEfficiencyTools)
+    delete tTool;
 }
 
 //______________________________________________________________________________
@@ -107,7 +95,10 @@ StatusCode TauEfficiencyCorrectionsTool::initializeWithTauSelectionTool()
 
   // configure the tool depending on cuts used in the TauSelectionTool if
   // EfficiencyCorrectionTypes have not been set
-  if ((m_sRecommendationTag == "mc15-pre-recommendations" or m_sRecommendationTag == "mc15-moriond") and m_vEfficiencyCorrectionTypes.size() == 0)
+  if ((m_sRecommendationTag == "2016-fall" or
+       m_sRecommendationTag == "2016-ichep" or
+       m_sRecommendationTag == "mc15-moriond" or
+       m_sRecommendationTag == "mc15-pre-recommendations") and m_vEfficiencyCorrectionTypes.size() == 0)
   {
     // add reco systematics in any case
     m_vEfficiencyCorrectionTypes.push_back(SFRecoHadTau);
@@ -131,6 +122,8 @@ StatusCode TauEfficiencyCorrectionsTool::initializeWithTauSelectionTool()
     {
       m_vEfficiencyCorrectionTypes.push_back(SFEleOLRHadTau);
       ATH_MSG_VERBOSE( "added SFEleOLRHadTau" );
+      m_vEfficiencyCorrectionTypes.push_back(SFEleOLRElectron);
+      ATH_MSG_VERBOSE( "added SFEleOLRElectron" );
     }
   }
   else if (m_sRecommendationTag == "mc12-final" and m_vEfficiencyCorrectionTypes.size() == 0)
@@ -162,6 +155,18 @@ StatusCode TauEfficiencyCorrectionsTool::initialize()
   if (m_bSkipTruthMatchCheck)
     ATH_MSG_WARNING("Truth match check will be skipped. This is ONLY FOR TESTING PURPOSE!");
 
+#ifdef TAUANALYSISTOOLS_PRWTOOL_AVAILABLE
+  if (!m_tPRWTool.empty())
+    ATH_CHECK(m_tPRWTool.retrieve());
+#endif // TAUANALYSISTOOLS_PRWTOOL_AVAILABLE
+
+  if (!m_tTauSelectionToolHandle.empty())
+  {
+
+    ATH_CHECK(m_tTauSelectionToolHandle.retrieve());
+    m_tTauSelectionTool = dynamic_cast<TauAnalysisTools::TauSelectionTool*>(&*m_tTauSelectionToolHandle);
+  }
+
   if (m_tTauSelectionTool)
     if (initializeWithTauSelectionTool().isFailure())
     {
@@ -170,7 +175,7 @@ StatusCode TauEfficiencyCorrectionsTool::initialize()
     }
 
   // configure default set of variations if not set by the constructor using TauSelectionTool or the user
-  if (m_sRecommendationTag == "mc15-moriond" and m_vEfficiencyCorrectionTypes.size() == 0)
+  if ((m_sRecommendationTag == "2016-fall" or m_sRecommendationTag == "2016-ichep" or m_sRecommendationTag == "mc15-moriond") and m_vEfficiencyCorrectionTypes.size() == 0)
     m_vEfficiencyCorrectionTypes = {SFRecoHadTau,
                                     SFJetIDHadTau,
                                     SFEleOLRHadTau,
@@ -186,204 +191,32 @@ StatusCode TauEfficiencyCorrectionsTool::initialize()
                                     SFEleID
                                    };
 
-  std::string sDirectory = "TauAnalysisTools/"+std::string(sSharedFilesVersion)+"/EfficiencyCorrections/";
-
-  if (m_sRecommendationTag == "mc15-moriond")
-  {
-    for (auto iEfficiencyCorrectionType : m_vEfficiencyCorrectionTypes)
-    {
-      if (iEfficiencyCorrectionType == SFJetIDHadTau)
-      {
-        // only set vars if they differ from "", which means they have been configured by the user
-        if (m_sInputFilePathJetIDHadTau.empty()) m_sInputFilePathJetIDHadTau = sDirectory+"JetID_TrueHadTau_mc15-moriond.root";
-        if (m_sVarNameJetIDHadTau.length() == 0) m_sVarNameJetIDHadTau = "TauScaleFactorJetIDHadTau";
-        CommonEfficiencyTool* tTool = new CommonEfficiencyTool(name()+"_JetIDHadTauTool");
-        if (tTool->setProperty("InputFilePath", m_sInputFilePathJetIDHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("VarName", m_sVarNameJetIDHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("WP", ConvertJetIDToString(m_iIDLevel)).isFailure()) return StatusCode::FAILURE;
-        m_vCommonEfficiencyTools.push_back(tTool);
-      }
-      else if (iEfficiencyCorrectionType == SFEleOLRHadTau)
-      {
-        // only set vars if they differ from "", which means they have been configured by the user
-        if (m_sInputFilePathEleOLRHadTau.empty()) m_sInputFilePathEleOLRHadTau = sDirectory+"EleOLR_TrueHadTau_mc15-moriond.root";
-        if (m_sVarNameEleOLRHadTau.length() == 0) m_sVarNameEleOLRHadTau = "TauScaleFactorEleOLRHadTau";
-
-        CommonEfficiencyTool* tTool = new CommonEfficiencyTool(name()+"_EleOLRHadTauTool");
-        if (tTool->setProperty("InputFilePath", m_sInputFilePathEleOLRHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("VarName", m_sVarNameEleOLRHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck).isFailure()) return StatusCode::FAILURE;
-        m_vCommonEfficiencyTools.push_back(tTool);
-      }
-      else if (iEfficiencyCorrectionType == SFEleOLRElectron)
-      {
-        // only set vars if they differ from "", which means they have been configured by the user
-        if (m_sInputFilePathEleOLRElectron.empty()) m_sInputFilePathEleOLRElectron = sDirectory+"EleOLR_TrueElectron_mc15-moriond.root";
-        if (m_sVarNameEleOLRElectron.length() == 0) m_sVarNameEleOLRElectron = "TauScaleFactorEleOLRElectron";
-
-        CommonEfficiencyTool* tTool = new CommonEfficiencyTool(name()+"_EleOLRElectronTool");
-        if (tTool->setProperty("InputFilePath", m_sInputFilePathEleOLRElectron).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("VarName", m_sVarNameEleOLRElectron).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("WP", ConvertEleOLRToString(m_iOLRLevel)).isFailure()) return StatusCode::FAILURE;
-        m_vCommonEfficiencyTools.push_back(tTool);
-      }
-      else if (iEfficiencyCorrectionType == SFRecoHadTau)
-      {
-        // only set vars if they differ from "", which means they have been configured by the user
-        if (m_sInputFilePathRecoHadTau.empty()) m_sInputFilePathRecoHadTau = sDirectory+"Reco_TrueHadTau_mc15-prerec.root";
-        if (m_sVarNameRecoHadTau.length() == 0) m_sVarNameRecoHadTau = "TauScaleFactorReconstructionHadTau";
-
-        CommonEfficiencyTool* tTool = new CommonEfficiencyTool(name()+"_ReconstructionHadTauTool");
-        if (tTool->setProperty("InputFilePath", m_sInputFilePathRecoHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("VarName", m_sVarNameRecoHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck).isFailure()) return StatusCode::FAILURE;
-        m_vCommonEfficiencyTools.push_back(tTool);
-      }
-      else if (iEfficiencyCorrectionType == SFTriggerHadTau)
-      {
-        // only set vars if they differ from "", which means they have been configured by the user
-        if (m_sInputFilePathTriggerHadTau.empty())
-        {
-          if (m_sTriggerName.empty()) ATH_MSG_FATAL("Property \"Trigger\" was not set, please provide a trigger name.");
-          if (m_bUseTriggerInclusiveEta) m_sInputFilePathTriggerHadTau = sDirectory+"Trigger/Trigger_TrueHadTau_mc15-prerec_"+m_sTriggerName+"_etainc.root";
-          else m_sInputFilePathTriggerHadTau                           = sDirectory+"Trigger/Trigger_TrueHadTau_mc15-prerec_"+m_sTriggerName+"_etaexcl.root";
-        }
-        if (m_sVarNameTriggerHadTau.length() == 0) m_sVarNameTriggerHadTau = "TauScaleFactorTriggerHadTau";
-        CommonEfficiencyTool* tTool = new TauEfficiencyTriggerTool(name()+"_TriggerHadTauTool");
-        if (tTool->setProperty("InputFilePath", m_sInputFilePathTriggerHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("VarName", m_sVarNameTriggerHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("WP", ConvertTriggerIDToString(m_iIDLevel)).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("PeriodBinning", (int)m_iTriggerPeriodBinning).isFailure()) return StatusCode::FAILURE;
-        m_vCommonEfficiencyTools.push_back(tTool);
-      }
-    }
-  }
+  if (m_sRecommendationTag == "2016-fall")
+    ATH_CHECK(initializeTools_2016_fall());
+  else if (m_sRecommendationTag == "2016-ichep")
+    ATH_CHECK(initializeTools_2016_ichep());
+  else if (m_sRecommendationTag == "mc15-moriond")
+    ATH_CHECK(initializeTools_mc15_moriond());
   else if (m_sRecommendationTag == "mc15-pre-recommendations")
-  {
-    for (auto iEfficiencyCorrectionType : m_vEfficiencyCorrectionTypes)
-    {
-      if (iEfficiencyCorrectionType == SFJetIDHadTau)
-      {
-        // only set vars if they differ from "", which means they have been configured by the user
-        if (m_sInputFilePathJetIDHadTau.empty()) m_sInputFilePathJetIDHadTau = sDirectory+"JetID_TrueHadTau_mc15-prerec.root";
-        if (m_sVarNameJetIDHadTau.length() == 0) m_sVarNameJetIDHadTau = "TauScaleFactorJetIDHadTau";
-        CommonEfficiencyTool* tTool = new CommonEfficiencyTool(name()+"_JetIDHadTauTool");
-        if (tTool->setProperty("InputFilePath", m_sInputFilePathJetIDHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("VarName", m_sVarNameJetIDHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("WP", ConvertJetIDToString(m_iIDLevel)).isFailure()) return StatusCode::FAILURE;
-        m_vCommonEfficiencyTools.push_back(tTool);
-      }
-      else if (iEfficiencyCorrectionType == SFEleOLRHadTau)
-      {
-        // only set vars if they differ from "", which means they have been configured by the user
-        if (m_sInputFilePathEleOLRHadTau.empty()) m_sInputFilePathEleOLRHadTau = sDirectory+"EleOLR_TrueHadTau_mc15-prerec.root";
-        if (m_sVarNameEleOLRHadTau.length() == 0) m_sVarNameEleOLRHadTau = "TauScaleFactorEleOLRHadTau";
-
-        CommonEfficiencyTool* tTool = new CommonEfficiencyTool(name()+"_EleOLRHadTauTool");
-        if (tTool->setProperty("InputFilePath", m_sInputFilePathEleOLRHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("VarName", m_sVarNameEleOLRHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck).isFailure()) return StatusCode::FAILURE;
-        m_vCommonEfficiencyTools.push_back(tTool);
-      }
-      else if (iEfficiencyCorrectionType == SFRecoHadTau)
-      {
-        // only set vars if they differ from "", which means they have been configured by the user
-        if (m_sInputFilePathRecoHadTau.empty()) m_sInputFilePathRecoHadTau = sDirectory+"Reco_TrueHadTau_mc15-prerec.root";
-        if (m_sVarNameRecoHadTau.length() == 0) m_sVarNameRecoHadTau = "TauScaleFactorReconstructionHadTau";
-
-        CommonEfficiencyTool* tTool = new CommonEfficiencyTool(name()+"_ReconstructionHadTauTool");
-        if (tTool->setProperty("InputFilePath", m_sInputFilePathRecoHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("VarName", m_sVarNameRecoHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck).isFailure()) return StatusCode::FAILURE;
-        m_vCommonEfficiencyTools.push_back(tTool);
-      }
-      else if (iEfficiencyCorrectionType == SFTriggerHadTau)
-      {
-        // only set vars if they differ from "", which means they have been configured by the user
-        if (m_sInputFilePathTriggerHadTau.empty())
-        {
-          if (m_sTriggerName.empty()) ATH_MSG_FATAL("Property \"Trigger\" was not set, please provide a trigger name.");
-          if (m_bUseTriggerInclusiveEta) m_sInputFilePathTriggerHadTau = sDirectory+"Trigger/Trigger_TrueHadTau_mc15-prerec_"+m_sTriggerName+"_etainc.root";
-          else m_sInputFilePathTriggerHadTau                           = sDirectory+"Trigger/Trigger_TrueHadTau_mc15-prerec_"+m_sTriggerName+"_etaexcl.root";
-        }
-        if (m_sVarNameTriggerHadTau.length() == 0) m_sVarNameTriggerHadTau = "TauScaleFactorTriggerHadTau";
-        CommonEfficiencyTool* tTool = new TauEfficiencyTriggerTool(name()+"_TriggerHadTauTool");
-        if (tTool->setProperty("InputFilePath", m_sInputFilePathTriggerHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("VarName", m_sVarNameTriggerHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("WP", ConvertTriggerIDToString(m_iIDLevel)).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("PeriodBinning", (int)m_iTriggerPeriodBinning).isFailure()) return StatusCode::FAILURE;
-        m_vCommonEfficiencyTools.push_back(tTool);
-      }
-    }
-  }
+    ATH_CHECK(initializeTools_mc15_pre_recommendations());
   else if (m_sRecommendationTag == "mc12-final")
-  {
-    for (auto iEfficiencyCorrectionType : m_vEfficiencyCorrectionTypes)
-    {
-      if (iEfficiencyCorrectionType == SFJetID or iEfficiencyCorrectionType == SFJetIDHadTau )
-      {
-        // only set vars if they differ from "", which means they have been configured by the user
-        if (m_sInputFilePathJetIDHadTau.empty())
-        {
-          if (m_bUsePtBinnedSF)
-          {
-            if (m_bUseInclusiveEta) m_sInputFilePathJetIDHadTau = sDirectory+"JetID_TrueHadTau_mc12-final_ptbin_etainc.root";
-            else                    m_sInputFilePathJetIDHadTau = sDirectory+"JetID_TrueHadTau_mc12-final_ptbin_etabin.root";
-          }
-          else
-          {
-            if (m_bUseInclusiveEta) m_sInputFilePathJetIDHadTau = sDirectory+"JetID_TrueHadTau_mc12-final_ptinc_etainc.root";
-            else                    m_sInputFilePathJetIDHadTau = sDirectory+"JetID_TrueHadTau_mc12-final_ptinc_etabin.root";
-          }
-        }
-        if (m_sVarNameJetIDHadTau.length() == 0) m_sVarNameJetIDHadTau = "TauScaleFactorJetIDHadTau";
-        CommonEfficiencyTool* tTool = new TauEfficiencyJetIDTool(name()+"_JetIDHadTauTool");
-        if (tTool->setProperty("InputFilePath", m_sInputFilePathJetIDHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("VarName", m_sVarNameJetIDHadTau).isFailure()) return StatusCode::FAILURE;
-        tTool->setParent(this);
-        m_vCommonEfficiencyTools.push_back(tTool);
-
-      }
-      else if (iEfficiencyCorrectionType == SFContJetID)
-      {
-        // only set vars if they differ from "", which means they have been configured by the user
-        if (m_sInputFilePathContJetIDHadTau.empty()) m_sInputFilePathContJetIDHadTau = sDirectory+"ContJetIDSF.root";
-        if (m_sVarNameContJetIDHadTau.length() == 0) m_sVarNameContJetIDHadTau = "TauScaleFactorContJetIDHadTau";
-        CommonEfficiencyTool* tTool = new TauEfficiencyContJetIDTool(name()+"TauEfficiencyContJetIDHadTauTool");
-        if (tTool->setProperty("InputFilePath", m_sInputFilePathContJetIDHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("VarName", m_sVarNameContJetIDHadTau).isFailure()) return StatusCode::FAILURE;
-        tTool->setParent(this);
-        m_vCommonEfficiencyTools.push_back(tTool);
-      }
-      else if (iEfficiencyCorrectionType == SFEleID or iEfficiencyCorrectionType == SFEleIDHadTau)
-      {
-        // only set vars if they differ from "", which means they have been configured by the user
-        if (m_sInputFilePathEleIDHadTau.empty()) m_sInputFilePathEleIDHadTau = sDirectory+"EleID_TrueHadTau_mc12-final.root";
-        if (m_sVarNameEleIDHadTau.length() == 0) m_sVarNameEleIDHadTau = "TauScaleFactorEleIDHadTau";
-        CommonEfficiencyTool* tTool = new TauEfficiencyEleIDTool(name()+"TauEfficiencyEleIDHadTauToolg");
-        if (tTool->setProperty("InputFilePath", m_sInputFilePathEleIDHadTau).isFailure()) return StatusCode::FAILURE;
-        if (tTool->setProperty("VarName", m_sVarNameEleIDHadTau).isFailure()) return StatusCode::FAILURE;
-        tTool->setParent(this);
-        m_vCommonEfficiencyTools.push_back(tTool);
-      }
-    }
-  }
+    ATH_CHECK(initializeTools_mc12_final());
   else
   {
     ATH_MSG_FATAL("Unknown RecommendationTag: "<<m_sRecommendationTag);
     return StatusCode::FAILURE;
   }
 
-  for (auto tCommonEfficiencyTool : m_vCommonEfficiencyTools)
+  // for (auto tCommonEfficiencyTool : m_vCommonEfficiencyTools)
+  for (auto it = m_vCommonEfficiencyTools.begin(); it != m_vCommonEfficiencyTools.end(); it++)
   {
-    tCommonEfficiencyTool->msg().setLevel( this->msg().level() );
-    tCommonEfficiencyTool->setParent(this);
-    ATH_CHECK(tCommonEfficiencyTool->initialize());
+    ATH_CHECK((**it).setProperty("OutputLevel", this->msg().level()));
+    ATH_CHECK((**it).initialize());
+  }
+  for (auto it = m_vTriggerEfficiencyTools.begin(); it != m_vTriggerEfficiencyTools.end(); it++)
+  {
+    ATH_CHECK((**it).setProperty("OutputLevel", this->msg().level()));
+    ATH_CHECK((**it).initialize());
   }
 
   // Add the affecting systematics to the global registry
@@ -399,6 +232,30 @@ StatusCode TauEfficiencyCorrectionsTool::initialize()
   return StatusCode::SUCCESS;
 }
 
+StatusCode TauEfficiencyCorrectionsTool::beginEvent()
+{
+  if (!m_bIsConfigured)
+  {
+    const xAOD::EventInfo* xEventInfo = 0;
+    ATH_CHECK(evtStore()->retrieve(xEventInfo,"EventInfo"));
+    m_bIsData = !(xEventInfo->eventType( xAOD::EventInfo::IS_SIMULATION));
+    m_bIsConfigured=true;
+  }
+
+  if (m_bIsData)
+    return StatusCode::SUCCESS;
+
+#ifdef TAUANALYSISTOOLS_PRWTOOL_AVAILABLE
+  if (m_tPRWTool.empty())
+    return StatusCode::SUCCESS;
+
+  const xAOD::EventInfo* xEventInfo = 0;
+  ATH_CHECK(evtStore()->retrieve(xEventInfo, m_sEventInfoName ));
+  m_iRunNumber = m_tPRWTool->getRandomRunNumber(*xEventInfo);
+#endif // TAUANALYSISTOOLS_PRWTOOL_AVAILABLE
+  return StatusCode::SUCCESS;
+}
+
 //______________________________________________________________________________
 void TauEfficiencyCorrectionsTool::printConfig(bool bAlways)
 {
@@ -421,6 +278,7 @@ void TauEfficiencyCorrectionsTool::printConfig(bool bAlways)
     ATH_MSG_ALWAYS( "  VarNameTriggerHadTau " << m_sVarNameTriggerHadTau );
     ATH_MSG_ALWAYS( "  RecommendationTag " << m_sRecommendationTag );
     ATH_MSG_ALWAYS( "  TriggerName " << m_sTriggerName );
+    ATH_MSG_ALWAYS( "  TriggerYear " << m_sTriggerYear );
 
     ATH_MSG_ALWAYS( "  UseIDExclusiveSF " << m_bUseIDExclusiveSF );
     ATH_MSG_ALWAYS( "  UseInclusiveEta " << m_bUseInclusiveEta );
@@ -452,6 +310,7 @@ void TauEfficiencyCorrectionsTool::printConfig(bool bAlways)
     ATH_MSG_DEBUG( "  VarNameTriggerHadTau " << m_sVarNameTriggerHadTau );
     ATH_MSG_DEBUG( "  RecommendationTag " << m_sRecommendationTag );
     ATH_MSG_DEBUG( "  TriggerName " << m_sTriggerName );
+    ATH_MSG_DEBUG( "  TriggerYear " << m_sTriggerYear );
 
     ATH_MSG_DEBUG( "  UseIDExclusiveSF " << m_bUseIDExclusiveSF );
     ATH_MSG_DEBUG( "  UseInclusiveEta " << m_bUseInclusiveEta );
@@ -471,10 +330,24 @@ CP::CorrectionCode TauEfficiencyCorrectionsTool::getEfficiencyScaleFactor( const
     double& eff )
 {
   eff = 1.;
-  for (auto tCommonEfficiencyTool : m_vCommonEfficiencyTools)
+
+  if (m_bIsData)
+    return CP::CorrectionCode::Ok;
+
+  for (auto it = m_vCommonEfficiencyTools.begin(); it != m_vCommonEfficiencyTools.end(); it++)
+  {
+    double dToolEff = 1.;
+    CP::CorrectionCode tmpCorrectionCode = (**it)->getEfficiencyScaleFactor(xTau, dToolEff);
+    if (tmpCorrectionCode != CP::CorrectionCode::Ok)
+      return tmpCorrectionCode;
+    eff *= dToolEff;
+  }
+  for (auto it = m_vTriggerEfficiencyTools.begin(); it != m_vTriggerEfficiencyTools.end(); it++)
   {
+    if ( !(**it)->isSupportedRunNumber(m_iRunNumber) )
+      continue;
     double dToolEff = 1.;
-    CP::CorrectionCode tmpCorrectionCode = tCommonEfficiencyTool->getEfficiencyScaleFactor(xTau, dToolEff);
+    CP::CorrectionCode tmpCorrectionCode = (**it)->getEfficiencyScaleFactor(xTau, dToolEff);
     if (tmpCorrectionCode != CP::CorrectionCode::Ok)
       return tmpCorrectionCode;
     eff *= dToolEff;
@@ -485,9 +358,20 @@ CP::CorrectionCode TauEfficiencyCorrectionsTool::getEfficiencyScaleFactor( const
 //______________________________________________________________________________
 CP::CorrectionCode TauEfficiencyCorrectionsTool::applyEfficiencyScaleFactor( const xAOD::TauJet& xTau )
 {
-  for (auto tCommonEfficiencyTool : m_vCommonEfficiencyTools)
+  if (m_bIsData)
+    return CP::CorrectionCode::Ok;
+
+  for (auto it = m_vCommonEfficiencyTools.begin(); it != m_vCommonEfficiencyTools.end(); it++)
   {
-    CP::CorrectionCode tmpCorrectionCode = tCommonEfficiencyTool->applyEfficiencyScaleFactor(xTau);
+    CP::CorrectionCode tmpCorrectionCode = (**it)->applyEfficiencyScaleFactor(xTau);
+    if (tmpCorrectionCode != CP::CorrectionCode::Ok)
+      return tmpCorrectionCode;
+  }
+  for (auto it = m_vTriggerEfficiencyTools.begin(); it != m_vTriggerEfficiencyTools.end(); it++)
+  {
+    if ( !(**it)->isSupportedRunNumber(m_iRunNumber) )
+      continue;
+    CP::CorrectionCode tmpCorrectionCode = (**it)->applyEfficiencyScaleFactor(xTau);
     if (tmpCorrectionCode != CP::CorrectionCode::Ok)
       return tmpCorrectionCode;
   }
@@ -498,8 +382,11 @@ CP::CorrectionCode TauEfficiencyCorrectionsTool::applyEfficiencyScaleFactor( con
 //______________________________________________________________________________
 bool TauEfficiencyCorrectionsTool::isAffectedBySystematic( const CP::SystematicVariation& systematic ) const
 {
-  for (auto tCommonEfficiencyTool : m_vCommonEfficiencyTools)
-    if (tCommonEfficiencyTool->isAffectedBySystematic(systematic))
+  for (auto it = m_vCommonEfficiencyTools.begin(); it != m_vCommonEfficiencyTools.end(); it++)
+    if ((**it)->isAffectedBySystematic(systematic))
+      return true;
+  for (auto it = m_vTriggerEfficiencyTools.begin(); it != m_vTriggerEfficiencyTools.end(); it++)
+    if ((**it)->isAffectedBySystematic(systematic))
       return true;
   return false;
 }
@@ -509,8 +396,10 @@ bool TauEfficiencyCorrectionsTool::isAffectedBySystematic( const CP::SystematicV
 CP::SystematicSet TauEfficiencyCorrectionsTool::affectingSystematics() const
 {
   CP::SystematicSet sAffectingSystematics;
-  for (auto tCommonEfficiencyTool : m_vCommonEfficiencyTools)
-    sAffectingSystematics.insert(tCommonEfficiencyTool->affectingSystematics());
+  for (auto it = m_vCommonEfficiencyTools.begin(); it != m_vCommonEfficiencyTools.end(); it++)
+    sAffectingSystematics.insert((**it)->affectingSystematics());
+  for (auto it = m_vTriggerEfficiencyTools.begin(); it != m_vTriggerEfficiencyTools.end(); it++)
+    sAffectingSystematics.insert((**it)->affectingSystematics());
   return sAffectingSystematics;
 }
 
@@ -519,31 +408,546 @@ CP::SystematicSet TauEfficiencyCorrectionsTool::affectingSystematics() const
 CP::SystematicSet TauEfficiencyCorrectionsTool::recommendedSystematics() const
 {
   CP::SystematicSet sRecommendedSystematics;
-  for (auto tCommonEfficiencyTool : m_vCommonEfficiencyTools)
-    sRecommendedSystematics.insert(tCommonEfficiencyTool->recommendedSystematics());
+  for (auto it = m_vCommonEfficiencyTools.begin(); it != m_vCommonEfficiencyTools.end(); it++)
+    sRecommendedSystematics.insert((**it)->recommendedSystematics());
+  for (auto it = m_vTriggerEfficiencyTools.begin(); it != m_vTriggerEfficiencyTools.end(); it++)
+    sRecommendedSystematics.insert((**it)->recommendedSystematics());
   return sRecommendedSystematics;
 }
 
 //______________________________________________________________________________
 CP::SystematicCode TauEfficiencyCorrectionsTool::applySystematicVariation ( const CP::SystematicSet& sSystematicSet)
 {
-  for (auto tCommonEfficiencyTool : m_vCommonEfficiencyTools)
-    if (tCommonEfficiencyTool->applySystematicVariation(sSystematicSet) == CP::SystematicCode::Unsupported)
+  for (auto it = m_vCommonEfficiencyTools.begin(); it != m_vCommonEfficiencyTools.end(); it++)
+    if ((**it)->applySystematicVariation(sSystematicSet) == CP::SystematicCode::Unsupported)
+      return CP::SystematicCode::Unsupported;
+  for (auto it = m_vTriggerEfficiencyTools.begin(); it != m_vTriggerEfficiencyTools.end(); it++)
+    if ((**it)->applySystematicVariation(sSystematicSet) == CP::SystematicCode::Unsupported)
       return CP::SystematicCode::Unsupported;
   return CP::SystematicCode::Ok;
 }
 
+//=================================PRIVATE-PART=================================
+
 //______________________________________________________________________________
-StatusCode TauEfficiencyCorrectionsTool::setRunNumber(int iRunNumber)
+StatusCode TauEfficiencyCorrectionsTool::initializeTools_2016_fall()
 {
-  // avoid compiler warning
-  (void)iRunNumber;
-  ATH_MSG_FATAL("Functionality not fully implemented, sorry.");
-  return StatusCode::FAILURE;
+  std::string sDirectory = "TauAnalysisTools/"+std::string(sSharedFilesVersion)+"/EfficiencyCorrections/";
+  for (auto iEfficiencyCorrectionType : m_vEfficiencyCorrectionTypes)
+  {
+    if (iEfficiencyCorrectionType == SFJetIDHadTau)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathJetIDHadTau.empty()) m_sInputFilePathJetIDHadTau = sDirectory+"JetID_TrueHadTau_2016-ichep.root";
+      if (m_sVarNameJetIDHadTau.length() == 0) m_sVarNameJetIDHadTau = "TauScaleFactorJetIDHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("JetIDHadTauTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::CommonEfficiencyTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathJetIDHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameJetIDHadTau));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+      ATH_CHECK(tTool->setProperty("WP", ConvertJetIDToString(m_iIDLevel)));
+    }
+    else if (iEfficiencyCorrectionType == SFEleOLRHadTau)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathEleOLRHadTau.empty()) m_sInputFilePathEleOLRHadTau = sDirectory+"EleOLR_TrueHadTau_2016-ichep.root";
+      if (m_sVarNameEleOLRHadTau.length() == 0) m_sVarNameEleOLRHadTau = "TauScaleFactorEleOLRHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("EleOLRHadTauTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::CommonEfficiencyTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathEleOLRHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameEleOLRHadTau));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+    }
+    else if (iEfficiencyCorrectionType == SFEleOLRElectron)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathEleOLRElectron.empty()) m_sInputFilePathEleOLRElectron = sDirectory+"EleOLR_TrueElectron_2016-ichep.root";
+      if (m_sVarNameEleOLRElectron.length() == 0) m_sVarNameEleOLRElectron = "TauScaleFactorEleOLRElectron";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("EleOLRElectronTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::CommonEfficiencyTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathEleOLRElectron));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameEleOLRElectron));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+      ATH_CHECK(tTool->setProperty("WP", ConvertEleOLRToString(m_iOLRLevel)));
+    }
+    else if (iEfficiencyCorrectionType == SFRecoHadTau)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathRecoHadTau.empty()) m_sInputFilePathRecoHadTau = sDirectory+"Reco_TrueHadTau_2016-ichep.root";
+      if (m_sVarNameRecoHadTau.length() == 0) m_sVarNameRecoHadTau = "TauScaleFactorReconstructionHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("RecoHadTauTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::CommonEfficiencyTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathRecoHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameRecoHadTau));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+    }
+    else if (iEfficiencyCorrectionType == SFTriggerHadTau)
+    {
+#ifdef TAUANALYSISTOOLS_PRWTOOL_AVAILABLE
+      if (m_tPRWTool.empty())   // use single setup
+      {
+        // only set vars if they differ from "", which means they have been configured by the user
+        if (m_sInputFilePathTriggerHadTau.empty())
+        {
+          if (m_sTriggerName.empty()) ATH_MSG_FATAL("Property \"Trigger\" was not set, please provide a trigger name.");
+          if (m_bUseTriggerInclusiveEta) m_sInputFilePathTriggerHadTau = sDirectory+"Trigger/Trigger_TrueHadTau_2016-fall_data"+m_sTriggerYear+"_"+m_sTriggerName+"_etainc.root";
+          else
+          {
+            ATH_MSG_ERROR("eta exclusive scale factors not available");
+            return StatusCode::FAILURE;
+          }
+        }
+        if (m_sVarNameTriggerHadTau.length() == 0) m_sVarNameTriggerHadTau = "TauScaleFactorTriggerHadTau";
+
+        asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("TriggerHadTauTool", this);
+        m_vTriggerEfficiencyTools.push_back(tTool);
+        ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::TauEfficiencyTriggerTool));
+        ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathTriggerHadTau));
+        ATH_CHECK(tTool->setProperty("VarName", m_sVarNameTriggerHadTau));
+        ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+        ATH_CHECK(tTool->setProperty("WP", ConvertTriggerIDToString(m_iIDLevel)));
+        ATH_CHECK(tTool->setProperty("PeriodBinning", (int)m_iTriggerPeriodBinning));
+      }
+      else                      // setup two tools
+#endif // TAUANALYSISTOOLS_PRWTOOL_AVAILABLE
+      {
+        if (m_sVarNameTriggerHadTau.length() == 0) m_sVarNameTriggerHadTau = "TauScaleFactorTriggerHadTau";
+
+        std::string sInputFilePathTriggerHadTau("");
+        if (m_sTriggerName != "HLT_tau160_medium1_tracktwo")
+        {
+          // only set vars if they differ from "", which means they have been configured by the user
+          if (m_sInputFilePathTriggerHadTau.empty())
+          {
+            if (m_sTriggerName.empty()) ATH_MSG_FATAL("Property \"Trigger\" was not set, please provide a trigger name.");
+            if (m_bUseTriggerInclusiveEta) sInputFilePathTriggerHadTau = sDirectory+"Trigger/Trigger_TrueHadTau_2016-fall_data2015_"+m_sTriggerName+"_etainc.root";
+            else
+            {
+              ATH_MSG_ERROR("eta exclusive scale factors not available");
+              return StatusCode::FAILURE;
+            }
+          }
+          else
+            sInputFilePathTriggerHadTau = m_sInputFilePathTriggerHadTau;
+
+          asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool_2015 = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("TriggerHadTauTool_2015", this);
+          m_vTriggerEfficiencyTools.push_back(tTool_2015);
+          ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool_2015, TauAnalysisTools::TauEfficiencyTriggerTool));
+          ATH_CHECK(tTool_2015->setProperty("InputFilePath", sInputFilePathTriggerHadTau));
+          ATH_CHECK(tTool_2015->setProperty("VarName", m_sVarNameTriggerHadTau));
+          ATH_CHECK(tTool_2015->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+          ATH_CHECK(tTool_2015->setProperty("WP", ConvertTriggerIDToString(m_iIDLevel)));
+          ATH_CHECK(tTool_2015->setProperty("PeriodBinning", (int)m_iTriggerPeriodBinning));
+          ATH_CHECK(tTool_2015->setProperty("MaxRunNumber", 284484));
+        }
+
+        if (m_sInputFilePathTriggerHadTau.empty())
+        {
+          if (m_sTriggerName.empty()) ATH_MSG_FATAL("Property \"Trigger\" was not set, please provide a trigger name.");
+          if (m_bUseTriggerInclusiveEta) sInputFilePathTriggerHadTau = sDirectory+"Trigger/Trigger_TrueHadTau_2016-fall_data2016_"+m_sTriggerName+"_etainc.root";
+          else
+          {
+            ATH_MSG_ERROR("eta exclusive scale factors not available");
+            return StatusCode::FAILURE;
+          }
+        }
+        else
+          sInputFilePathTriggerHadTau = m_sInputFilePathTriggerHadTau;
+
+        asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool_2016 = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("TriggerHadTauTool_2016", this);
+        m_vTriggerEfficiencyTools.push_back(tTool_2016);
+        ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool_2016, TauAnalysisTools::TauEfficiencyTriggerTool));
+        ATH_CHECK(tTool_2016->setProperty("InputFilePath", sInputFilePathTriggerHadTau));
+        ATH_CHECK(tTool_2016->setProperty("VarName", m_sVarNameTriggerHadTau));
+        ATH_CHECK(tTool_2016->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+        ATH_CHECK(tTool_2016->setProperty("WP", ConvertTriggerIDToString(m_iIDLevel)));
+        ATH_CHECK(tTool_2016->setProperty("PeriodBinning", (int)m_iTriggerPeriodBinning));
+        ATH_CHECK(tTool_2016->setProperty("MinRunNumber", 296939));
+      }
+    }
+    else
+    {
+      ATH_MSG_WARNING("unsupported EfficiencyCorrectionsType with enum "<<iEfficiencyCorrectionType);
+    }
+  }
+  return StatusCode::SUCCESS;
 }
 
+//______________________________________________________________________________
+StatusCode TauEfficiencyCorrectionsTool::initializeTools_2016_ichep()
+{
+  std::string sDirectory = "TauAnalysisTools/"+std::string(sSharedFilesVersion)+"/EfficiencyCorrections/";
+  for (auto iEfficiencyCorrectionType : m_vEfficiencyCorrectionTypes)
+  {
+    if (iEfficiencyCorrectionType == SFJetIDHadTau)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathJetIDHadTau.empty()) m_sInputFilePathJetIDHadTau = sDirectory+"JetID_TrueHadTau_2016-ichep.root";
+      if (m_sVarNameJetIDHadTau.length() == 0) m_sVarNameJetIDHadTau = "TauScaleFactorJetIDHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("JetIDHadTauTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::CommonEfficiencyTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathJetIDHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameJetIDHadTau));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+      ATH_CHECK(tTool->setProperty("WP", ConvertJetIDToString(m_iIDLevel)));
+    }
+    else if (iEfficiencyCorrectionType == SFEleOLRHadTau)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathEleOLRHadTau.empty()) m_sInputFilePathEleOLRHadTau = sDirectory+"EleOLR_TrueHadTau_2016-ichep.root";
+      if (m_sVarNameEleOLRHadTau.length() == 0) m_sVarNameEleOLRHadTau = "TauScaleFactorEleOLRHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("EleOLRHadTauTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::CommonEfficiencyTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathEleOLRHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameEleOLRHadTau));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+    }
+    else if (iEfficiencyCorrectionType == SFEleOLRElectron)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathEleOLRElectron.empty()) m_sInputFilePathEleOLRElectron = sDirectory+"EleOLR_TrueElectron_2016-ichep.root";
+      if (m_sVarNameEleOLRElectron.length() == 0) m_sVarNameEleOLRElectron = "TauScaleFactorEleOLRElectron";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("EleOLRElectronTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::CommonEfficiencyTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathEleOLRElectron));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameEleOLRElectron));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+      ATH_CHECK(tTool->setProperty("WP", ConvertEleOLRToString(m_iOLRLevel)));
+    }
+    else if (iEfficiencyCorrectionType == SFRecoHadTau)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathRecoHadTau.empty()) m_sInputFilePathRecoHadTau = sDirectory+"Reco_TrueHadTau_2016-ichep.root";
+      if (m_sVarNameRecoHadTau.length() == 0) m_sVarNameRecoHadTau = "TauScaleFactorReconstructionHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("RecoHadTauTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::CommonEfficiencyTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathRecoHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameRecoHadTau));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+    }
+    else if (iEfficiencyCorrectionType == SFTriggerHadTau)
+    {
+#ifdef TAUANALYSISTOOLS_PRWTOOL_AVAILABLE
+      if (m_tPRWTool.empty())   // use single setup
+      {
+        // only set vars if they differ from "", which means they have been configured by the user
+        if (m_sInputFilePathTriggerHadTau.empty())
+        {
+          if (m_sTriggerName.empty()) ATH_MSG_FATAL("Property \"Trigger\" was not set, please provide a trigger name.");
+          if (m_bUseTriggerInclusiveEta) m_sInputFilePathTriggerHadTau = sDirectory+"Trigger/Trigger_TrueHadTau_2016-ichep_data"+m_sTriggerYear+"_"+m_sTriggerName+"_etainc.root";
+          else m_sInputFilePathTriggerHadTau                           = sDirectory+"Trigger/Trigger_TrueHadTau_2016-ichep_data"+m_sTriggerYear+"_"+m_sTriggerName+"_etaexcl.root";
+        }
+        if (m_sVarNameTriggerHadTau.length() == 0) m_sVarNameTriggerHadTau = "TauScaleFactorTriggerHadTau";
+
+        asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("TriggerHadTauTool", this);
+        m_vTriggerEfficiencyTools.push_back(tTool);
+        ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::TauEfficiencyTriggerTool));
+        ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathTriggerHadTau));
+        ATH_CHECK(tTool->setProperty("VarName", m_sVarNameTriggerHadTau));
+        ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+        ATH_CHECK(tTool->setProperty("WP", ConvertTriggerIDToString(m_iIDLevel)));
+        ATH_CHECK(tTool->setProperty("PeriodBinning", (int)m_iTriggerPeriodBinning));
+      }
+      else                      // setup two tools
+#endif // TAUANALYSISTOOLS_PRWTOOL_AVAILABLE
+      {
+        if (m_sVarNameTriggerHadTau.length() == 0) m_sVarNameTriggerHadTau = "TauScaleFactorTriggerHadTau";
+
+        // only set vars if they differ from "", which means they have been configured by the user
+        std::string sInputFilePathTriggerHadTau("");
+        if (m_sInputFilePathTriggerHadTau.empty())
+        {
+          if (m_sTriggerName.empty()) ATH_MSG_FATAL("Property \"Trigger\" was not set, please provide a trigger name.");
+          if (m_bUseTriggerInclusiveEta) sInputFilePathTriggerHadTau = sDirectory+"Trigger/Trigger_TrueHadTau_2016-ichep_data2015_"+m_sTriggerName+"_etainc.root";
+          else                           sInputFilePathTriggerHadTau = sDirectory+"Trigger/Trigger_TrueHadTau_2016-ichep_data2015_"+m_sTriggerName+"_etaexcl.root";
+        }
+        else
+          sInputFilePathTriggerHadTau = m_sInputFilePathTriggerHadTau;
+
+        asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool_2015 = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("TriggerHadTauTool_2015", this);
+        m_vTriggerEfficiencyTools.push_back(tTool_2015);
+        ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool_2015, TauAnalysisTools::TauEfficiencyTriggerTool));
+        ATH_CHECK(tTool_2015->setProperty("InputFilePath", sInputFilePathTriggerHadTau));
+        ATH_CHECK(tTool_2015->setProperty("VarName", m_sVarNameTriggerHadTau));
+        ATH_CHECK(tTool_2015->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+        ATH_CHECK(tTool_2015->setProperty("WP", ConvertTriggerIDToString(m_iIDLevel)));
+        ATH_CHECK(tTool_2015->setProperty("PeriodBinning", (int)m_iTriggerPeriodBinning));
+        // ATH_CHECK(tTool_2015->setProperty("MinRunNumber", 266904));
+        ATH_CHECK(tTool_2015->setProperty("MaxRunNumber", 284484));
+
+        if (m_sInputFilePathTriggerHadTau.empty())
+        {
+          if (m_sTriggerName.empty()) ATH_MSG_FATAL("Property \"Trigger\" was not set, please provide a trigger name.");
+          if (m_bUseTriggerInclusiveEta) sInputFilePathTriggerHadTau = sDirectory+"Trigger/Trigger_TrueHadTau_2016-ichep_data2016_"+m_sTriggerName+"_etainc.root";
+          else                           sInputFilePathTriggerHadTau = sDirectory+"Trigger/Trigger_TrueHadTau_2016-ichep_data2016_"+m_sTriggerName+"_etaexcl.root";
+        }
+        else
+          sInputFilePathTriggerHadTau = m_sInputFilePathTriggerHadTau;
+
+        asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool_2016 = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("TriggerHadTauTool_2016", this);
+        m_vTriggerEfficiencyTools.push_back(tTool_2016);
+        ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool_2016, TauAnalysisTools::TauEfficiencyTriggerTool));
+        ATH_CHECK(tTool_2016->setProperty("InputFilePath", sInputFilePathTriggerHadTau));
+        ATH_CHECK(tTool_2016->setProperty("VarName", m_sVarNameTriggerHadTau));
+        ATH_CHECK(tTool_2016->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+        ATH_CHECK(tTool_2016->setProperty("WP", ConvertTriggerIDToString(m_iIDLevel)));
+        ATH_CHECK(tTool_2016->setProperty("PeriodBinning", (int)m_iTriggerPeriodBinning));
+        ATH_CHECK(tTool_2016->setProperty("MinRunNumber", 296939));
+        // ATH_CHECK(tTool_2016->setProperty("MaxRunNumber", ));
+      }
+    }
+    else
+    {
+      ATH_MSG_WARNING("unsupported EfficiencyCorrectionsType with enum "<<iEfficiencyCorrectionType);
+    }
+  }
+  return StatusCode::SUCCESS;
+}
+
+//______________________________________________________________________________
+StatusCode TauEfficiencyCorrectionsTool::initializeTools_mc15_moriond()
+{
+  std::string sDirectory = "TauAnalysisTools/"+std::string(sSharedFilesVersion)+"/EfficiencyCorrections/";
+  for (auto iEfficiencyCorrectionType : m_vEfficiencyCorrectionTypes)
+  {
+    if (iEfficiencyCorrectionType == SFJetIDHadTau)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathJetIDHadTau.empty()) m_sInputFilePathJetIDHadTau = sDirectory+"JetID_TrueHadTau_mc15-moriond.root";
+      if (m_sVarNameJetIDHadTau.length() == 0) m_sVarNameJetIDHadTau = "TauScaleFactorJetIDHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("JetIDHadTauTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::CommonEfficiencyTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathJetIDHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameJetIDHadTau));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+      ATH_CHECK(tTool->setProperty("WP", ConvertJetIDToString(m_iIDLevel)));
+    }
+    else if (iEfficiencyCorrectionType == SFEleOLRHadTau)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathEleOLRHadTau.empty()) m_sInputFilePathEleOLRHadTau = sDirectory+"EleOLR_TrueHadTau_mc15-moriond.root";
+      if (m_sVarNameEleOLRHadTau.length() == 0) m_sVarNameEleOLRHadTau = "TauScaleFactorEleOLRHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("EleOLRHadTauTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::CommonEfficiencyTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathEleOLRHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameEleOLRHadTau));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+    }
+    else if (iEfficiencyCorrectionType == SFEleOLRElectron)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathEleOLRElectron.empty()) m_sInputFilePathEleOLRElectron = sDirectory+"EleOLR_TrueElectron_mc15-moriond.root";
+      if (m_sVarNameEleOLRElectron.length() == 0) m_sVarNameEleOLRElectron = "TauScaleFactorEleOLRElectron";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("EleOLRElectronTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::CommonEfficiencyTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathEleOLRElectron));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameEleOLRElectron));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+      ATH_CHECK(tTool->setProperty("WP", ConvertEleOLRToString(m_iOLRLevel)));
+    }
+    else if (iEfficiencyCorrectionType == SFRecoHadTau)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathRecoHadTau.empty()) m_sInputFilePathRecoHadTau = sDirectory+"Reco_TrueHadTau_mc15-prerec.root";
+      if (m_sVarNameRecoHadTau.length() == 0) m_sVarNameRecoHadTau = "TauScaleFactorReconstructionHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("ReconstructionHadTauTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::CommonEfficiencyTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathRecoHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameRecoHadTau));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+    }
+    else if (iEfficiencyCorrectionType == SFTriggerHadTau)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathTriggerHadTau.empty())
+      {
+        if (m_sTriggerName.empty()) ATH_MSG_FATAL("Property \"Trigger\" was not set, please provide a trigger name.");
+        if (m_bUseTriggerInclusiveEta) m_sInputFilePathTriggerHadTau = sDirectory+"Trigger/Trigger_TrueHadTau_mc15-prerec_"+m_sTriggerName+"_etainc.root";
+        else m_sInputFilePathTriggerHadTau                           = sDirectory+"Trigger/Trigger_TrueHadTau_mc15-prerec_"+m_sTriggerName+"_etaexcl.root";
+      }
+      if (m_sVarNameTriggerHadTau.length() == 0) m_sVarNameTriggerHadTau = "TauScaleFactorTriggerHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("TriggerHadTauTool", this);
+      m_vTriggerEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::TauEfficiencyTriggerTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathTriggerHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameTriggerHadTau));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+      ATH_CHECK(tTool->setProperty("WP", ConvertTriggerIDToString(m_iIDLevel)));
+      ATH_CHECK(tTool->setProperty("PeriodBinning", (int)m_iTriggerPeriodBinning));
+    }
+    else
+    {
+      ATH_MSG_WARNING("unsupported EfficiencyCorrectionsType with enum "<<iEfficiencyCorrectionType);
+    }
+  }
+  return StatusCode::SUCCESS;
+}
+
+//______________________________________________________________________________
+StatusCode TauEfficiencyCorrectionsTool::initializeTools_mc15_pre_recommendations()
+{
+  std::string sDirectory = "TauAnalysisTools/"+std::string(sSharedFilesVersion)+"/EfficiencyCorrections/";
+  for (auto iEfficiencyCorrectionType : m_vEfficiencyCorrectionTypes)
+  {
+    if (iEfficiencyCorrectionType == SFJetIDHadTau)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathJetIDHadTau.empty()) m_sInputFilePathJetIDHadTau = sDirectory+"JetID_TrueHadTau_mc15-prerec.root";
+      if (m_sVarNameJetIDHadTau.length() == 0) m_sVarNameJetIDHadTau = "TauScaleFactorJetIDHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("JetIDHadTauTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::CommonEfficiencyTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathJetIDHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameJetIDHadTau));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+      ATH_CHECK(tTool->setProperty("WP", ConvertJetIDToString(m_iIDLevel)));
+    }
+    else if (iEfficiencyCorrectionType == SFEleOLRHadTau)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathEleOLRHadTau.empty()) m_sInputFilePathEleOLRHadTau = sDirectory+"EleOLR_TrueHadTau_mc15-prerec.root";
+      if (m_sVarNameEleOLRHadTau.length() == 0) m_sVarNameEleOLRHadTau = "TauScaleFactorEleOLRHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("EleOLRHadTauTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::CommonEfficiencyTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathEleOLRHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameEleOLRHadTau));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+    }
+    else if (iEfficiencyCorrectionType == SFRecoHadTau)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathRecoHadTau.empty()) m_sInputFilePathRecoHadTau = sDirectory+"Reco_TrueHadTau_mc15-prerec.root";
+      if (m_sVarNameRecoHadTau.length() == 0) m_sVarNameRecoHadTau = "TauScaleFactorReconstructionHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("ReconstructionHadTauTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::CommonEfficiencyTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathRecoHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameRecoHadTau));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+    }
+    else if (iEfficiencyCorrectionType == SFTriggerHadTau)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathTriggerHadTau.empty())
+      {
+        if (m_sTriggerName.empty()) ATH_MSG_FATAL("Property \"Trigger\" was not set, please provide a trigger name.");
+        if (m_bUseTriggerInclusiveEta) m_sInputFilePathTriggerHadTau = sDirectory+"Trigger/Trigger_TrueHadTau_mc15-prerec_"+m_sTriggerName+"_etainc.root";
+        else m_sInputFilePathTriggerHadTau                           = sDirectory+"Trigger/Trigger_TrueHadTau_mc15-prerec_"+m_sTriggerName+"_etaexcl.root";
+      }
+      if (m_sVarNameTriggerHadTau.length() == 0) m_sVarNameTriggerHadTau = "TauScaleFactorTriggerHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("TriggerHadTauTool", this);
+      m_vTriggerEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::TauEfficiencyTriggerTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathTriggerHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameTriggerHadTau));
+      ATH_CHECK(tTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
+      ATH_CHECK(tTool->setProperty("WP", ConvertTriggerIDToString(m_iIDLevel)));
+      ATH_CHECK(tTool->setProperty("PeriodBinning", (int)m_iTriggerPeriodBinning));
+    }
+    else
+    {
+      ATH_MSG_WARNING("unsupported EfficiencyCorrectionsType with enum "<<iEfficiencyCorrectionType);
+    }
+  }
+  return StatusCode::SUCCESS;
+}
+
+//______________________________________________________________________________
+StatusCode TauEfficiencyCorrectionsTool::initializeTools_mc12_final()
+{
+  std::string sDirectory = "TauAnalysisTools/"+std::string(sSharedFilesVersion)+"/EfficiencyCorrections/";
+  for (auto iEfficiencyCorrectionType : m_vEfficiencyCorrectionTypes)
+  {
+    if (iEfficiencyCorrectionType == SFJetID or iEfficiencyCorrectionType == SFJetIDHadTau )
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathJetIDHadTau.empty())
+      {
+        if (m_bUsePtBinnedSF)
+        {
+          if (m_bUseInclusiveEta) m_sInputFilePathJetIDHadTau = sDirectory+"JetID_TrueHadTau_mc12-final_ptbin_etainc.root";
+          else                    m_sInputFilePathJetIDHadTau = sDirectory+"JetID_TrueHadTau_mc12-final_ptbin_etabin.root";
+        }
+        else
+        {
+          if (m_bUseInclusiveEta) m_sInputFilePathJetIDHadTau = sDirectory+"JetID_TrueHadTau_mc12-final_ptinc_etainc.root";
+          else                    m_sInputFilePathJetIDHadTau = sDirectory+"JetID_TrueHadTau_mc12-final_ptinc_etabin.root";
+        }
+      }
+      if (m_sVarNameJetIDHadTau.length() == 0) m_sVarNameJetIDHadTau = "TauScaleFactorJetIDHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("JetIDHadTauTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::TauEfficiencyJetIDTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathJetIDHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameJetIDHadTau));
+    }
+    else if (iEfficiencyCorrectionType == SFContJetID)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathContJetIDHadTau.empty()) m_sInputFilePathContJetIDHadTau = sDirectory+"ContJetIDSF.root";
+      if (m_sVarNameContJetIDHadTau.length() == 0) m_sVarNameContJetIDHadTau = "TauScaleFactorContJetIDHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("TauEfficiencyContJetIDHadTauTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::TauEfficiencyContJetIDTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathContJetIDHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameContJetIDHadTau));
+      ATH_CHECK(tTool->setProperty("ContSysType", m_iContSysType));
+    }
+    else if (iEfficiencyCorrectionType == SFEleID or iEfficiencyCorrectionType == SFEleIDHadTau)
+    {
+      // only set vars if they differ from "", which means they have been configured by the user
+      if (m_sInputFilePathEleIDHadTau.empty()) m_sInputFilePathEleIDHadTau = sDirectory+"EleID_TrueHadTau_mc12-final.root";
+      if (m_sVarNameEleIDHadTau.length() == 0) m_sVarNameEleIDHadTau = "TauScaleFactorEleIDHadTau";
+
+      asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* tTool = new asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>("TauEfficiencyEleIDHadTauTool", this);
+      m_vCommonEfficiencyTools.push_back(tTool);
+      ATH_CHECK(ASG_MAKE_ANA_TOOL(*tTool, TauAnalysisTools::TauEfficiencyEleIDTool));
+      ATH_CHECK(tTool->setProperty("InputFilePath", m_sInputFilePathEleIDHadTau));
+      ATH_CHECK(tTool->setProperty("VarName", m_sVarNameEleIDHadTau));
+      ATH_CHECK(tTool->setProperty("IDLevel", m_iIDLevel));
+      ATH_CHECK(tTool->setProperty("EVLevel", m_iEVLevel));
+      ATH_CHECK(tTool->setProperty("OLRLevel", m_iOLRLevel));
+    }
+    else
+    {
+      ATH_MSG_WARNING("unsupported EfficiencyCorrectionsType with enum "<<iEfficiencyCorrectionType);
+    }
+  }
+  return StatusCode::SUCCESS;
+}
 
-//=================================PRIVATE-PART=================================
 //______________________________________________________________________________
 std::string TauEfficiencyCorrectionsTool::ConvertJetIDToString(const int& iLevel)
 {
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyEleIDTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyEleIDTool.cxx
index 55a1c677c06..5df222c3995 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyEleIDTool.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyEleIDTool.cxx
@@ -9,16 +9,12 @@ using namespace TauAnalysisTools;
 
 //=================================PUBLIC-PART==================================
 //______________________________________________________________________________
-TauEfficiencyEleIDTool::TauEfficiencyEleIDTool(std::string sName) :
-  CommonEfficiencyTool(sName)
-  , m_iIDLevelCache(JETIDNONEUNCONFIGURED)
-  , m_iEVLevelCache(ELEIDNONEUNCONFIGURED)
-  , m_iOLRLevelCache(ELEIDNONEUNCONFIGURED)
+TauEfficiencyEleIDTool::TauEfficiencyEleIDTool(std::string sName)
+  : CommonEfficiencyTool(sName)
+  , m_sWorkingPoint_1p("")
+  , m_sWorkingPoint_3p("")
 {
   m_sSystematicSet = new CP::SystematicSet();
-  m_iSysDirection = 0;
-
-  ATH_MSG_WARNING("implement string caching!!!");
 }
 
 //______________________________________________________________________________
@@ -26,6 +22,12 @@ TauEfficiencyEleIDTool::~TauEfficiencyEleIDTool()
 {
 }
 
+StatusCode TauEfficiencyEleIDTool::initialize()
+{
+  setupWorkingPointSubstrings();
+  return CommonEfficiencyTool::initialize();
+}
+
 //______________________________________________________________________________
 CP::CorrectionCode TauEfficiencyEleIDTool::getEfficiencyScaleFactor(const xAOD::TauJet& xTau,
     double& dEfficiencyScaleFactor)
@@ -37,16 +39,6 @@ CP::CorrectionCode TauEfficiencyEleIDTool::getEfficiencyScaleFactor(const xAOD::
     return CP::CorrectionCode::Ok;
   }
 
-  // only recreate m_sIDLevel if user changed the IDLevel through the tool
-  // properties
-  if (m_iIDLevelCache != m_tTECT->m_iIDLevel && m_iEVLevelCache != m_tTECT->m_iEVLevel &&  m_iOLRLevelCache != m_tTECT->m_iOLRLevel)
-  {
-    m_iIDLevelCache = m_tTECT->m_iIDLevel;
-    m_iEVLevelCache = m_tTECT->m_iEVLevel;
-    m_iOLRLevelCache = m_tTECT->m_iOLRLevel;
-    setupWorkingPointSubstrings();
-  }
-
   // get prong extension for histogram name
   std::string sWorkingPoint = (xTau.nTracks() == 1) ? m_sWorkingPoint_1p : m_sWorkingPoint_3p;
 
@@ -104,25 +96,29 @@ CP::CorrectionCode TauEfficiencyEleIDTool::getEfficiencyScaleFactor(const xAOD::
 //______________________________________________________________________________
 void TauEfficiencyEleIDTool::setupWorkingPointSubstrings()
 {
-  m_sIDLevel = convertIDToString(m_tTECT->m_iIDLevel);
-  m_sEVLevel = convertEVetoToString(m_tTECT->m_iEVLevel);
-  m_sOLRLevel = convertOLRToString(m_tTECT->m_iOLRLevel);
+  std::string sIDLevel = convertIDToString(m_iIDLevel);
+  std::string sEVLevel = convertEVetoToString(m_iEVLevel);
+  std::string sOLRLevel = convertOLRToString(m_iOLRLevel);
+
+  std::string sIDLevel_eveto3p;
+  std::string sEVLevel_eveto3p;
+  std::string sOLRLevel_eveto3p;
 
-  if(m_tTECT->m_iIDLevel != JETIDBDTMEDIUM || m_tTECT->m_iEVLevel != ELEIDBDTLOOSE || m_tTECT->m_iOLRLevel != OLRTIGHTPP)
+  if(m_iIDLevel != JETIDBDTMEDIUM || m_iEVLevel != ELEIDBDTLOOSE || m_iOLRLevel != OLRTIGHTPP)
   {
-    m_sIDLevel_eveto3p = convertIDToString(JETIDBDTOTHER);
-    m_sEVLevel_eveto3p = convertEVetoToString(ELEIDOTHER);
-    m_sOLRLevel_eveto3p = convertOLRToString(OLROTHER);
+    sIDLevel_eveto3p = convertIDToString(JETIDBDTOTHER);
+    sEVLevel_eveto3p = convertEVetoToString(ELEIDOTHER);
+    sOLRLevel_eveto3p = convertOLRToString(OLROTHER);
   }
   else
   {
-    m_sIDLevel_eveto3p = m_sIDLevel;
-    m_sEVLevel_eveto3p = m_sEVLevel;
-    m_sOLRLevel_eveto3p = m_sOLRLevel;
+    sIDLevel_eveto3p = sIDLevel;
+    sEVLevel_eveto3p = sEVLevel;
+    sOLRLevel_eveto3p = sOLRLevel;
   }
 
-  m_sWorkingPoint_1p = "_"+m_sIDLevel+"_"+m_sEVLevel+"_"+m_sOLRLevel;
-  m_sWorkingPoint_3p = "_"+m_sIDLevel_eveto3p+"_"+m_sEVLevel_eveto3p+"_"+m_sOLRLevel_eveto3p;
+  m_sWorkingPoint_1p = "_"+sIDLevel+"_"+sEVLevel+"_"+sOLRLevel;
+  m_sWorkingPoint_3p = "_"+sIDLevel_eveto3p+"_"+sEVLevel_eveto3p+"_"+sOLRLevel_eveto3p;
 }
 
 //______________________________________________________________________________
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyJetIDTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyJetIDTool.cxx
index 0fb8e6164b4..cf770cf38f5 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyJetIDTool.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyJetIDTool.cxx
@@ -11,8 +11,6 @@ using namespace TauAnalysisTools;
 //______________________________________________________________________________
 TauEfficiencyJetIDTool::TauEfficiencyJetIDTool(std::string sName)
   : CommonEfficiencyTool(sName)
-  , m_sIDLevel("")
-  , m_iIDLevelCache(-1)
 {
 }
 
@@ -31,22 +29,12 @@ CP::CorrectionCode TauEfficiencyJetIDTool::getEfficiencyScaleFactor(const xAOD::
     return CP::CorrectionCode::Ok;
   }
 
-  // only recreate m_sIDLevel if user changed the IDLevel through the tool
-  // properties
-  if (m_iIDLevelCache != m_tTECT->m_iIDLevel)
-  {
-    m_iIDLevelCache = m_tTECT->m_iIDLevel;
-    m_sIDLevel = "_"+m_tTECT->ConvertJetIDToString(m_iIDLevelCache);
-    if (m_tTECT->m_bUseIDExclusiveSF)
-      m_sIDLevel+="_excl";
-  }
-
   // get prong extension for histogram name
   std::string sProng = (xTau.nTracks() == 1) ? "_1p" : "_3p";
 
   // get standard scale factor
   CP::CorrectionCode tmpCorrectionCode;
-  tmpCorrectionCode = getValue("sf"+m_sIDLevel+sProng,
+  tmpCorrectionCode = getValue("sf"+m_sWP+sProng,
                                xTau,
                                dEfficiencyScaleFactor);
   // return correction code if histogram is not available
@@ -67,7 +55,7 @@ CP::CorrectionCode TauEfficiencyJetIDTool::getEfficiencyScaleFactor(const xAOD::
 
     // get uncertainty value
     double dUncertaintySyst = 0;
-    tmpCorrectionCode = getValue(it->second+m_sIDLevel+sProng,
+    tmpCorrectionCode = getValue(it->second+m_sWP+sProng,
                                  xTau,
                                  dUncertaintySyst);
 
@@ -85,7 +73,7 @@ CP::CorrectionCode TauEfficiencyJetIDTool::getEfficiencyScaleFactor(const xAOD::
     dTotalSystematic2 += dUncertaintySyst * dUncertaintySyst;
 
     // add high pt inflation in quadrature to TAUS_EFF_JETID_SYST
-    if(m_tTECT->m_bUseHighPtUncert && xTau.pt() > 100000. && syst.basename() == "TAUS_EFF_JETID_SYST" )
+    if(m_bUseHighPtUncert && xTau.pt() > 100000. && syst.basename() == "TAUS_EFF_JETID_SYST" )
     {
       double dHighPtInflation = 0.;
       if(xTau.nTracks() == 1)
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyTriggerTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyTriggerTool.cxx
index 7e2c47109aa..8b9fe6965e6 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyTriggerTool.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyTriggerTool.cxx
@@ -21,20 +21,14 @@ using namespace TauAnalysisTools;
 TauEfficiencyTriggerTool::TauEfficiencyTriggerTool(std::string sName)
   : CommonEfficiencyTool ( sName )
   , m_ePeriod(PeriodUnknown)
-  , m_ePeriodBinning(PeriodBinningUnknown)
 {
   m_mSystematics = {};
-  declareProperty( "PeriodBinning", m_ePeriodBinning );
-}
-
-TauEfficiencyTriggerTool::~TauEfficiencyTriggerTool()
-{
-  if (m_mSF)
-    for (auto mEntry : *m_mSF)
-      delete std::get<0>(mEntry.second);
-  delete m_mSF;
+  declareProperty( "PeriodBinning", m_ePeriodBinning = (int)PeriodBinningUnknown );
+  declareProperty( "MinRunNumber", m_iMinRunNumber = 0 );
+  declareProperty( "MaxRunNumber", m_iMaxRunNumber = 0 );
 }
 
+//______________________________________________________________________________
 StatusCode TauEfficiencyTriggerTool::initialize()
 {
   ATH_MSG_INFO( "Initializing TauEfficiencyTriggerTool" );
@@ -60,9 +54,6 @@ StatusCode TauEfficiencyTriggerTool::initialize()
   m_sInputFileName = vInputFilePath.back();
   generateSystematicSets();
 
-  // if (m_sWP.length()>0)
-  //   m_sSFHistName = "sf_"+m_sWP;
-
   // load empty systematic variation by default
   if (applySystematicVariation(CP::SystematicSet()) != CP::SystematicCode::Ok )
     return StatusCode::FAILURE;
@@ -113,9 +104,7 @@ CP::CorrectionCode TauEfficiencyTriggerTool::getEfficiencyScaleFactor(const xAOD
     auto it = m_mSystematicsHistNames.find(syst.basename());
 
     // dirty hack, replace urgently
-    std::string sDirection = "";
-    if (syst.basename().back() != 'T')
-      sDirection = (syst.parameter() > 0) ? "_up" : "_down";
+    std::string sDirection = (syst.parameter() > 0) ? "_up" : "_down";
 
     // get uncertainty value
     double dUncertaintySyst = 0;
@@ -146,57 +135,6 @@ CP::CorrectionCode TauEfficiencyTriggerTool::getEfficiencyScaleFactor(const xAOD
   return CP::CorrectionCode::Ok;
 }
 
-//______________________________________________________________________________
-CP::CorrectionCode TauEfficiencyTriggerTool::applyEfficiencyScaleFactor(const xAOD::TauJet& xTau)
-{
-  double dSf = 0.;
-
-  if (!m_bSFIsAvailableChecked)
-  {
-    m_bSFIsAvailable = xTau.isAvailable< double >(m_sVarName);
-    m_bSFIsAvailableChecked = true;
-    if (m_bSFIsAvailable)
-    {
-      ATH_MSG_DEBUG(m_sVarName << " decoration is available on first tau processed, switched of applyEfficiencyScaleFactor for further taus.");
-      ATH_MSG_DEBUG("If an application of efficiency scale factors needs to be redone, please pass a shallow copy of the original tau.");
-    }
-  }
-  if (m_bSFIsAvailable)
-    return CP::CorrectionCode::Ok;
-
-  // retreive scale factor
-  CP::CorrectionCode tmpCorrectionCode = getEfficiencyScaleFactor(xTau, dSf);
-  // adding scale factor to tau as decoration
-  xTau.auxdecor<double>(m_sVarName) = dSf;
-
-  return tmpCorrectionCode;
-}
-
-//______________________________________________________________________________
-bool TauEfficiencyTriggerTool::isAffectedBySystematic( const CP::SystematicVariation& systematic ) const
-{
-  CP::SystematicSet sys = affectingSystematics();
-  return sys.find (systematic) != sys.end ();
-}
-
-//______________________________________________________________________________
-CP::SystematicSet TauEfficiencyTriggerTool::affectingSystematics() const
-{
-  return m_sAffectingSystematics;
-}
-
-//______________________________________________________________________________
-CP::SystematicSet TauEfficiencyTriggerTool::recommendedSystematics() const
-{
-  return m_sRecommendedSystematics;
-}
-
-//______________________________________________________________________________
-void TauEfficiencyTriggerTool::setParent(TauEfficiencyCorrectionsTool* tTECT)
-{
-  m_tTECT = tTECT;
-}
-
 //______________________________________________________________________________
 CP::SystematicCode TauEfficiencyTriggerTool::applySystematicVariation ( const CP::SystematicSet& sSystematicSet)
 {
@@ -246,283 +184,17 @@ CP::SystematicCode TauEfficiencyTriggerTool::applySystematicVariation ( const CP
   return CP::SystematicCode::Ok;
 }
 
-//=================================PRIVATE-PART=================================
 //______________________________________________________________________________
-std::string TauEfficiencyTriggerTool::ConvertProngToString(const int& fProngness)
+bool TauEfficiencyTriggerTool::isSupportedRunNumber(int iRunNumber)
 {
-  std::string prong = "";
-  if (fProngness == 0)
-    ATH_MSG_DEBUG("passed tau with 0 tracks, which is not supported, taking multiprong SF for now");
-  fProngness == 1 ? prong = "_1p" : prong = "_3p";
-  return prong;
-}
-
-//______________________________________________________________________________
-void TauEfficiencyTriggerTool::ReadInputs(TFile* fFile)
-{
-  m_mSF->clear();
-
-  // initialize function pointer
-  m_fX = &tauPt;
-  m_fY = &tauEta;
-
-  TKey *kKey;
-  TIter itNext(fFile->GetListOfKeys());
-  while ((kKey = (TKey*)itNext()))
-  {
-    // parse file content for objects of type TNamed, check their title for
-    // known strings and reset funtion pointer
-    std::string sKeyName = kKey->GetName();
-    if (sKeyName == "Xaxis")
-    {
-      TNamed* tObj = (TNamed*)kKey->ReadObj();
-      std::string sTitle = tObj->GetTitle();
-      delete tObj;
-      if (sTitle == "P")
-      {
-        m_fX = &tauP;
-        ATH_MSG_DEBUG("using full momentum for x-axis");
-      }
-      continue;
-    }
-    if (sKeyName == "Yaxis")
-    {
-      TNamed* tObj = (TNamed*)kKey->ReadObj();
-      std::string sTitle = tObj->GetTitle();
-      delete tObj;
-      if (sTitle == "track-eta")
-      {
-        m_fY = &tauLeadTrackEta;
-        ATH_MSG_DEBUG("using leading track eta for y-axis");
-      }
-      else if (sTitle == "|eta|")
-      {
-        m_fY = &tauAbsEta;
-        ATH_MSG_DEBUG("using absolute tau eta for y-axis");
-      }
-      continue;
-    }
-
-    // handling for the 3 different input types TH1F/TH1D/TF1, function pointer
-    // handle the access methods for the final scale factor retrieval
-    TClass *cClass = gROOT->GetClass(kKey->GetClassName());
-    if (cClass->InheritsFrom("TH2"))
-    {
-      std::vector<std::string> m_vSplitKeyName = {};
-      split(sKeyName,'_',m_vSplitKeyName);
-      TH1F* oObject = (TH1F*)kKey->ReadObj();
-      oObject->SetDirectory(0);
-      if (cClass->InheritsFrom("TH2D"))
-        (*m_mSF)[sKeyName] = tTupleObjectFunc(oObject,&getValueTH2D);
-      else
-        (*m_mSF)[sKeyName] = tTupleObjectFunc(oObject,&getValueTH2F);
-      ATH_MSG_DEBUG("added histogram with name "<<sKeyName);
-    }
-    else if (cClass->InheritsFrom("TF1"))
-    {
-      std::vector<std::string> m_vSplitKeyName = {};
-      split(sKeyName,'_',m_vSplitKeyName);
-      TObject* oObject = kKey->ReadObj();
-      (*m_mSF)[sKeyName] = tTupleObjectFunc(oObject,&getValueTF1);
-      ATH_MSG_DEBUG("added function with name "<<sKeyName);
-    }
-  }
-  ATH_MSG_INFO("data loaded from " << fFile->GetName());
-}
-
-//______________________________________________________________________________
-void TauEfficiencyTriggerTool::generateSystematicSets()
-{
-  // creation of basic string for all NPs, e.g. "TAUS_TRUEHADTAU_EFF_RECO_"
-  std::vector<std::string> m_vSplitInputFilePath = {};
-  split(m_sInputFileName,'_',m_vSplitInputFilePath);
-  std::string sEfficiencyType = m_vSplitInputFilePath.at(0);
-  std::string sTruthType = m_vSplitInputFilePath.at(1);
-  std::transform(sEfficiencyType.begin(), sEfficiencyType.end(), sEfficiencyType.begin(), toupper);
-  std::transform(sTruthType.begin(), sTruthType.end(), sTruthType.begin(), toupper);
-  std::string sSystematicBaseString = "TAUS_"+sTruthType+"_EFF_"+sEfficiencyType+"_";
-
-  // set truth type to check for in truth matching
-  if (sTruthType=="TRUEHADTAU") m_eCheckTruth = TauAnalysisTools::TruthHadronicTau;
-  if (sTruthType=="TRUEELECTRON") m_eCheckTruth = TauAnalysisTools::TruthElectron;
-  if (sTruthType=="TRUEMUON") m_eCheckTruth = TauAnalysisTools::TruthMuon;
-  if (sTruthType=="TRUEJET") m_eCheckTruth = TauAnalysisTools::TruthJet;
-  if (sEfficiencyType=="ELEOLR") m_bNoMultiprong = true;
-
-  for (auto mSF : *m_mSF)
-  {
-    // parse for nuisance parameter in histogram name
-    std::vector<std::string> m_vSplitNP = {};
-    split(mSF.first,'_',m_vSplitNP);
-    std::string sNP = m_vSplitNP.at(0);
-    std::string sNPUppercase = m_vSplitNP.at(0);
-
-    // skip nominal scale factors
-    if (sNP == "sf") continue;
-    // skip if non 1p histogram to avoid duplications (TODO: come up with a better solution)
-    if (mSF.first.find("_1p") == std::string::npos) continue;
-
-    // test if NP starts with a capital letter indicating that this should be recommended
-    bool bIsRecommended = false;
-    if (isupper(sNP.at(0)))
-      bIsRecommended = true;
-
-    // make sNP uppercase and build final NP entry name
-    std::transform(sNPUppercase.begin(), sNPUppercase.end(), sNPUppercase.begin(), toupper);
-    std::string sSystematicString = sSystematicBaseString+sNPUppercase;
-
-    // add all found systematics to the AffectingSystematics
-    m_sAffectingSystematics.insert(CP::SystematicVariation (sSystematicString, 1));
-    m_sAffectingSystematics.insert(CP::SystematicVariation (sSystematicString, -1));
-    // only add found uppercase systematics to the RecommendedSystematics
-    if (bIsRecommended)
-    {
-      ATH_MSG_VERBOSE("added "<<sSystematicString<<" to recommended systematics");
-      m_sRecommendedSystematics.insert(CP::SystematicVariation (sSystematicString, 1));
-      m_sRecommendedSystematics.insert(CP::SystematicVariation (sSystematicString, -1));
-    }
-
-    // // if a working point is provided, add it to the NP name
-    // if (m_sWP.length() > 0)
-    //   sNP += "_"+m_sWP;
-
-    ATH_MSG_DEBUG("connected base name " << sNP << " with systematic " <<sSystematicString);
-    m_mSystematicsHistNames.insert({sSystematicString,sNP});
-  }
-}
-
-//______________________________________________________________________________
-CP::CorrectionCode TauEfficiencyTriggerTool::getValue(const std::string& sHistName,
-    const xAOD::TauJet& xTau,
-    double& dEfficiencyScaleFactor) const
-{
-  if (m_mSF->find(sHistName) == m_mSF->end())
-  {
-    ATH_MSG_ERROR("Object with name "<<sHistName<<" was not found in input file.");
-    return CP::CorrectionCode::Error;
-  }
-
-  // get a tuple (TObject*,functionPointer) from the scale factor map
-  tTupleObjectFunc tTuple = (*m_mSF)[sHistName];
-
-  // get pt and eta (for x and y axis respectively)
-  double dPt = m_fX(xTau);
-  double dEta = m_fY(xTau);
-
-  // finally obtain efficiency scale factor from TH1F/TH1D/TF1, by calling the
-  // function pointer stored in the tuple from the scale factor map
-  return  (std::get<1>(tTuple))(std::get<0>(tTuple), dEfficiencyScaleFactor, dPt, dEta);
-}
-
-//______________________________________________________________________________
-CP::CorrectionCode TauEfficiencyTriggerTool::getValueTH2F(const TObject* oObject,
-    double& dEfficiencyScaleFactor,
-    double dPt,
-    double dEta)
-{
-  const TH2F* hHist = dynamic_cast<const TH2F*>(oObject);
-
-  if (!hHist)
-  {
-    // ATH_MSG_ERROR("Problem with casting TObject of type "<<oObject->ClassName()<<" to TH2F");
-    return CP::CorrectionCode::Error;
-  }
-
-  // protect values from underflow bins
-  dPt = std::max(dPt,hHist->GetXaxis()->GetXmin());
-  dEta = std::max(dEta,hHist->GetYaxis()->GetXmin());
-  // protect values from overflow bins (times .999 to keep it inside last bin)
-  dPt = std::min(dPt,hHist->GetXaxis()->GetXmax() * .999);
-  dEta = std::min(dEta,hHist->GetYaxis()->GetXmax() * .999);
-
-  // get bin from TH2 depending in x and y values; finally set the scale factor
-  int iBin = hHist->FindFixBin(dPt,dEta);
-  dEfficiencyScaleFactor = hHist->GetBinContent(iBin);
-  return CP::CorrectionCode::Ok;
-}
-
-//______________________________________________________________________________
-CP::CorrectionCode TauEfficiencyTriggerTool::getValueTH2D(const TObject* oObject,
-    double& dEfficiencyScaleFactor,
-    double dPt,
-    double dEta)
-{
-  const TH2D* hHist = dynamic_cast<const TH2D*>(oObject);
-
-  if (!hHist)
-  {
-    // ATH_MSG_ERROR("Problem with casting TObject of type "<<oObject->ClassName()<<" to TH2D");
-    return CP::CorrectionCode::Error;
-  }
-
-  // protect values from underflow bins
-  dPt = std::max(dPt,hHist->GetXaxis()->GetXmin());
-  dEta = std::max(dEta,hHist->GetYaxis()->GetXmin());
-  // protect values from overflow bins (times .999 to keep it inside last bin)
-  dPt = std::min(dPt,hHist->GetXaxis()->GetXmax() * .999);
-  dEta = std::min(dEta,hHist->GetYaxis()->GetXmax() * .999);
-
-  // get bin from TH2 depending in x and y values; finally set the scale factor
-  int iBin = hHist->FindFixBin(dPt,dEta);
-  dEfficiencyScaleFactor = hHist->GetBinContent(iBin);
-  return CP::CorrectionCode::Ok;
-}
-
-//______________________________________________________________________________
-CP::CorrectionCode TauEfficiencyTriggerTool::getValueTF1(const TObject* oObject,
-    double& dEfficiencyScaleFactor,
-    double dPt,
-    double dEta)
-{
-  const TF1* fFunc = static_cast<const TF1*>(oObject);
-
-  if (!fFunc)
-  {
-    // ATH_MSG_ERROR("Problem with casting TObject of type "<<oObject->ClassName()<<" to TF1");
-    return CP::CorrectionCode::Error;
-  }
-
-  // evaluate TFunction and set scale factor
-  dEfficiencyScaleFactor = fFunc->Eval(dPt, dEta);
-  return CP::CorrectionCode::Ok;
-}
-
-//______________________________________________________________________________
-e_TruthMatchedParticleType TauEfficiencyTriggerTool::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;
+  if ( m_iMinRunNumber != 0 and m_iMinRunNumber > iRunNumber)
+    return false;
+  if ( m_iMaxRunNumber != 0 and m_iMaxRunNumber < iRunNumber)
+    return false;
+  return true;
 }
 
+//=================================PRIVATE-PART=================================
 //______________________________________________________________________________
 StatusCode TauEfficiencyTriggerTool::setRunNumber(int iRunNumber)
 {
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauOverlappingElectronLLHDecorator.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauOverlappingElectronLLHDecorator.cxx
index 501dd801f65..664879b5ac5 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauOverlappingElectronLLHDecorator.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauOverlappingElectronLLHDecorator.cxx
@@ -28,9 +28,15 @@ TauOverlappingElectronLLHDecorator::TauOverlappingElectronLLHDecorator( const st
   , m_bElectonsAvailable(true)
   , m_hCutValues(0)
   , m_bEleOLRMatchAvailable(false)
-  , m_bEleOLRMatchAvailableChecked(false)
   , m_bNewEvent(false)
-  , m_sElectronPhotonSelectorToolsConfigFile("ElectronPhotonSelectorTools/offline/mc15_20150224/ElectronLikelihoodLooseOfflineConfig2015.conf")
+  // , m_sElectronPhotonSelectorToolsConfigFile("ElectronPhotonSelectorTools/offline/mc15_20150224/ElectronLikelihoodLooseOfflineConfig2015.conf")
+  , m_sElectronPhotonSelectorToolsConfigFile("ElectronPhotonSelectorTools/offline/mc15_20150712/ElectronLikelihoodLooseOfflineConfig2015.conf")
+  , m_sEleOlrPassDecorationName("ele_olr_pass_fix")
+#ifndef XAODTAU_VERSIONS_TAUJET_V3_H
+  , m_sEleOlrLhScoreDecorationName("ele_match_lhscore_fix")
+#else
+  , m_sEleOlrLhScoreDecorationName("EleMatchLikelihoodScore")
+#endif
 {
   m_sEleOLRFilePath = "TauAnalysisTools/"+std::string(sSharedFilesVersion)+"/Selection/eveto_cutvals.root";
 
@@ -51,7 +57,7 @@ StatusCode TauOverlappingElectronLLHDecorator::initialize()
   ATH_MSG_INFO( "Initializing TauOverlappingElectronLLHDecorator" );
   // create a EM LH tool
   m_tEMLHTool = new AsgElectronLikelihoodTool (name()+"_ELHTool");
-  m_tEMLHTool->msg().setLevel( msg().level() );
+  ATH_CHECK(m_tEMLHTool->setProperty("OutputLevel", msg().level() ));
   if (m_tEMLHTool->setProperty("primaryVertexContainer","PrimaryVertices").isFailure())
   {
     ATH_MSG_FATAL("SelectionCutEleOLR constructor failed setting property primaryVertexContainer");
@@ -68,6 +74,7 @@ StatusCode TauOverlappingElectronLLHDecorator::initialize()
     return StatusCode::FAILURE;
   }
 
+  ATH_MSG_INFO("Loading ele OLR cut file "<< m_sEleOLRFilePath);
   TFile tmpFile(PathResolverFindCalibFile(m_sEleOLRFilePath).c_str());
   m_hCutValues = (TH2D*) tmpFile.Get("eveto_cutvals");
   m_hCutValues->SetDirectory(0);
@@ -77,24 +84,18 @@ StatusCode TauOverlappingElectronLLHDecorator::initialize()
 }
 
 //______________________________________________________________________________
-StatusCode TauOverlappingElectronLLHDecorator::decorate(const xAOD::TauJet& xTau)
+StatusCode TauOverlappingElectronLLHDecorator::decorate(const xAOD::TauJet& xTau) const
 {
   if (m_bNewEvent)
   {
-    if (retrieveElectrons().isFailure())
-      return StatusCode::FAILURE;
+    ATH_CHECK(retrieveElectrons());
     m_bNewEvent = false;
-  }
 
-  if (!m_bEleOLRMatchAvailableChecked)
-  {
-    m_bEleOLRMatchAvailable = (xTau.isAvailable<char>("ele_olr_pass") || xTau.isAvailable<float>("EleMatchLikelihoodScore"));
-    m_bEleOLRMatchAvailableChecked = true;
+    m_bEleOLRMatchAvailable = (xTau.isAvailable<char>(m_sEleOlrPassDecorationName) || xTau.isAvailable<float>("EleMatchLikelihoodScore"));
     if (m_bEleOLRMatchAvailable)
-    {
-      ATH_MSG_DEBUG("ele_olr_pass decoration is available on first tau processed, switched of processing for further taus.");
-      ATH_MSG_DEBUG("If a reprocessing of the electron overlap removal is needed, please pass a shallow copy of the original tau.");
-    }
+      ATH_MSG_DEBUG("ele_olr_pass decoration is available in this event.");
+    else
+      ATH_MSG_DEBUG("ele_olr_pass decoration is not available in this event. Will decorated it.");
   }
   if (m_bEleOLRMatchAvailable)
     return StatusCode::SUCCESS;
@@ -120,49 +121,65 @@ StatusCode TauOverlappingElectronLLHDecorator::decorate(const xAOD::TauJet& xTau
   if(xEleMatch!=0)
     fLHScore = (m_tEMLHTool->calculate(xEleMatch)).getMVAResponse ();
 
-  static SG::AuxElement::Decorator< ElementLink< xAOD::ElectronContainer > > decElectronLink("electronLink");
-  // create link to the matched electron
-  if (xEleMatch)
-  {
-    ElementLink < xAOD::ElectronContainer > lElectronMatchLink(xEleMatch, *(m_xElectronContainer));
-    decElectronLink(xTau) = lElectronMatchLink;
-  }
-  else
-  {
-    ElementLink < xAOD::ElectronContainer > lElectronMatchLink;
-    decElectronLink(xTau) = lElectronMatchLink;
-  }
+  // static SG::AuxElement::Decorator< ElementLink< xAOD::ElectronContainer > > decElectronLink("electronLink");
+  // // create link to the matched electron
+  // if (xEleMatch)
+  // {
+  //   ElementLink < xAOD::ElectronContainer > lElectronMatchLink(xEleMatch, *(m_xElectronContainer));
+  //   decElectronLink(xTau) = lElectronMatchLink;
+  // }
+  // else
+  // {
+  //   ElementLink < xAOD::ElectronContainer > lElectronMatchLink;
+  //   decElectronLink(xTau) = lElectronMatchLink;
+  // }
 
   // decorate tau with score
-  static SG::AuxElement::Decorator< float > decEleMatchLhscore("ele_match_lhscore");
+  static SG::AuxElement::Decorator< float > decEleMatchLhscore(m_sEleOlrLhScoreDecorationName);
   decEleMatchLhscore(xTau) = fLHScore;
 
   bool bPass = false;
   if (xTau.nTracks() == 1)
-    bPass = (fLHScore <= getCutVal(xTau.track(0)->eta(),
-                                   xTau.pt()/1000.));
+  {
+#ifdef XAODTAU_VERSIONS_TAUJET_V3_H
+    static SG::AuxElement::Accessor< xAOD::TauJet::TauTrackLinks_t > trackAcc( "trackLinks" );
+#else
+    static SG::AuxElement::Accessor< xAOD::TauJet::TrackParticleLinks_t > trackAcc( "trackLinks" );
+#endif // XAODTAU_VERSIONS_TAUJET_V3_H
+    if (trackAcc(xTau)[0].isValid())
+      bPass = (fLHScore <= getCutVal(xTau.track(0)->eta(),
+                                     xTau.pt()/1000.));
+    else
+    {
+      ATH_MSG_DEBUG("Invalid track link, TauSelectionTool will discard this tau");
+      bPass = false;
+    }
+  }
   else
     bPass = true;
-  static SG::AuxElement::Decorator< char > decEleOlrPass("ele_olr_pass");
+  static SG::AuxElement::Decorator< char > decEleOlrPass(m_sEleOlrPassDecorationName);
   decEleOlrPass(xTau) = (char)bPass;
 
   return StatusCode::SUCCESS;
 }
 
 //______________________________________________________________________________
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 StatusCode TauOverlappingElectronLLHDecorator::initializeEvent()
 {
   return beginEvent();
 }
+#pragma GCC diagnostic pop
 
 //=================================PRIVATE-PART=================================
 //______________________________________________________________________________
-float TauOverlappingElectronLLHDecorator::getCutVal(float fEta, float fPt)
+float TauOverlappingElectronLLHDecorator::getCutVal(float fEta, float fPt) const
 {
   if(fPt>250) fPt=250;
-  if(fabs(fEta)>2.465) fEta=2.465;
+  if(std::abs(fEta)>2.465) fEta=2.465;
 
-  int iBin= m_hCutValues->FindBin(fPt, fabs(fEta));
+  int iBin= m_hCutValues->FindBin(fPt, std::abs(fEta));
   return m_hCutValues->GetBinContent(iBin);
 }
 
@@ -174,7 +191,7 @@ StatusCode TauOverlappingElectronLLHDecorator::beginEvent()
 }
 
 //______________________________________________________________________________
-StatusCode TauOverlappingElectronLLHDecorator::retrieveElectrons()
+StatusCode TauOverlappingElectronLLHDecorator::retrieveElectrons() const
 {
   if (evtStore()->contains<xAOD::ElectronContainer>(m_sElectronContainerName))
     if ( evtStore()->retrieve(m_xElectronContainer,m_sElectronContainerName).isSuccess() )
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSelectionTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSelectionTool.cxx
index a854c7a4586..5503b6631ef 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSelectionTool.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSelectionTool.cxx
@@ -20,35 +20,13 @@ using namespace TauAnalysisTools;
 //______________________________________________________________________________
 TauSelectionTool::TauSelectionTool( const std::string& name )
   : asg::AsgMetadataTool( name )
-  , m_iSelectionCuts(NoCut) // initialize with 'no' cuts
-  , m_vPtRegion( {})
-, m_vAbsEtaRegion( {})
-, m_vAbsCharges( {})
-, m_vNTracks( {})
-, m_vJetBDTRegion( {})
-, m_sJetIDWP("JETIDNONE")
-, m_iJetIDWP(0)
-, m_vEleBDTRegion( {})
-, m_sEleBDTWP("ELEIDNONE")
-, m_iEleBDTWP(0)
-, m_bEleOLR(false)
-, m_bMuonVeto(false)
-, m_dPtMin(NAN) // in GeV
-, m_dPtMax(NAN) // in GeV
-, m_dAbsEtaMin(NAN)
-, m_dAbsEtaMax(NAN)
-, m_iAbsCharge(NAN)
-, m_iNTrack(NAN)
-, m_dJetBDTMin(NAN)
-, m_dJetBDTMax(NAN)
-, m_dEleBDTMin(NAN)
-, m_dEleBDTMax(NAN)
-, m_fOutFile(0)
-, m_sConfigPath("")
-, m_sCuts("")
-, m_sElectronContainerName("Electrons")
-, m_xElectronContainer(0)
-, m_aAccept( "TauSelection" )
+  , m_sJetIDWP("JETIDNONE")
+  , m_sEleBDTWP("ELEIDNONE")
+  , m_fOutFile(0)
+  , m_sElectronContainerName("Electrons")
+  , m_sMuonContainerName("Muons")
+  , m_tTOELLHDecorator(this->name()+"_TauOverlappingElectronLLHDecorator", this)
+  , m_aAccept( "TauSelection" )
 {
   declareProperty( "CreateControlPlots", m_bCreateControlPlots = false);
   /*
@@ -57,34 +35,36 @@ TauSelectionTool::TauSelectionTool( const std::string& name )
     other properties named in plural are a list of exact values to cut on
     other properties are single cuts
   */
-  declareProperty( "SelectionCuts", m_iSelectionCuts); // initialize with 'no' cuts
-  declareProperty( "PtRegion", m_vPtRegion ); // in GeV
-  declareProperty( "PtMin", m_dPtMin); // in GeV
-  declareProperty( "PtMax", m_dPtMax); // in GeV
-  declareProperty( "AbsEtaRegion", m_vAbsEtaRegion);
-  declareProperty( "AbsEtaMin", m_dAbsEtaMin);
-  declareProperty( "AbsEtaMax", m_dAbsEtaMax);
-  declareProperty( "AbsCharges", m_vAbsCharges);
-  declareProperty( "AbsCharge", m_iAbsCharge);
-  declareProperty( "NTracks", m_vNTracks);
-  declareProperty( "NTrack", m_iNTrack);
-  declareProperty( "JetBDTRegion", m_vJetBDTRegion);
-  declareProperty( "JetBDTMin", m_dJetBDTMin);
-  declareProperty( "JetBDTMax", m_dJetBDTMax);
-  declareProperty( "JetIDWP", m_iJetIDWP);
-  declareProperty( "EleBDTRegion", m_vEleBDTRegion);
-  declareProperty( "EleBDTMin", m_dEleBDTMin);
-  declareProperty( "EleBDTMax", m_dEleBDTMax);
-  declareProperty( "EleBDTWP", m_iEleBDTWP);
-  declareProperty( "EleOLR", m_bEleOLR);
-  declareProperty( "MuonVeto", m_bMuonVeto);
+  declareProperty( "SelectionCuts", m_iSelectionCuts = NoCut); // initialize with 'no' cuts
+  declareProperty( "PtRegion",      m_vPtRegion      = {}); // in GeV
+  declareProperty( "PtMin",         m_dPtMin         = NAN); // in GeV
+  declareProperty( "PtMax",         m_dPtMax         = NAN); // in GeV
+  declareProperty( "AbsEtaRegion",  m_vAbsEtaRegion  = {});
+  declareProperty( "AbsEtaMin",     m_dAbsEtaMin     = NAN);
+  declareProperty( "AbsEtaMax",     m_dAbsEtaMax     = NAN);
+  declareProperty( "AbsCharges",    m_vAbsCharges    = {});
+  declareProperty( "AbsCharge",     m_iAbsCharge     = NAN);
+  declareProperty( "NTracks",       m_vNTracks       = {});
+  declareProperty( "NTrack",        m_iNTrack        = NAN);
+  declareProperty( "JetBDTRegion",  m_vJetBDTRegion  = {});
+  declareProperty( "JetBDTMin",     m_dJetBDTMin     = NAN);
+  declareProperty( "JetBDTMax",     m_dJetBDTMax     = NAN);
+  declareProperty( "JetIDWP",       m_iJetIDWP       = 0);
+  declareProperty( "EleBDTRegion",  m_vEleBDTRegion  = {});
+  declareProperty( "EleBDTMin",     m_dEleBDTMin     = NAN);
+  declareProperty( "EleBDTMax",     m_dEleBDTMax     = NAN);
+  declareProperty( "EleBDTWP",      m_iEleBDTWP      = 0);
+  declareProperty( "EleOLR",        m_bEleOLR        = false);
+  declareProperty( "MuonVeto",      m_bMuonVeto      = false);
+  declareProperty( "MuonOLR",       m_bMuonOLR       = false);
 
   m_sConfigPath = "TauAnalysisTools/"+std::string(sSharedFilesVersion)+"/Selection/recommended_selection_mc15.conf";
   m_sEleOLRFilePath = "TauAnalysisTools/"+std::string(sSharedFilesVersion)+"/Selection/eveto_cutvals.root";
 
-  declareProperty( "ConfigPath", m_sConfigPath);
-  declareProperty( "EleOLRFilePath", m_sEleOLRFilePath);
+  declareProperty( "ConfigPath",            m_sConfigPath);
+  declareProperty( "EleOLRFilePath",        m_sEleOLRFilePath);
   declareProperty( "ElectronContainerName", m_sElectronContainerName);
+  declareProperty( "MuonContainerName",     m_sMuonContainerName);
 }
 
 //______________________________________________________________________________
@@ -98,7 +78,44 @@ TauSelectionTool::~TauSelectionTool()
 //______________________________________________________________________________
 StatusCode TauSelectionTool::initialize()
 {
-  if (!m_sConfigPath.empty())
+  bool bConfigViaConfigFile = !m_sConfigPath.empty();
+  bool bConfigViaProperties = false;
+  if (!bConfigViaProperties and !m_vPtRegion.empty())         bConfigViaProperties = true;
+  if (!bConfigViaProperties and m_dPtMin == m_dPtMin)         bConfigViaProperties = true;
+  if (!bConfigViaProperties and m_dPtMax == m_dPtMax)         bConfigViaProperties = true;
+  if (!bConfigViaProperties and !m_vAbsEtaRegion.empty())     bConfigViaProperties = true;
+  if (!bConfigViaProperties and m_dAbsEtaMin == m_dAbsEtaMin) bConfigViaProperties = true;
+  if (!bConfigViaProperties and m_dAbsEtaMax == m_dAbsEtaMax) bConfigViaProperties = true;
+  if (!bConfigViaProperties and !m_vAbsCharges.empty())       bConfigViaProperties = true;
+  if (!bConfigViaProperties and m_iAbsCharge == m_iAbsCharge) bConfigViaProperties = true;
+  if (!bConfigViaProperties and !m_vNTracks.empty())          bConfigViaProperties = true;
+  if (!bConfigViaProperties and m_iNTrack == m_iNTrack)       bConfigViaProperties = true;
+  if (!bConfigViaProperties and !m_vJetBDTRegion.empty())     bConfigViaProperties = true;
+  if (!bConfigViaProperties and m_dJetBDTMin == m_dJetBDTMin) bConfigViaProperties = true;
+  if (!bConfigViaProperties and m_dJetBDTMax == m_dJetBDTMax) bConfigViaProperties = true;
+  if (!bConfigViaProperties and m_iJetIDWP != 0)              bConfigViaProperties = true;
+  if (!bConfigViaProperties and !m_vEleBDTRegion.empty())     bConfigViaProperties = true;
+  if (!bConfigViaProperties and m_dEleBDTMin == m_dEleBDTMin) bConfigViaProperties = true;
+  if (!bConfigViaProperties and m_dEleBDTMax == m_dEleBDTMax) bConfigViaProperties = true;
+  if (!bConfigViaProperties and m_iEleBDTWP != 0)             bConfigViaProperties = true;
+  if (!bConfigViaProperties and m_bEleOLR == true)            bConfigViaProperties = true;
+  if (!bConfigViaProperties and m_bMuonVeto == true)          bConfigViaProperties = true;
+  if (!bConfigViaProperties and m_bMuonOLR == true)           bConfigViaProperties = true;
+
+  if (bConfigViaConfigFile and bConfigViaProperties)
+  {
+    ATH_MSG_WARNING("Configured tool via setProperty and configuration file, which may lead to unexpected configuration.");
+    ATH_MSG_WARNING("In doubt check the configuration that is printed when the tool is initialized and the message level is set to debug");
+    ATH_MSG_WARNING("For further details please refer to the documentation:");
+    ATH_MSG_WARNING("https://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/trunk/doc/README-TauSelectionTool.rst");
+  }
+  if (!bConfigViaConfigFile and !bConfigViaProperties)
+  {
+    ATH_MSG_WARNING("No cut configuration provided, the tool will not do anything. For further details please refer to the documentation:");
+    ATH_MSG_WARNING("https://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/trunk/doc/README-TauSelectionTool.rst");
+  }
+
+  if (bConfigViaConfigFile)
   {
     TEnv rEnv;
     std::string sInputFilePath = PathResolverFindCalibFile(m_sConfigPath);
@@ -109,23 +126,23 @@ StatusCode TauSelectionTool::initialize()
     rEnv.ReadFile(sInputFilePath.c_str(),
                   kEnvAll);
 
-    std::vector<std::string> m_vCuts;
+    std::vector<std::string> vCuts;
     // if Cuts are specified in the config file take these ones, if not take all
     // specified in the config
     if (rEnv.Defined("SelectionCuts"))
-      TauAnalysisTools::split(rEnv, "SelectionCuts", ' ', m_vCuts);
+      TauAnalysisTools::split(rEnv, "SelectionCuts", ' ', vCuts);
     else
     {
       auto lList = rEnv.GetTable();
       for( Int_t i = 0; i < lList->GetEntries(); ++i )
       {
-        m_vCuts.push_back( lList->At( i )->GetName() );
+        vCuts.push_back( lList->At( i )->GetName() );
       }
     }
 
     int iSelectionCuts = 0;
 
-    for (auto sCut : m_vCuts)
+    for (auto sCut : vCuts)
     {
       if (sCut == "PtRegion")
       {
@@ -247,6 +264,12 @@ StatusCode TauSelectionTool::initialize()
         if (m_bMuonVeto == false)
           m_bMuonVeto = rEnv.GetValue("MuonVeto",false);
       }
+      else if (sCut == "MuonOLR")
+      {
+        iSelectionCuts = iSelectionCuts | CutMuonOLR;
+        if (m_bMuonOLR == false)
+          m_bMuonOLR = rEnv.GetValue("MuonOLR",false);
+      }
       else ATH_MSG_WARNING("Cut " << sCut << " is not available");
     }
 
@@ -266,7 +289,8 @@ StatusCode TauSelectionTool::initialize()
     {CutEleBDTScore, new TauAnalysisTools::SelectionCutBDTEleScore(this)},
     {CutEleBDTWP, new TauAnalysisTools::SelectionCutEleBDTWP(this)},
     {CutEleOLR, new TauAnalysisTools::SelectionCutEleOLR(this)},
-    {CutMuonVeto, new TauAnalysisTools::SelectionCutMuonVeto(this)}
+    {CutMuonVeto, new TauAnalysisTools::SelectionCutMuonVeto(this)},
+    {CutMuonOLR, new TauAnalysisTools::SelectionCutMuonOLR(this)}
   };
 
   ATH_MSG_INFO( "Initializing TauSelectionTool" );
@@ -292,6 +316,7 @@ StatusCode TauSelectionTool::initialize()
   PrintConfigValue  ("EleBDTDWP ENUM",m_iEleBDTWP);
   PrintConfigValue  ("EleOLR",      m_bEleOLR);
   PrintConfigValue  ("MuonVeto",    m_bMuonVeto);
+  PrintConfigValue  ("MuonOLR",    m_bMuonOLR);
 
   std::string sCuts = "";
   if (m_iSelectionCuts & CutPt) sCuts+= "Pt ";
@@ -303,29 +328,37 @@ StatusCode TauSelectionTool::initialize()
   if (m_iSelectionCuts & CutEleBDTScore) sCuts+= "EleBDTScore ";
   if (m_iSelectionCuts & CutEleBDTWP) sCuts+= "EleBDTWP ";
   if (m_iSelectionCuts & CutEleOLR) sCuts+= "EleOLR ";
-  if (m_iSelectionCuts & CutMuonVeto) sCuts+= "CutMuonVeto ";
+  if (m_iSelectionCuts & CutMuonVeto) sCuts+= "MuonVeto ";
+  if (m_iSelectionCuts & CutMuonOLR) sCuts+= "MuonOLR ";
 
   ATH_MSG_DEBUG( "cuts: " << sCuts);
 
   if (m_bCreateControlPlots)
     setupCutFlowHistogram();
 
+  if (m_iSelectionCuts & CutEleOLR or m_bCreateControlPlots)
+  {
+    ATH_CHECK(ASG_MAKE_ANA_TOOL(m_tTOELLHDecorator, TauAnalysisTools::TauOverlappingElectronLLHDecorator));
+    ATH_CHECK(m_tTOELLHDecorator.setProperty( "EleOLRFilePath", m_sEleOLRFilePath ));
+    ATH_CHECK(m_tTOELLHDecorator.setProperty( "ElectronContainerName", m_sElectronContainerName ));
+    ATH_CHECK(m_tTOELLHDecorator.initialize());
+  }
+
   return StatusCode::SUCCESS;
 }
 
 //______________________________________________________________________________
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 StatusCode TauSelectionTool::initializeEvent()
 {
   return beginEvent();
 }
+#pragma GCC diagnostic pop
 
 //______________________________________________________________________________
 StatusCode TauSelectionTool::beginEvent()
 {
-  SelectionCutEleOLR* tSelectionCutEleOLR = dynamic_cast<SelectionCutEleOLR*>(m_cMap.at(CutEleOLR));
-  if (tSelectionCutEleOLR!=nullptr)
-    if (tSelectionCutEleOLR->beginEvent().isFailure())
-      return StatusCode::FAILURE;
   return StatusCode::SUCCESS;
 }
 
@@ -367,10 +400,13 @@ const Root::TAccept& TauSelectionTool::accept( const xAOD::TauJet& xTau ) const
   // Reset the result:
   m_aAccept.clear();
   int iNBin = 0;
-  if (m_iSelectionCuts & CutEleOLR)
+  if (m_iSelectionCuts & CutEleOLR or m_bCreateControlPlots)
   {
-    SelectionCutEleOLR* tSelectionCutEleOLR = dynamic_cast<SelectionCutEleOLR*>(m_cMap.at(CutEleOLR));
-    if (tSelectionCutEleOLR!=nullptr) tSelectionCutEleOLR->getEvetoPass(xTau);
+    if (m_tTOELLHDecorator->decorate(xTau).isFailure())
+    {
+      ATH_MSG_ERROR("Failed decorating information for CutEleOLR");
+      return m_aAccept;
+    }
   }
 
   if (m_bCreateControlPlots)
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSmearingRun1Tool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSmearingRun1Tool.cxx
index e0760c16b38..4f977674412 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSmearingRun1Tool.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSmearingRun1Tool.cxx
@@ -20,7 +20,7 @@ using namespace TauAnalysisTools;
 //______________________________________________________________________________
 TauSmearingRun1Tool::TauSmearingRun1Tool( const std::string& sName )
   : CommonSmearingTool(sName)
-  , GeV(1000.)
+  , m_GeV(1000.)
   , m_iEtaBins(5)
   , m_dInSituStat1P(0.013)
   , m_dInSituStat3P(0.014)
@@ -79,7 +79,7 @@ StatusCode TauSmearingRun1Tool::initialize()
 //______________________________________________________________________________
 CP::CorrectionCode TauSmearingRun1Tool::applyCorrection( xAOD::TauJet& xTau )
 {
-  if (m_tTST->m_bIsData)
+  if (m_bIsData)
   {
     // apply TES shift only in data
     xTau.setP4( ( 1 + getTESShift(xTau.pt(), xTau.nTracks()) ) * xTau.pt(),
@@ -281,7 +281,7 @@ void TauSmearingRun1Tool::getHist(TFile* fFile, std::string sName, std::string s
 double TauSmearingRun1Tool::getTESShift(double pt, // MeV
                                         int ntracks)
 {
-  pt = pt / GeV;		// pt in GeV
+  pt = pt / m_GeV;		// pt in m_GeV
   if(pt > 70.)
     return 0.;
   double alpha = ntracks == 1 ? 0.008 : 0.011;
@@ -308,14 +308,14 @@ double TauSmearingRun1Tool::getTESUncertainty(double pt, // MeV
   /* switched on for HSG4
      assert(component != REMAININGSYS && "User are not supposed to access REMAININGSYS component. Giving up");
   */
-  pt = pt / GeV;
+  pt = pt / m_GeV;
   if(pt < 15)
     pt = 16.; // Take the lowest bin
 
   if(pt > 199)
     pt = 199.; // Take the highest bin
 
-  if(std::fabs(eta)>2.5)
+  if(std::abs(eta)>2.5)
   {
     ATH_MSG_DEBUG("GetTESUncertainty: There is no TES uncertainty defined for |eta|>=2.5 (you gave " << eta << "). Returning 1.");
     return 1.;
@@ -329,7 +329,7 @@ double TauSmearingRun1Tool::getTESUncertainty(double pt, // MeV
 
   unsigned int iE = 0;
   for(iE = 0; iE < m_iEtaBins; ++iE)
-    if(fabs(eta) >= m_vEtaBins.at(iE) && fabs(eta) <= m_vEtaBins.at(iE + 1))
+    if(std::abs(eta) >= m_vEtaBins.at(iE) && std::abs(eta) <= m_vEtaBins.at(iE + 1))
       break;
   if(iComponent == INSITUSTAT)
     return getInSituStat(ntracks);
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSmearingTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSmearingTool.cxx
index 4dd57e19856..467fb737836 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSmearingTool.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauSmearingTool.cxx
@@ -15,18 +15,16 @@ namespace TauAnalysisTools
 
 TauSmearingTool::TauSmearingTool( const std::string& sName )
   : asg::AsgTool( sName )
-  , m_tCommonSmearingTool(0)
+  , m_tCommonSmearingTool(sName+"_CommonSmearingTool", this)
   , m_sInputFilePath("")
-  , m_sRecommendationTag("mc15-moriond")
-  , m_bSkipTruthMatchCheck(false)
-  , m_bApplyFading(true)
-  , m_bIsData(false)
 {
-  declareProperty( "IsData", m_bIsData = false );
-  declareProperty( "InputFilePath", m_sInputFilePath = "" );
-  declareProperty( "RecommendationTag", m_sRecommendationTag = "mc15-moriond" );
+  declareProperty( "RecommendationTag",   m_sRecommendationTag = "2016-ichep" );
   declareProperty( "SkipTruthMatchCheck", m_bSkipTruthMatchCheck = false );
-  declareProperty( "ApplyFading", m_bApplyFading = true);
+  declareProperty( "ApplyFading",         m_bApplyFading = true);
+  declareProperty( "ApplyMVATES",         m_bApplyMVATES = false);
+
+  // deprecated property
+  declareProperty( "IsData",              m_bIsData = false );
 }
 
 TauSmearingTool::~TauSmearingTool()
@@ -35,6 +33,13 @@ TauSmearingTool::~TauSmearingTool()
 
 StatusCode TauSmearingTool::initialize()
 {
+  // check if user has modified IsData property, if so, tell him that its deprecated
+  if (m_bIsData)
+  {
+    ATH_MSG_ERROR("The property IsData is deprecated, please don't use it anymore. The check is now done automatically. The Property will be removed in the future without further notice");
+    return StatusCode::FAILURE;
+  }
+
   // Greet the user:
   ATH_MSG_INFO( "Initializing TauSmearingTool" );
 
@@ -43,48 +48,57 @@ StatusCode TauSmearingTool::initialize()
 
   std::string sDirectory = "TauAnalysisTools/"+std::string(sSharedFilesVersion)+"/Smearing/";
 
-  if (m_sRecommendationTag == "mc15-moriond")
+  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("OutputLevel", this->msg().level()));
+  }
+  else if (m_sRecommendationTag == "mc15-moriond")
   {
     if (m_sInputFilePath.empty())
       m_sInputFilePath = sDirectory+"TES_TrueHadTau_mc15_moriond.root";
-    m_tCommonSmearingTool.reset(new CommonSmearingTool(name()+"_"+m_sRecommendationTag));
-    if (m_tCommonSmearingTool->setProperty("InputFilePath", m_sInputFilePath).isFailure()) return StatusCode::FAILURE;
-    if (m_tCommonSmearingTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck).isFailure()) return StatusCode::FAILURE;
-    if (m_tCommonSmearingTool->setProperty("ApplyFading", m_bApplyFading).isFailure()) return StatusCode::FAILURE;
-
+    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));
   }
   else if (m_sRecommendationTag == "mc15-pre-recommendations")
   {
     if (m_sInputFilePath.empty())
       m_sInputFilePath = sDirectory+"TES_TrueHadTau_mc15_prerec.root";
-    m_tCommonSmearingTool.reset(new CommonSmearingTool(name()+"_"+m_sRecommendationTag));
-    if (m_tCommonSmearingTool->setProperty("InputFilePath", m_sInputFilePath).isFailure()) return StatusCode::FAILURE;
-    if (m_tCommonSmearingTool->setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck).isFailure()) return StatusCode::FAILURE;
-    if (m_tCommonSmearingTool->setProperty("ApplyFading", false).isFailure()) return StatusCode::FAILURE; // apply fading off by default
+    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";
-    m_tCommonSmearingTool.reset(new TauSmearingRun1Tool(name()+"_"+m_sRecommendationTag));
+    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";
-    m_tCommonSmearingTool.reset(new TauSmearingRun1Tool(name()+"_"+m_sRecommendationTag));
+    ATH_CHECK(ASG_MAKE_ANA_TOOL(m_tCommonSmearingTool, TauAnalysisTools::TauSmearingRun1Tool));
+    ATH_CHECK(m_tCommonSmearingTool.setProperty("InputFilePath", m_sInputFilePath));
   }
-
-  if (!m_tCommonSmearingTool)
+  else
   {
     ATH_MSG_FATAL("unknown recommendation tag "<<m_sRecommendationTag);
     return StatusCode::FAILURE;
   }
-  // only set vars if they differ from "", which means they have been configured by the user
 
-  m_tCommonSmearingTool->msg().setLevel( this->msg().level() );
-  m_tCommonSmearingTool->setParent(this);
-  ATH_CHECK(m_tCommonSmearingTool->initialize());
+  ATH_CHECK(m_tCommonSmearingTool.initialize());
 
   // Add the affecting systematics to the global registry
   CP::SystematicRegistry& registry = CP::SystematicRegistry::getInstance();
@@ -99,6 +113,7 @@ StatusCode TauSmearingTool::initialize()
 
 CP::CorrectionCode TauSmearingTool::applyCorrection( xAOD::TauJet& xTau )
 {
+
   return m_tCommonSmearingTool->applyCorrection(xTau);
 }
 
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx
index 80918836b90..6b299ab916e 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx
@@ -2,6 +2,7 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
+// Local include(s)
 #include <TauAnalysisTools/TauTruthMatchingTool.h>
 
 // Core include(s):
@@ -9,6 +10,10 @@
 
 // EDM include(s):
 #include "xAODTruth/TruthVertex.h"
+#include "xAODEventInfo/EventInfo.h"
+
+// Tool include(s)
+#include "MCTruthClassifier/MCTruthClassifier.h"
 
 using namespace TauAnalysisTools;
 
@@ -16,6 +21,8 @@ using namespace TauAnalysisTools;
 //______________________________________________________________________________
 TauTruthMatchingTool::TauTruthMatchingTool( const std::string& name )
   : AsgMetadataTool(name)
+  , m_bIsData(false)
+  , m_bIsConfigured(false)
   , m_xTruthParticleContainer(0)
   , m_xTruthTauContainerConst(0)
   , m_xTruthMuonContainerConst(0)
@@ -23,22 +30,11 @@ TauTruthMatchingTool::TauTruthMatchingTool( const std::string& name )
   , m_xTruthJetContainerConst(0)
   , m_xTruthTauContainer(0)
   , m_xTruthTauAuxContainer(0)
-  , m_dMaxDeltaR(0.2)
-  , m_bWriteTruthTaus(false)
-  , m_sNewTruthTauContainerName("TruthTaus")
   , m_sNewTruthTauContainerNameAux("TruthTausAux.")
-  , m_sTruthTauContainerName("TruthTaus")
-  , m_sTruthMuonContainerName("TruthMuons")
-  , m_sTruthElectronContainerName("TruthElectrons")
-  , m_sTruthParticlesContainerName("TruthParticles")
   , m_bTruthTauAvailable(true)
   , m_bTruthMuonAvailable(true)
   , m_bTruthElectronAvailable(true)
   , m_bTruthJetAvailable(true)
-  , m_bWriteInvisibleFourMomentum(false)
-  , m_bWriteVisibleChargedFourMomentum(false)
-  , m_bWriteVisibleNeutralFourMomentum(false)
-  , m_bWriteDecayModeVector(true)
   , m_iNChargedPions(0)
   , m_iNNeutralPions(0)
   , m_iNChargedOthers(0)
@@ -47,10 +43,12 @@ TauTruthMatchingTool::TauTruthMatchingTool( const std::string& name )
   , m_bIsHadronicTau(false)
   , m_bIsTruthMatchedAvailable(false)
   , m_bIsTruthMatchedAvailableChecked(false)
+  , m_bNewEvent(false)
   , m_accPtVis("pt_vis")
   , m_accEtaVis("eta_vis")
   , m_accPhiVis("phi_vis")
   , m_accMVis("m_vis")
+  , m_tMCTruthClassifier("MCTruthClassifierTool", this)
 {
   declareProperty( "MaxDeltaR", m_dMaxDeltaR = .2);
   declareProperty( "WriteTruthTaus", m_bWriteTruthTaus = false);
@@ -66,10 +64,6 @@ TauTruthMatchingTool::TauTruthMatchingTool( const std::string& name )
   declareProperty( "WriteVisibleChargedFourMomentum", m_bWriteVisibleChargedFourMomentum = false);
   declareProperty( "WriteVisibleNeutralFourMomentum", m_bWriteVisibleNeutralFourMomentum = false);
   declareProperty( "WriteDecayModeVector", m_bWriteDecayModeVector = true);
-
-  // deprecated properties
-  declareProperty( "OptimizeForReco", m_bOptimizeForReco = false);
-  declareProperty( "SampleType", m_iSampleType = -1);
 }
 
 //______________________________________________________________________________
@@ -84,17 +78,16 @@ StatusCode TauTruthMatchingTool::initialize()
   ATH_MSG_INFO( "Initializing TauTruthMatchingTool" );
   m_sNewTruthTauContainerNameAux = m_sNewTruthTauContainerName + "Aux.";
 
-  if (m_bOptimizeForReco)
-    ATH_MSG_WARNING("The property OptimizeForReco is not used at the moment");
-  if (m_iSampleType != -1)
-    ATH_MSG_WARNING("The property SampleType is deprecated and will be removed");
-
+  ATH_CHECK(ASG_MAKE_ANA_TOOL(m_tMCTruthClassifier, MCTruthClassifier));
+  ATH_CHECK(m_tMCTruthClassifier.initialize());
   return StatusCode::SUCCESS;
 }
 
 //______________________________________________________________________________
 xAOD::TruthParticleContainer* TauTruthMatchingTool::getTruthTauContainer()
 {
+  if (m_bIsData)
+    return 0;
   if (!m_bTruthTauAvailable)
     return m_xTruthTauContainer;
   else
@@ -107,6 +100,8 @@ xAOD::TruthParticleContainer* TauTruthMatchingTool::getTruthTauContainer()
 //______________________________________________________________________________
 xAOD::TruthParticleAuxContainer* TauTruthMatchingTool::getTruthTauAuxContainer()
 {
+  if (m_bIsData)
+    return 0;
   if (!m_bTruthTauAvailable)
     return m_xTruthTauAuxContainer;
   else
@@ -133,6 +128,10 @@ std::vector<const xAOD::TruthParticle*> TauTruthMatchingTool::applyTruthMatch(co
 }
 
 //______________________________________________________________________________
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
 StatusCode TauTruthMatchingTool::setTruthParticleContainer(const xAOD::TruthParticleContainer* xTruthParticleContainer)
 {
   m_xTruthParticleContainer = xTruthParticleContainer;
@@ -140,24 +139,47 @@ StatusCode TauTruthMatchingTool::setTruthParticleContainer(const xAOD::TruthPart
   m_bTruthTauAvailable = false;
   return buildTruthTausFromTruthParticles();
 }
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
 
 //______________________________________________________________________________
 StatusCode TauTruthMatchingTool::beginEvent()
 {
-  if (retrieveTruthTaus().isFailure())
-    return StatusCode::FAILURE;
+  m_bNewEvent = true;
+  if (m_bIsConfigured)
+    return StatusCode::SUCCESS;
+
+  const xAOD::EventInfo* xEventInfo = 0;
+  ATH_CHECK(evtStore()->retrieve(xEventInfo,"EventInfo"));
+  m_bIsData = !(xEventInfo->eventType( xAOD::EventInfo::IS_SIMULATION));
+  m_bIsConfigured=true;
+
   return StatusCode::SUCCESS;
 }
 
 //______________________________________________________________________________
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
 StatusCode TauTruthMatchingTool::initializeEvent()
 {
-  return beginEvent();
+  return StatusCode::SUCCESS;
 }
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
 
 //______________________________________________________________________________
 const xAOD::TruthParticle* TauTruthMatchingTool::getTruth(const xAOD::TauJet& xTau)
 {
+  if (m_bIsData)
+    return nullptr;
+
+  if (retrieveTruthTaus().isFailure())
+    return nullptr;
+
   if (findTruthTau(xTau).isFailure())
     ATH_MSG_WARNING("There was a failure in finding the matched truth tau");
 
@@ -356,14 +378,14 @@ int TauTruthMatchingTool::getNTauDecayParticles(const xAOD::TruthParticle& xTrut
   }
 
   static SG::AuxElement::ConstAccessor<std::vector<int> > accDecayModeVector("DecayModeVector");
-  for(auto _iPdgId : accDecayModeVector(xTruthTau))
+  for(auto iPdgId2 : accDecayModeVector(xTruthTau))
     if (!bCompareAbsoluteValues)
     {
-      if (_iPdgId == iPdgId) iNum++;
+      if (iPdgId2 == iPdgId) iNum++;
     }
     else
     {
-      if (fabs(_iPdgId) == fabs(iPdgId)) iNum++;
+      if (std::abs(iPdgId2) == std::abs(iPdgId)) iNum++;
     }
   return iNum;
 }
@@ -457,13 +479,15 @@ StatusCode TauTruthMatchingTool::findTruthTau(const xAOD::TauJet& xTau) const
 //______________________________________________________________________________
 StatusCode TauTruthMatchingTool::retrieveTruthTaus()
 {
+  if (m_bNewEvent)
+    m_bNewEvent = false;
+  else
+    return StatusCode::SUCCESS;
+
   if ( m_bTruthTauAvailable )
   {
     if (evtStore()->contains<xAOD::TruthParticleContainer>(m_sTruthTauContainerName))
-    {
-      if ( evtStore()->retrieve(m_xTruthTauContainerConst,m_sTruthTauContainerName).isFailure() )
-        return StatusCode::FAILURE;
-    }
+      ATH_CHECK( evtStore()->retrieve(m_xTruthTauContainerConst,m_sTruthTauContainerName));
     else
     {
       ATH_MSG_INFO("TruthTaus container with name " << m_sTruthTauContainerName << " is not available, will generate the container for each event from TruthParticles container");
@@ -474,10 +498,7 @@ StatusCode TauTruthMatchingTool::retrieveTruthTaus()
   if ( m_bTruthMuonAvailable )
   {
     if (evtStore()->contains<xAOD::TruthParticleContainer>(m_sTruthMuonContainerName))
-    {
-      if ( evtStore()->retrieve(m_xTruthMuonContainerConst,m_sTruthMuonContainerName).isFailure() )
-        return StatusCode::FAILURE;
-    }
+      ATH_CHECK(evtStore()->retrieve(m_xTruthMuonContainerConst,m_sTruthMuonContainerName));
     else
     {
       ATH_MSG_INFO("TruthMuons container with name " << m_sTruthMuonContainerName << " is not available, won't perform matching to truth muons");
@@ -488,10 +509,7 @@ StatusCode TauTruthMatchingTool::retrieveTruthTaus()
   if ( m_bTruthElectronAvailable )
   {
     if (evtStore()->contains<xAOD::TruthParticleContainer>(m_sTruthElectronContainerName))
-    {
-      if ( evtStore()->retrieve(m_xTruthElectronContainerConst,m_sTruthElectronContainerName).isFailure() )
-        return StatusCode::FAILURE;
-    }
+      ATH_CHECK(evtStore()->retrieve(m_xTruthElectronContainerConst,m_sTruthElectronContainerName));
     else
     {
       ATH_MSG_INFO("TruthElectrons container with name " << m_sTruthElectronContainerName << " is not available, won't perform matching to truth electrons");
@@ -502,10 +520,7 @@ StatusCode TauTruthMatchingTool::retrieveTruthTaus()
   if ( m_bTruthJetAvailable )
   {
     if (evtStore()->contains<xAOD::JetContainer>(m_sTruthJetContainerName))
-    {
-      if ( evtStore()->retrieve(m_xTruthJetContainerConst,m_sTruthJetContainerName).isFailure() )
-        return StatusCode::FAILURE;
-    }
+      ATH_CHECK(evtStore()->retrieve(m_xTruthJetContainerConst,m_sTruthJetContainerName));
     else
     {
       ATH_MSG_INFO("TruthJets container with name " << m_sTruthJetContainerName << " is not available, won't perform matching to truth jets");
@@ -575,6 +590,13 @@ StatusCode TauTruthMatchingTool::buildTruthTausFromTruthParticles()
         continue;
       }
 
+      // Run classification
+      std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin> pClassification = m_tMCTruthClassifier->particleTruthClassifier(xTruthTau);
+      static SG::AuxElement::Decorator<unsigned int> decClassifierParticleType("classifierParticleType");
+      static SG::AuxElement::Decorator<unsigned int> decClassifierParticleOrigin("classifierParticleOrigin");
+      decClassifierParticleType(*xTruthTau) = pClassification.first;
+      decClassifierParticleOrigin(*xTruthTau) = pClassification.second;
+
       // create link to the original TruthParticle
       ElementLink < xAOD::TruthParticleContainer > lTruthParticleLink(xTruthParticle, *m_xTruthParticleContainer);
       static SG::AuxElement::Accessor<ElementLink< xAOD::TruthParticleContainer > > accOriginalTruthParticle("originalTruthParticle");
@@ -757,6 +779,12 @@ StatusCode TauTruthMatchingTool::examineTruthTau(const xAOD::TruthParticle& xTru
   for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xDecayVertex->nOutgoingParticles(); ++iOutgoingParticle )
   {
     const xAOD::TruthParticle* xTruthDaughter = xDecayVertex->outgoingParticle(iOutgoingParticle);
+    if (!xTruthDaughter)
+    {
+      ATH_MSG_FATAL("Truth daughter of tau decay was not found in "<<m_sTruthParticlesContainerName<<" container. Please ensure that this container has the full tau decay information or produce the TruthTaus container in AtlasDerivation.\nInformation on how to do this can be found here:\nhttps://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/TauPreRecommendations2015#Accessing_Tau_Truth_Information");
+      return StatusCode::FAILURE;
+    }
+
     // if tau decays into tau this is not a proper tau decay
     if ( xTruthDaughter->isTau() )
     {
@@ -857,6 +885,12 @@ StatusCode TauTruthMatchingTool::examineTruthTauDecay(const xAOD::TruthParticle&
   for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xDecayVertex->nOutgoingParticles(); ++iOutgoingParticle )
   {
     const xAOD::TruthParticle* xTruthDaughter = xDecayVertex->outgoingParticle(iOutgoingParticle);
+    if (!xTruthDaughter)
+    {
+      ATH_MSG_FATAL("Truth daughter of tau decay was not found in "<<m_sTruthParticlesContainerName<<" container. Please ensure that this container has the full tau decay information or produce the TruthTaus container in AtlasDerivation.\nInformation on how to do this can be found here:\nhttps://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/TauPreRecommendations2015#Accessing_Tau_Truth_Information");
+      return StatusCode::FAILURE;
+    }
+
     int iAbsPdgId = xTruthDaughter->absPdgId();
     int iPdgId = xTruthDaughter->pdgId();
 
@@ -929,6 +963,11 @@ void TauTruthMatchingTool::printDecay(const xAOD::TruthParticle& xTruthParticle,
   for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xDecayVertex->nOutgoingParticles(); ++iOutgoingParticle )
   {
     const xAOD::TruthParticle* xTruthDaughter = xDecayVertex->outgoingParticle(iOutgoingParticle);
+    if (!xTruthDaughter)
+    {
+      ATH_MSG_FATAL("Truth daughter of tau decay was not found in "<<m_sTruthParticlesContainerName<<" container. Please ensure that this container has the full tau decay information or produce the TruthTaus container in AtlasDerivation.\nInformation on how to do this can be found here:\nhttps://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/TauPreRecommendations2015#Accessing_Tau_Truth_Information");
+      return;
+    }
     ATH_MSG_WARNING("depth "<<depth
                     <<" e "<<xTruthDaughter->e()
                     <<" eta "<<xTruthDaughter->p4().Eta()
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthTrackMatchingTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthTrackMatchingTool.cxx
index f150612bf3c..69ec7c53300 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthTrackMatchingTool.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthTrackMatchingTool.cxx
@@ -4,6 +4,9 @@
 
 #include <TauAnalysisTools/TauTruthTrackMatchingTool.h>
 
+// EDM include(s)
+#include "xAODTruth/TruthParticle.h"
+
 using namespace TauAnalysisTools;
 
 //=================================PUBLIC-PART==================================
@@ -12,6 +15,8 @@ TauTruthTrackMatchingTool::TauTruthTrackMatchingTool( const std::string& name )
   : AsgTool(name)
   , m_bIsHadronicTrackAvailable(false)
   , m_bIsHadronicTrackAvailableChecked(false)
+  , m_bIsInitialized(false)
+  , m_tInDetTrackSelectionTool("InDetTrackSelectionTool", this)
 {
 }
 
@@ -23,7 +28,13 @@ TauTruthTrackMatchingTool::~TauTruthTrackMatchingTool( )
 //______________________________________________________________________________
 StatusCode TauTruthTrackMatchingTool::initialize()
 {
+  if (m_bIsInitialized)
+    return StatusCode::SUCCESS;
   ATH_MSG_INFO( "Initializing TauTruthTrackMatchingTool" );
+  ATH_CHECK(ASG_MAKE_ANA_TOOL(m_tInDetTrackSelectionTool, InDet::InDetTrackSelectionTool));
+  ATH_CHECK(m_tInDetTrackSelectionTool.setProperty( "CutLevel", "Loose" ));
+  ATH_CHECK(m_tInDetTrackSelectionTool.initialize());
+  m_bIsInitialized = true;
   return StatusCode::SUCCESS;
 }
 
@@ -44,8 +55,8 @@ StatusCode TauTruthTrackMatchingTool::classifyTrack(const TAUTRACKPARTICLE& xTra
   if (m_bIsHadronicTrackAvailable)
     return StatusCode::SUCCESS;
 
-  checkTrackIsTauInheritant(xTrackParticle);
-  checkTrackSpuriousType(xTrackParticle);
+  ATH_CHECK(checkTrackIsTauInheritant(xTrackParticle));
+  ATH_CHECK(checkTrackType(xTrackParticle));
   return StatusCode::SUCCESS;
 }
 
@@ -54,48 +65,130 @@ StatusCode TauTruthTrackMatchingTool::classifyTracks(std::vector<const TAUTRACKP
 {
   for (auto xTrackParticle : vTrackParticles)
   {
-    checkTrackIsTauInheritant(*xTrackParticle);
-    checkTrackSpuriousType(*xTrackParticle);
+    ATH_CHECK(checkTrackIsTauInheritant(*xTrackParticle));
+    ATH_CHECK(checkTrackType(*xTrackParticle));
   }
   return StatusCode::SUCCESS;
 }
 
 //=================================PRIVATE-PART=================================
 //______________________________________________________________________________
-void TauTruthTrackMatchingTool::checkTrackSpuriousType(const TAUTRACKPARTICLE& xTrackParticle)
+StatusCode TauTruthTrackMatchingTool::checkTrackType(const TAUTRACKPARTICLE& xTrackParticle)
 {
   const xAOD::TruthParticle* xTruthParticle = getTruthParticle(xTrackParticle);
 
-  static SG::AuxElement::Decorator<int> decSpuriousType("SpuriousType");
-  // if not truth track is available -> unclassified
+  static SG::AuxElement::Decorator<int> decTrackType("TrackType");
   if (!xTruthParticle)
   {
-    decSpuriousType(xTrackParticle) = TauAnalysisTools::UnclassifiedTrack;
-    return;
+    decTrackType(xTrackParticle) = TauAnalysisTools::UnclassifiedTrack;
+    return StatusCode::SUCCESS;
+  }
+
+#ifndef XAODTAU_VERSIONS_TAUJET_V3_H
+  if (!m_tInDetTrackSelectionTool->accept(xTrackParticle))
+#else
+  if (!m_tInDetTrackSelectionTool->accept(xTrackParticle.track()))
+#endif // not XAODTAU_VERSIONS_TAUJET_V3_H
+  {
+    decTrackType(xTrackParticle) = TauAnalysisTools::UnclassifiedTrack;
+    return StatusCode::SUCCESS;
   }
 
-  int iBarcode = xTruthParticle->barcode();
   static SG::AuxElement::ConstAccessor<float> accTruthMatchProbability("truthMatchProbability");
-  if (accTruthMatchProbability(xTrackParticle) >= 0.5)
+#ifndef XAODTAU_VERSIONS_TAUJET_V3_H
+  if (accTruthMatchProbability(xTrackParticle) < 0.5)
+#else
+  if (accTruthMatchProbability(*(xTrackParticle.track())) < 0.5)
+#endif // not XAODTAU_VERSIONS_TAUJET_V3_H
   {
-    if (iBarcode >= 10000 && iBarcode < 200000) decSpuriousType(xTrackParticle) = TauAnalysisTools::PileupTrack;
-    else if (iBarcode >= 200000)                decSpuriousType(xTrackParticle) = TauAnalysisTools::ConversionTrack;
-    else if (iBarcode > 0 && iBarcode < 10000)  decSpuriousType(xTrackParticle) = TauAnalysisTools::UnderlyingEventTrack;
-    else if (iBarcode == 0)                     decSpuriousType(xTrackParticle) = TauAnalysisTools::FakeTrack;
+    decTrackType(xTrackParticle) = TauAnalysisTools::FakeTrack;
+    return StatusCode::SUCCESS;
   }
-  else
+
+  static SG::AuxElement::ConstAccessor< char > accIsHadronicTrack("IsHadronicTrack");
+  static SG::AuxElement::ConstAccessor< int > accIsHadronicTrackDecayDepth("IsHadronicTrackDecayDepth");
+  if ((bool)accIsHadronicTrack(xTrackParticle) and accIsHadronicTrackDecayDepth(xTrackParticle) == 0)
   {
-    if (iBarcode < 200000)                      decSpuriousType(xTrackParticle) = TauAnalysisTools::FakeTrack;
-    else                                        decSpuriousType(xTrackParticle) = TauAnalysisTools::ConversionTrack;
+    decTrackType(xTrackParticle) = TauAnalysisTools::TauTrack;
+    return StatusCode::SUCCESS;
   }
+
+  int iBarcode = xTruthParticle->barcode();
+  if (iBarcode > 0 && iBarcode < 10000)            decTrackType(xTrackParticle) = TauAnalysisTools::UnderlyingEventTrack;
+  else if (iBarcode >= 10000 && iBarcode < 200000) decTrackType(xTrackParticle) = TauAnalysisTools::PileupTrack;
+  else if (iBarcode == 0)                          decTrackType(xTrackParticle) = TauAnalysisTools::FakeTrack;
+  else if (iBarcode >= 200000)                     ATH_CHECK(classifyConversion(xTrackParticle, *xTruthParticle));
+  else ATH_MSG_WARNING("No truth classification possible for barcode "<<iBarcode);
+
+  return StatusCode::SUCCESS;
 }
 
+//______________________________________________________________________________
+StatusCode TauTruthTrackMatchingTool::classifyConversion(const TAUTRACKPARTICLE& xTrackParticle, const xAOD::TruthParticle& xTruthParticle)
+{
+  static SG::AuxElement::Decorator<int> decTrackType("TrackType");
+  if (!xTruthParticle.isElectron())
+  {
+    decTrackType(xTrackParticle) = TauAnalysisTools::SecondaryTrack;
+    return StatusCode::SUCCESS;
+  }
+  const xAOD::TruthVertex* xProdVertex = xTruthParticle.prodVtx();
+  if ( !xProdVertex )
+  {
+    decTrackType(xTrackParticle) = TauAnalysisTools::SecondaryTrack;
+    return StatusCode::SUCCESS;
+  }
+  for ( size_t iIncomingParticle = 0; iIncomingParticle < xProdVertex->nIncomingParticles(); ++iIncomingParticle )
+  {
+    const xAOD::TruthParticle* xTruthParent = xProdVertex->incomingParticle(iIncomingParticle);
+    if (!xTruthParent)
+    {
+      ATH_MSG_FATAL("Truth parent of tau decay was not found in TruthParticles container. Please ensure that this container has the full tau decay information or produce the TruthTaus container in AtlasDerivation.\nInformation on how to do this can be found here:\nhttps://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/TauPreRecommendations2015#Accessing_Tau_Truth_Information");
+      return StatusCode::SUCCESS;
+    }
+
+    if (!xTruthParent->isPhoton())
+    {
+      decTrackType(xTrackParticle) = TauAnalysisTools::SecondaryTrack;
+      return StatusCode::SUCCESS;
+    }
+  }
+
+  size_t iElectrons = 0;
+  for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xProdVertex->nOutgoingParticles(); ++iOutgoingParticle )
+  {
+    const xAOD::TruthParticle* xTruthDaughter = xProdVertex->outgoingParticle(iOutgoingParticle);
+    if (!xTruthDaughter)
+    {
+      ATH_MSG_FATAL("Truth daughter of tau decay was not found in TruthParticles container. Please ensure that this container has the full tau decay information or produce the TruthTaus container in AtlasDerivation.\nInformation on how to do this can be found here:\nhttps://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/TauPreRecommendations2015#Accessing_Tau_Truth_Information");
+      return StatusCode::SUCCESS;
+    }
+
+    if (!xTruthDaughter->isElectron())
+    {
+      decTrackType(xTrackParticle) = TauAnalysisTools::SecondaryTrack;
+      return StatusCode::SUCCESS;
+    }
+    iElectrons++;
+  }
+  if (iElectrons != 2)
+  {
+    decTrackType(xTrackParticle) = TauAnalysisTools::SecondaryTrack;
+    return StatusCode::SUCCESS;
+  }
+  decTrackType(xTrackParticle) = TauAnalysisTools::ConversionTrack;
+  return StatusCode::SUCCESS;
+}
 
 //______________________________________________________________________________
 const xAOD::TruthParticle* TauTruthTrackMatchingTool::getTruthParticle(const TAUTRACKPARTICLE& xTrackParticle)
 {
   static SG::AuxElement::ConstAccessor< ElementLink<xAOD::TruthParticleContainer> > accTruthParticleLink("truthParticleLink");
+#ifdef XAODTAU_VERSIONS_TAUJET_V3_H
+  auto xTruthParticleContainer = accTruthParticleLink(*(xTrackParticle.track()));
+#else
   auto xTruthParticleContainer = accTruthParticleLink(xTrackParticle);
+#endif // XAODTAU_VERSIONS_TAUJET_V3_H
   //check validity of truth particle element link
   if (xTruthParticleContainer.isValid())
     return (*xTruthParticleContainer);
@@ -103,7 +196,7 @@ const xAOD::TruthParticle* TauTruthTrackMatchingTool::getTruthParticle(const TAU
 }
 
 //______________________________________________________________________________
-void TauTruthTrackMatchingTool::checkTrackIsTauInheritant(const TAUTRACKPARTICLE& xTrackParticle)
+StatusCode TauTruthTrackMatchingTool::checkTrackIsTauInheritant(const TAUTRACKPARTICLE& xTrackParticle)
 {
   static SG::AuxElement::Decorator< char > decIsHadronicTrack("IsHadronicTrack");
   static SG::AuxElement::Decorator< int > decIsHadronicTrackDecayDepth("IsHadronicTrackDecayDepth");
@@ -122,6 +215,8 @@ void TauTruthTrackMatchingTool::checkTrackIsTauInheritant(const TAUTRACKPARTICLE
   }
   decIsHadronicTrackDecayDepth(xTrackParticle) = iDepth;
   decDecayHistory(xTrackParticle) = sHistory;
+
+  return StatusCode::SUCCESS;
 }
 
 //______________________________________________________________________________
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonEfficiencyTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonEfficiencyTool.h
index f9e4e8f6ef1..d75dfb93c49 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonEfficiencyTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonEfficiencyTool.h
@@ -36,9 +36,6 @@
 #include "TF1.h"
 #include "TKey.h"
 
-// BOOST include(s):
-#include <boost/unordered_map.hpp>
-
 namespace TauAnalysisTools
 {
 
@@ -66,8 +63,6 @@ public:
   virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::TauJet& tau, double& dEfficiencyScaleFactor);
   virtual CP::CorrectionCode applyEfficiencyScaleFactor(const xAOD::TauJet& xTau);
 
-  virtual void setParent(TauEfficiencyCorrectionsTool* tTECT);
-
   /// returns: whether this tool is affected by the given systematis
   virtual bool isAffectedBySystematic( const CP::SystematicVariation& systematic ) const;
 
@@ -82,6 +77,12 @@ public:
   /// ignored (unless they
   virtual CP::SystematicCode applySystematicVariation ( const CP::SystematicSet& sSystematicSet);
 
+  virtual bool isSupportedRunNumber( int iRunNumber )
+  {
+    (void) iRunNumber;
+    return true;
+  };
+
 protected:
 
   std::string ConvertProngToString(const int& iProngness);
@@ -94,8 +95,7 @@ protected:
   typedef std::map<std::string, tTupleObjectFunc > tSFMAP;
   tSFMAP* m_mSF;
 
-  TauEfficiencyCorrectionsTool* m_tTECT;
-  boost::unordered_map < CP::SystematicSet, std::string > m_mSystematicSets;
+  std::unordered_map < CP::SystematicSet, std::string > m_mSystematicSets;
   const CP::SystematicSet* m_sSystematicSet;
   std::map<std::string, int> m_mSystematics;
   std::map<std::string, std::string> m_mSystematicsHistNames;
@@ -130,16 +130,26 @@ protected:
   e_TruthMatchedParticleType checkTruthMatch(const xAOD::TauJet& xTau) const;
   void generateSystematicSets();
 
+protected:
+
+  CP::SystematicSet m_sAffectingSystematics;
+  CP::SystematicSet m_sRecommendedSystematics;
+
   std::string m_sInputFilePath;
   std::string m_sInputFileName;
   std::string m_sWP;
   std::string m_sVarName;
-  bool m_bSkipTruthMatchCheck;
   std::string m_sSFHistName;
-  e_TruthMatchedParticleType m_eCheckTruth;
+  bool m_bSkipTruthMatchCheck;
+  bool m_bUseHighPtUncert;
   bool m_bNoMultiprong;
-  CP::SystematicSet m_sAffectingSystematics;
-  CP::SystematicSet m_sRecommendedSystematics;
+  bool m_bUseInclusiveEta;
+  int m_iIDLevel;
+  int m_iEVLevel;
+  int m_iOLRLevel;
+  int m_iContSysType;
+
+  e_TruthMatchedParticleType m_eCheckTruth;
 
   bool m_bSFIsAvailable;
   bool m_bSFIsAvailableChecked;
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonSmearingTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonSmearingTool.h
index e997db8fd0b..db1e77e2ce2 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonSmearingTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonSmearingTool.h
@@ -16,7 +16,8 @@
 */
 
 // Framework include(s):
-#include "AsgTools/AsgTool.h"
+#include "AsgTools/AsgMetadataTool.h"
+#include "AsgTools/AnaToolHandle.h"
 
 // EDM include(s):
 #include "xAODTau/TauJet.h"
@@ -35,18 +36,16 @@
 #include "TH1F.h"
 #include "TKey.h"
 
-// BOOST include(s):
-#include <boost/unordered_map.hpp>
+
+// tauRecTools include(s)
+#include "tauRecTools/ITauToolBase.h"
 
 namespace TauAnalysisTools
 {
 
-// forward declaration
-class TauSmearingTool;
-
 class CommonSmearingTool
   : public virtual ITauSmearingTool
-  , public asg::AsgTool
+  , public asg::AsgMetadataTool
 {
   /// Create a proper constructor for Athena
   ASG_TOOL_CLASS( CommonSmearingTool, TauAnalysisTools::ITauSmearingTool )
@@ -68,8 +67,6 @@ public:
   virtual CP::CorrectionCode correctedCopy( const xAOD::TauJet& xTau,
       xAOD::TauJet*& xTauCopy);
 
-  virtual void setParent(TauSmearingTool* tTST);
-
   /// returns: whether this tool is affected by the given systematis
   virtual bool isAffectedBySystematic( const CP::SystematicVariation& systematic ) const;
 
@@ -91,8 +88,7 @@ protected:
 
   typedef std::map<std::string, TH1F*> SFMAP;
   SFMAP* m_mSF;
-  TauSmearingTool* m_tTST;
-  boost::unordered_map < CP::SystematicSet, std::string > m_mSystematicSets;
+  std::unordered_map < CP::SystematicSet, std::string > m_mSystematicSets;
   const CP::SystematicSet* m_sSystematicSet;
   std::map<std::string, int> m_mSystematics;
   std::map<std::string, std::string> m_mSystematicsHistNames;
@@ -111,12 +107,25 @@ protected:
 
   std::string m_sInputFilePath;
   std::string m_sInputFileName;
+  bool m_bIsData;
+  bool m_bIsConfigured;
   bool m_bSkipTruthMatchCheck;
   bool m_bApplyFading;
+  bool m_bApplyMVATES;
+
+  asg::AnaToolHandle<ITauToolBase> m_tMvaTESVariableDecorator;
+  asg::AnaToolHandle<ITauToolBase> m_tMvaTESEvaluator;
+
   e_TruthMatchedParticleType m_eCheckTruth;
   bool m_bNoMultiprong;
   CP::SystematicSet m_sAffectingSystematics;
   CP::SystematicSet m_sRecommendedSystematics;
+
+private:
+
+  // Execute at each event
+  virtual StatusCode beginEvent();
+
 };
 } // namespace TauAnalysisTools
 
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauEfficiencyCorrectionsTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauEfficiencyCorrectionsTool.h
index 1f1dfca6080..c94c04d4852 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauEfficiencyCorrectionsTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauEfficiencyCorrectionsTool.h
@@ -46,6 +46,8 @@ public:
   /// Decorate the tau with its efficiency
   virtual CP::CorrectionCode applyEfficiencyScaleFactor( const xAOD::TauJet& xTau ) = 0;
 
+  virtual bool isSupportedRunNumber(int iRunNumber) = 0;
+
 }; // class ITauEfficiencyCorrectionsTool
 
 } // namespace TauAnalysisTools
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauOverlappingElectronLLHDecorator.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauOverlappingElectronLLHDecorator.h
index bed97898be6..9237bcd46aa 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauOverlappingElectronLLHDecorator.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauOverlappingElectronLLHDecorator.h
@@ -28,7 +28,8 @@
 namespace TauAnalysisTools
 {
 
-class ITauOverlappingElectronLLHDecorator : public virtual asg::IAsgTool
+class ITauOverlappingElectronLLHDecorator
+  : public virtual asg::IAsgTool
 {
 
   /// Declare the interface that the class provides
@@ -38,7 +39,7 @@ public:
 
   virtual StatusCode initializeEvent() __attribute__ ((deprecated("This function is deprecated. Please remove it from your code.\nFor further information please refer to the README:\nhttps://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/trunk/doc/README-TauOverlappingElectronLLHDecorator.rst"))) = 0;
 
-  virtual StatusCode decorate(const xAOD::TauJet& xTau) = 0;
+  virtual StatusCode decorate(const xAOD::TauJet& xTau) const = 0;
 
 }; // class ITauOverlappingElectronLLHDecorator
 
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauSelectionTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauSelectionTool.h
index 826cb5aab11..6ad6093cca2 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauSelectionTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauSelectionTool.h
@@ -60,6 +60,9 @@ public:
   /// Write control histograms to output file
   virtual void writeControlHistograms() = 0;
 
+  /// Call this for each new event.
+  virtual StatusCode beginEvent() __attribute__ ((deprecated("This function is deprecated and will be removed in the future without further notice. Please remove it from your code."))) = 0;
+
 }; // class ITauSelectionTool
 
 } // namespace TauAnalysisTools
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthMatchingTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthMatchingTool.h
index 718efead107..9effc9a5d11 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthMatchingTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthMatchingTool.h
@@ -86,6 +86,10 @@ public:
   virtual xAOD::TauJetParameters::DecayMode getDecayMode(const xAOD::TauJet& xTau) = 0;
   virtual xAOD::TauJetParameters::DecayMode getDecayMode(const xAOD::TruthParticle& xTruthTau) = 0;
 
+  // build the truth tau collection
+  virtual StatusCode buildTruthTausFromTruthParticles() = 0;
+  virtual StatusCode retrieveTruthTaus() = 0;
+
 }; // class ITauTruthMatchingTool
 
 } // namespace TauAnalysisTools
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthTrackMatchingTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthTrackMatchingTool.h
index 452555c53cf..37da4c1213a 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthTrackMatchingTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthTrackMatchingTool.h
@@ -20,21 +20,14 @@
 // Framework include(s):
 #include "AsgTools/IAsgTool.h"
 
-// Core include(s):
-#include "AthLinks/ElementLink.h"
-
 // xAOD include(s):
 #include "xAODTracking/TrackParticle.h"
-#include "xAODTruth/TruthParticle.h"
-#include "xAODTruth/TruthParticleContainer.h"
-#include "xAODTruth/TruthVertex.h"
 #include "xAODTau/TauJet.h"
+#include "xAODTruth/TruthParticleContainer.h"
 
 // EDM include(s):
 #include "PATInterfaces/CorrectionCode.h"
 
-// Local include(s):
-
 namespace TauAnalysisTools
 {
 
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/SelectionCuts.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/SelectionCuts.h
index 1ec3ff2cde1..97fb6af40ad 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/SelectionCuts.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/SelectionCuts.h
@@ -21,12 +21,12 @@
 #include "xAODTau/TauJet.h"
 #include "PATCore/TAccept.h"
 
-// Local include(s):
-#include "TauAnalysisTools/TauOverlappingElectronLLHDecorator.h"
-
 // ROOT include(s):
 #include "TH1F.h"
 
+// EDM include(s)
+#include "xAODMuon/MuonContainer.h"
+
 namespace TauAnalysisTools
 {
 
@@ -42,10 +42,6 @@ public:
   void writeControlHistograms();
   void fillHistogramCutPre(const xAOD::TauJet& xTau);
   void fillHistogramCut(const xAOD::TauJet& xTau);
-  virtual StatusCode beginEvent()
-  {
-    return StatusCode::SUCCESS;
-  };
   virtual bool accept(const xAOD::TauJet& xTau) = 0;
   TH1F* CreateControlPlot(const char* sName, const char* sTitle, int iBins, double dXLow, double dXUp);
 
@@ -151,17 +147,18 @@ class SelectionCutEleOLR
 {
 public:
   SelectionCutEleOLR(TauSelectionTool* tTST);
-  StatusCode beginEvent();
   bool accept(const xAOD::TauJet& xTau);
   ~SelectionCutEleOLR();
 
   bool getEvetoPass(const xAOD::TauJet& xTau);
 private:
-  TauOverlappingElectronLLHDecorator* m_tTOELLHDecorator;
+#ifndef XAODTAU_VERSIONS_TAUJET_V3_H
   bool m_bCheckEleMatchPassAvailable;
   bool m_bEleMatchPassAvailable;
+#endif // not XAODTAU_VERSIONS_TAUJET_V3_H
+
+  std::string m_sEleOlrPassDecorationName;
 
-  StatusCode createTOELLHDecorator();
   void fillHistogram(const xAOD::TauJet& xTau, TH1F& hHist);
   const std::string m_sEleOlrLhScoreDecorationName;
 };
@@ -176,6 +173,21 @@ private:
   void fillHistogram(const xAOD::TauJet& xTau, TH1F& hHist);
 };
 
+//added by Li-Gang Xia < ligang.xia@cern.ch >
+//to remove taus overlapping with mouns satisfying pt > 2 GeV and not calo-tagged
+class SelectionCutMuonOLR
+  : public SelectionCut
+{
+public:
+  SelectionCutMuonOLR(TauSelectionTool* tTST);
+  bool accept(const xAOD::TauJet& xTau);
+private:
+  bool m_bTauMuonOLR; //False: overlapped, the tau is not kept. True: not overlapped, the tau is kept.)
+  const xAOD::MuonContainer* m_xMuonContainer;
+  void fillHistogram(const xAOD::TauJet& xTau, TH1F& hHist);
+};
+
+
 }
 
 #endif // TAUANALYSISTOOLS_SELECTIONCUTS_H
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/SharedFilesVersion.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/SharedFilesVersion.h
index af3f4a18e9c..7a366349a92 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/SharedFilesVersion.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/SharedFilesVersion.h
@@ -2,4 +2,4 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-#define sSharedFilesVersion "00-01-36"
+#define sSharedFilesVersion "00-02-35"
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyContJetIDTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyContJetIDTool.h
index ae5b2a93869..75969092792 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyContJetIDTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyContJetIDTool.h
@@ -25,6 +25,8 @@ namespace TauAnalysisTools
 
 class TauEfficiencyContJetIDTool : public CommonEfficiencyTool
 {
+  ASG_TOOL_CLASS( TauEfficiencyContJetIDTool,
+                  TauAnalysisTools::ITauEfficiencyCorrectionsTool )
 
 public:
 
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyCorrectionsTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyCorrectionsTool.h
index 06832881bef..e7b7a2ff68c 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyCorrectionsTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyCorrectionsTool.h
@@ -18,43 +18,40 @@
 */
 
 // Framework include(s):
-#include "AsgTools/AsgTool.h"
+#include "AsgTools/AsgMetadataTool.h"
 
 // Local include(s):
-#include "TauAnalysisTools/Enums.h"
 #include "TauAnalysisTools/ITauEfficiencyCorrectionsTool.h"
+#include "TauAnalysisTools/TauSelectionTool.h"
 #include "TauAnalysisTools/CommonEfficiencyTool.h"
 #include "TauAnalysisTools/TauEfficiencyJetIDTool.h"
 #include "TauAnalysisTools/TauEfficiencyContJetIDTool.h"
 #include "TauAnalysisTools/TauEfficiencyEleIDTool.h"
 #include "TauAnalysisTools/TauEfficiencyTriggerTool.h"
-#include "TauAnalysisTools/TauSelectionTool.h"
+
+#if __has_include("PileupReweighting/IPileupReweightingTool.h")
+// Tool include(s)
+#include "AsgAnalysisInterfaces/IPileupReweightingTool.h"
+#define TAUANALYSISTOOLS_PRWTOOL_AVAILABLE
+#endif
 
 namespace TauAnalysisTools
 {
 
 class TauEfficiencyCorrectionsTool
   : public virtual ITauEfficiencyCorrectionsTool
-  , public asg::AsgTool
+  , public asg::AsgMetadataTool
 {
   /// Create a proper constructor for Athena
   ASG_TOOL_CLASS( TauEfficiencyCorrectionsTool, TauAnalysisTools::ITauEfficiencyCorrectionsTool )
 
-  // declaration of classes as friends to access private member variables
-  friend class CommonEfficiencyTool;
-  friend class TauEfficiencyJetIDTool;
-  friend class TauEfficiencyJetIDRun2Tool;
-  friend class TauEfficiencyContJetIDTool;
-  friend class TauEfficiencyEleIDTool;
-  friend class TauEfficiencyTriggerTool;
-
 public:
   /// Create a constructor for standalone usage
   TauEfficiencyCorrectionsTool( const std::string& sName );
 
   /// Create a constructor for standalone usage with preconfiguration for scale
   /// factors types depending on applied cuts from TauSelection Tool
-  TauEfficiencyCorrectionsTool( const std::string& sName, TauSelectionTool* tTauSelectionTool );
+  TauEfficiencyCorrectionsTool( const std::string& sName, TauSelectionTool* tTauSelectionTool )  __attribute__ ((deprecated("This function is deprecated. Please pass the TauSelectionTool as a ToolHandle via the property \"TauSelectionTool\". The function will be removed in the future without further notice.\nFor further information please refer to the README:\nhttps://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/trunk/doc/README-TauEfficiencyCorrectionsTool.rst")));
 
   ~TauEfficiencyCorrectionsTool();
 
@@ -81,21 +78,32 @@ public:
 
   virtual CP::SystematicCode applySystematicVariation( const CP::SystematicSet& systConfig );
 
-  virtual StatusCode setRunNumber(int iRunNumber);
+  virtual bool isSupportedRunNumber( int iRunNumber )
+  {
+    (void) iRunNumber;
+    return true;
+  };
 
 private:
+  StatusCode beginEvent();
+
   std::string ConvertJetIDToString(const int& iLevel);
   std::string ConvertEleOLRToString(const int& iLevel);
   std::string ConvertTriggerIDToString(const int& iLevel);
 
   StatusCode initializeWithTauSelectionTool();
 
+  StatusCode initializeTools_2016_fall();
+  StatusCode initializeTools_2016_ichep();
+  StatusCode initializeTools_mc15_moriond();
+  StatusCode initializeTools_mc15_pre_recommendations();
+  StatusCode initializeTools_mc12_final();
+
 private:
-  /// Some dummy property
-  int m_iEfficiencyCorrectionType;
+
   std::vector<int> m_vEfficiencyCorrectionTypes;
-  std::vector< CommonEfficiencyTool* > m_vCommonEfficiencyTools;
-  std::string m_sInputFilePath;
+  std::vector< asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* > m_vCommonEfficiencyTools;
+  std::vector< asg::AnaToolHandle<ITauEfficiencyCorrectionsTool>* > m_vTriggerEfficiencyTools;
   std::string m_sInputFilePathRecoHadTau;
   std::string m_sInputFilePathEleOLRHadTau;
   std::string m_sInputFilePathEleOLRElectron;
@@ -113,21 +121,31 @@ private:
   std::string m_sVarNameTriggerHadTau;
   std::string m_sRecommendationTag;
   std::string m_sTriggerName;
+  std::string m_sTriggerYear;
   bool m_bSkipTruthMatchCheck;
-  bool m_bNoMultiprong;
+  //bool m_bNoMultiprong;
   bool m_bUseIDExclusiveSF;
   bool m_bUseInclusiveEta;
   bool m_bUseTriggerInclusiveEta;
   bool m_bUsePtBinnedSF;
   bool m_bUseHighPtUncert;
+  bool m_bIsData;
+  bool m_bIsConfigured;
   int m_iIDLevel;
   int m_iEVLevel;
   int m_iOLRLevel;
   int m_iContSysType;
   int m_iTriggerPeriodBinning;
 
+  unsigned int m_iRunNumber;
+
+  ToolHandle<TauAnalysisTools::ITauSelectionTool> m_tTauSelectionToolHandle;
+#ifdef TAUANALYSISTOOLS_PRWTOOL_AVAILABLE
+  ToolHandle<CP::IPileupReweightingTool> m_tPRWTool;
+#endif // TAUANALYSISTOOLS_PRWTOOL_AVAILABLE
   TauSelectionTool* m_tTauSelectionTool;
 
+  std::string m_sEventInfoName;
 }; // class TauEfficiencyCorrectionsTool
 
 } // namespace TauAnalysisTools
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyEleIDTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyEleIDTool.h
index f3398f0cb9d..0c4e0cc7338 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyEleIDTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyEleIDTool.h
@@ -25,6 +25,8 @@ namespace TauAnalysisTools
 
 class TauEfficiencyEleIDTool : public CommonEfficiencyTool
 {
+  ASG_TOOL_CLASS( TauEfficiencyEleIDTool,
+                  TauAnalysisTools::ITauEfficiencyCorrectionsTool )
 
 public:
 
@@ -35,34 +37,18 @@ public:
   CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::TauJet& xTau,
       double& dEfficiencyScaleFactor);
 
+  virtual StatusCode initialize();
+
 private:
   void setupWorkingPointSubstrings();
   std::string convertIDToString(int iLevel) const;
   std::string convertEVetoToString(int iLevel) const;
   std::string convertOLRToString(int iLevel) const;
 
-  // cache configs;
-  int m_iIDLevelCache;
-  int m_iEVLevelCache;
-  int m_iOLRLevelCache;
-
-  // string configs
-  std::string m_sIDLevel;
-  std::string m_sEVLevel;
-  std::string m_sOLRLevel;
-
-  // string configs for 3p eveto
-  std::string m_sIDLevel_eveto3p;
-  std::string m_sEVLevel_eveto3p;
-  std::string m_sOLRLevel_eveto3p;
-
   // declaration of the working point
   std::string m_sWorkingPoint_1p;
   std::string m_sWorkingPoint_3p;
 
-  // up/down direction
-  int m_iSysDirection;
-
 };
 } // namespace TauAnalysisTools
 
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyJetIDTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyJetIDTool.h
index 87a67dba83a..c9bf8705f9a 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyJetIDTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyJetIDTool.h
@@ -25,6 +25,8 @@ namespace TauAnalysisTools
 
 class TauEfficiencyJetIDTool : public CommonEfficiencyTool
 {
+  ASG_TOOL_CLASS( TauEfficiencyJetIDTool,
+                  TauAnalysisTools::ITauEfficiencyCorrectionsTool )
 
 public:
 
@@ -34,10 +36,6 @@ public:
 
   CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::TauJet& xTau,
       double& efficiencyScaleFactor);
-
-private:
-  std::string m_sIDLevel;
-  int m_iIDLevelCache;
 };
 } // namespace TauAnalysisTools
 
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyTriggerTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyTriggerTool.h
index 3bb5ce06b73..bf112f16cdf 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyTriggerTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauEfficiencyTriggerTool.h
@@ -37,9 +37,6 @@
 #include "TF1.h"
 #include "TKey.h"
 
-// BOOST include(s):
-#include <boost/unordered_map.hpp>
-
 namespace TauAnalysisTools
 {
 
@@ -49,78 +46,32 @@ class TauEfficiencyCorrectionsTool;
 class TauEfficiencyTriggerTool
   : public CommonEfficiencyTool
 {
+  ASG_TOOL_CLASS( TauEfficiencyTriggerTool,
+                  TauAnalysisTools::ITauEfficiencyCorrectionsTool )
 
 public:
 
   TauEfficiencyTriggerTool(std::string sName);
 
-  ~TauEfficiencyTriggerTool();
-
-  virtual StatusCode initialize();
-
-  // TauEfficiencyTriggerTool pure virtual public functionality
-  //__________________________________________________________________________
+  StatusCode initialize();
 
   virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::TauJet& tau, double& dEfficiencyScaleFactor);
-  virtual CP::CorrectionCode applyEfficiencyScaleFactor(const xAOD::TauJet& xTau);
-
-  virtual void setParent(TauEfficiencyCorrectionsTool* tTECT);
-
-  /// returns: whether this tool is affected by the given systematis
-  virtual bool isAffectedBySystematic( const CP::SystematicVariation& systematic ) const;
 
-  /// returns: the list of all systematics this tool can be affected by
-  virtual CP::SystematicSet affectingSystematics() const;
-
-  /// returns: the list of all systematics this tool recommends to use
-  virtual CP::SystematicSet recommendedSystematics() const;
-
-  /// configure this tool for the given list of systematic variations.  any
-  /// requested systematics that are not affecting this tool will be silently
-  /// ignored (unless they
   virtual CP::SystematicCode applySystematicVariation ( const CP::SystematicSet& sSystematicSet);
 
   virtual StatusCode setRunNumber(int iRunNumber);
 
+  bool isSupportedRunNumber(int iRunNumber);
+
 protected:
 
-  std::string ConvertProngToString(const int& iProngness);
   std::string convertPeriodToStr();
 
-  typedef std::tuple<TObject*,
-          CP::CorrectionCode (*)(const TObject* oObject,
-                                 double& dEfficiencyScaleFactor,
-                                 double dPt,
-                                 double dEta) > tTupleObjectFunc;
-  typedef std::map<std::string, tTupleObjectFunc > tSFMAP;
-
-  void ReadInputs(TFile* fFile);
-  virtual CP::CorrectionCode getValue(const std::string& sHistName,
-                                      const xAOD::TauJet& xTau,
-                                      double& dEfficiencyScaleFactor) const;
-
-  static CP::CorrectionCode getValueTH2F(const TObject* oObject,
-                                         double& dEfficiencyScaleFactor,
-                                         double dPt,
-                                         double dEta
-                                        );
-  static CP::CorrectionCode getValueTH2D(const TObject* oObject,
-                                         double& dEfficiencyScaleFactor,
-                                         double dPt,
-                                         double dEta
-                                        );
-  static CP::CorrectionCode getValueTF1(const TObject* oObject,
-                                        double& dEfficiencyScaleFactor,
-                                        double dPt,
-                                        double dEta
-                                       );
-
-  e_TruthMatchedParticleType checkTruthMatch(const xAOD::TauJet& xTau) const;
-  void generateSystematicSets();
-
   e_DataPeriod m_ePeriod;
   int m_ePeriodBinning;
 
+  int m_iMinRunNumber;
+  int m_iMaxRunNumber;
 };
 } // namespace TauAnalysisTools
 
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauOverlappingElectronLLHDecorator.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauOverlappingElectronLLHDecorator.h
index 38015e31ed4..877dde124da 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauOverlappingElectronLLHDecorator.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauOverlappingElectronLLHDecorator.h
@@ -57,27 +57,28 @@ public:
 
   virtual StatusCode initializeEvent() __attribute__ ((deprecated("This function is deprecated. Please remove it from your code.\nFor further information please refer to the README:\nhttps://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/trunk/doc/README-TauOverlappingElectronLLHDecorator.rst")));
 
-  virtual StatusCode decorate(const xAOD::TauJet& xTau);
+  virtual StatusCode decorate(const xAOD::TauJet& xTau) const;
 
 private:
   AsgElectronLikelihoodTool* m_tEMLHTool;
-  const xAOD::ElectronContainer* m_xElectronContainer;
+  mutable const xAOD::ElectronContainer* m_xElectronContainer;
   std::string m_sElectronContainerName;
   bool m_bElectonsAvailable;
   std::string m_sEleOLRFilePath;
   TH2D* m_hCutValues;
 
 private:
-  float getCutVal(float fEta, float fPt);
-  StatusCode retrieveElectrons();
+  float getCutVal(float fEta, float fPt) const;
+  StatusCode retrieveElectrons() const;
   virtual StatusCode beginEvent();
 
 private:
-  bool m_bEleOLRMatchAvailable;
-  bool m_bEleOLRMatchAvailableChecked;
-  bool m_bNewEvent;
+  mutable bool m_bEleOLRMatchAvailable;
+  mutable bool m_bNewEvent;
 
   std::string m_sElectronPhotonSelectorToolsConfigFile;
+  std::string m_sEleOlrPassDecorationName;
+  std::string m_sEleOlrLhScoreDecorationName;
 
 }; // class TauOverlappingElectronLLHDecorator
 
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSelectionTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSelectionTool.h
index 92ce0946bc6..7f61cc2a21a 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSelectionTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSelectionTool.h
@@ -19,15 +19,15 @@
 
 // Framework include(s):
 #include "AsgTools/AsgMetadataTool.h"
+#include "AsgTools/AnaToolHandle.h"
 #include "PATCore/IAsgSelectionTool.h"
 
 // Local include(s):
 #include "TauAnalysisTools/ITauSelectionTool.h"
 #include "TauAnalysisTools/Enums.h"
 #include "TauAnalysisTools/HelperFunctions.h"
-
-// EDM include(s):
-#include "xAODEgamma/ElectronContainer.h"
+// for some reason it's not enough to include interface
+#include "TauAnalysisTools/TauOverlappingElectronLLHDecorator.h"
 
 // ROOT include(s):
 #include "TH1F.h"
@@ -47,23 +47,25 @@ class SelectionCutBDTEleScore;
 class SelectionCutEleBDTWP;
 class SelectionCutEleOLR;
 class SelectionCutMuonVeto;
+class SelectionCutMuonOLR;
 
 enum SelectionCuts
 {
-  NoCut           = 0,   	// 00000000000
-  CutPt           = 1,   	// 00000000001
-  CutAbsEta       = 1<<1,	// 00000000010
-  CutPhi          = 1<<2,	// 00000000100
-  CutNTrack       = 1<<3,	// 00000001000
-  CutAbsCharge    = 1<<4,	// 00000010000
-  CutJetBDTScore  = 1<<5,	// 00000100000
-  CutJetIDWP      = 1<<6,	// 00001000000
-  CutEleBDTScore  = 1<<7,	// 00010000000
-  CutEleBDTWP     = 1<<8,	// 00100000000
-  CutMuonVeto     = 1<<9,	// 01000000000
-  CutEleOLR       = 1<<10	// 10000000000
+  NoCut           = 0,   	// 000000000000
+  CutPt           = 1,   	// 000000000001
+  CutAbsEta       = 1<<1,	// 000000000010
+  CutPhi          = 1<<2,	// 000000000100
+  CutNTrack       = 1<<3,	// 000000001000
+  CutAbsCharge    = 1<<4,	// 000000010000
+  CutJetBDTScore  = 1<<5,	// 000000100000
+  CutJetIDWP      = 1<<6,	// 000001000000
+  CutEleBDTScore  = 1<<7,	// 000010000000
+  CutEleBDTWP     = 1<<8,	// 000100000000
+  CutMuonVeto     = 1<<9,	// 001000000000
+  CutEleOLR       = 1<<10,	// 010000000000
+  CutMuonOLR      = 1<<11	// 100000000000
 };
-
+  
 class TauSelectionTool : public virtual IAsgSelectionTool,
   public virtual ITauSelectionTool,
   public asg::AsgMetadataTool
@@ -81,6 +83,7 @@ class TauSelectionTool : public virtual IAsgSelectionTool,
   friend class SelectionCutEleBDTWP;
   friend class SelectionCutEleOLR;
   friend class SelectionCutMuonVeto;
+  friend class SelectionCutMuonOLR;
 
   /// Create a proper constructor for Athena
   ASG_TOOL_CLASS2( TauSelectionTool,
@@ -157,6 +160,8 @@ private:
   bool m_bEleOLR;
   // do muon veto
   bool m_bMuonVeto;
+  // do muon OLR
+  bool m_bMuonOLR;
 
   float m_dPtMin;
   float m_dPtMax;
@@ -176,10 +181,10 @@ protected:
 private:
   std::string m_sConfigPath;
   std::string m_sEleOLRFilePath;
-  std::string m_sCuts;
   std::string m_sElectronContainerName;
+  std::string m_sMuonContainerName;
 
-  const xAOD::ElectronContainer* m_xElectronContainer;
+  asg::AnaToolHandle<TauAnalysisTools::ITauOverlappingElectronLLHDecorator> m_tTOELLHDecorator;
 
   std::map<SelectionCuts, TauAnalysisTools::SelectionCut*> m_cMap;
 
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSmearingRun1Tool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSmearingRun1Tool.h
index 1c5d298280e..93f01d6b5fe 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSmearingRun1Tool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSmearingRun1Tool.h
@@ -27,15 +27,14 @@
 #include "TH1D.h"
 #include "TFile.h"
 
-// BOOST include(s):
-#include <boost/unordered_map.hpp>
-
 namespace TauAnalysisTools
 {
 
 class TauSmearingRun1Tool
   : public CommonSmearingTool
 {
+  ASG_TOOL_CLASS( TauSmearingRun1Tool,
+                  TauAnalysisTools::ITauSmearingTool )
 
 public:
   /// Create a constructor for standalone usage
@@ -95,7 +94,7 @@ public:
   };
 
 private:
-  const double GeV;
+  const double m_GeV;
   const unsigned int m_iEtaBins;
   //in-situ uncertainties
   const double m_dInSituStat1P;
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSmearingTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSmearingTool.h
index f0a4a3ad9cf..ddc7b7d6889 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSmearingTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauSmearingTool.h
@@ -19,6 +19,7 @@
 
 // Framework include(s):
 #include "AsgTools/AsgTool.h"
+#include "AsgTools/AnaToolHandle.h"
 
 // Local include(s):
 #include "TauAnalysisTools/Enums.h"
@@ -28,9 +29,6 @@
 namespace TauAnalysisTools
 {
 
-// forward includes
-class TauSmearingRun1Tool;
-
 class TauSmearingTool
   : public asg::AsgTool
   , public virtual ITauSmearingTool
@@ -38,10 +36,6 @@ class TauSmearingTool
   /// Create a proper constructor for Athena
   ASG_TOOL_CLASS( TauSmearingTool, TauAnalysisTools::ITauSmearingTool )
 
-  // declaration of classes as friends to access private member variables
-  friend class CommonSmearingTool;
-  friend class TauSmearingRun1Tool;
-
 public:
   /// Create a constructor for standalone usage
   TauSmearingTool( const std::string& sName );
@@ -69,12 +63,14 @@ public:
   virtual CP::SystematicCode applySystematicVariation( const CP::SystematicSet& systConfig );
 
 private:
-  std::shared_ptr<CommonSmearingTool> m_tCommonSmearingTool;
+  asg::AnaToolHandle<ITauSmearingTool> m_tCommonSmearingTool;
   std::string m_sInputFilePath;
   std::string m_sRecommendationTag;
+  bool m_bIsData;
   bool m_bSkipTruthMatchCheck;
   bool m_bApplyFading;
-  bool m_bIsData;
+
+  bool m_bApplyMVATES;
 
 }; // class TauSmearingTool
 
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauTruthMatchingTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauTruthMatchingTool.h
index d2782016ad4..efcfb1c481c 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauTruthMatchingTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauTruthMatchingTool.h
@@ -19,9 +19,11 @@
 
 // Framework include(s):
 #include "AsgTools/AsgMetadataTool.h"
+#include "AsgTools/AnaToolHandle.h"
 
 // Core include(s):
 #include "TruthUtils/PIDHelpers.h"
+#include "MCTruthClassifier/IMCTruthClassifier.h"
 
 // EDM include(s):
 #include "xAODTau/TauxAODHelpers.h"
@@ -42,7 +44,7 @@ enum eSampleType
 
 
 class TauTruthMatchingTool
-  : public TauAnalysisTools::ITauTruthMatchingTool
+  : public virtual TauAnalysisTools::ITauTruthMatchingTool
   , public asg::AsgMetadataTool
 {
   /// Create a proper constructor for Athena
@@ -56,63 +58,64 @@ public:
   virtual ~TauTruthMatchingTool();
 
   // initialize the tool
-  virtual StatusCode initialize();
+  virtual StatusCode initialize() override final;
 
   // get TruthTauContainer
-  virtual xAOD::TruthParticleContainer* getTruthTauContainer();
+  virtual xAOD::TruthParticleContainer* getTruthTauContainer() override final;
 
   // get TruthTauAuxContainer
-  virtual xAOD::TruthParticleAuxContainer* getTruthTauAuxContainer();
+  virtual xAOD::TruthParticleAuxContainer* getTruthTauAuxContainer() override final;
 
   // apply match to a single tau
-  virtual const xAOD::TruthParticle* applyTruthMatch(const xAOD::TauJet& xTau);
+  virtual const xAOD::TruthParticle* applyTruthMatch(const xAOD::TauJet& xTau) override final;
 
   // apply match to all taus in a vector
-  virtual std::vector<const xAOD::TruthParticle*> applyTruthMatch(const std::vector<const xAOD::TauJet*>& vTaus);
+  virtual std::vector<const xAOD::TruthParticle*> applyTruthMatch(const std::vector<const xAOD::TauJet*>& vTaus) override final;
 
   // set pointer to truth particle container
-  virtual StatusCode setTruthParticleContainer(const xAOD::TruthParticleContainer* xTruthParticleContainer) __attribute__ ((deprecated("This function is deprecated. Please remove it from your code and use the configurable property \"TruthParticlesContainerName\" instead.\nFor further information please refer to the README:\nhttps://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/trunk/doc/README-TauTruthMatchingTool.rst")));
+  virtual StatusCode setTruthParticleContainer(const xAOD::TruthParticleContainer* xTruthParticleContainer)  override final __attribute__ ((deprecated("This function is deprecated. Please remove it from your code and use the configurable property \"TruthParticlesContainerName\" instead.\nFor further information please refer to the README:\nhttps://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/trunk/doc/README-TauTruthMatchingTool.rst")));
 
   // set pointer to event
-  virtual StatusCode initializeEvent() __attribute__ ((deprecated("This function is deprecated. Please remove it from your code.\nFor further information please refer to the README:\nhttps://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/trunk/doc/README-TauTruthMatchingTool.rst")));
+  virtual StatusCode initializeEvent() override final __attribute__ ((deprecated("This function is deprecated. Please remove it from your code.\nFor further information please refer to the README:\nhttps://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/trunk/doc/README-TauTruthMatchingTool.rst")));
 
   // get pointer to truth tau, if no truth tau was found a null pointer is returned
-  virtual const xAOD::TruthParticle* getTruth(const xAOD::TauJet& xTau);
+  virtual const xAOD::TruthParticle* getTruth(const xAOD::TauJet& xTau) override final;
+
+  StatusCode buildTruthTausFromTruthParticles() override final;
+  StatusCode retrieveTruthTaus() override final;
 
   // wrapper function to get truth tau visible TLorentzvector
-  virtual TLorentzVector getTruthTauP4Vis(const xAOD::TauJet& xTau);
-  virtual TLorentzVector getTruthTauP4Vis(const xAOD::TruthParticle& xTruthTau);
+  virtual TLorentzVector getTruthTauP4Vis(const xAOD::TauJet& xTau) override final;
+  virtual TLorentzVector getTruthTauP4Vis(const xAOD::TruthParticle& xTruthTau) override final;
 
   // wrapper function to get truth tau prompt TLorentzvector
-  virtual TLorentzVector getTruthTauP4Prompt(const xAOD::TauJet& xTau);
-  virtual TLorentzVector getTruthTauP4Prompt(const xAOD::TruthParticle& xTruthTau);
+  virtual TLorentzVector getTruthTauP4Prompt(const xAOD::TauJet& xTau) override final;
+  virtual TLorentzVector getTruthTauP4Prompt(const xAOD::TruthParticle& xTruthTau) override final;
 
   // wrapper function to get truth tau invisible TLorentzvector
-  virtual TLorentzVector getTruthTauP4Invis(const xAOD::TauJet& xTau);
-  virtual TLorentzVector getTruthTauP4Invis(const xAOD::TruthParticle& xTruthTau);
+  virtual TLorentzVector getTruthTauP4Invis(const xAOD::TauJet& xTau) override final;
+  virtual TLorentzVector getTruthTauP4Invis(const xAOD::TruthParticle& xTruthTau) override final;
 
   // get type of truth match particle (hadronic tau, leptonic tau, electron, muon, jet)
-  virtual TauAnalysisTools::TruthMatchedParticleType getTruthParticleType(const xAOD::TauJet& xTau);
+  virtual TauAnalysisTools::TruthMatchedParticleType getTruthParticleType(const xAOD::TauJet& xTau) override final;
 
   // wrapper function to count number of decay particles of given pdg id
-  virtual int getNTauDecayParticles(const xAOD::TauJet& xTau, int iPdgId, bool bCompareAbsoluteValues = false);
-  virtual int getNTauDecayParticles(const xAOD::TruthParticle& xTruthTau, int iPdgId, bool bCompareAbsoluteValues = false);
+  virtual int getNTauDecayParticles(const xAOD::TauJet& xTau, int iPdgId, bool bCompareAbsoluteValues = false) override final;
+  virtual int getNTauDecayParticles(const xAOD::TruthParticle& xTruthTau, int iPdgId, bool bCompareAbsoluteValues = false) override final;
 
   // wrapper function to obtain truth verion of xAOD::TauJetParameters::DecayMode
-  virtual xAOD::TauJetParameters::DecayMode getDecayMode(const xAOD::TauJet& xTau);
-  virtual xAOD::TauJetParameters::DecayMode getDecayMode(const xAOD::TruthParticle& xTruthTau);
+  virtual xAOD::TauJetParameters::DecayMode getDecayMode(const xAOD::TauJet& xTau) override final;
+  virtual xAOD::TauJetParameters::DecayMode getDecayMode(const xAOD::TruthParticle& xTruthTau) override final;
 
 private:
 
   // Execute at each event
-  virtual StatusCode beginEvent();
+  virtual StatusCode beginEvent() override final;
 
   int getNumPdgId(const xAOD::TauJet& xTau, std::vector<int> vPdgIdMatch) const;
   int getNumPdgId(const xAOD::TruthParticle& xTruthTau, std::vector<int> vPdgIdMatch) const;
 
   StatusCode findTruthTau(const xAOD::TauJet& xTau) const;
-  StatusCode retrieveTruthTaus();
-  StatusCode buildTruthTausFromTruthParticles();
 
   StatusCode examineTruthTau(const xAOD::TruthParticle& xTruthParticle);
   StatusCode examineTruthTauDecay(const xAOD::TruthParticle& xTruthParticle);
@@ -120,6 +123,10 @@ private:
 
   StatusCode checkTruthMatch (const xAOD::TauJet& xTau, const xAOD::TruthParticleContainer& xTauContainer) const;
 
+private:
+  bool m_bIsData;
+  bool m_bIsConfigured;
+
   const xAOD::TruthParticleContainer* m_xTruthParticleContainer;
   const xAOD::TruthParticleContainer* m_xTruthTauContainerConst;
   const xAOD::TruthParticleContainer* m_xTruthMuonContainerConst;
@@ -162,19 +169,17 @@ private:
 
   bool m_bIsHadronicTau;
 
-  // deprecated variables
-  int m_iSampleType;
-  bool m_bOptimizeForReco;
-
 private:
   mutable bool m_bIsTruthMatchedAvailable;
   mutable bool m_bIsTruthMatchedAvailableChecked;
+  mutable bool m_bNewEvent;
 
   SG::AuxElement::ConstAccessor<double> m_accPtVis;
   SG::AuxElement::ConstAccessor<double> m_accEtaVis;
   SG::AuxElement::ConstAccessor<double> m_accPhiVis;
   SG::AuxElement::ConstAccessor<double> m_accMVis;
 
+  asg::AnaToolHandle<IMCTruthClassifier> m_tMCTruthClassifier;
 
 }; // class TauTruthMatchingTool
 
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauTruthTrackMatchingTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauTruthTrackMatchingTool.h
index 3e92eab1883..7c670a3e2f8 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauTruthTrackMatchingTool.h
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauTruthTrackMatchingTool.h
@@ -19,20 +19,29 @@
 
 // Framework include(s):
 #include "AsgTools/AsgTool.h"
+#include "AsgTools/AnaToolHandle.h"
 
-// Local include(s):
+// Tool include(s)
+#include "InDetTrackSelectionTool/InDetTrackSelectionTool.h"
+
+// Local include(s)
 #include "TauAnalysisTools/ITauTruthTrackMatchingTool.h"
 
+// EDM include(s)
+#include "xAODTruth/TruthVertex.h"
+
 
 namespace TauAnalysisTools
 {
-enum TrackSpuriousType_t
+enum TrackType_t
 {
   UnclassifiedTrack     = 0, // Track is unclassified
-  ConversionTrack       = 1, // Track is from conversion
-  PileupTrack           = 2, // Track is from pileup
+  TauTrack              = 1, // Track is from direct tau decay
+  ConversionTrack       = 2, // Track is from conversion
   UnderlyingEventTrack  = 3, // Track is from underlying event
-  FakeTrack             = 4  // Track is a fake
+  SecondaryTrack        = 4, // Track is a secondary track
+  PileupTrack           = 5, // Track is from pileup
+  FakeTrack             = 6  // Track is a fake
 };
 
 
@@ -60,14 +69,17 @@ public:
 
 private:
 
-  void checkTrackSpuriousType(const TAUTRACKPARTICLE& xTrackParticle);
-  void checkTrackIsTauInheritant(const TAUTRACKPARTICLE& xTrackParticle);
+  StatusCode classifyConversion(const TAUTRACKPARTICLE& xTrackParticle, const xAOD::TruthParticle& xTruthParticle);
+  StatusCode checkTrackType(const TAUTRACKPARTICLE& xTrackParticle);
+  StatusCode checkTrackIsTauInheritant(const TAUTRACKPARTICLE& xTrackParticle);
   bool checkTruthParent(const xAOD::TruthParticle& xTruthParticle, int& iDepth, std::string& sHistory);
   const xAOD::TruthParticle* getTruthParticle(const TAUTRACKPARTICLE& xTrackParticle);
 
 private:
   bool m_bIsHadronicTrackAvailable;
   bool m_bIsHadronicTrackAvailableChecked;
+  bool m_bIsInitialized;
+  asg::AnaToolHandle<InDet::IInDetTrackSelectionTool> m_tInDetTrackSelectionTool;
 
 }; // class TauTruthTrackMatchingTool
 
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/selection.xml b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/selection.xml
index bfd306b9c9c..2b1f07be412 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/selection.xml
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/selection.xml
@@ -1,4 +1,6 @@
 <lcgdict>
+  <class name="TauAnalysisTools::CommonSmearingTool" />
+  <class name="TauAnalysisTools::CommonEfficiencyTool" />
   <class name="TauAnalysisTools::TauEfficiencyCorrectionsTool" />
   <class name="TauAnalysisTools::TauSelectionTool" />
   <class name="TauAnalysisTools::TauSmearingTool" />
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/cmt/Makefile.RootCore b/PhysicsAnalysis/TauID/TauAnalysisTools/cmt/Makefile.RootCore
index df6fc60531f..317c2ab8891 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/cmt/Makefile.RootCore
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/cmt/Makefile.RootCore
@@ -12,7 +12,7 @@ PACKAGE_OBJFLAGS =
 PACKAGE_LDFLAGS  = 
 PACKAGE_BINFLAGS =
 PACKAGE_LIBFLAGS = 
-PACKAGE_DEP      = AsgTools PATCore xAODTau xAODEventInfo xAODTruth xAODJet PATInterfaces PathResolver xAODEgamma ElectronPhotonSelectorTools
+PACKAGE_DEP      = AsgTools PATCore xAODTau xAODEventInfo xAODTruth xAODJet PATInterfaces PathResolver xAODEgamma ElectronPhotonSelectorTools InDetTrackSelectionTool MCTruthClassifier PileupReweighting tauRecTools
 PACKAGE_TRYDEP   = 
 PACKAGE_CLEAN    =
 PACKAGE_NOGRID   =
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/cmt/requirements b/PhysicsAnalysis/TauID/TauAnalysisTools/cmt/requirements
index 6f296046847..dec70505a7f 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/cmt/requirements
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/cmt/requirements
@@ -1,7 +1,9 @@
 package TauAnalysisTools
+author NLAA
 
 public
 
+
 use AtlasPolicy     AtlasPolicy-*
 
 use AsgTools        AsgTools-*        Control/AthToolSupport
@@ -12,12 +14,15 @@ use xAODTau         xAODTau-*         Event/xAOD
 use xAODTruth       xAODTruth-*       Event/xAOD
 use xAODJet         xAODJet-*         Event/xAOD
 use xAODEgamma      xAODEgamma-*      Event/xAOD
+use xAODMuon        xAODMuon-*        Event/xAOD
 use xAODTracking    xAODTracking-*    Event/xAOD
 use AtlasROOT       AtlasROOT-*       External
-use AtlasBoost      AtlasBoost-*      External 
-use AthLinks        AthLinks-*        Control
 use TruthUtils      TruthUtils-*      Generators
 use ElectronPhotonSelectorTools ElectronPhotonSelectorTools-*  PhysicsAnalysis/ElectronPhotonID
+use InDetTrackSelectionTool InDetTrackSelectionTool-* InnerDetector/InDetRecTools
+use MCTruthClassifier MCTruthClassifier-* PhysicsAnalysis
+# use PileupReweighting PileupReweighting-* PhysicsAnalysis/AnalysisCommon
+use tauRecTools     tauRecTools-*     Reconstruction
 
 private
 
@@ -26,6 +31,9 @@ use AthenaBaseComps AthenaBaseComps-* Control
 use xAODEventInfo   xAODEventInfo-*   Event/xAOD
 use xAODCore        xAODCore-*        Event/xAOD
 use PathResolver    PathResolver-*    Tools
+use AthLinks        AthLinks-*        Control
+use AthAnalysisBaseComps AthAnalysisBaseComps-* Control
+use POOLRootAccess POOLRootAccess-* PhysicsAnalysis
 
 end_private
 
@@ -42,3 +50,9 @@ apply_pattern declare_runtime files="*.root ../share/EfficiencyCorrections/*.roo
 # # generate dictionaries for PyROOT 
 # apply_pattern lcgdict dict=TauAnalysisTools selectionfile=selection.xml headerfiles="../TauAnalysisTools/TauAnalysisToolsDict.h"
 
+#test application
+private
+application ut_TauAnalysisTools_test ../test/ut_TauAnalysisTools_test.cxx
+#ensure main library is built before the test application, and all components are created so factory exists
+macro_append ut_TauAnalysisTools_test_dependencies " TauAnalysisToolsMergeComponentsList "
+end_private
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauEfficiencyCorrectionsTool.rst b/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauEfficiencyCorrectionsTool.rst
index c5e9d070135..bc3979013d5 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauEfficiencyCorrectionsTool.rst
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauEfficiencyCorrectionsTool.rst
@@ -63,12 +63,15 @@ The variable names for the scale factors have default values, but can be
 configured. For information on this please refer to the `section Available
 properties <README-TauEfficiencyCorrectionsTool.rst#available-properties>`_
 below.
-  
-In addition to the standard tool constructor, the TauEfficiencyCorrectionsTool
-can be constructed, passing the `TauSelectionTool
-<README-TauSelectionTool.rst>`_, which was used for the tau selection::
 
-  TauAnalysisTools::TauEfficiencyCorrectionsTool TauEffTool( "TauEfficiencyCorrectionsTool" , TauSelTool);
+The ``TauEfficiencyCorrectionsTool`` can be configured in an atomised way by
+passing a tool handle of the `TauSelectionTool <README-TauSelectionTool.rst>`_,
+which was used for the tau selection
+
+.. code-block:: python
+
+  ToolHandle < TauAnalysisTools::ITauSelectionTool > TauSelToolHandle = TauSelTool;
+  TauEffTool.setProperty( "TauSelectionTool" , TauSelToolHandle);
 
 This configures the set of ``EfficiencyCorrectionTypes`` and if needed the jet
 (electron) ID working points, depending on the applied cuts.  Please note, that
@@ -99,38 +102,134 @@ Overview
 ========
 
 The tool can be used to retrieve scale factors for a specific
-``RecommendationTag``:
+``RecommendationTag``.
 
-+-------------------------------+------------------+----------------+------------------------------------------+
-| property name                 | type             | default value  | other sensible values                    |
-+===============================+==================+================+==========================================+
-| RecommendationTag             | std::string      | "mc15-moriond" | "mc15-pre-recommendations", "mc12-final" |
-+-------------------------------+------------------+----------------+------------------------------------------+
+.. list-table::
+   :header-rows: 1
+   :widths: 15 10 20 55
+      
+   * - property name
+     - type
+     - default value
+     - other sensible values
+
+   * - ``RecommendationTag``
+     - ``std::string``
+     - ``"2016-fall"``
+     - ``"2016-ichep"``, ``"mc15-moriond"``, ``"mc15-pre-recommendations"``, ``"mc12-final"``
 
 For the default ``RecommendationTag`` "mc15-moriond" the following properties
 are available for tool steering:
 
-+-------------------------------+------------------+------------------------------------------------------------------------------------------------------------+-----------------------+
-| property name                 | type             | default value                                                                                              | other sensible values |
-+===============================+==================+============================================================================================================+=======================+
-| EfficiencyCorrectionTypes     | std::vector<int> | {SFRecoHadTau, SFJetIDHadTau, SFEleOLRHadTau, SFEleOLRElectron}                                            |                       |
-+-------------------------------+------------------+------------------------------------------------------------------------------------------------------------+-----------------------+
-| InputFilePathRecoHadTau       | std::string      | "TauAnalysisTools/"+ ``SharedFilesVersion`` +"EfficiencyCorrections/Reco_TrueHadTau_mc15-moriond.root"     |                       |
-+-------------------------------+------------------+------------------------------------------------------------------------------------------------------------+-----------------------+
-| InputFilePathEleOLRHadTau     | std::string      | "TauAnalysisTools/"+ ``SharedFilesVersion`` +"EfficiencyCorrections/EleOLR_TrueHadTau_mc15-moriond.root"   |                       |
-+-------------------------------+------------------+------------------------------------------------------------------------------------------------------------+-----------------------+
-| InputFilePathEleOLRHadTau     | std::string      | "TauAnalysisTools/"+ ``SharedFilesVersion`` +"EfficiencyCorrections/EleOLR_TrueElectron_mc15-moriond.root" |                       |
-+-------------------------------+------------------+------------------------------------------------------------------------------------------------------------+-----------------------+
-| InputFilePathJetIDHadTau      | std::string      | "TauAnalysisTools/"+ ``SharedFilesVersion`` +"EfficiencyCorrections/JetID_TrueHadTau_mc15-moriond.root"    |                       |
-+-------------------------------+------------------+------------------------------------------------------------------------------------------------------------+-----------------------+
-| VarNameRecoHadTau             | std::string      | "TauScaleFactorReconstructionHadTau"                                                                       |                       |
-+-------------------------------+------------------+------------------------------------------------------------------------------------------------------------+-----------------------+
-| VarNameEleOLRHadTau           | std::string      | "TauScaleFactorEleOLRHadTau"                                                                               |                       |
-+-------------------------------+------------------+------------------------------------------------------------------------------------------------------------+-----------------------+
-| VarNameEleOLRElectron         | std::string      | "TauScaleFactorEleOLRElectron"                                                                             |                       |
-+-------------------------------+------------------+------------------------------------------------------------------------------------------------------------+-----------------------+
-| VarNameJetIDHadTau            | std::string      | "TauScaleFactorJetIDHadTau"                                                                                |                       |
-+-------------------------------+------------------+------------------------------------------------------------------------------------------------------------+-----------------------+
+.. list-table::
+   :header-rows: 1
+   :widths: 25 10 55
+
+   * - property name
+     - type
+     - default value
+ 
+   * - ``EfficiencyCorrectionTypes``
+     - ``std::vector<int>``
+     - ``{SFRecoHadTau, SFJetIDHadTau, SFEleOLRHadTau, SFEleOLRElectron}``
+
+   * - ``InputFilePathRecoHadTau``
+     - ``std::string``
+     - ``"TauAnalysisTools/"+ <SharedFilesVersion> +"EfficiencyCorrections/Reco_TrueHadTau_mc15-moriond.root"``
+
+   * - ``InputFilePathEleOLRHadTau``
+     - ``std::string``
+     - ``"TauAnalysisTools/"+ <SharedFilesVersion> +"EfficiencyCorrections/EleOLR_TrueHadTau_mc15-moriond.root"``
+
+   * - ``InputFilePathEleOLRHadTau``
+     - ``std::string``
+     - ``"TauAnalysisTools/"+ <SharedFilesVersion> +"EfficiencyCorrections/EleOLR_TrueElectron_mc15-moriond.root"``
+
+   * - ``InputFilePathJetIDHadTau``
+     - ``std::string``
+     - ``"TauAnalysisTools/"+ <SharedFilesVersion> +"EfficiencyCorrections/JetID_TrueHadTau_mc15-moriond.root"``
+
+   * - ``VarNameRecoHadTau``
+     - ``std::string``
+     - ``"TauScaleFactorReconstructionHadTau"``
+
+   * - ``VarNameEleOLRHadTau``
+     - ``std::string``
+     - ``"TauScaleFactorEleOLRHadTau"``
+
+   * - ``VarNameEleOLRElectron``
+     - ``std::string``
+     - ``"TauScaleFactorEleOLRElectron"``
+
+   * - ``VarNameJetIDHadTau``
+     - ``std::string``
+     - ``"TauScaleFactorJetIDHadTau"``
+
+In addition the following properties are available for further configurations:
+     
+.. list-table::
+   :header-rows: 1
+   :widths: 5 10 5
+
+   * - property name
+     - type
+     - default value
+     
+   * - ``TauSelectionTool``
+     - ``ToolHandle<TauAnalysisTools::TauSelectionTool>``
+     - empty
+
+   * - ``PileupReweightingTool``
+     - ``ToolHandle<CP::PileupReweightingTool>``
+     - empty
+
+   * - ``TriggerName``
+     - ``std::string``
+     - ``""``
+
+   * - ``TriggerYear``
+     - ``std::string``
+     - ``"2016"``
+     
+   * - ``UseIDExclusiveSF``
+     - ``bool``
+     - ``false``
+
+   * - ``UseInclusiveEta``
+     - ``bool``
+     - ``false``
+
+   * - ``UseTriggerInclusiveEta``
+     - ``bool``
+     - ``true``
+
+   * - ``UsePtBinnedSF``
+     - ``bool``
+     - ``false``
+
+   * - ``UseHighPtUncert``
+     - ``bool``
+     - ``false``
+
+   * - ``IDLevel``
+     - ``int``
+     - ``JETIDBDTTIGHT``
+
+   * - ``EVLevel``
+     - ``int``
+     - ``ELEIDBDTLOOSE``
+
+   * - ``OLRLevel``
+     - ``int``
+     - ``TAUELEOLR``
+
+   * - ``ContSysType``
+     - ``int``
+     - ``TOTAL``
+
+   * - ``TriggerPeriodBinning``
+     - ``int``
+     - ``PeriodBinningAll``
 
 Details
 =======
@@ -183,8 +282,8 @@ These can be accessed, for example via::
 
   TauEffTool.setProperty("IDLevel", (int)JETIDBDTLOOSE);
 
-SFEleOLRHadTau
---------------
+SFEleOLRElectron
+----------------
 
 Electron overlap removal scale factors are provided for a couple of working
 points:
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauEfficiencyCorrectionsTool_Trigger.rst b/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauEfficiencyCorrectionsTool_Trigger.rst
index 3c88f811f9d..1251680413e 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauEfficiencyCorrectionsTool_Trigger.rst
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauEfficiencyCorrectionsTool_Trigger.rst
@@ -11,18 +11,62 @@ TauEfficiencyCorrectionsTool -- Trigger
 Introduction
 ------------
 
-Tau trigger efficiency scale factors for run 2 have recently become
-available. The the current implementation is not complete and does not provide
-all features. However, the basic setup to provide scale factors for EOYE
-analysis is in place. As it is expected that there will be some changes to the
-tool handling and default behaviour it is recommended to check the README's on a
-regular basis.
-
-More information on trigger scale factors can be found in this `presentation
-<https://indico.cern.ch/event/463811/contribution/2/attachments/1192916/1732031/TauTriggerSliceMeeging_tagandprobe_23Nov2015_v2.pdf>`_.
+Latest information on trigger scale factors for analysing 2015 and 2016 data
+taking can be found in this `presentation
+<https://indico.cern.ch/event/539998/contributions/2192863/attachments/1287118/1915369/tautrig_160608.pdf>`_. Scale
+factors are only applied to reconstructed taus matched to truth hadronic tau
+decays, which is done internally and does not require action by the user if the
+requirements listed on the `twiki
+<https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/TauRecommendationsSummer2016#Important_prerequisites_for_appl>`_
+are fulfilled
 
 **IMPORTANT:** Use the tool only for taus matched to the trigger!
 
+-----------------
+Quick start guide
+-----------------
+     
+To get started you can do the following::
+  
+  TauAnalysisTools::TauEfficiencyCorrectionsTool TauTriggerEffTool( "TauTriggerEfficiencyCorrectionsTool" );
+
+  CHECK(TauTriggerEffTool.setProperty("EfficiencyCorrectionTypes", std::vector<int>({SFTriggerHadTau}) ));
+  CHECK(TauTriggerEffTool.setProperty("TriggerName", "HLT_tau25_medium1_tracktwo" ));
+  CHECK(TauTriggerEffTool.setProperty("IDLevel", (int)JETIDBDTTIGHT ));
+  CHECK(TauTriggerEffTool.setProperty("PileupReweightingTool", PileupReweightingTool ));
+
+  CHECK(TauTriggerEffTool.initialize());
+
+The ``PileupReweightingTool`` is required to be a ToolHandle to the same
+PileupReweightingTool that you use for you analysis. This tool is used to obtain
+the random run number to make a decision on the year of data taking, that is
+based on the ``LumiCalcFiles``. So if you have an ``LumiCalcFiles`` based only
+on 2015(2016), then only 2015(2016) scale factors are used. If this file is for
+both data taking periods, then the scale factors are used either from 2015
+or 2016.
+
+Remember to use the cast to
+int for enums, like in the setting of ``IDLevel`` to ``(int)JETIDBDTTIGHT``.
+
+Then in your loop you can apply or get scale factors from the tool by::
+
+  TauTriggerEffTool.applyEfficiencyScaleFactor(xTau);                                     // either directly appending scale factors to the xAOD tau auxiliary store
+  TauTriggerEffTool.getEfficiencyScaleFactor(xTau, dEfficiencyScaleFactor);               // or storing fake factors in variable dEfficiencyScaleFactor
+
+Notes on different scale factors for 2015 and 2016
+--------------------------------------------------
+
+By default, if the ``PRWTool`` property is not set, only scale factors for 2016
+data analysis are applied. If you are only analysing 2015 data, this can be
+changed by setting the ``TriggerYear`` property of the tool to ``"2015"``,
+like::
+
+  CHECK(TauTriggerEffTool.setProperty("TriggerYear", "2015" ));
+
+--------------------
+Available properties
+--------------------
+
 To be able to use trigger scale factors from the TauEfficiencyCorrectionsTool
 one needs a separate tool instance with at least the following configuration:
 
@@ -34,13 +78,24 @@ one needs a separate tool instance with at least the following configuration:
      - default value
      - explanation
 	 
-   * - TriggerName
+   * - ``TriggerName``
      - ``std::string``
      - ``""`` (empty)
      - trigger name, like ``"HLT_tau125_medium1_tracktwo"``, other available
        option can be found below
 	 
-   * - IDLevel
+   * - ``TriggerYear``
+     - ``std::string``
+     - ``"2016"``
+     - year of data taking, not necessary if PileupReweightingTool Property is used
+	 
+   * - ``PileupReweightingTool``
+     - ``ToolHandle<CP::PileupReweightingTool>``
+     - empty
+     - pass this tool to automatically decide which trigger scale factors to
+       apply
+     
+   * - ``IDLevel``
      - ``int``
      - ``JETIDBDTMEDIUM`` 
      - level of offline ID, it is the same property as for jet ID scale
@@ -49,33 +104,48 @@ one needs a separate tool instance with at least the following configuration:
 In addition the variable ``EfficiencyCorrectionTypes`` needs to be set to the
 value ``std::vector<int>({SFTriggerHadTau})``
 
------------------
-Quick start guide
------------------
-     
-To get started you can do the following::
-  
-  TauAnalysisTools::TauEfficiencyCorrectionsTool TauTriggerEffTool( "TauTriggerEfficiencyCorrectionsTool" );
+----------------------
+Overview of Variations
+----------------------
 
-  CHECK(TauTriggerEffTool.setProperty("EfficiencyCorrectionTypes", std::vector<int>({SFTriggerHadTau}) ));
-  CHECK(TauTriggerEffTool.setProperty("TriggerName", "HLT_tau25_medium1_tracktwo" ));
-  CHECK(TauTriggerEffTool.setProperty("IDLevel", (int)JETIDBDTTIGHT ));
+2016 fall
+---------
 
-  CHECK(TauTriggerEffTool.initialize());
+The recommended systematic variations are as of now for 2015 or 2016 as
+indicated by the postfix number:
 
-Remember to use the cast to int for enums, like in the setting of ``IDLevel`` to
-``(int)JETIDBDTTIGHT``.
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_STATDATA2015``
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_STATMC2015``
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_SYST2015``
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_STATDATA2016``
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_STATMC2016``
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_SYST2016``
 
-Then in your loop you can apply or get scale factors from the tool by::
+The following additional systematic variations are also available (**NOT recommended**):
 
-  TauTriggerEffTool.applyEfficiencyScaleFactor(xTau);                                     // either directly appending scale factors to the xAOD tau auxiliary store
-  TauTriggerEffTool.getEfficiencyScaleFactor(xTau, dEfficiencyScaleFactor);               // or storing fake factors in variable dEfficiencyScaleFactor
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_TOTAL2015``
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_TOTAL2016``
 
-EOYE setup
+2016 ICHEP
 ----------
 
-Please use tag ``TauAnalysisTools-00-01-21`` or ABR 2.3.36 for EOYE
-analyses. This includes the recommended trigger scale factors.
+The recommended systematic variations are as of now for 2015 or 2016 as
+indicated by the postfix number:
+
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_STATDATA2015``
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_STATMC2015``
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_SYST2015``
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_TOTAL2016``
+
+The following additional systematic variations are also available (**NOT recommended**):
+
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_TOTAL2015``
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_STATDATA2016``
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_STATMC2016``
+* ``TAUS_TRUEHADTAU_EFF_TRIGGER_SYST2016``
+
+2015 EOYE and 2016 moriond
+--------------------------
 
 The recommended systematic variations are as of now:
 
@@ -88,14 +158,27 @@ the recommended systematics is also available:
 
 * ``TAUS_TRUEHADTAU_EFF_TRIGGER_TOTAL``
 
-**IMPORTANT:** Once again, use the tool only for taus matched to the trigger!
-
 ---------------------
 Supported tau trigger
 ---------------------
 
+**IMPORTANT:** Once again, use the tool only for taus matched to the trigger!
+
 At the moment the following tau trigger are supported:
 
+2016 fall
+----------------
+
+* ``HLT_tau25_medium1_tracktwo``
+* ``HLT_tau35_medium1_tracktwo``
+* ``HLT_tau50_medium1_tracktwo_L1TAU12``
+* ``HLT_tau80_medium1_tracktwo``
+* ``HLT_tau125_medium1_tracktwo``
+* ``HLT_tau160_medium1_tracktwo``
+
+until 2016 ichep
+----------------
+
 * ``HLT_tau25_medium1_tracktwo``
 * ``HLT_tau35_medium1_tracktwo``
 * ``HLT_tau50_medium1_tracktwo_L1TAU12``
@@ -123,12 +206,11 @@ By default scale factors are not binned in tau-eta (this may change in the futur
 
   TauEffTool.setProperty("UseTriggerInclusiveEta", false);
 
+..
+      Binning in data periods
+      -----------------------
 
-Binning in data periods
------------------------
-
-Not implemented yet
-
+      Not implemented yet
 
 ----------
 Navigation
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauSmearingTool.rst b/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauSmearingTool.rst
index e4c38eeb129..52d51eeb4fd 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauSmearingTool.rst
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauSmearingTool.rst
@@ -43,13 +43,19 @@ The tool can in general be used, including the header file::
 
   #include "TauAnalysisTools/TauSmearingTool.h"
 
-and calling::
+The tool is created and initialized by calling::
 
   TauAnalysisTools::TauSmearingTool TauSmeTool( "TauSmaringTool" );
   TauSmeTool.initialize();
 
+The smearing can be either applied to `non-const` taus::
+
   TauSmeTool.applyCorrection(xTau);
 
+or by obtaining a `non-const` copy from a `const` tau::
+
+  TauSmeTool.correctedCopy(xTauOrig, xTauCopy);
+
 The set of recommended systematic variations can in general be retrieved by
 calling::
 
@@ -64,6 +70,23 @@ The tool can be configured to use a specific set of systematic variations callin
 
   TauSmeTool.applySystematicVariation(customSystematicSet);
 
+-------
+MVA TES
+-------
+
+The MVA TES calibration can be applied as well with TauSmearingTool. In addition
+to your standard configuration set the option::
+
+  TauSmeTool.setProperty("ApplyMVATES", true );
+
+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..
 
 --------------------
 Available properties
@@ -75,51 +98,43 @@ Overview
 The tool can be used to apply tau pt smearing for a specific
 ``RecommendationTag``:
 
-+-------------------------------+------------------+----------------+--------------------------------------------------------+
-| property name                 | type             | default value  | other sensible values                                  |
-+===============================+==================+================+========================================================+
-| RecommendationTag             | std::string      | "mc15-moriond" | "mc15-pre-recommendations", "mc12-final", "mc11-final" |
-+-------------------------------+------------------+----------------+--------------------------------------------------------+
-
-For the default ``RecommendationTag`` "mc15-moriond" the following properties
-are available for tool steering:
-
-+-------------------------------+------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
-| property name                 | type             | default value                                                                            | other sensible values                                                         |
-+===============================+==================+==========================================================================================+===============================================================================+
-| InputFilePath                 | std::string      | "TauAnalysisTools/"+ ``SharedFilesVersion`` +"Smearing/TES_TrueHadTau_mc15_moriond.root" |                                                                               |
-+-------------------------------+------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
-
-For the ``RecommendationTag`` "mc15-pre-recommendations" the following
-properties are available for tool steering:
-
-+-------------------------------+------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
-| property name                 | type             | default value                                                                           | other sensible values                                                         |
-+===============================+==================+=========================================================================================+===============================================================================+
-| InputFilePath                 | std::string      | "TauAnalysisTools/"+ ``SharedFilesVersion`` +"Smearing/TES_TrueHadTau_mc15_prerec.root" |                                                                               |
-+-------------------------------+------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
-
-For the ``RecommendationTag`` "mc12-final" the following properties are
-available for tool steering:
-
-+-------------------------------+------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
-| property name                 | type             | default value                                                                           | other sensible values                                                         |
-+===============================+==================+=========================================================================================+===============================================================================+
-| InputFilePath                 | std::string      | "TauAnalysisTools/"+ ``SharedFilesVersion`` +"Smearing/mc12_p1344_medium.root"          | "TauAnalysisTools/"+ ``SharedFilesVersion`` +"Smearing/mc12_p1344_tight.root" |
-+-------------------------------+------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
-| IsData                        | bool             | false                                                                                   | true                                                                          |
-+-------------------------------+------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
-
-For the ``RecommendationTag`` "mc11-final" the following properties are
-available for tool steering:
-
-+-------------------------------+------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
-| property name                 | type             | default value                                                                           | other sensible values                                                         |
-+===============================+==================+=========================================================================================+===============================================================================+
-| InputFilePath                 | std::string      | "TauAnalysisTools/"+ ``SharedFilesVersion`` +"Smearing/mc11.root"                       |                                                                               |
-+-------------------------------+------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
-| IsData                        | bool             | false                                                                                   | true                                                                          |
-+-------------------------------+------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
+.. list-table::
+   :header-rows: 1
+   :widths: 15 10 20 55
+      
+   * - property name
+     - type
+     - default value
+     - other sensible values
+
+   * - ``RecommendationTag``
+     - ``std::string``
+     - ``"2016-ichep"``
+     - ``"mc15-moriond"``, ``"mc15-pre-recommendations"``, ``"mc12-final"``, ``"mc11-final"``
+
+The following table lists other properties for further configurations:
+
+
+.. list-table::
+   :header-rows: 1
+   :widths: 15 10 20 55
+      
+   * - property name
+     - type
+     - default value
+     - comment
+
+   * - ``ApplyMVATES``
+     - ``bool``
+     - ``false``
+     - apply new MVA based TES, see section `MVA TES`_
+
+   * - ``IsData``
+     - ``bool``
+     - ``false``
+     - only for ``RecommendationTags`` ``"mc12-final"``, ``"mc11-final"``, if
+       set to ``true`` the tool applies a pT smearing aimed to correct for
+       differences in DATA vs. MC pT
 
 Notes for run 1 tau pt smearing
 ===============================
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/src/components/TauAnalysisTools_entries.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/src/components/TauAnalysisTools_entries.cxx
index b43cb235707..8fb5248c559 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/src/components/TauAnalysisTools_entries.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/src/components/TauAnalysisTools_entries.cxx
@@ -2,30 +2,52 @@
 #include "GaudiKernel/DeclareFactoryEntries.h"
 
 // Local include(s):
+#include "TauAnalysisTools/CommonEfficiencyTool.h"
+#include "TauAnalysisTools/CommonSmearingTool.h"
 #include "TauAnalysisTools/TauSelectionTool.h"
 #include "TauAnalysisTools/TauSmearingTool.h"
+#include "TauAnalysisTools/TauSmearingRun1Tool.h"
 #include "TauAnalysisTools/TauTruthMatchingTool.h"
 #include "TauAnalysisTools/TauTruthTrackMatchingTool.h"
 #include "TauAnalysisTools/TauEfficiencyCorrectionsTool.h"
+#include "TauAnalysisTools/TauEfficiencyContJetIDTool.h"
+#include "TauAnalysisTools/TauEfficiencyCorrectionsTool.h"
+#include "TauAnalysisTools/TauEfficiencyEleIDTool.h"
+#include "TauAnalysisTools/TauEfficiencyJetIDTool.h"
+#include "TauAnalysisTools/TauEfficiencyTriggerTool.h"
 #include "TauAnalysisTools/TauOverlappingElectronLLHDecorator.h"
 #include "../TauAnalysisToolsExampleAthena.h"
 
+DECLARE_NAMESPACE_TOOL_FACTORY( TauAnalysisTools, CommonEfficiencyTool )
+DECLARE_NAMESPACE_TOOL_FACTORY( TauAnalysisTools, CommonSmearingTool )
 DECLARE_NAMESPACE_TOOL_FACTORY( TauAnalysisTools, TauSelectionTool )
 DECLARE_NAMESPACE_TOOL_FACTORY( TauAnalysisTools, TauSmearingTool )
+DECLARE_NAMESPACE_TOOL_FACTORY( TauAnalysisTools, TauSmearingRun1Tool )
 DECLARE_NAMESPACE_TOOL_FACTORY( TauAnalysisTools, TauTruthMatchingTool )
 DECLARE_NAMESPACE_TOOL_FACTORY( TauAnalysisTools, TauTruthTrackMatchingTool )
 DECLARE_NAMESPACE_TOOL_FACTORY( TauAnalysisTools, TauEfficiencyCorrectionsTool )
+DECLARE_NAMESPACE_TOOL_FACTORY( TauAnalysisTools, TauEfficiencyContJetIDTool )
+DECLARE_NAMESPACE_TOOL_FACTORY( TauAnalysisTools, TauEfficiencyEleIDTool )
+DECLARE_NAMESPACE_TOOL_FACTORY( TauAnalysisTools, TauEfficiencyJetIDTool )
+DECLARE_NAMESPACE_TOOL_FACTORY( TauAnalysisTools, TauEfficiencyTriggerTool )
 DECLARE_NAMESPACE_TOOL_FACTORY( TauAnalysisTools, TauOverlappingElectronLLHDecorator )
 
 DECLARE_NAMESPACE_ALGORITHM_FACTORY( TauAnalysisTools, TauAnalysisToolsExampleAthena )
 
 DECLARE_FACTORY_ENTRIES( TauAnalysisTools )
 {
+  DECLARE_NAMESPACE_TOOL( TauAnalysisTools, CommonEfficiencyTool )
+  DECLARE_NAMESPACE_TOOL( TauAnalysisTools, CommonSmearingTool )
   DECLARE_NAMESPACE_TOOL( TauAnalysisTools, TauSelectionTool )
   DECLARE_NAMESPACE_TOOL( TauAnalysisTools, TauSmearingTool )
+  DECLARE_NAMESPACE_TOOL( TauAnalysisTools, TauSmearingRun1Tool )
   DECLARE_NAMESPACE_TOOL( TauAnalysisTools, TauTruthMatchingTool )
   DECLARE_NAMESPACE_TOOL( TauAnalysisTools, TauTruthTrackMatchingTool )
   DECLARE_NAMESPACE_TOOL( TauAnalysisTools, TauEfficiencyCorrectionsTool )
+  DECLARE_NAMESPACE_TOOL( TauAnalysisTools, TauEfficiencyContJetIDTool )
+  DECLARE_NAMESPACE_TOOL( TauAnalysisTools, TauEfficiencyEleIDTool )
+  DECLARE_NAMESPACE_TOOL( TauAnalysisTools, TauEfficiencyJetIDTool )
+  DECLARE_NAMESPACE_TOOL( TauAnalysisTools, TauEfficiencyTriggerTool )
   DECLARE_NAMESPACE_TOOL( TauAnalysisTools, TauOverlappingElectronLLHDecorator )
 
   DECLARE_NAMESPACE_ALGORITHM( TauAnalysisTools, TauAnalysisToolsExampleAthena )
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/test/TauAnalysisTools.xml b/PhysicsAnalysis/TauID/TauAnalysisTools/test/TauAnalysisTools.xml
new file mode 100644
index 00000000000..6b2c15e4639
--- /dev/null
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/test/TauAnalysisTools.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<atn>
+
+  <TEST name="TauAnalysisToolsTest" type="makecheck" suite="ASG">
+    <package>PhysicsAnalysis/TauID/TauAnalysisTools</package>
+    <timelimit>5</timelimit>
+    <author>Dirk Uwe Duschinger</author>
+    <mailto>dirk.duschinger@cern.ch</mailto>
+    <expectations>
+      <errorMessage>ERROR</errorMessage>
+      <errorMessage>differ</errorMessage>
+      <returnValue>0</returnValue>
+    </expectations>
+  </TEST>
+
+</atn>
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/test/ut_TauAnalysisTools_test.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/test/ut_TauAnalysisTools_test.cxx
new file mode 100644
index 00000000000..adfe484461b
--- /dev/null
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/test/ut_TauAnalysisTools_test.cxx
@@ -0,0 +1,184 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef ROOTCORE
+#ifdef XAOD_ANALYSIS
+
+#ifndef TAUANALYSISTOOLS_UT_TAUANALYSISTOOLS_TEST_H
+#define TAUANALYSISTOOLS_UT_TAUANALYSISTOOLS_TEST_H 1
+
+
+#include "AthAnalysisBaseComps/AthAnalysisHelper.h" //tool creation and configuration
+#include "POOLRootAccess/TEvent.h" //event looping
+#include "GaudiKernel/ToolHandle.h" //for better working with tools
+
+#include "AsgTools/MessageCheck.h" //messaging
+using namespace asg::msgUserCode;  //messaging
+
+//ROOT includes
+#include "TString.h"
+#include "TSystem.h"
+
+// Local include(s):
+#include "TauAnalysisTools/TauEfficiencyCorrectionsTool.h"
+#include "TauAnalysisTools/TauSelectionTool.h"
+#include "TauAnalysisTools/TauSmearingTool.h"
+#include "TauAnalysisTools/TauTruthMatchingTool.h"
+#include "TauAnalysisTools/TauTruthTrackMatchingTool.h"
+#include "TauAnalysisTools/TauOverlappingElectronLLHDecorator.h"
+
+// EDM include(s):
+#include "xAODTau/TauJetContainer.h"
+
+int main( int argc, char* argv[] )
+{
+
+  IAppMgrUI* app = POOL::Init(); //important to do this first!
+
+  // Open the input file:
+  TString fileName = "$ASG_TEST_FILE_MC";
+  if( argc < 2 )
+  {
+    ANA_MSG_WARNING( "No file name received, using $ASG_TEST_FILE_MC" );
+  }
+  else
+  {
+    fileName = argv[1]; //use the user provided file
+  }
+  ANA_MSG_INFO("Opening file: " << gSystem->ExpandPathName(fileName.Data()) );
+
+  //Here's an example of how you would create a tool of type ToolType, and set a property on it
+  //The preferred way to create and configure the tool is with a ToolHandle:
+  //ToolHandle<IToolInterface> myTool("ToolType/myTool");
+  //AthAnalysisHelper::setProperty( myTool, "MyProperty", value );
+  //myTool.retrieve(); //this will cause the tool to be created and initialized
+
+  // ===========================================================================
+  // TauSelectionTool
+  // ===========================================================================
+  ToolHandle<TauAnalysisTools::ITauSelectionTool> TauSelTool("TauAnalysisTools::TauSelectionTool/TauSelectionTool");
+  TauSelTool.retrieve(); //this will cause the tool to be created and initialized
+
+  // ===========================================================================
+  // TauSmearingTool
+  // ===========================================================================
+  ToolHandle<TauAnalysisTools::ITauSmearingTool> TauSmeTool("TauAnalysisTools::TauSmearingTool/TauSmearingTool");
+  TauSmeTool.retrieve();
+
+  // ===========================================================================
+  // TauEfficiencyCorrectionsTool
+  // ===========================================================================
+  ToolHandle<TauAnalysisTools::ITauEfficiencyCorrectionsTool> TauEffCorrTool( "TauAnalysisTools::TauEfficiencyCorrectionsTool/TauEfficiencyCorrectionsTool" );
+  AthAnalysisHelper::setProperty(TauEffCorrTool, "TauSelectionTool", TauSelTool);
+  TauEffCorrTool.retrieve();
+
+  // ===========================================================================
+  // TauTruthMatchingTool
+  // ===========================================================================
+  ToolHandle<TauAnalysisTools::ITauTruthMatchingTool> T2MT( "TauAnalysisTools::TauTruthMatchingTool/TauTruthMatchingTool");
+  AthAnalysisHelper::setProperty(T2MT, "WriteTruthTaus", true);
+  T2MT.retrieve();
+
+  // ===========================================================================
+  // TauTruthTrackMatchingTool
+  // ===========================================================================
+  ToolHandle<TauAnalysisTools::ITauTruthTrackMatchingTool> T3MT( "TauAnalysisTools::TauTruthTrackMatchingTool/TauTruthTrackMatchingTool");
+  T3MT.retrieve();
+
+  // defining needed Container
+  const xAOD::TauJetContainer* xTauJetContainer = 0;
+
+  //loop over input file with POOL
+  POOL::TEvent evt;
+  evt.readFrom( fileName );
+
+  // for(int i=0;i < evt.getEntries(); i++) {
+  for(int i=0; i < 100; i++)
+  {
+    if( evt.getEntry(i) < 0)
+    {
+      ANA_MSG_ERROR("Failed to read event " << i);
+      continue;
+    }
+
+    evt.retrieve( xTauJetContainer, "TauJets" );
+
+    for ( auto xTau : *xTauJetContainer )
+    {
+      // perform truth matching
+      auto xTruthTau = T2MT->getTruth(*xTau);
+
+      // Select "good" taus:
+      if( ! TauSelTool->accept( *xTau ) ) continue;
+
+      // print some info about the selected tau:
+      ANA_MSG_INFO( "Selected tau: pt = " << xTau->pt()
+                    << " MeV, eta = " << xTau->eta()
+                    << ", phi = " << xTau->phi()
+                    << ", prong = " << int(xTau->nTracks())
+                    << ", charge = " << int(xTau->charge()));
+
+      if ((bool)xTau->auxdata<char>("IsTruthMatched"))
+      {
+        if (xTruthTau->isTau())
+        {
+          if ((bool)xTruthTau->auxdata<char>("IsHadronicTau"))
+            ANA_MSG_INFO( "Tau was matched to a truth hadronic tau, which has " << int(xTruthTau->auxdata<size_t>("numCharged"))
+                          << " prongs and a charge of " << int(xTruthTau->charge()));
+          else
+            ANA_MSG_INFO( "Tau was matched to a truth leptonic tau, which has a charge of " << int(xTruthTau->charge()));
+        }
+        else if (xTruthTau->isElectron())
+          ANA_MSG_INFO( "Tau was matched to a truth electron");
+        else if (xTruthTau->isMuon())
+          ANA_MSG_INFO( "Tau was matched to a truth muon");
+      }
+      else
+        ANA_MSG_INFO( "Tau was not matched to truth" );
+
+      typedef ElementLink< xAOD::TruthParticleContainer > Link_t;
+      if (!xTau->isAvailable< Link_t >("truthParticleLink"))
+      {
+        ANA_MSG_WARNING("link truthParticleLink is not available");
+        continue;
+      }
+      auto xTruthJetLink = xTau->auxdata< ElementLink< xAOD::JetContainer > >("truthJetLink");
+      if (xTruthJetLink.isValid())
+      {
+        const xAOD::Jet* xTruthJet = *xTruthJetLink;
+        ANA_MSG_INFO( "Tau was matched to a truth jet, which has pt = " << xTruthJet->p4().Pt()
+                      << ", eta = " << xTruthJet->p4().Eta()
+                      << ", phi = " << xTruthJet->p4().Phi()
+                      << ", m = " << xTruthJet->p4().M() );
+      }
+      else
+        ANA_MSG_INFO( "Tau was not matched to truth jet" );
+
+      // test the TauEfficiencyCorrectionsTool
+      ANA_CHECK(TauEffCorrTool->applyEfficiencyScaleFactor(*xTau));
+
+      // test the TauSmearingTool
+      xAOD::TauJet* xTauCopy = 0;
+      ANA_CHECK(TauSmeTool->correctedCopy(*xTau, xTauCopy));
+    }
+  }
+  ServiceHandle<IProperty> toolSvc("ToolSvc","");
+  toolSvc->setProperty("OutputLevel","1");
+  asg::msgToolHandle::setMsgLevel(MSG::Level::DEBUG);
+
+  app->finalize(); //trigger finalization of all services and tools created by the Gaudi Application
+  return 0;
+}
+
+#endif //> !TAUANALYSISTOOLS_UT_TAUANALYSISTOOLS_TEST_H
+
+#else
+int main()
+{
+  return 0;
+}
+
+#endif // XAOD_ANALYSIS
+
+#endif // not ROOTCORE
diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/util/TauAnalysisToolsExample.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/util/TauAnalysisToolsExample.cxx
index f81ae39b546..93fd67309d9 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/util/TauAnalysisToolsExample.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/util/TauAnalysisToolsExample.cxx
@@ -23,7 +23,8 @@
 #include "xAODEventInfo/EventInfo.h"
 #include "xAODTau/TauJetContainer.h"
 #include "xAODTau/TauJetAuxContainer.h"
-#include "xAODTruth/TruthParticle.h"
+
+#include "AsgTools/ToolHandle.h"
 
 // Local include(s):
 #include "TauAnalysisTools/TauEfficiencyCorrectionsTool.h"
@@ -33,6 +34,8 @@
 #include "TauAnalysisTools/TauTruthTrackMatchingTool.h"
 #include "TauAnalysisTools/TauOverlappingElectronLLHDecorator.h"
 
+#include "PileupReweighting/PileupReweightingTool.h"
+
 // Smart Slimming include(s):
 #include "xAODCore/tools/IOStats.h"
 #include "xAODCore/tools/ReadStats.h"
@@ -61,6 +64,8 @@ int main( int argc, char* argv[] )
 {
   CP::SystematicCode::enableFailure();
 
+  xAOD::TReturnCode::enableFailure();
+
   // Check if we received a file name:
   if( argc < 2 )
   {
@@ -88,7 +93,8 @@ int main( int argc, char* argv[] )
   CHECK( fOutputFile.get() );
 
   // Create a TEvent object:
-  xAOD::TEvent xEvent( xAOD::TEvent::kClassAccess );
+  // xAOD::TEvent xEvent( xAOD::TEvent::kClassAccess );
+  xAOD::TEvent xEvent( xAOD::TEvent::kAthenaAccess );
   CHECK( xEvent.readFrom( fInputFile.get() ) );
 
   // Connect TEvent with output file :
@@ -110,25 +116,40 @@ int main( int argc, char* argv[] )
 
   // defining needed Container
   const xAOD::EventInfo* xEventInfo = 0;
-  const xAOD::TauJetContainer* xTauJetContainer = 0;
-  const xAOD::TruthParticleContainer* xTruthParticleContainer = 0;
-  const xAOD::TrackParticleContainer* xTrackParticleContainer = 0;
+#ifndef XAODTAU_VERSIONS_TAUJET_V3_H
+  const
+#endif // not XAODTAU_VERSIONS_TAUJET_V3_H
+  xAOD::TauJetContainer* xTauJetContainer = 0;
+
+  CP::PileupReweightingTool* m_tPRWTool = new CP::PileupReweightingTool("PileupReweightingTool");
+  std::vector<std::string> vLumiCalcFiles = {"ilumicalc_histograms_HLT_tau160_medium1_tracktwo_297730-311481_OflLumi-13TeV-005.root"};
+  CHECK(m_tPRWTool->setProperty("LumiCalcFiles", vLumiCalcFiles));
+  // CHECK(m_tPRWTool->setProperty("DefaultChannel", "" ));
+  CHECK(m_tPRWTool->initialize());
+  ToolHandle<CP::IPileupReweightingTool> m_tPRWToolHandle = m_tPRWTool;
 
   // ===========================================================================
   // TauSelectionTool
   // ===========================================================================
   TauAnalysisTools::TauSelectionTool* TauSelTool = new TauAnalysisTools::TauSelectionTool( "TauSelectionTool" );
-  TauSelTool->msg().setLevel( MSG::INFO );
+  TauSelTool->msg().setLevel( MSG::DEBUG );
   // preparation for control hisograms
   TauSelTool->setOutFile( fOutputFile.get() );
   CHECK(TauSelTool->setProperty("CreateControlPlots", true ));
+  CHECK(TauSelTool->setProperty("MuonOLR", true ));
+  CHECK(TauSelTool->setProperty("PtMin", 20. ));
+  CHECK(TauSelTool->setProperty("ConfigPath", "" ));
+  CHECK(TauSelTool->setProperty("SelectionCuts", int(CutPt|CutMuonOLR) ));
   CHECK(TauSelTool->initialize());
 
+  // ToolHandle<TauAnalysisTools::ITauSelectionTool> TauSelToolHandle = TauSelTool;
+
   // ===========================================================================
   // TauSmearingTool
   // ===========================================================================
   TauAnalysisTools::TauSmearingTool TauSmeTool( "TauSmearingTool" );
   TauSmeTool.msg().setLevel( MSG::INFO );
+  // CHECK(TauSmeTool.setProperty("ApplyMVATES", true ));
   CHECK(TauSmeTool.initialize());
 
   // restructure all recommended systematic variations for smearing tool
@@ -139,11 +160,19 @@ int main( int argc, char* argv[] )
     vSmearingSystematicSet.back().insert(SystematicsVariation);
   }
 
+  CP::SystematicSet sTESAFIIDown;
+  sTESAFIIDown.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_SME_TES_AFII",-1));
+  vSmearingSystematicSet.push_back(sTESAFIIDown);
+  CP::SystematicSet sTESAFIIUp;
+  sTESAFIIUp.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_SME_TES_AFII",1));
+  vSmearingSystematicSet.push_back(sTESAFIIUp);
+
   // ===========================================================================
   // TauEfficiencyCorrectionsTool
   // ===========================================================================
   TauAnalysisTools::TauEfficiencyCorrectionsTool TauEffCorrTool( "TauEfficiencyCorrectionsTool" );
   TauEffCorrTool.msg().setLevel( MSG::DEBUG );
+  // CHECK(TauEffCorrTool.setProperty("TauSelectionTool",TauSelToolHandle));
   CHECK(TauEffCorrTool.initialize());
 
   // restructure all recommended systematic variations for efficiency tools
@@ -151,27 +180,9 @@ int main( int argc, char* argv[] )
   vEfficiencyCorrectionsSystematicSet.push_back(CP::SystematicSet());
   for (auto SystematicsVariation : TauEffCorrTool.recommendedSystematics())
   {
-    std::cout<< "SystematicsVariation " << SystematicsVariation.basename()<<"\n";
     vEfficiencyCorrectionsSystematicSet.push_back(CP::SystematicSet());
     vEfficiencyCorrectionsSystematicSet.back().insert(SystematicsVariation);
   }
-  CP::SystematicSet sHighRecoPtDown;
-  sHighRecoPtDown.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_RECO_TOTAL",-1));
-  sHighRecoPtDown.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_RECO_HIGHPT",-1));
-  vEfficiencyCorrectionsSystematicSet.push_back(sHighRecoPtDown);
-  CP::SystematicSet sHighRecoPtUp;
-  sHighRecoPtUp.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_RECO_TOTAL",1));
-  sHighRecoPtUp.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_RECO_HIGHPT",1));
-  vEfficiencyCorrectionsSystematicSet.push_back(sHighRecoPtUp);
-
-  CP::SystematicSet sHighJetIDPtDown;
-  sHighJetIDPtDown.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_JETID_TOTAL",-1));
-  sHighJetIDPtDown.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_JETID_HIGHPT",-1));
-  vEfficiencyCorrectionsSystematicSet.push_back(sHighJetIDPtDown);
-  CP::SystematicSet sHighJetIDPtUp;
-  sHighJetIDPtUp.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_JETID_TOTAL",1));
-  sHighJetIDPtUp.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_JETID_HIGHPT",1));
-  vEfficiencyCorrectionsSystematicSet.push_back(sHighJetIDPtUp);
 
   // ===========================================================================
   // TauEfficiencyCorrectionsTriggerTool
@@ -179,8 +190,9 @@ int main( int argc, char* argv[] )
   TauAnalysisTools::TauEfficiencyCorrectionsTool TauEffTrigTool( "TauEfficiencyCorrectionsTriggerTool" );
   TauEffTrigTool.msg().setLevel( MSG::DEBUG );
   CHECK(TauEffTrigTool.setProperty("EfficiencyCorrectionTypes", std::vector<int>({SFTriggerHadTau}) ));
-  CHECK(TauEffTrigTool.setProperty("TriggerName", "HLT_tau125_medium1_tracktwo" ));
+  CHECK(TauEffTrigTool.setProperty("TriggerName", "HLT_tau25_medium1_tracktwo" ));
   CHECK(TauEffTrigTool.setProperty("IDLevel", (int)JETIDBDTTIGHT ));
+  CHECK(TauEffTrigTool.setProperty("PileupReweightingTool", m_tPRWToolHandle ));
   CHECK(TauEffTrigTool.initialize());
 
   // restructure all recommended systematic variations for efficiency tools
@@ -188,29 +200,10 @@ int main( int argc, char* argv[] )
   vEfficiencyCorrectionsTriggerSystematicSet.push_back(CP::SystematicSet());
   for (auto SystematicsVariation : TauEffTrigTool.recommendedSystematics())
   {
-    std::cout<< "SystematicsVariation " << SystematicsVariation.basename()<<"\n";
     vEfficiencyCorrectionsTriggerSystematicSet.push_back(CP::SystematicSet());
     vEfficiencyCorrectionsTriggerSystematicSet.back().insert(SystematicsVariation);
   }
 
-  CP::SystematicSet sTOTALDOWN;
-  sTOTALDOWN.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_TRIGGER_TOTAL",-1));
-  vEfficiencyCorrectionsTriggerSystematicSet.push_back(sTOTALDOWN);
-  CP::SystematicSet sTOTALUP;
-  sTOTALUP.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_TRIGGER_TOTAL",1));
-  vEfficiencyCorrectionsTriggerSystematicSet.push_back(sTOTALUP);
-
-  CP::SystematicSet sTOTALDOWN_COMB;
-  sTOTALDOWN_COMB.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_TRIGGER_STATDATA",-1));
-  sTOTALDOWN_COMB.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_TRIGGER_STATMC",1));
-  sTOTALDOWN_COMB.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_TRIGGER_SYST",-1));
-  vEfficiencyCorrectionsTriggerSystematicSet.push_back(sTOTALDOWN_COMB);
-  CP::SystematicSet sTOTALUP_COMB;
-  sTOTALUP_COMB.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_TRIGGER_STATDATA",1));
-  sTOTALUP_COMB.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_TRIGGER_STATMC",-1));
-  sTOTALUP_COMB.insert(CP::SystematicVariation("TAUS_TRUEHADTAU_EFF_TRIGGER_SYST",1));
-  vEfficiencyCorrectionsTriggerSystematicSet.push_back(sTOTALUP_COMB);
-
   // ===========================================================================
   // TauTruthMatchingTool
   // ===========================================================================
@@ -251,8 +244,6 @@ int main( int argc, char* argv[] )
             static_cast< int >( iEntry ) );
 
     RETRIEVE(xAOD::TauJetContainer, xTauJetContainer, "TauJets");
-    RETRIEVE(xAOD::TrackParticleContainer, xTrackParticleContainer , "InDetTrackParticles" );
-    RETRIEVE(xAOD::TruthParticleContainer, xTruthParticleContainer , "TruthParticles" );
 
     // copy truth particles to get truthparticle link for truth taus to work
     CHECK( xEvent.copy("TruthParticles") );
@@ -276,7 +267,7 @@ int main( int argc, char* argv[] )
       if( ! TauSelTool->accept( *xTau ) ) continue;
 
       // print some info about the selected tau:
-      Info( "TauAnalysisToolsExample", "Selected tau: pt = %g, eta = %g, phi = %g, prong = %i, charge = %i",
+      Info( "TauAnalysisToolsExample", "Selected tau: pt = %g MeV, eta = %g, phi = %g, prong = %i, charge = %i",
             xTau->pt(), xTau->eta(), xTau->phi(), int(xTau->nTracks()), int(xTau->charge()));
 
       if ((bool)xTau->auxdata<char>("IsTruthMatched"))
@@ -351,19 +342,21 @@ int main( int argc, char* argv[] )
               sSystematicSet.name().c_str());
       }
 
-      for (size_t iTrack = 0; iTrack < xTau->nTracks(); iTrack++)
-      {
-        const TAUTRACKPARTICLE* xTrack = xTau->track(iTrack);
-
-        CHECK(T3MT.classifyTrack(*xTrack));
-        if (xTrack->auxdata<char>("IsHadronicTrack"))
-          Info( "TauAnalysisToolsExample", "Track is matched to a hadronic tau decay, with decay depth %i",xTrack->auxdata<int>("IsHadronicTrackDecayDepth"));
-        else
-          Info( "TauAnalysisToolsExample", "Track is not matched to a hadronic tau decay");
-        Info ("TauAnalysisToolsExample", "The track decay history is: %s", (xTrack->auxdata<std::string>("DecayHistory")).c_str());
-        Info ("TauAnalysisToolsExample", "The spurious type is: %i", xTrack->auxdata<int>("SpuriousType") );
-      }
+      // for (size_t iTrack = 1; iTrack < xTau->nTracks(); iTrack++)
+      // {
+      //   const TAUTRACKPARTICLE* xTrack = xTau->track(iTrack);
+
+      //   CHECK(T3MT.classifyTrack(*xTrack));
+      //   if (xTrack->auxdata<char>("IsHadronicTrack"))
+      //     Info( "TauAnalysisToolsExample", "Track is matched to a hadronic tau decay, with decay depth %i",xTrack->auxdata<int>("IsHadronicTrackDecayDepth"));
+      //   else
+      //     Info( "TauAnalysisToolsExample", "Track is not matched to a hadronic tau decay");
+      //   Info ("TauAnalysisToolsExample", "The track decay history is: %s", (xTrack->auxdata<std::string>("DecayHistory")).c_str());
+      //   Info ("TauAnalysisToolsExample", "The spurious type is: %i", xTrack->auxdata<int>("TrackType") );
+      // }
     }
+    if (xTauJetContainer->empty())
+      T2MT.retrieveTruthTaus();
     xEvent.fill();
   }
 
-- 
GitLab