From cf2cd9b6a7b007f56f7c3db67242138dc3a36a64 Mon Sep 17 00:00:00 2001
From: Emmanuel Le Guirriec <emmanuel.le.guirriec@cern.ch>
Date: Wed, 12 Dec 2018 14:53:02 +0100
Subject: [PATCH] Data Handle migration of TauOverlappingElectronLLHDecorator

---
 .../Root/TauOverlappingElectronLLHDecorator.cxx      | 12 +++++-------
 Reconstruction/MET/METUtilities/src/METMakerAlg.cxx  |  2 +-
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauOverlappingElectronLLHDecorator.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauOverlappingElectronLLHDecorator.cxx
index d301435b2cc..fd00eb65aef 100644
--- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauOverlappingElectronLLHDecorator.cxx
+++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauOverlappingElectronLLHDecorator.cxx
@@ -102,15 +102,8 @@ StatusCode TauOverlappingElectronLLHDecorator::setEleOlrLhScoreDecorationName(co
 //______________________________________________________________________________
 StatusCode TauOverlappingElectronLLHDecorator::decorate(const xAOD::TauJet& xTau) const
 {
-  SG::ReadHandle<xAOD::ElectronContainer> h_ElectronContainer;
-
   if (m_bNewEvent)
   {
-    h_ElectronContainer = SG::makeHandle(m_sElectronContainerName);
-    if (!h_ElectronContainer.isValid()) {
-      ATH_MSG_FATAL("Electron container with name " << m_sElectronContainerName << " was not found in event store, but is needed for electron OLR. Ensure that it is there with the correct name");
-      return StatusCode::FAILURE;
-    }
     m_bNewEvent = false;
 
     m_bEleOLRMatchAvailable = (xTau.isAvailable<char>(m_sEleOlrPassDecorationName) || xTau.isAvailable<float>(m_sEleOlrLhScoreDecorationName));
@@ -122,6 +115,11 @@ StatusCode TauOverlappingElectronLLHDecorator::decorate(const xAOD::TauJet& xTau
   if (m_bEleOLRMatchAvailable)
     return StatusCode::SUCCESS;
 
+  SG::ReadHandle<xAOD::ElectronContainer> h_ElectronContainer(m_sElectronContainerName);
+  if (!h_ElectronContainer.isValid()) {
+    ATH_MSG_FATAL("Electron container with name " << m_sElectronContainerName << " was not found in event store, but is needed for electron OLR. Ensure that it is there with the correct name");
+    return StatusCode::FAILURE;
+  }
 
   const xAOD::Electron * xEleMatch = 0;
   float fLHScore = -4.; // default if no match was found
diff --git a/Reconstruction/MET/METUtilities/src/METMakerAlg.cxx b/Reconstruction/MET/METUtilities/src/METMakerAlg.cxx
index 909d8903319..20a8e9f5545 100644
--- a/Reconstruction/MET/METUtilities/src/METMakerAlg.cxx
+++ b/Reconstruction/MET/METUtilities/src/METMakerAlg.cxx
@@ -162,7 +162,7 @@ namespace met {
     SG::ReadHandle<xAOD::ElectronContainer> Electrons(m_ElectronContainerKey);
     if (!Electrons.isValid()) {
       ATH_MSG_WARNING("Unable to retrieve ElectronContainer: " << Electrons.key());
-      return StatusCode::SUCCESS;
+      return StatusCode::FAILURE;
     }
 
     /// Photons
-- 
GitLab