From 415558d91c9a216a8f244fef04606958e92f3f92 Mon Sep 17 00:00:00 2001
From: christos <christos@cern.ch>
Date: Tue, 4 May 2021 02:35:40 +0200
Subject: [PATCH] DerivationFrameworkEGamma , use private Tools via new Gaudi
 style. format the code , std::abs and tidy

---
 .../BkgElectronClassification.h               |  14 +-
 .../EGElectronAmbiguityTool.h                 | 190 +++---
 .../EGPhotonCleaningWrapper.h                 |   7 +-
 .../EGTransverseMassTool.h                    | 111 ++--
 .../PhotonsDirectionTool.h                    |   7 +-
 .../TruthCaloShowerDecorator.h                | 108 ++--
 .../src/BkgElectronClassification.cxx         |   8 +-
 .../src/EGElectronAmbiguityTool.cxx           | 542 ++++++++++--------
 .../src/EGElectronLikelihoodToolWrapper.cxx   |  13 +-
 .../src/EGInvariantMassTool.cxx               |   4 +-
 .../src/EGPhotonCleaningWrapper.cxx           |   1 -
 .../src/EGSelectionToolWrapper.cxx            |   4 +-
 .../src/EGTransverseMassTool.cxx              | 270 ++++-----
 .../src/TruthCaloShowerDecorator.cxx          | 204 ++++---
 14 files changed, 800 insertions(+), 683 deletions(-)

diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/BkgElectronClassification.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/BkgElectronClassification.h
index 0dca1fd288a..36bbd4dfa74 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/BkgElectronClassification.h
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/BkgElectronClassification.h
@@ -7,8 +7,10 @@
 
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "DerivationFrameworkInterfaces/IAugmentationTool.h"
+//
 #include "GaudiKernel/ToolHandle.h"
 #include "MCTruthClassifier/IMCTruthClassifier.h"
+///
 #include "StoreGate/ReadHandle.h"
 #include "StoreGate/ReadHandleKey.h"
 #include "StoreGate/WriteDecorHandle.h"
@@ -32,7 +34,12 @@ public:
 
 private:
   /** @brief MCTruthClassifier **/
-  ToolHandle<IMCTruthClassifier> m_mcTruthClassifier;
+  ToolHandle<IMCTruthClassifier> m_mcTruthClassifier{
+    this,
+    "MCTruthClassifierTool",
+    "",
+    "Handle to the MCTruthClassifier"
+  };
   /** @brief barcode cut for egamma helpers **/
   int m_barcodecut;
 
@@ -51,9 +58,8 @@ private:
     "Input Truth Particles"
   };
 
-
-  //Write decoration handle keys 
-  //these are not really configuarable
+  // Write decoration handle keys
+  // these are not really configuarable
   SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_truthPdgId{
     "Electrons.truthPdgId"
   };
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGElectronAmbiguityTool.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGElectronAmbiguityTool.h
index c03e71b4953..da391b29af6 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGElectronAmbiguityTool.h
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGElectronAmbiguityTool.h
@@ -18,107 +18,111 @@
 #include "StoreGate/ReadHandleKey.h"
 #include "StoreGate/WriteDecorHandle.h"
 
+#include "AthContainers/ConstDataVector.h"
+#include "xAODEgamma/Electron.h"
 #include "xAODEgamma/ElectronContainer.h"
-#include "xAODTracking/VertexContainer.h"
+#include "xAODTracking/TrackParticle.h"
 #include "xAODTracking/TrackParticleContainer.h"
-#include "xAODEgamma/Electron.h"
 #include "xAODTracking/Vertex.h"
-#include "xAODTracking/TrackParticle.h"
-#include "AthContainers/ConstDataVector.h"
+#include "xAODTracking/VertexContainer.h"
 
 #include <string>
 
 namespace DerivationFramework {
 
-  class EGElectronAmbiguityTool : public AthAlgTool, public IAugmentationTool {
-    
-    public: 
-      EGElectronAmbiguityTool(const std::string& t,
-                              const std::string& n,
-                              const IInterface* p);
-
-      virtual StatusCode initialize() override final;
-      virtual StatusCode addBranches() const override final;
-
-  private:
-      SG::ReadHandleKey<xAOD::ElectronContainer> m_containerName{
-        this,
-        "ContainerName",
-        "Electrons",
-        "SG key of electron container"
-      };
-      SG::ReadHandleKey<xAOD::VertexContainer> m_VtxContainerName{
-        this,
-        "VtxContainerName",
-        "PrimaryVertices",
-        "SG key of vertex container"
-      };
-      SG::ReadHandleKey<xAOD::TrackParticleContainer> m_tpContainerName{
-        this,
-        "tpContainerName",
-        "InDetTrackParticles",
-        "SG key of track particles container"
-      };
-
-      SG::ReadHandleKey<xAOD::TrackParticleContainer> m_tpCName{
-        this,
-        "tpCName",
-        "GSFTrackParticles",
-        "SG key of TrackParticleInputContainer"
-      };
-
-      //Write decoration handle keys
-      SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_drv{
-        "Electrons.DFCommonSimpleConvRadius"
-      };
-      SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dphiv{
-        "Electrons.DFCommonSimpleConvPhi"
-      };
-      SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dmee{
-        "Electrons.DFCommonSimpleMee"
-      };
-      SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dmeeVtx{
-        "Electrons.DFCommonSimpleMeeAtVtx"
-      };
-      SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dsep{
-        "Electrons.DFCommonSimpleSeparation"
-      };
-      SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dambi{
-        "Electrons.DFCommonAddAmbiguity"
-      };
-      SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dtrv{
-        "Electrons.DFCommonProdTrueRadius"
-      };
-      SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dtpv{
-        "Electrons.DFCommonProdTruePhi"
-      };
-      SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dtzv{
-        "Electrons.DFCommonProdTrueZ"
-      };
-
-      StatusCode decorateSimple(const EventContext& ctx,
-                                std::unique_ptr<ConstDataVector<xAOD::TrackParticleContainer>> & tpC,
-                                const xAOD::Electron *ele,
-                                const xAOD::Vertex *pvtx) const;
-      void helix(const xAOD::TrackParticle *trkP,
-                 const xAOD::Vertex *pvtx,
-                 std::vector<double>& h) const;
-
-      bool m_isMC;
-
-      // cuts to select the electron to run on
-      double m_elepTCut;
-      std::string m_idCut;
-
-      // cuts to select the other track 
-      unsigned int m_nSiCut;
-      double m_dctCut, m_sepCut, m_dzCut;
-
-      // cuts to define the various types :
-      // ambi = -1 : no other track, 0 : other track exists but no good gamma reco, 1 : gamma*, 2 : material conversion
-      double m_rvECCut, m_meeAtVtxECCut,m_meeICCut;
-
-  }; 
+class EGElectronAmbiguityTool
+  : public AthAlgTool
+  , public IAugmentationTool
+{
+
+public:
+  EGElectronAmbiguityTool(const std::string& t,
+                          const std::string& n,
+                          const IInterface* p);
+
+  virtual StatusCode initialize() override final;
+  virtual StatusCode addBranches() const override final;
+
+private:
+  SG::ReadHandleKey<xAOD::ElectronContainer> m_containerName{
+    this,
+    "ContainerName",
+    "Electrons",
+    "SG key of electron container"
+  };
+  SG::ReadHandleKey<xAOD::VertexContainer> m_VtxContainerName{
+    this,
+    "VtxContainerName",
+    "PrimaryVertices",
+    "SG key of vertex container"
+  };
+  SG::ReadHandleKey<xAOD::TrackParticleContainer> m_tpContainerName{
+    this,
+    "tpContainerName",
+    "InDetTrackParticles",
+    "SG key of track particles container"
+  };
+
+  SG::ReadHandleKey<xAOD::TrackParticleContainer> m_tpCName{
+    this,
+    "tpCName",
+    "GSFTrackParticles",
+    "SG key of TrackParticleInputContainer"
+  };
+
+  // Write decoration handle keys
+  SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_drv{
+    "Electrons.DFCommonSimpleConvRadius"
+  };
+  SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dphiv{
+    "Electrons.DFCommonSimpleConvPhi"
+  };
+  SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dmee{
+    "Electrons.DFCommonSimpleMee"
+  };
+  SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dmeeVtx{
+    "Electrons.DFCommonSimpleMeeAtVtx"
+  };
+  SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dsep{
+    "Electrons.DFCommonSimpleSeparation"
+  };
+  SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dambi{
+    "Electrons.DFCommonAddAmbiguity"
+  };
+  SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dtrv{
+    "Electrons.DFCommonProdTrueRadius"
+  };
+  SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dtpv{
+    "Electrons.DFCommonProdTruePhi"
+  };
+  SG::WriteDecorHandleKey<xAOD::ElectronContainer> m_dtzv{
+    "Electrons.DFCommonProdTrueZ"
+  };
+
+  StatusCode decorateSimple(
+    const EventContext& ctx,
+    std::unique_ptr<ConstDataVector<xAOD::TrackParticleContainer>>& tpC,
+    const xAOD::Electron* ele,
+    const xAOD::Vertex* pvtx) const;
+  void helix(const xAOD::TrackParticle* trkP,
+             const xAOD::Vertex* pvtx,
+             std::vector<double>& h) const;
+
+  bool m_isMC;
+
+  // cuts to select the electron to run on
+  double m_elepTCut;
+  std::string m_idCut;
+
+  // cuts to select the other track
+  unsigned int m_nSiCut;
+  double m_dctCut, m_sepCut, m_dzCut;
+
+  // cuts to define the various types :
+  // ambi = -1 : no other track, 0 : other track exists but no good gamma reco,
+  // 1 : gamma*, 2 : material conversion
+  double m_rvECCut, m_meeAtVtxECCut, m_meeICCut;
+};
 }
 
 #endif // DERIVATIONFRAMEWORK_EGCONVERSIONINFOTOOL_H
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGPhotonCleaningWrapper.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGPhotonCleaningWrapper.h
index 22d15fe97ca..0a066e1e60b 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGPhotonCleaningWrapper.h
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGPhotonCleaningWrapper.h
@@ -37,7 +37,12 @@ public:
   virtual StatusCode addBranches() const override final;
 
 private:
-  ToolHandle<IElectronPhotonShowerShapeFudgeTool> m_fudgeMCTool;
+  ToolHandle<IElectronPhotonShowerShapeFudgeTool> m_fudgeMCTool{
+    this,
+    "EGammaFudgeMCTool",
+    "",
+    "Handle to the Fudging Tool"
+  };
   SG::ReadHandleKey<xAOD::PhotonContainer> m_containerName{ this,
                                                             "ContainerName",
                                                             "",
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGTransverseMassTool.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGTransverseMassTool.h
index 86054536df3..a036c6bfc8c 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGTransverseMassTool.h
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGTransverseMassTool.h
@@ -24,68 +24,73 @@
 
 namespace DerivationFramework {
 
-  class EGTransverseMassTool : public ExpressionParserUser<AthAlgTool>, public IAugmentationTool {
-    public:
-      EGTransverseMassTool(const std::string& t, const std::string& n, const IInterface* p);
+class EGTransverseMassTool
+  : public ExpressionParserUser<AthAlgTool>
+  , public IAugmentationTool
+{
+public:
+  EGTransverseMassTool(
+    const std::string& t,
+    const std::string& n,
+    const IInterface* p);
 
-      virtual StatusCode initialize() override final;
-      virtual StatusCode addBranches() const override final;
+  virtual StatusCode initialize() override final;
+  virtual StatusCode addBranches() const override final;
 
-    private:
-      StatusCode getTransverseMasses(const EventContext& ctx,
-                                     std::vector<float>&) const;
+private:
+  StatusCode getTransverseMasses(const EventContext& ctx, std::vector<float>&)
+    const;
 
-      std::string m_expression1;
-      float m_METmin;
-      float m_mass1Hypothesis;
+  std::string m_expression1;
+  float m_METmin;
+  float m_mass1Hypothesis;
 
-      SG::WriteHandleKey<std::vector<float>> m_sgName{ this,
-                                                       "StoreGateEntryName",
-                                                       "",
-                                                       "SG key of output object" };
-      
-      SG::ReadHandleKey<xAOD::IParticleContainer> m_container1Name{
-        this,
-        "ObjectContainerName",
-        "",
-        "SG key of first container"
-      };
-      SG::ReadHandleKey<xAOD::MissingETContainer> m_container2Name{
-        this,
-        "METContainerName",
-        "MET_LocHadTopo",
-        "SG key of second container"
-      };
+  SG::WriteHandleKey<std::vector<float>> m_sgName{ this,
+                                                   "StoreGateEntryName",
+                                                   "",
+                                                   "SG key of output object" };
 
-      SG::ReadHandleKey<std::vector<float>> m_pt1BranchName{
-        this,
-        "ObjectPtBranchName",
-        "",
-        "Pt1 if different than default"
-      };
+  SG::ReadHandleKey<xAOD::IParticleContainer> m_container1Name{
+    this,
+    "ObjectContainerName",
+    "",
+    "SG key of first container"
+  };
+  SG::ReadHandleKey<xAOD::MissingETContainer> m_container2Name{
+    this,
+    "METContainerName",
+    "MET_LocHadTopo",
+    "SG key of second container"
+  };
 
-      SG::ReadHandleKey<std::vector<float>> m_phi1BranchName{
-        this,
-        "ObjectPhiBranchName",
-        "",
-        "Phi1 if different than default"
-      };
+  SG::ReadHandleKey<std::vector<float>> m_pt1BranchName{
+    this,
+    "ObjectPtBranchName",
+    "",
+    "Pt1 if different than default"
+  };
 
-      SG::ReadHandleKey<std::vector<float>> m_pt2BranchName{
-        this,
-        "METPtBranchName",
-        "",
-        "Pt2 if different than default"
-      };
+  SG::ReadHandleKey<std::vector<float>> m_phi1BranchName{
+    this,
+    "ObjectPhiBranchName",
+    "",
+    "Phi1 if different than default"
+  };
 
-      SG::ReadHandleKey<std::vector<float>> m_phi2BranchName{
-        this,
-        "METPhiBranchName",
-        "",
-        "Phi2 if different than default"
-      };
+  SG::ReadHandleKey<std::vector<float>> m_pt2BranchName{
+    this,
+    "METPtBranchName",
+    "",
+    "Pt2 if different than default"
+  };
 
-  }; 
+  SG::ReadHandleKey<std::vector<float>> m_phi2BranchName{
+    this,
+    "METPhiBranchName",
+    "",
+    "Phi2 if different than default"
+  };
+};
 }
 
 #endif // DERIVATIONFRAMEWORK_EGTRANSVERSEMASSTOOL_H
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/PhotonsDirectionTool.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/PhotonsDirectionTool.h
index 8a98992c002..093ef60a43f 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/PhotonsDirectionTool.h
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/PhotonsDirectionTool.h
@@ -23,9 +23,10 @@ class PhotonsDirectionTool
   , public IAugmentationTool
 {
 public:
-  PhotonsDirectionTool(const std::string& t,
-                       const std::string& n,
-                       const IInterface* p);
+  PhotonsDirectionTool(
+    const std::string& t,
+    const std::string& n,
+    const IInterface* p);
 
   virtual StatusCode initialize() override final;
   virtual StatusCode addBranches() const override final;
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/TruthCaloShowerDecorator.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/TruthCaloShowerDecorator.h
index 9fd8f0313dc..ed9e089e2c1 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/TruthCaloShowerDecorator.h
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/TruthCaloShowerDecorator.h
@@ -13,63 +13,69 @@
 #include "StoreGate/ReadHandleKey.h"
 #include "StoreGate/WriteDecorHandle.h"
 
-#include "xAODTruth/TruthParticleContainer.h"
 #include "CaloCalibHitRec/CalibHitToCaloCellTool.h"
+#include "xAODTruth/TruthParticleContainer.h"
 
 #include <vector>
 
-
 namespace DerivationFramework {
 
-  class TruthCaloShowerDecorator : public AthAlgTool, public IAugmentationTool {
-    public: 
-      TruthCaloShowerDecorator(const std::string& t, const std::string& n, const IInterface* p);
-
-      StatusCode initialize();
-      StatusCode finalize();
-      virtual StatusCode addBranches() const;
-
-    private:
-
-      /** @brief SG key of the truth particle container **/
-      SG::ReadHandleKey<xAOD::TruthParticleContainer> m_truthParticleContainerName{
-        this,
-        "TruthParticleContainerName",
-        "egammaTruthParticles",
-        "SG key of the truth particle container"
-      };
-
-      // Non-configurable read handle keys
-      SG::ReadHandleKey<xAOD::CaloClusterContainer> m_truthClusterContainerEtot{
-        "TruthLArClustersEtot",
-      };
-      SG::ReadHandleKey<xAOD::CaloClusterContainer> m_truthClusterContainerEvis{
-        "TruthLArClustersEvis"
-      };
-      SG::ReadHandleKey<xAOD::CaloClusterContainer> m_truthClusterContainerEem{
-        "TruthLArClustersEem"
-      };
-
-      // Write decoration handle keys
-      SG::WriteDecorHandleKey<xAOD::TruthParticleContainer>
-        m_linkDecoratorClusterEtot{
-          "egammaTruthParticles.truthLArClusterEtotLink"
-      };
-      SG::WriteDecorHandleKey<xAOD::TruthParticleContainer>
-        m_linkDecoratorClusterEvis{
-          "egammaTruthParticles.truthLArClusterEvisLink"
-      };
-      SG::WriteDecorHandleKey<xAOD::TruthParticleContainer>
-        m_linkDecoratorClusterEem{
-          "egammaTruthParticles.truthLArClusterEemLink"
-      };
-
-      /** @brief barcode cut for egamma helpers **/
-      int m_singleParticleBarcode;
-
-      ToolHandle<CalibHitToCaloCellTool> m_calibhitToCaloCellTool; 
-
-  }; 
+class TruthCaloShowerDecorator
+  : public AthAlgTool
+  , public IAugmentationTool
+{
+public:
+  TruthCaloShowerDecorator(
+    const std::string& t,
+    const std::string& n,
+    const IInterface* p);
+
+  StatusCode initialize();
+  StatusCode finalize();
+  virtual StatusCode addBranches() const;
+
+private:
+  /** @brief SG key of the truth particle container **/
+  SG::ReadHandleKey<xAOD::TruthParticleContainer> m_truthParticleContainerName{
+    this,
+    "TruthParticleContainerName",
+    "egammaTruthParticles",
+    "SG key of the truth particle container"
+  };
+
+  // Non-configurable read handle keys
+  SG::ReadHandleKey<xAOD::CaloClusterContainer> m_truthClusterContainerEtot{
+    "TruthLArClustersEtot",
+  };
+  SG::ReadHandleKey<xAOD::CaloClusterContainer> m_truthClusterContainerEvis{
+    "TruthLArClustersEvis"
+  };
+  SG::ReadHandleKey<xAOD::CaloClusterContainer> m_truthClusterContainerEem{
+    "TruthLArClustersEem"
+  };
+
+  // Write decoration handle keys
+  SG::WriteDecorHandleKey<xAOD::TruthParticleContainer>
+    m_linkDecoratorClusterEtot{
+      "egammaTruthParticles.truthLArClusterEtotLink"
+    };
+  SG::WriteDecorHandleKey<xAOD::TruthParticleContainer>
+    m_linkDecoratorClusterEvis{
+      "egammaTruthParticles.truthLArClusterEvisLink"
+    };
+  SG::WriteDecorHandleKey<xAOD::TruthParticleContainer>
+    m_linkDecoratorClusterEem{ "egammaTruthParticles.truthLArClusterEemLink" };
+
+  /** @brief barcode cut for egamma helpers **/
+  int m_singleParticleBarcode;
+
+  ToolHandle<CalibHitToCaloCellTool> m_calibhitToCaloCellTool{
+    this,
+    "CalibHitToCaloCellTool",
+    "",
+    "Handle to the Calib Hit to Calo cell Tool"
+  };
+};
 }
 
 #endif // DERIVATIONFRAMEWORK_TRUTHCALOSHOWERDECORATOR_H
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/BkgElectronClassification.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/BkgElectronClassification.cxx
index 23f731c7577..006acf2c65a 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/BkgElectronClassification.cxx
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/BkgElectronClassification.cxx
@@ -18,10 +18,6 @@ BkgElectronClassification::BkgElectronClassification(const std::string& t,
 {
 
   declareInterface<DerivationFramework::IAugmentationTool>(this);
-
-  declareProperty("MCTruthClassifierTool",
-                  m_mcTruthClassifier,
-                  "Handle of MCTruthClassifier");
   declareProperty("barcodeCut",
                   m_barcodecut = 200e3,
                   "Cut on the barcode for the xAODEgammaTruthHelpers");
@@ -53,7 +49,7 @@ BkgElectronClassification::initialize()
   m_lastEgMotherPdgId = baseName + ".lastEgMotherPdgId";
 
   ATH_CHECK(m_truthPdgId.initialize());
-  // 
+  //
   ATH_CHECK(m_firstEgMotherTruthType.initialize());
   ATH_CHECK(m_firstEgMotherTruthOrigin.initialize());
   ATH_CHECK(m_firstEgMotherTruthParticleLink.initialize());
@@ -63,7 +59,7 @@ BkgElectronClassification::initialize()
   ATH_CHECK(m_lastEgMotherTruthOrigin.initialize());
   ATH_CHECK(m_lastEgMotherTruthParticleLink.initialize());
   ATH_CHECK(m_lastEgMotherPdgId.initialize());
-  
+
   ATH_MSG_DEBUG("Initialization successful");
 
   return StatusCode::SUCCESS;
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGElectronAmbiguityTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGElectronAmbiguityTool.cxx
index 613ad0fa85d..30d096e4e1c 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGElectronAmbiguityTool.cxx
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGElectronAmbiguityTool.cxx
@@ -5,13 +5,13 @@
 ///////////////////////////////////////////////////////////////////
 // EGElectronAmbiguityTool.cxx, (c) ATLAS Detector software
 ///////////////////////////////////////////////////////////////////
-// 
+//
 //
 
 #include "DerivationFrameworkEGamma/EGElectronAmbiguityTool.h"
 
-#include "xAODTruth/xAODTruthHelpers.h"
 #include "xAODEgamma/ElectronxAODHelpers.h"
+#include "xAODTruth/xAODTruthHelpers.h"
 
 #include "xAODTruth/TruthParticle.h"
 #include "xAODTruth/TruthVertex.h"
@@ -20,209 +20,248 @@
 
 namespace DerivationFramework {
 
-  EGElectronAmbiguityTool::EGElectronAmbiguityTool(const std::string& t,
-                                                   const std::string& n,
-                                                   const IInterface* p)
-    : AthAlgTool(t,n,p)
-  {
-    declareInterface<DerivationFramework::IAugmentationTool>(this);
+EGElectronAmbiguityTool::EGElectronAmbiguityTool(const std::string& t,
+                                                 const std::string& n,
+                                                 const IInterface* p)
+  : AthAlgTool(t, n, p)
+{
+  declareInterface<DerivationFramework::IAugmentationTool>(this);
+
+  declareProperty("isMC", m_isMC);
+
+  declareProperty(
+    "pTCut", m_elepTCut = 9e3, "minimum pT for an electron to be studied");
+  declareProperty("idCut",
+                  m_idCut = "DFCommonElectronsLHLoose",
+                  "minimal quality for an electron to be studied");
+
+  declareProperty(
+    "nSiCut", m_nSiCut = 7, "minimum number of Si hits in the other track");
+  declareProperty(
+    "dzsinTCut", m_dzCut = 0.5, "max dz sinTheta between ele and other tracks");
+  declareProperty("SeparationCut", m_sepCut = 1., "first separation cut");
+  declareProperty("DCTCut", m_dctCut = 0.02, "second separation cut");
+
+  declareProperty("radiusCut",
+                  m_rvECCut = 20,
+                  "minimum radius to be classified as external conversion");
+  declareProperty(
+    "meeAtVtxCut",
+    m_meeAtVtxECCut = 100,
+    "maximal mass at vertex to be classified as external conversion");
+  declareProperty("meeCut",
+                  m_meeICCut = 100,
+                  "maximal mass at primary vertex to be classified as gamma*");
+}
 
-    declareProperty("isMC", m_isMC);
+StatusCode
+EGElectronAmbiguityTool::initialize()
+{
 
-    declareProperty("pTCut",            m_elepTCut = 9e3, "minimum pT for an electron to be studied");
-    declareProperty("idCut",            m_idCut    = "DFCommonElectronsLHLoose", "minimal quality for an electron to be studied");
+  ATH_CHECK(m_containerName.initialize());
+  ATH_CHECK(m_VtxContainerName.initialize());
+  ATH_CHECK(m_tpContainerName.initialize());
+  ATH_CHECK(m_tpCName.initialize());
+
+  const std::string baseName = m_containerName.key();
+  m_drv = baseName + ".DFCommonSimpleConvRadius";
+  m_dphiv = baseName + ".DFCommonSimpleConvPhi";
+  m_dmee = baseName + ".DFCommonSimpleMee";
+  m_dmeeVtx = baseName + ".DFCommonSimpleMeeAtVtx";
+  m_dsep = baseName + ".DFCommonSimpleSeparation";
+  m_dambi = baseName + ".DFCommonAddAmbiguity";
+  m_dtrv = baseName + ".DFCommonProdTrueRadius";
+  m_dtpv = baseName + ".DFCommonProdTruePhi";
+  m_dtzv = baseName + ".DFCommonProdTrueZ";
+
+  ATH_CHECK(m_drv.initialize());
+  ATH_CHECK(m_dphiv.initialize());
+  ATH_CHECK(m_dmee.initialize());
+  ATH_CHECK(m_dmeeVtx.initialize());
+  ATH_CHECK(m_dsep.initialize());
+  ATH_CHECK(m_dambi.initialize());
+  ATH_CHECK(m_dtrv.initialize());
+  ATH_CHECK(m_dtpv.initialize());
+  ATH_CHECK(m_dtzv.initialize());
 
-    declareProperty("nSiCut",           m_nSiCut  = 7,    "minimum number of Si hits in the other track");
-    declareProperty("dzsinTCut",        m_dzCut   = 0.5,  "max dz sinTheta between ele and other tracks");
-    declareProperty("SeparationCut",    m_sepCut  = 1.,   "first separation cut");
-    declareProperty("DCTCut",           m_dctCut  = 0.02, "second separation cut");
+  return StatusCode::SUCCESS;
+}
 
-    declareProperty("radiusCut",        m_rvECCut       = 20,  "minimum radius to be classified as external conversion");
-    declareProperty("meeAtVtxCut",      m_meeAtVtxECCut = 100, "maximal mass at vertex to be classified as external conversion");
-    declareProperty("meeCut",           m_meeICCut      = 100, "maximal mass at primary vertex to be classified as gamma*");
-  }
+StatusCode
+EGElectronAmbiguityTool::addBranches() const
+{
+  const EventContext& ctx = Gaudi::Hive::currentContext();
 
-  StatusCode EGElectronAmbiguityTool::initialize()
-  {
-
-    ATH_CHECK( m_containerName.initialize() );
-    ATH_CHECK( m_VtxContainerName.initialize() );
-    ATH_CHECK( m_tpContainerName.initialize() );
-    ATH_CHECK( m_tpCName.initialize() );
-
-    const std::string baseName = m_containerName.key();
-    m_drv     = baseName + ".DFCommonSimpleConvRadius";
-    m_dphiv   = baseName + ".DFCommonSimpleConvPhi";
-    m_dmee    = baseName + ".DFCommonSimpleMee";
-    m_dmeeVtx = baseName + ".DFCommonSimpleMeeAtVtx";
-    m_dsep    = baseName + ".DFCommonSimpleSeparation";
-    m_dambi   = baseName + ".DFCommonAddAmbiguity";
-    m_dtrv = baseName + ".DFCommonProdTrueRadius";
-    m_dtpv = baseName + ".DFCommonProdTruePhi";
-    m_dtzv = baseName + ".DFCommonProdTrueZ";
-
-    ATH_CHECK(m_drv.initialize());
-    ATH_CHECK(m_dphiv.initialize());
-    ATH_CHECK(m_dmee.initialize());
-    ATH_CHECK(m_dmeeVtx.initialize());
-    ATH_CHECK(m_dsep.initialize());
-    ATH_CHECK(m_dambi.initialize());
-    ATH_CHECK(m_dtrv.initialize());
-    ATH_CHECK(m_dtpv.initialize());
-    ATH_CHECK(m_dtzv.initialize());
+  SG::WriteDecorHandle<xAOD::ElectronContainer, float> drv(m_drv, ctx);
+  SG::WriteDecorHandle<xAOD::ElectronContainer, float> dphiv(m_dphiv, ctx);
+  SG::WriteDecorHandle<xAOD::ElectronContainer, float> dmee(m_dmee, ctx);
+  SG::WriteDecorHandle<xAOD::ElectronContainer, float> dmeeVtx(m_dmeeVtx, ctx);
+  SG::WriteDecorHandle<xAOD::ElectronContainer, float> dsep(m_dsep, ctx);
+  SG::WriteDecorHandle<xAOD::ElectronContainer, int> dambi(m_dambi, ctx);
+  SG::WriteDecorHandle<xAOD::ElectronContainer, float> dtrv(m_dtrv, ctx);
+  SG::WriteDecorHandle<xAOD::ElectronContainer, float> dtpv(m_dtpv, ctx);
+  SG::WriteDecorHandle<xAOD::ElectronContainer, float> dtzv(m_dtzv, ctx);
 
-    return StatusCode::SUCCESS;
-  }
+  static const SG::AuxElement::ConstAccessor<char> aidCut(m_idCut);
 
-  StatusCode EGElectronAmbiguityTool::addBranches() const
-  {
-    const EventContext& ctx = Gaudi::Hive::currentContext();
-
-    SG::WriteDecorHandle<xAOD::ElectronContainer, float> drv(m_drv, ctx);
-    SG::WriteDecorHandle<xAOD::ElectronContainer, float> dphiv(m_dphiv, ctx);
-    SG::WriteDecorHandle<xAOD::ElectronContainer, float> dmee(m_dmee, ctx);
-    SG::WriteDecorHandle<xAOD::ElectronContainer, float> dmeeVtx(m_dmeeVtx, ctx);
-    SG::WriteDecorHandle<xAOD::ElectronContainer, float> dsep(m_dsep, ctx);
-    SG::WriteDecorHandle<xAOD::ElectronContainer, int> dambi(m_dambi, ctx);
-    SG::WriteDecorHandle<xAOD::ElectronContainer, float> dtrv(m_dtrv, ctx);
-    SG::WriteDecorHandle<xAOD::ElectronContainer, float> dtpv(m_dtpv, ctx);
-    SG::WriteDecorHandle<xAOD::ElectronContainer, float> dtzv(m_dtzv, ctx);
-
-    static const SG::AuxElement::ConstAccessor<char> aidCut(m_idCut);
-
-    // retrieve primary vertex
-    const xAOD::Vertex *pvtx(nullptr);
-    SG::ReadHandle<xAOD::VertexContainer> inputVtx{ m_VtxContainerName, ctx };
-    const xAOD::VertexContainer* vtxC = inputVtx.ptr();
-    for (const auto *vertex: *vtxC) {
-      if (vertex->vertexType() == xAOD::VxType::VertexType::PriVtx) {
-        pvtx = vertex;
-        break;
-      }
+  // retrieve primary vertex
+  const xAOD::Vertex* pvtx(nullptr);
+  SG::ReadHandle<xAOD::VertexContainer> inputVtx{ m_VtxContainerName, ctx };
+  const xAOD::VertexContainer* vtxC = inputVtx.ptr();
+  for (const auto* vertex : *vtxC) {
+    if (vertex->vertexType() == xAOD::VxType::VertexType::PriVtx) {
+      pvtx = vertex;
+      break;
     }
+  }
 
-    // retrieve electron container
-    SG::ReadHandle<xAOD::ElectronContainer> inputElectrons{ m_containerName, ctx };
-    const xAOD::ElectronContainer* eleC = inputElectrons.ptr();
-    
-    if( ! eleC ) {
-      ATH_MSG_ERROR ("Couldn't retrieve Electron container with key: " << m_containerName );
-      return StatusCode::FAILURE;
-    }
-    if (!pvtx) {
-      ATH_MSG_DEBUG("No primary vertex found. Setting default values.");
-      for (const xAOD::Electron* iele : *eleC) {
-        drv(*iele) = -1;
-        dphiv(*iele) = -1;
-        dmee(*iele) = -1;
-        dmeeVtx(*iele) = -1;
-        dsep(*iele) = -1;
-        dambi(*iele) = -1;
-        dtrv(*iele) = -1;
-        dtpv(*iele) = -1;
-        dtzv(*iele) = -1;
-      }
-      return StatusCode::SUCCESS;
+  // retrieve electron container
+  SG::ReadHandle<xAOD::ElectronContainer> inputElectrons{ m_containerName,
+                                                          ctx };
+  const xAOD::ElectronContainer* eleC = inputElectrons.ptr();
+
+  if (!eleC) {
+    ATH_MSG_ERROR(
+      "Couldn't retrieve Electron container with key: " << m_containerName);
+    return StatusCode::FAILURE;
+  }
+  if (!pvtx) {
+    ATH_MSG_DEBUG("No primary vertex found. Setting default values.");
+    for (const xAOD::Electron* iele : *eleC) {
+      drv(*iele) = -1;
+      dphiv(*iele) = -1;
+      dmee(*iele) = -1;
+      dmeeVtx(*iele) = -1;
+      dsep(*iele) = -1;
+      dambi(*iele) = -1;
+      dtrv(*iele) = -1;
+      dtpv(*iele) = -1;
+      dtzv(*iele) = -1;
     }
-    ATH_MSG_DEBUG("Pvx z = " << pvtx->z() << ", number of electrons " << eleC->size());
+    return StatusCode::SUCCESS;
+  }
+  ATH_MSG_DEBUG("Pvx z = " << pvtx->z() << ", number of electrons "
+                           << eleC->size());
 
-    // Make a container of selected tracks : with Si hits, close to electron track 
-    SG::ReadHandle<xAOD::TrackParticleContainer> inputTrackParticles{ m_tpContainerName, ctx };
-    const xAOD::TrackParticleContainer* idtpC = inputTrackParticles.ptr();
+  // Make a container of selected tracks : with Si hits, close to electron track
+  SG::ReadHandle<xAOD::TrackParticleContainer> inputTrackParticles{
+    m_tpContainerName, ctx
+  };
+  const xAOD::TrackParticleContainer* idtpC = inputTrackParticles.ptr();
 
-    std::set<const xAOD::TrackParticle*> alreadyStored;
-    std::set<const xAOD::TrackParticle*> eleIDtpStored, eleGSFtpStored;
-    auto closeByTracks = std::make_unique<ConstDataVector<xAOD::TrackParticleContainer>>(SG::VIEW_ELEMENTS);
+  std::set<const xAOD::TrackParticle*> alreadyStored;
+  std::set<const xAOD::TrackParticle*> eleIDtpStored, eleGSFtpStored;
+  auto closeByTracks =
+    std::make_unique<ConstDataVector<xAOD::TrackParticleContainer>>(
+      SG::VIEW_ELEMENTS);
 
-    for (const auto *ele : *eleC) {
+  for (const auto* ele : *eleC) {
 
-      dambi(*ele) = -1;
+    dambi(*ele) = -1;
 
-      // Electron preselection
-      if (ele->pt() < m_elepTCut || !(!m_idCut.empty() && aidCut.isAvailable(*ele) && aidCut(*ele)))
-        continue;
+    // Electron preselection
+    if (ele->pt() < m_elepTCut ||
+        !(!m_idCut.empty() && aidCut.isAvailable(*ele) && aidCut(*ele)))
+      continue;
 
-      // Just for debug
-      const xAOD::TrackParticle *eleGSFtp = ele->trackParticle();
-      if (eleGSFtpStored.find(eleGSFtp) == eleGSFtpStored.end())
-        eleGSFtpStored.insert(eleGSFtp);
+    // Just for debug
+    const xAOD::TrackParticle* eleGSFtp = ele->trackParticle();
+    if (eleGSFtpStored.find(eleGSFtp) == eleGSFtpStored.end())
+      eleGSFtpStored.insert(eleGSFtp);
 
-      const xAOD::TrackParticle *eleIDtp = xAOD::EgammaHelpers::getOriginalTrackParticle(ele);
-      if (eleIDtpStored.find(eleIDtp) == eleIDtpStored.end())
-        eleIDtpStored.insert(eleIDtp);
+    const xAOD::TrackParticle* eleIDtp =
+      xAOD::EgammaHelpers::getOriginalTrackParticle(ele);
+    if (eleIDtpStored.find(eleIDtp) == eleIDtpStored.end())
+      eleIDtpStored.insert(eleIDtp);
 
-      // The loop on track
-      for (const auto *tp : *idtpC) {
+    // The loop on track
+    for (const auto* tp : *idtpC) {
 
-        // Keep the electron track (I build a container to run vertexing on it...)
-        if (tp == eleIDtp) {
-          closeByTracks->push_back(tp);
-          alreadyStored.insert(tp);
-          continue;
-        }
+      // Keep the electron track (I build a container to run vertexing on it...)
+      if (tp == eleIDtp) {
+        closeByTracks->push_back(tp);
+        alreadyStored.insert(tp);
+        continue;
+      }
 
-        // potential candidate to store if not already there
-        if (alreadyStored.find(tp) != alreadyStored.end())
-          continue;
+      // potential candidate to store if not already there
+      if (alreadyStored.find(tp) != alreadyStored.end())
+        continue;
 
-        //// Keep only opposite charge
-        //if (tp->charge() * ele->charge() > 0)
-        //  continue;
+      //// Keep only opposite charge
+      // if (tp->charge() * ele->charge() > 0)
+      //  continue;
 
-        // Close-by
-        double dR = eleIDtp->p4().DeltaR(tp->p4());
-        double dz = fabs(eleIDtp->z0()-tp->z0())*sin(eleIDtp->theta());
-        if (!(dR < 0.3 && dz < m_dzCut))
-          continue;
+      // Close-by
+      double dR = eleIDtp->p4().DeltaR(tp->p4());
+      double dz = std::abs(eleIDtp->z0() - tp->z0()) * sin(eleIDtp->theta());
+      if (!(dR < 0.3 && dz < m_dzCut))
+        continue;
 
-        // With minimum number of Si hits
-        if (xAOD::EgammaHelpers::numberOfSiHits(tp) < m_nSiCut)
-          continue;
+      // With minimum number of Si hits
+      if (xAOD::EgammaHelpers::numberOfSiHits(tp) < m_nSiCut)
+        continue;
 
-        alreadyStored.insert(tp);
+      alreadyStored.insert(tp);
 
-        closeByTracks->push_back(tp); 
-      }
+      closeByTracks->push_back(tp);
     }
+  }
 
-    if (closeByTracks->empty())
-      return StatusCode::SUCCESS;
-
-    if (msgLvl(MSG::DEBUG)) {
-      SG::ReadHandle<xAOD::TrackParticleContainer> tpCReadHandle{ m_tpCName, ctx };
-      const xAOD::TrackParticleContainer* tpC = tpCReadHandle.ptr();
+  if (closeByTracks->empty())
+    return StatusCode::SUCCESS;
 
-      ATH_MSG_DEBUG("Number of input tracks " << idtpC->size() << " , number of selected close-by tracks " << closeByTracks->size() << " , number of GSF tracks " << tpC->size());
-      for (const auto *trk : eleIDtpStored)
-        ATH_MSG_DEBUG("ele  ID trk " << trk << " pt = " << trk->pt()*1e-3 << " eta = " << trk->eta() << " phi = " << trk->phi() << " nSi = " << xAOD::EgammaHelpers::numberOfSiHits(trk));
-      for (const auto *trk : eleGSFtpStored)
-        ATH_MSG_DEBUG("ele GSF trk " << trk << " pt = " << trk->pt()*1e-3 << " eta = " << trk->eta() << " phi = " << trk->phi() << " nSi = " << xAOD::EgammaHelpers::numberOfSiHits(trk));
-      for (const xAOD::TrackParticle *trk : *closeByTracks)
-        ATH_MSG_DEBUG("closeby trk " << trk << " pt = " << trk->pt()*1e-3 << " eta = " << trk->eta() << " phi = " << trk->phi() << " nSi = " << xAOD::EgammaHelpers::numberOfSiHits(trk));
-    }
+  if (msgLvl(MSG::DEBUG)) {
+    SG::ReadHandle<xAOD::TrackParticleContainer> tpCReadHandle{ m_tpCName,
+                                                                ctx };
+    const xAOD::TrackParticleContainer* tpC = tpCReadHandle.ptr();
+
+    ATH_MSG_DEBUG("Number of input tracks "
+                  << idtpC->size() << " , number of selected close-by tracks "
+                  << closeByTracks->size() << " , number of GSF tracks "
+                  << tpC->size());
+    for (const auto* trk : eleIDtpStored)
+      ATH_MSG_DEBUG("ele  ID trk "
+                    << trk << " pt = " << trk->pt() * 1e-3
+                    << " eta = " << trk->eta() << " phi = " << trk->phi()
+                    << " nSi = " << xAOD::EgammaHelpers::numberOfSiHits(trk));
+    for (const auto* trk : eleGSFtpStored)
+      ATH_MSG_DEBUG("ele GSF trk "
+                    << trk << " pt = " << trk->pt() * 1e-3
+                    << " eta = " << trk->eta() << " phi = " << trk->phi()
+                    << " nSi = " << xAOD::EgammaHelpers::numberOfSiHits(trk));
+    for (const xAOD::TrackParticle* trk : *closeByTracks)
+      ATH_MSG_DEBUG("closeby trk "
+                    << trk << " pt = " << trk->pt() * 1e-3
+                    << " eta = " << trk->eta() << " phi = " << trk->phi()
+                    << " nSi = " << xAOD::EgammaHelpers::numberOfSiHits(trk));
+  }
 
-    for (const auto *ele : *eleC) {
+  for (const auto* ele : *eleC) {
 
-      // Electron preselection
-      if (ele->pt() < m_elepTCut || !(!m_idCut.empty() && aidCut.isAvailable(*ele) && aidCut(*ele)))
-        continue;      
+    // Electron preselection
+    if (ele->pt() < m_elepTCut ||
+        !(!m_idCut.empty() && aidCut.isAvailable(*ele) && aidCut(*ele)))
+      continue;
 
-      // Henri's circles
-      if (decorateSimple(ctx, closeByTracks, ele, pvtx).isFailure()) {
-        ATH_MSG_ERROR("Cannot decorate the electron with the simple info");
-        return StatusCode::FAILURE;
-      }
+    // Henri's circles
+    if (decorateSimple(ctx, closeByTracks, ele, pvtx).isFailure()) {
+      ATH_MSG_ERROR("Cannot decorate the electron with the simple info");
+      return StatusCode::FAILURE;
+    }
 
-    }      // loop on electrons to decorate
+  } // loop on electrons to decorate
 
-    return StatusCode::SUCCESS;
-  }
+  return StatusCode::SUCCESS;
+}
 }
 
-StatusCode DerivationFramework::EGElectronAmbiguityTool::decorateSimple(const EventContext& ctx,
-                                                                        std::unique_ptr<ConstDataVector<xAOD::TrackParticleContainer>> & tpC,
-                                                                        const xAOD::Electron *ele,
-                                                                        const xAOD::Vertex *pvtx) const
+StatusCode
+DerivationFramework::EGElectronAmbiguityTool::decorateSimple(
+  const EventContext& ctx,
+  std::unique_ptr<ConstDataVector<xAOD::TrackParticleContainer>>& tpC,
+  const xAOD::Electron* ele,
+  const xAOD::Vertex* pvtx) const
 {
   SG::WriteDecorHandle<xAOD::ElectronContainer, float> drv(m_drv, ctx);
   SG::WriteDecorHandle<xAOD::ElectronContainer, float> dphiv(m_dphiv, ctx);
@@ -235,21 +274,28 @@ StatusCode DerivationFramework::EGElectronAmbiguityTool::decorateSimple(const Ev
   SG::WriteDecorHandle<xAOD::ElectronContainer, float> dtzv(m_dtzv, ctx);
 
   // This is the GSF electron track
-  const xAOD::TrackParticle *eleGSFtrkP = ele->trackParticle();
+  const xAOD::TrackParticle* eleGSFtrkP = ele->trackParticle();
 
   // And the ID one
-  const xAOD::TrackParticle *eleIDtrkP = xAOD::EgammaHelpers::getOriginalTrackParticle(ele);
+  const xAOD::TrackParticle* eleIDtrkP =
+    xAOD::EgammaHelpers::getOriginalTrackParticle(ele);
 
-  // For the time being, use the ID one, to be consistent when we only find a good ID to make a conversion and no GSF
-  bool useGSF = false; // hardcoded because it seems we will not use true. Kept for the time being, as not 100% sure
-  const xAOD::TrackParticle *eletrkP = useGSF ? eleGSFtrkP : eleIDtrkP;
+  // For the time being, use the ID one, to be consistent when we only find a
+  // good ID to make a conversion and no GSF
+  bool useGSF = false; // hardcoded because it seems we will not use true. Kept
+                       // for the time being, as not 100% sure
+  const xAOD::TrackParticle* eletrkP = useGSF ? eleGSFtrkP : eleIDtrkP;
 
-  ATH_MSG_DEBUG("Electron pt = " << ele->pt()*1e-3 << " eta = " << ele->eta() << " phi = " << ele->phi() << " GSF trk ptr = " << eleGSFtrkP << " ID trk ptr " << eleIDtrkP);
+  ATH_MSG_DEBUG("Electron pt = " << ele->pt() * 1e-3 << " eta = " << ele->eta()
+                                 << " phi = " << ele->phi() << " GSF trk ptr = "
+                                 << eleGSFtrkP << " ID trk ptr " << eleIDtrkP);
 
   if (m_isMC) {
-    const xAOD::TruthParticle *truthEl = xAOD::TruthHelpers::getTruthParticle(*ele);
+    const xAOD::TruthParticle* truthEl =
+      xAOD::TruthHelpers::getTruthParticle(*ele);
     double tpvr = -1, tpvp = 9e9, tpvz = 9e9;
-    if (truthEl && fabs(truthEl->pdgId()) == 11 && truthEl->prodVtx() != nullptr) {
+    if (truthEl && std::abs(truthEl->pdgId()) == 11 &&
+        truthEl->prodVtx() != nullptr) {
       tpvr = truthEl->prodVtx()->perp();
       tpvp = truthEl->prodVtx()->phi();
       tpvz = truthEl->prodVtx()->z();
@@ -259,23 +305,24 @@ StatusCode DerivationFramework::EGElectronAmbiguityTool::decorateSimple(const Ev
     dtzv(*ele) = tpvz;
   }
 
-  // Find the closest track particle with opposite charge and a minimum nb of Si hits
-  const xAOD::TrackParticle *otrkP(nullptr);
+  // Find the closest track particle with opposite charge and a minimum nb of Si
+  // hits
+  const xAOD::TrackParticle* otrkP(nullptr);
   double detaMin = 9e9;
-  for (const xAOD::TrackParticle *tp : *tpC) {
+  for (const xAOD::TrackParticle* tp : *tpC) {
     // Keep only opposite charge
     if (tp->charge() * eletrkP->charge() > 0)
       continue;
 
     // Close-by
     double dR = eletrkP->p4().DeltaR(tp->p4());
-    double dz = fabs(eletrkP->z0()-tp->z0())*sin(eletrkP->theta());
+    double dz = std::abs(eletrkP->z0() - tp->z0()) * sin(eletrkP->theta());
     if (!(dR < 0.3 && dz < m_dzCut))
       continue;
 
-    double deta = fabs(eletrkP->eta() - tp->eta());
+    double deta = std::abs(eletrkP->eta() - tp->eta());
     if (deta < detaMin) {
-      otrkP   = tp;
+      otrkP = tp;
       detaMin = deta;
     }
   }
@@ -290,101 +337,112 @@ StatusCode DerivationFramework::EGElectronAmbiguityTool::decorateSimple(const Ev
   if (otrkP) {
 
     // To be consistent with the other, use the ID track.
-    TLorentzVector ep4; ep4.SetPtEtaPhiM(eletrkP->pt(),eletrkP->eta(),eletrkP->phi(),0.511);
+    TLorentzVector ep4;
+    ep4.SetPtEtaPhiM(eletrkP->pt(), eletrkP->eta(), eletrkP->phi(), 0.511);
 
     // Maybe could see if a GSF tp exists for this ID tp and use it if yes ?
-    TLorentzVector op4; op4.SetPtEtaPhiM(otrkP->pt(),otrkP->eta(),otrkP->phi(),0.511);
+    TLorentzVector op4;
+    op4.SetPtEtaPhiM(otrkP->pt(), otrkP->eta(), otrkP->phi(), 0.511);
 
     // Simple masses
-    mee = (ep4+op4).M();
+    mee = (ep4 + op4).M();
     op4.SetPhi(eletrkP->phi());
-    meeAtVtx = (ep4+op4).M();
+    meeAtVtx = (ep4 + op4).M();
 
     // And the conversion point
     std::vector<double> helix1, helix2;
     helix1.resize(5);
     helix2.resize(5);
-    helix(eletrkP,pvtx,helix1);
-    helix(otrkP,pvtx,helix2);
+    helix(eletrkP, pvtx, helix1);
+    helix(otrkP, pvtx, helix2);
 
     double beta(0.);
     if (helix1[4] < helix2[4])
-      beta = TMath::PiOver2()-helix1[4];
+      beta = TMath::PiOver2() - helix1[4];
     else
-      beta = TMath::PiOver2()-helix2[4];
+      beta = TMath::PiOver2() - helix2[4];
 
     double phi1(helix1[4] + beta);
-    if (phi1 > TMath::TwoPi()) phi1 -= TMath::TwoPi();
-    if (phi1 < 0.)             phi1 += TMath::TwoPi();
+    if (phi1 > TMath::TwoPi())
+      phi1 -= TMath::TwoPi();
+    if (phi1 < 0.)
+      phi1 += TMath::TwoPi();
 
     double phi2(helix2[4] + beta);
-    if (phi2 > TMath::TwoPi()) phi2 -= TMath::TwoPi();
-    if (phi2 < 0.)             phi2 += TMath::TwoPi();
+    if (phi2 > TMath::TwoPi())
+      phi2 -= TMath::TwoPi();
+    if (phi2 < 0.)
+      phi2 += TMath::TwoPi();
 
     /// HelixToCircle Main Track Electron
-    double r1 = 1/(2.*fabs(helix1[1]));
+    double r1 = 1 / (2. * std::abs(helix1[1]));
 
     double charge1(1.);
-    if (helix1[1]<0.) charge1 = -1.;
-    double rcenter1(helix1[3]/charge1 + r1);
-    double phicenter1(phi1 + TMath::PiOver2()*charge1);
+    if (helix1[1] < 0.)
+      charge1 = -1.;
+    double rcenter1(helix1[3] / charge1 + r1);
+    double phicenter1(phi1 + TMath::PiOver2() * charge1);
 
-    double x1 = rcenter1*cos(phicenter1);
-    double y1 = rcenter1*sin(phicenter1);
+    double x1 = rcenter1 * cos(phicenter1);
+    double y1 = rcenter1 * sin(phicenter1);
 
     /// HelixToCircle Other Electron Conv Track
-    double r2 = 1/(2.*fabs(helix2[1]));
+    double r2 = 1 / (2. * std::abs(helix2[1]));
 
     double charge2(1.);
-    if(helix2[1]<0.) charge2 = -1.;
-    double rcenter2(helix2[3]/charge2 + r2);
-    double phicenter2(phi2 + TMath::PiOver2()*charge2);
+    if (helix2[1] < 0.)
+      charge2 = -1.;
+    double rcenter2(helix2[3] / charge2 + r2);
+    double phicenter2(phi2 + TMath::PiOver2() * charge2);
 
-    double x2 = rcenter2*cos(phicenter2);
-    double y2 = rcenter2*sin(phicenter2);
+    double x2 = rcenter2 * cos(phicenter2);
+    double y2 = rcenter2 * sin(phicenter2);
     //////
 
-    double dx(x1-x2);
-    if (dx <  1e-9 && dx > 0.) dx =  1e-9;
-    if (dx > -1e-9 && dx < 0.) dx = -1e-9;
-    double slope((y1-y2)/dx);
-    double b(y1 - slope*x1);
+    double dx(x1 - x2);
+    if (dx < 1e-9 && dx > 0.)
+      dx = 1e-9;
+    if (dx > -1e-9 && dx < 0.)
+      dx = -1e-9;
+    double slope((y1 - y2) / dx);
+    double b(y1 - slope * x1);
     double alpha(atan(slope));
-    double d(sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
-    //only keeping opposite sign option
-    double separation = d-r1-r2;
+    double d(sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
+    // only keeping opposite sign option
+    double separation = d - r1 - r2;
     double cpx1, cpx2;
     if (x1 > x2) {
-      cpx1 = x1-r1*cos(alpha);
-      cpx2 = x2+r2*cos(alpha); 
+      cpx1 = x1 - r1 * cos(alpha);
+      cpx2 = x2 + r2 * cos(alpha);
     } else {
-      cpx1 = x1+r1*cos(alpha);
-      cpx2 = x2 - r2*cos(alpha);
+      cpx1 = x1 + r1 * cos(alpha);
+      cpx2 = x2 - r2 * cos(alpha);
     }
 
-    double temp1 = (cpx1+cpx2)/2;
-    double temp2 = slope*temp1+b;
-    double convX = cos(beta)*temp1 + sin(beta)*temp2;
-    double convY = -sin(beta)*temp1+ cos(beta)*temp2;
+    double temp1 = (cpx1 + cpx2) / 2;
+    double temp2 = slope * temp1 + b;
+    double convX = cos(beta) * temp1 + sin(beta) * temp2;
+    double convY = -sin(beta) * temp1 + cos(beta) * temp2;
 
-    double dct(helix1[0]-helix2[0]);
+    double dct(helix1[0] - helix2[0]);
 
     ///////
-    if (fabs(separation) < m_sepCut && fabs(dct) < m_dctCut){
+    if (std::abs(separation) < m_sepCut && std::abs(dct) < m_dctCut) {
       goodConv = true;
       sep = separation;
-      pv  = TMath::ATan2(convY,convX);
-      rv  = sqrt(convX*convX + convY*convY);
-      if (convX*cos(eletrkP->phi()) + convY*sin(eletrkP->phi()) < 0) rv *= -1.; 
+      pv = std::atan2(convY, convX);
+      rv = sqrt(convX * convX + convY * convY);
+      if (convX * cos(eletrkP->phi()) + convY * sin(eletrkP->phi()) < 0)
+        rv *= -1.;
     }
   } else {
-    dambi(*ele) = -1; 
+    dambi(*ele) = -1;
   }
-  drv(*ele)     = rv;
-  dphiv(*ele)   = pv;
-  dmee(*ele)    = mee;
+  drv(*ele) = rv;
+  dphiv(*ele) = pv;
+  dmee(*ele) = mee;
   dmeeVtx(*ele) = meeAtVtx;
-  dsep(*ele)    = sep;
+  dsep(*ele) = sep;
   if (goodConv && rv > m_rvECCut && meeAtVtx < m_meeAtVtxECCut)
     dambi(*ele) = 2;
   else if (otrkP) {
@@ -396,14 +454,16 @@ StatusCode DerivationFramework::EGElectronAmbiguityTool::decorateSimple(const Ev
   return StatusCode::SUCCESS;
 }
 
-void DerivationFramework::EGElectronAmbiguityTool::helix(const xAOD::TrackParticle *trkP,
-                                                         const xAOD::Vertex *pvtx,
-                                                         std::vector<double>&he) const
+void
+DerivationFramework::EGElectronAmbiguityTool::helix(
+  const xAOD::TrackParticle* trkP,
+  const xAOD::Vertex* pvtx,
+  std::vector<double>& he) const
 {
   constexpr double PTTOCURVATURE = -0.301;
 
-  he[0] = 1./tan(trkP->theta());
-  he[1] = PTTOCURVATURE*trkP->charge()/trkP->pt();
+  he[0] = 1. / tan(trkP->theta());
+  he[1] = PTTOCURVATURE * trkP->charge() / trkP->pt();
 
   if (trkP->phi0() > 0.)
     he[4] = trkP->phi0();
@@ -412,10 +472,10 @@ void DerivationFramework::EGElectronAmbiguityTool::helix(const xAOD::TrackPartic
 
   double c1 = cos(trkP->phi0());
   double s1 = sin(trkP->phi0());
-  he[3] = trkP->d0() + c1*pvtx->y() - s1*pvtx->x(); 
+  he[3] = trkP->d0() + c1 * pvtx->y() - s1 * pvtx->x();
 
   c1 *= he[0];
   s1 *= he[0];
-  he[2] = trkP->z0() - c1*pvtx->x() - s1*pvtx->y() + pvtx->z();
+  he[2] = trkP->z0() - c1 * pvtx->x() - s1 * pvtx->y() + pvtx->z();
 }
 
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGElectronLikelihoodToolWrapper.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGElectronLikelihoodToolWrapper.cxx
index a54cc16316e..8e5625d4bc7 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGElectronLikelihoodToolWrapper.cxx
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGElectronLikelihoodToolWrapper.cxx
@@ -29,7 +29,7 @@ EGElectronLikelihoodToolWrapper::EGElectronLikelihoodToolWrapper(
   , m_storeTResult(false)
 {
   declareInterface<DerivationFramework::IAugmentationTool>(this);
- declareProperty("CutType", m_cut);
+  declareProperty("CutType", m_cut);
   declareProperty("StoreGateEntryName", m_sgName);
   declareProperty("StoreTResult", m_storeTResult);
 }
@@ -79,7 +79,8 @@ EGElectronLikelihoodToolWrapper::addBranches() const
     m_decoratorIsEM, ctx
   };
 
-  SG::WriteDecorHandle<xAOD::EgammaContainer, double>* decoratorResult = nullptr;
+  SG::WriteDecorHandle<xAOD::EgammaContainer, double>* decoratorResult =
+    nullptr;
   if (m_storeTResult) {
     SG::WriteDecorHandle<xAOD::EgammaContainer, double> concreteHandle{
       m_decoratorResult, ctx
@@ -126,7 +127,7 @@ EGElectronLikelihoodToolWrapper::addBranches() const
       }
     }
     // compute the output of the selector
-    asg::AcceptData theAccept(m_tool->accept(ctx,pCopy));
+    asg::AcceptData theAccept(m_tool->accept(ctx, pCopy));
     const unsigned int isEM =
       (unsigned int)theAccept.getCutResultInvertedBitSet()
         .to_ulong(); // this should work for both the
@@ -142,7 +143,8 @@ EGElectronLikelihoodToolWrapper::addBranches() const
       }
       decoratorIsEM(*par) = isEM;
       if (decoratorResult) {
-        (*decoratorResult)(*par) = static_cast<double>(m_tool->calculate(ctx, pCopy));
+        (*decoratorResult)(*par) =
+          static_cast<double>(m_tool->calculate(ctx, pCopy));
       }
     } else {
       if (theAccept.getCutResult(m_cut)) {
@@ -154,7 +156,8 @@ EGElectronLikelihoodToolWrapper::addBranches() const
       if (decoratorResult) {
         static const SG::AuxElement::Decorator<double> decResult(m_sgName +
                                                                  "Result");
-        (*decoratorResult)(*par) = static_cast<double>(m_tool->calculate(ctx, pCopy));
+        (*decoratorResult)(*par) =
+          static_cast<double>(m_tool->calculate(ctx, pCopy));
       }
     }
     // delete the particle copy
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGInvariantMassTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGInvariantMassTool.cxx
index 49c4e52972b..bea883d4a3d 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGInvariantMassTool.cxx
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGInvariantMassTool.cxx
@@ -89,7 +89,7 @@ EGInvariantMassTool::addBranches() const
   // create the vector which will hold the values invariant masses
   auto masses = std::make_unique<std::vector<float>>();
   // compute the invariant mass values
-  ATH_CHECK(getInvariantMasses(ctx,*masses));
+  ATH_CHECK(getInvariantMasses(ctx, *masses));
 
   ATH_CHECK(writeHandle.record(std::move(masses)));
 
@@ -264,4 +264,4 @@ EGInvariantMassTool::getInvariantMasses(const EventContext& ctx,
   }
   return StatusCode::SUCCESS;
 }
-} //end namespace DerivationFramework
+} // end namespace DerivationFramework
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGPhotonCleaningWrapper.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGPhotonCleaningWrapper.cxx
index 33d1d892fb9..0db691eb51a 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGPhotonCleaningWrapper.cxx
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGPhotonCleaningWrapper.cxx
@@ -21,7 +21,6 @@ EGPhotonCleaningWrapper::EGPhotonCleaningWrapper(const std::string& t,
   , m_sgName("DFCommonPhotonsCleaning")
 {
   declareInterface<DerivationFramework::IAugmentationTool>(this);
-  declareProperty("EGammaFudgeMCTool", m_fudgeMCTool);
   declareProperty("StoreGateEntryName", m_sgName);
 }
 
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGSelectionToolWrapper.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGSelectionToolWrapper.cxx
index 4d5262baa4d..283ba82bcd5 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGSelectionToolWrapper.cxx
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGSelectionToolWrapper.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -101,7 +101,7 @@ EGSelectionToolWrapper::addBranches() const
       }
     }
     // compute the output of the selector
-    asg::AcceptData theAccept(m_tool->accept(ctx,pCopy));
+    asg::AcceptData theAccept(m_tool->accept(ctx, pCopy));
     unsigned int isEM = (unsigned int)theAccept.getCutResultInvertedBitSet()
                           .to_ulong(); // this should work for both the
                                        // cut-based and the LH selectors
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGTransverseMassTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGTransverseMassTool.cxx
index 4877205b0e3..382e0a59d20 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGTransverseMassTool.cxx
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/EGTransverseMassTool.cxx
@@ -8,8 +8,8 @@
 //
 // The tool computes the transverse mass between the MET and the
 // particles belonging to some collection.
-// The MET met and phi values can either be stored in SG under 
-// keys specified with METPtBranchName and METPhiBranchName, 
+// The MET met and phi values can either be stored in SG under
+// keys specified with METPtBranchName and METPhiBranchName,
 // otherwise the met() and phi() of the MET object stored in
 // SG under the METContainerName (default = MET_LocHadTopo)
 // will be used.
@@ -32,150 +32,158 @@ using std::sqrt;
 
 namespace DerivationFramework {
 
-  EGTransverseMassTool::EGTransverseMassTool(const std::string& t,
-                                             const std::string& n,
-                                             const IInterface* p) : 
-    ExpressionParserUser<AthAlgTool>(t, n, p),
-    m_expression1("true"),
-    m_METmin(-999.),
-    m_mass1Hypothesis(0.0)
-  {
-    declareInterface<DerivationFramework::IAugmentationTool>(this);
-    declareProperty("ObjectRequirements", m_expression1);
-    declareProperty("METmin", m_METmin);
-    declareProperty("ObjectMassHypothesis", m_mass1Hypothesis);
+EGTransverseMassTool::EGTransverseMassTool(const std::string& t,
+                                           const std::string& n,
+                                           const IInterface* p)
+  : ExpressionParserUser<AthAlgTool>(t, n, p)
+  , m_expression1("true")
+  , m_METmin(-999.)
+  , m_mass1Hypothesis(0.0)
+{
+  declareInterface<DerivationFramework::IAugmentationTool>(this);
+  declareProperty("ObjectRequirements", m_expression1);
+  declareProperty("METmin", m_METmin);
+  declareProperty("ObjectMassHypothesis", m_mass1Hypothesis);
+}
+
+StatusCode
+EGTransverseMassTool::initialize()
+{
+  if (m_sgName.key().empty()) {
+    ATH_MSG_ERROR(
+      "No SG name provided for the output of the transverse mass tool!");
+    return StatusCode::FAILURE;
   }
+  ATH_CHECK(m_sgName.initialize());
 
-  StatusCode EGTransverseMassTool::initialize()
-  {
-    if (m_sgName.key().empty()) {
-      ATH_MSG_ERROR("No SG name provided for the output of the transverse mass tool!");
-      return StatusCode::FAILURE;
-    }
-    ATH_CHECK(m_sgName.initialize());
+  if (!m_container1Name.key().empty()) {
+    ATH_CHECK(m_container1Name.initialize());
+  }
+  if (!m_container2Name.key().empty()) {
+    ATH_CHECK(m_container2Name.initialize());
+  }
+  if (!m_pt1BranchName.key().empty()) {
+    ATH_CHECK(m_pt1BranchName.initialize());
+  }
+  if (!m_phi1BranchName.key().empty()) {
+    ATH_CHECK(m_phi1BranchName.initialize());
+  }
+  if (!m_pt2BranchName.key().empty()) {
+    ATH_CHECK(m_pt2BranchName.initialize());
+  }
+  if (!m_phi2BranchName.key().empty()) {
+    ATH_CHECK(m_phi2BranchName.initialize());
+  }
 
-    if (!m_container1Name.key().empty()) {
-      ATH_CHECK(m_container1Name.initialize());
-    }
-    if (!m_container2Name.key().empty()) {
-      ATH_CHECK(m_container2Name.initialize());
-    }
-    if (!m_pt1BranchName.key().empty()) {
-      ATH_CHECK(m_pt1BranchName.initialize());
-    }
-    if (!m_phi1BranchName.key().empty()) {
-      ATH_CHECK(m_phi1BranchName.initialize());
-    }
-    if (!m_pt2BranchName.key().empty()) {
-      ATH_CHECK(m_pt2BranchName.initialize());
-    }
-    if (!m_phi2BranchName.key().empty()) {
-      ATH_CHECK(m_phi2BranchName.initialize());
-    }
+  ATH_CHECK(initializeParser(m_expression1));
 
-    ATH_CHECK( initializeParser(m_expression1) );
+  return StatusCode::SUCCESS;
+}
 
-    return StatusCode::SUCCESS;
-  }
+StatusCode
+EGTransverseMassTool::addBranches() const
+{
+  const EventContext& ctx = Gaudi::Hive::currentContext();
+  SG::WriteHandle<std::vector<float>> writeHandle{ m_sgName, ctx };
 
-  StatusCode EGTransverseMassTool::addBranches() const
-  {
-    const EventContext& ctx = Gaudi::Hive::currentContext();
-    SG::WriteHandle<std::vector<float>> writeHandle{ m_sgName, ctx };
+  // create the vector which will hold the values invariant masses
+  auto masses = std::make_unique<std::vector<float>>();
+  // compute the invariant mass values
+  ATH_CHECK(getTransverseMasses(ctx, *masses));
 
-    // create the vector which will hold the values invariant masses
-    auto masses = std::make_unique<std::vector<float>>();
-    // compute the invariant mass values
-    ATH_CHECK(getTransverseMasses(ctx,*masses));
+  ATH_CHECK(writeHandle.record(std::move(masses)));
 
-    ATH_CHECK(writeHandle.record(std::move(masses)));   
+  return StatusCode::SUCCESS;
+}
 
-    return StatusCode::SUCCESS;
+StatusCode
+EGTransverseMassTool::getTransverseMasses(const EventContext& ctx,
+                                          std::vector<float>& masses) const
+{
+  // Get optional payload
+  const std::vector<float>* pt1 = nullptr;
+  if (!m_pt1BranchName.key().empty()) {
+    SG::ReadHandle<std::vector<float>> readHandle{ m_pt1BranchName, ctx };
+    pt1 = readHandle.ptr();
+  }
+  const std::vector<float>* pt2 = nullptr;
+  if (!m_pt2BranchName.key().empty()) {
+    SG::ReadHandle<std::vector<float>> readHandle{ m_pt2BranchName, ctx };
+    pt2 = readHandle.ptr();
   }
 
-  StatusCode EGTransverseMassTool::getTransverseMasses(const EventContext& ctx,
-                                                       std::vector<float>& masses) const
-  {
-    // Get optional payload
-    const std::vector<float>* pt1 = nullptr;
-    if (!m_pt1BranchName.key().empty()) {
-      SG::ReadHandle<std::vector<float>> readHandle{ m_pt1BranchName, ctx };
-      pt1 = readHandle.ptr();
-    }
-    const std::vector<float>* pt2 = nullptr;
-    if (!m_pt2BranchName.key().empty()) {
-      SG::ReadHandle<std::vector<float>> readHandle{ m_pt2BranchName, ctx };
-      pt2 = readHandle.ptr();
-    }
+  const std::vector<float>* phi1 = nullptr;
+  if (!m_phi1BranchName.key().empty()) {
+    SG::ReadHandle<std::vector<float>> readHandle{ m_phi1BranchName, ctx };
+    phi1 = readHandle.ptr();
+  }
+  const std::vector<float>* phi2 = nullptr;
+  if (!m_phi2BranchName.key().empty()) {
+    SG::ReadHandle<std::vector<float>> readHandle{ m_phi2BranchName, ctx };
+    phi2 = readHandle.ptr();
+  }
 
-    const std::vector<float>* phi1 = nullptr;
-    if (!m_phi1BranchName.key().empty()) {
-      SG::ReadHandle<std::vector<float>> readHandle{ m_phi1BranchName, ctx };
-      phi1 = readHandle.ptr();
+  // Get the input particle and MET
+  SG::ReadHandle<xAOD::IParticleContainer> inputParticles1{ m_container1Name,
+                                                            ctx };
+  SG::ReadHandle<xAOD::MissingETContainer> inputParticles2{ m_container2Name,
+                                                            ctx };
+  const xAOD::IParticleContainer* particles1 = inputParticles1.ptr();
+  const xAOD::MissingETContainer* particles2 = inputParticles2.ptr();
+
+  // compute MET
+  if (particles2->empty()) {
+    if (!pt2) {
+      ATH_MSG_WARNING("No MET info found");
+      return StatusCode::SUCCESS;
     }
-    const std::vector<float>* phi2 = nullptr;
-    if (!m_phi2BranchName.key().empty()) {
-      SG::ReadHandle<std::vector<float>> readHandle{ m_phi2BranchName, ctx };
-      phi2 = readHandle.ptr();
+    if (pt2->empty()) {
+      ATH_MSG_WARNING("No MET info found");
+      return StatusCode::SUCCESS;
     }
+  }
 
-    // Get the input particle and MET
-    SG::ReadHandle<xAOD::IParticleContainer> inputParticles1{ m_container1Name, ctx };
-    SG::ReadHandle<xAOD::MissingETContainer> inputParticles2{ m_container2Name, ctx };
-    const xAOD::IParticleContainer* particles1 = inputParticles1.ptr();
-    const xAOD::MissingETContainer* particles2 = inputParticles2.ptr();
-
-    // compute MET
-    if (particles2->empty()) {
-      if (!pt2){
-	      ATH_MSG_WARNING("No MET info found");
-	      return StatusCode::SUCCESS; 
-      }
-      if (pt2->empty()) {
-	      ATH_MSG_WARNING("No MET info found");
-	      return StatusCode::SUCCESS; 
-      }
-    }
+  float MET = pt2 ? (*pt2)[0] : particles2->at(0)->met();
+  float MET_phi = phi2 ? (*phi2)[0] : particles2->at(0)->phi();
 
-    float MET = pt2 ? (*pt2)[0] : particles2->at(0)->met();
-    float MET_phi = phi2 ? (*phi2)[0] : particles2->at(0)->phi();
-
-    // apply MET requirement
-    if (MET<m_METmin)
-      return StatusCode::SUCCESS; 
-
-    // get the positions of the particles which pass the requirement
-    std::vector<int> entries1 =  m_parser->evaluateAsVector();
-    unsigned int nEntries1 = entries1.size();
-
-    // if there are no particles in one of the two lists to combine, just leave function
-    if (nEntries1==0)
-      return StatusCode::SUCCESS; 
-
-    // check that the sizes are compatible
-    if (particles1->size() != nEntries1 ) { 
-      ATH_MSG_ERROR("Branch sizes incompatible - returning zero");
-      return StatusCode::FAILURE;
-    } 
-    if ((pt1 && pt1->size() != nEntries1) || 
-        (phi1 && phi1->size() != nEntries1)) {
-      ATH_MSG_ERROR("Branch sizes incompatible - returning zero");
-      return StatusCode::FAILURE;
-    } 
-
-    // Loop over the objects and calculate the transverse mass
-    unsigned int iter;
-    for (iter=0; iter<nEntries1; ++iter) {
-      if (entries1[iter]!=1) continue;
-      float apt1 = pt1 ? (*pt1)[iter] : ((*particles1)[iter])->p4().Pt(); 
-      float aphi1 = phi1 ? (*phi1)[iter] : ((*particles1)[iter])->p4().Phi(); 
-
-      TLorentzVector v1, v2;
-      v1.SetPtEtaPhiM(apt1,0.,aphi1,m_mass1Hypothesis);
-      v2.SetPtEtaPhiM(MET,0.,MET_phi,0.);
-      float mass = (v1+v2).M();
-      masses.push_back(mass);
-    }
-    return StatusCode::SUCCESS; 
+  // apply MET requirement
+  if (MET < m_METmin)
+    return StatusCode::SUCCESS;
+
+  // get the positions of the particles which pass the requirement
+  std::vector<int> entries1 = m_parser->evaluateAsVector();
+  unsigned int nEntries1 = entries1.size();
+
+  // if there are no particles in one of the two lists to combine, just leave
+  // function
+  if (nEntries1 == 0)
+    return StatusCode::SUCCESS;
+
+  // check that the sizes are compatible
+  if (particles1->size() != nEntries1) {
+    ATH_MSG_ERROR("Branch sizes incompatible - returning zero");
+    return StatusCode::FAILURE;
   }
+  if ((pt1 && pt1->size() != nEntries1) ||
+      (phi1 && phi1->size() != nEntries1)) {
+    ATH_MSG_ERROR("Branch sizes incompatible - returning zero");
+    return StatusCode::FAILURE;
+  }
+
+  // Loop over the objects and calculate the transverse mass
+  unsigned int iter;
+  for (iter = 0; iter < nEntries1; ++iter) {
+    if (entries1[iter] != 1)
+      continue;
+    float apt1 = pt1 ? (*pt1)[iter] : ((*particles1)[iter])->p4().Pt();
+    float aphi1 = phi1 ? (*phi1)[iter] : ((*particles1)[iter])->p4().Phi();
+
+    TLorentzVector v1, v2;
+    v1.SetPtEtaPhiM(apt1, 0., aphi1, m_mass1Hypothesis);
+    v2.SetPtEtaPhiM(MET, 0., MET_phi, 0.);
+    float mass = (v1 + v2).M();
+    masses.push_back(mass);
+  }
+  return StatusCode::SUCCESS;
+}
 }
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/TruthCaloShowerDecorator.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/TruthCaloShowerDecorator.cxx
index 93cf7659874..1c0feba8db5 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/TruthCaloShowerDecorator.cxx
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/src/TruthCaloShowerDecorator.cxx
@@ -3,104 +3,128 @@
 */
 
 #include "DerivationFrameworkEGamma/TruthCaloShowerDecorator.h"
-#include "xAODEgamma/ElectronContainer.h"
-#include "xAODEgamma/Electron.h"
+#include "CaloCalibHitRec/CalibHitToCaloCellTool.h"
 #include "xAODEgamma/EgammaTruthxAODHelpers.h"
+#include "xAODEgamma/Electron.h"
+#include "xAODEgamma/ElectronContainer.h"
 #include "xAODTruth/TruthParticle.h"
-#include "CaloCalibHitRec/CalibHitToCaloCellTool.h"
 
 namespace DerivationFramework {
 
-  TruthCaloShowerDecorator::TruthCaloShowerDecorator(const std::string& t,const std::string& n, const IInterface* p) : 
-    AthAlgTool(t,n,p)
-  {
-    declareInterface<DerivationFramework::IAugmentationTool>(this);
-    declareProperty("SingleParticleBarcode", m_singleParticleBarcode=10001, "Barcode of single particle");
-    declareProperty("CalibHitToCaloCellTool",m_calibhitToCaloCellTool);
-  }  
-
-  StatusCode TruthCaloShowerDecorator::initialize()
-  {
-    ATH_MSG_DEBUG("Initializing " << name() << "...");        
-
-    if(m_calibhitToCaloCellTool.retrieve().isFailure()) {
-      ATH_MSG_FATAL("Failed to retrieve tool " << m_calibhitToCaloCellTool);
-      return StatusCode::FAILURE;
-    }
-    ATH_MSG_INFO("Retrieved tool " << m_calibhitToCaloCellTool);
-
-    ATH_CHECK(m_truthParticleContainerName.initialize());
-    ATH_CHECK(m_truthClusterContainerEtot.initialize());
-    ATH_CHECK(m_truthClusterContainerEvis.initialize());
-    ATH_CHECK(m_truthClusterContainerEem.initialize());
-
-    const std::string baseName = m_truthParticleContainerName.key();
-    m_linkDecoratorClusterEtot = baseName + ".truthLArClusterEtotLink";
-    m_linkDecoratorClusterEvis = baseName + ".truthLArClusterEvisLink";
-    m_linkDecoratorClusterEem  = baseName + ".truthLArClusterEemLink";
-
-    ATH_CHECK(m_linkDecoratorClusterEtot.initialize());
-    ATH_CHECK(m_linkDecoratorClusterEvis.initialize());
-    ATH_CHECK(m_linkDecoratorClusterEem.initialize());
-   
-    return StatusCode::SUCCESS;
+TruthCaloShowerDecorator::TruthCaloShowerDecorator(const std::string& t,
+                                                   const std::string& n,
+                                                   const IInterface* p)
+  : AthAlgTool(t, n, p)
+{
+  declareInterface<DerivationFramework::IAugmentationTool>(this);
+  declareProperty("SingleParticleBarcode",
+                  m_singleParticleBarcode = 10001,
+                  "Barcode of single particle");
+}
+
+StatusCode
+TruthCaloShowerDecorator::initialize()
+{
+  ATH_MSG_DEBUG("Initializing " << name() << "...");
+
+  if (m_calibhitToCaloCellTool.retrieve().isFailure()) {
+    ATH_MSG_FATAL("Failed to retrieve tool " << m_calibhitToCaloCellTool);
+    return StatusCode::FAILURE;
   }
+  ATH_MSG_INFO("Retrieved tool " << m_calibhitToCaloCellTool);
+
+  ATH_CHECK(m_truthParticleContainerName.initialize());
+  ATH_CHECK(m_truthClusterContainerEtot.initialize());
+  ATH_CHECK(m_truthClusterContainerEvis.initialize());
+  ATH_CHECK(m_truthClusterContainerEem.initialize());
 
-  StatusCode TruthCaloShowerDecorator::finalize()
-  {
-    return StatusCode::SUCCESS;
+  const std::string baseName = m_truthParticleContainerName.key();
+  m_linkDecoratorClusterEtot = baseName + ".truthLArClusterEtotLink";
+  m_linkDecoratorClusterEvis = baseName + ".truthLArClusterEvisLink";
+  m_linkDecoratorClusterEem = baseName + ".truthLArClusterEemLink";
+
+  ATH_CHECK(m_linkDecoratorClusterEtot.initialize());
+  ATH_CHECK(m_linkDecoratorClusterEvis.initialize());
+  ATH_CHECK(m_linkDecoratorClusterEem.initialize());
+
+  return StatusCode::SUCCESS;
+}
+
+StatusCode
+TruthCaloShowerDecorator::finalize()
+{
+  return StatusCode::SUCCESS;
+}
+
+StatusCode
+TruthCaloShowerDecorator::addBranches() const
+{
+  const EventContext& ctx = Gaudi::Hive::currentContext();
+
+  SG::ReadHandle<xAOD::TruthParticleContainer> truthPartContainerReadHandle{
+    m_truthParticleContainerName, ctx
+  };
+  const xAOD::TruthParticleContainer* truthPartContainer =
+    truthPartContainerReadHandle.ptr();
+
+  // create truth clusters
+  ATH_MSG_DEBUG("Creating truth clusters");
+  int singleElectronBarcode = 10001;
+  if (!m_calibhitToCaloCellTool
+         ->processCalibHitsFromParticle(singleElectronBarcode)
+         .isSuccess()) {
+    ATH_MSG_FATAL("Tool " << m_calibhitToCaloCellTool << " failed.");
+    return StatusCode::FAILURE;
+  }
+
+  ATH_MSG_DEBUG("Retrieving truth clusters");
+  SG::ReadHandle<xAOD::CaloClusterContainer>
+    truthClusterContainerEtotReadHandle{ m_truthClusterContainerEtot, ctx };
+  SG::ReadHandle<xAOD::CaloClusterContainer>
+    truthClusterContainerEvisReadHandle{ m_truthClusterContainerEvis, ctx };
+  SG::ReadHandle<xAOD::CaloClusterContainer> truthClusterContainerEemReadHandle{
+    m_truthClusterContainerEem, ctx
+  };
+  const xAOD::CaloClusterContainer* truthClusterContainerEtot =
+    truthClusterContainerEtotReadHandle.ptr();
+  const xAOD::CaloClusterContainer* truthClusterContainerEvis =
+    truthClusterContainerEvisReadHandle.ptr();
+  const xAOD::CaloClusterContainer* truthClusterContainerEem =
+    truthClusterContainerEemReadHandle.ptr();
+
+  if (!truthClusterContainerEtot || !truthClusterContainerEvis ||
+      !truthClusterContainerEem) {
+    ATH_MSG_ERROR("Failed to retrieve truth cluster container");
+    return StatusCode::FAILURE;
   }
 
-  StatusCode TruthCaloShowerDecorator::addBranches() const
-  {    
-    const EventContext& ctx = Gaudi::Hive::currentContext();
-
-    SG::ReadHandle<xAOD::TruthParticleContainer> truthPartContainerReadHandle{ m_truthParticleContainerName, ctx };
-    const xAOD::TruthParticleContainer* truthPartContainer = truthPartContainerReadHandle.ptr();
-
-    // create truth clusters
-    ATH_MSG_DEBUG("Creating truth clusters");
-    int singleElectronBarcode = 10001;
-    if (!m_calibhitToCaloCellTool->processCalibHitsFromParticle(singleElectronBarcode).isSuccess()) {
-      ATH_MSG_FATAL("Tool " << m_calibhitToCaloCellTool << " failed.");
-      return StatusCode::FAILURE;
-    }
-
-    ATH_MSG_DEBUG("Retrieving truth clusters");
-    SG::ReadHandle<xAOD::CaloClusterContainer> truthClusterContainerEtotReadHandle{ m_truthClusterContainerEtot, ctx };
-    SG::ReadHandle<xAOD::CaloClusterContainer> truthClusterContainerEvisReadHandle{ m_truthClusterContainerEvis, ctx };
-    SG::ReadHandle<xAOD::CaloClusterContainer> truthClusterContainerEemReadHandle{ m_truthClusterContainerEem, ctx };
-    const xAOD::CaloClusterContainer* truthClusterContainerEtot = truthClusterContainerEtotReadHandle.ptr();
-    const xAOD::CaloClusterContainer* truthClusterContainerEvis = truthClusterContainerEvisReadHandle.ptr();
-    const xAOD::CaloClusterContainer* truthClusterContainerEem = truthClusterContainerEemReadHandle.ptr();
-
-    if (!truthClusterContainerEtot || !truthClusterContainerEvis || !truthClusterContainerEem) {
-      ATH_MSG_ERROR("Failed to retrieve truth cluster container");
-      return StatusCode::FAILURE;
-    }
-
-    SG::WriteDecorHandle<xAOD::TruthParticleContainer,
-                         ElementLink<xAOD::CaloClusterContainer>>
-      linkDecoratorClusterEtot(m_linkDecoratorClusterEtot, ctx);
-    SG::WriteDecorHandle<xAOD::TruthParticleContainer,
-                         ElementLink<xAOD::CaloClusterContainer>>
-      linkDecoratorClusterEvis(m_linkDecoratorClusterEvis, ctx);
-    SG::WriteDecorHandle<xAOD::TruthParticleContainer,
-                         ElementLink<xAOD::CaloClusterContainer>>
-      linkDecoratorClusterEem(m_linkDecoratorClusterEem, ctx);
-
-    ElementLink<xAOD::CaloClusterContainer> truthClusterEtot(*truthClusterContainerEtot,0);
-    ElementLink<xAOD::CaloClusterContainer> truthClusterEvis(*truthClusterContainerEvis,0);
-    ElementLink<xAOD::CaloClusterContainer> truthClusterEem(*truthClusterContainerEem,0);
-    
-    ATH_MSG_DEBUG("Decorating truth parts with truth cluster energy");
-    for (const auto *const truthPart: *truthPartContainer) {
-      if (!truthPart) continue;
-      if (truthPart->barcode() != m_singleParticleBarcode) continue;
-      linkDecoratorClusterEtot(*truthPart) = truthClusterEtot;
-      linkDecoratorClusterEvis(*truthPart) = truthClusterEvis;
-      linkDecoratorClusterEem(*truthPart) = truthClusterEem;	    
-    }
-    return StatusCode::SUCCESS;
+  SG::WriteDecorHandle<xAOD::TruthParticleContainer,
+                       ElementLink<xAOD::CaloClusterContainer>>
+    linkDecoratorClusterEtot(m_linkDecoratorClusterEtot, ctx);
+  SG::WriteDecorHandle<xAOD::TruthParticleContainer,
+                       ElementLink<xAOD::CaloClusterContainer>>
+    linkDecoratorClusterEvis(m_linkDecoratorClusterEvis, ctx);
+  SG::WriteDecorHandle<xAOD::TruthParticleContainer,
+                       ElementLink<xAOD::CaloClusterContainer>>
+    linkDecoratorClusterEem(m_linkDecoratorClusterEem, ctx);
+
+  ElementLink<xAOD::CaloClusterContainer> truthClusterEtot(
+    *truthClusterContainerEtot, 0);
+  ElementLink<xAOD::CaloClusterContainer> truthClusterEvis(
+    *truthClusterContainerEvis, 0);
+  ElementLink<xAOD::CaloClusterContainer> truthClusterEem(
+    *truthClusterContainerEem, 0);
+
+  ATH_MSG_DEBUG("Decorating truth parts with truth cluster energy");
+  for (const auto* const truthPart : *truthPartContainer) {
+    if (!truthPart)
+      continue;
+    if (truthPart->barcode() != m_singleParticleBarcode)
+      continue;
+    linkDecoratorClusterEtot(*truthPart) = truthClusterEtot;
+    linkDecoratorClusterEvis(*truthPart) = truthClusterEvis;
+    linkDecoratorClusterEem(*truthPart) = truthClusterEem;
   }
+  return StatusCode::SUCCESS;
+}
 }
-- 
GitLab