From 12a276b9ade950303e03df72198e880a6eeb870c Mon Sep 17 00:00:00 2001
From: Johannes Junggeburth <johannes.josef.junggeburth@cern.ch>
Date: Tue, 26 Mar 2024 18:03:45 +0100
Subject: [PATCH 1/5] Use MSG macros and inherit from AthMessasing

message
---
 .../MuonGeoModelR4/src/RpcReadoutGeomTool.cxx |  2 +-
 .../MuonTesterTree/MatrixBranch.h             | 14 +++------
 .../MuonTesterTree/MatrixBranch.icc           | 30 ++++++++++++-------
 .../MuonTesterTree/MuonTesterBranch.h         |  5 ++--
 .../MuonTesterTree/MuonTesterBranch.icc       | 15 ++++------
 .../MuonTesterTree/MuonTesterTree.icc         | 19 ++++++------
 .../MuonTesterTree/ScalarBranch.icc           | 12 ++++----
 .../MuonTesterTree/SetBranch.icc              |  7 ++---
 .../MuonTesterTree/Root/EventInfoBranch.cxx   | 16 +++++-----
 .../MuonTesterTree/Root/MuonTesterBranch.cxx  | 11 +++----
 10 files changed, 64 insertions(+), 67 deletions(-)

diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/RpcReadoutGeomTool.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/RpcReadoutGeomTool.cxx
index 8366a59ccd7f..56a39bd8fa2d 100644
--- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/RpcReadoutGeomTool.cxx
+++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/RpcReadoutGeomTool.cxx
@@ -252,7 +252,7 @@ StatusCode RpcReadoutGeomTool::buildReadOutElements(MuonDetectorManager& mgr) {
         define.chambDesign = key_tokens[1];
         define.alignTransform = m_geoUtilTool->findAlignableTransform(define.physVol);
         define.detElId = elementID;
-        ATH_MSG_VERBOSE("Key  "<<key<<" lead to Identifier "<<m_idHelperSvc->toStringDetEl(elementID));
+        ATH_MSG_ALWAYS("Key  "<<key<<" lead to Identifier "<<m_idHelperSvc->toStringDetEl(elementID));
         ATH_CHECK(loadDimensions(define, facCache));
 #ifndef SIMULATIONBASE
         define.layerBounds = layerBounds;
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MatrixBranch.h b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MatrixBranch.h
index bf910d80624e..9c8a497cbca3 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MatrixBranch.h
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MatrixBranch.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 #ifndef MUONTESTER_MATRIXBRANCH_H
 #define MUONTESTER_MATRIXBRANCH_H
@@ -9,7 +9,7 @@ class TTree;
 
 namespace MuonVal {
 class MuonTesterTree;
-template <class T> class MatrixBranch : public IMuonTesterBranch {
+template <class T> class MatrixBranch : public MuonTesterBranch, virtual public IMuonTesterBranch {
 public:
     /// Standard constructor
     MatrixBranch(TTree* tree, const std::string& name);
@@ -19,18 +19,11 @@ public:
     MatrixBranch(TTree* tree, const std::string& b_name, const T& def);
     MatrixBranch(MuonTesterTree& tree, const std::string& b_name, const T& def);
 
-    MatrixBranch(const MatrixBranch&) = delete;
-    void operator=(const MatrixBranch&) = delete;
+
     virtual ~MatrixBranch() = default;
 
     bool fill(const EventContext& ctx) override final;
     bool init() override final;
-    std::string name() const override final;
-
-    std::vector<DataDependency> data_dependencies() override final;
-
-    const TTree* tree() const override final;
-    TTree* tree() override final;
 
     bool initialized() const;
 
@@ -56,6 +49,7 @@ public:
 private:
     VectorBranch<std::vector<T>> m_Vec;
     T m_default;
+    MuonTesterTree* m_parent{nullptr};
 };
 }
 #include <MuonTesterTree/MatrixBranch.icc>
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MatrixBranch.icc b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MatrixBranch.icc
index 4c8011de075c..bfa7acb3ccb0 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MatrixBranch.icc
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MatrixBranch.icc
@@ -1,16 +1,27 @@
 /*
-  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 #ifndef MUONTESTER_MUONSMATRIXBRANCH_IXX
 #define MUONTESTER_MUONSMATRIXBRANCH_IXX
+
 namespace MuonVal {
-template <class T> MatrixBranch<T>::MatrixBranch(TTree* tree, const std::string& name) : m_Vec(tree, name) {}
-template <class T> MatrixBranch<T>::MatrixBranch(TTree* tree, const std::string& b_name, const T& def) : MatrixBranch<T>(tree, b_name) {
+
+
+template <class T> MatrixBranch<T>::MatrixBranch(TTree* tree, const std::string& name) : 
+    MuonTesterBranch{tree, name},
+    m_Vec(tree, name) {}
+template <class T> MatrixBranch<T>::MatrixBranch(TTree* tree, const std::string& b_name, const T& def) : 
+    MatrixBranch<T>(tree, b_name) {
     setDefault(def);
 }
-template <class T> MatrixBranch<T>::MatrixBranch(MuonTesterTree& tree, const std::string& name) : m_Vec(tree, name) {}
+template <class T> MatrixBranch<T>::MatrixBranch(MuonTesterTree& parent, const std::string& name) : 
+    MuonTesterBranch{parent, name},
+    m_Vec(tree(), name),
+    m_parent{&parent} {
+}
 template <class T>
-MatrixBranch<T>::MatrixBranch(MuonTesterTree& tree, const std::string& b_name, const T& def) : MatrixBranch<T>(tree, b_name) {
+MatrixBranch<T>::MatrixBranch(MuonTesterTree& tree, const std::string& b_name, const T& def) : 
+    MatrixBranch<T>(tree, b_name) {
     setDefault(def);
 }
 template <class T> void MatrixBranch<T>::push_back(size_t i, const T& value) { m_Vec[i].push_back(value); }
@@ -22,9 +33,10 @@ template <class T> T& MatrixBranch<T>::get(size_t i, size_t j) {
 }
 template <class T> std::vector<T>& MatrixBranch<T>::operator[](size_t i) { return m_Vec[i]; }
 template <class T> std::vector<T>& MatrixBranch<T>::get(size_t i) { return m_Vec.get(i); }
-template <class T> bool MatrixBranch<T>::fill(const EventContext& ctx) { return m_Vec.fill(ctx); }
+template <class T> bool MatrixBranch<T>::fill(const EventContext& ctx) { 
+    return m_Vec.fill(ctx); 
+}
 template <class T> bool MatrixBranch<T>::init() { return m_Vec.init(); }
-template <class T> std::string MatrixBranch<T>::name() const { return m_Vec.name(); }
 template <class T> size_t MatrixBranch<T>::nrows() const { return m_Vec.size(); }
 template <class T> size_t MatrixBranch<T>::ncols(size_t row) const {
     if (row >= nrows()) { return 0; }
@@ -32,9 +44,7 @@ template <class T> size_t MatrixBranch<T>::ncols(size_t row) const {
 }
 template <class T> const T& MatrixBranch<T>::getDefault() const { return m_default; }
 template <class T> void MatrixBranch<T>::setDefault(const T& def) { m_default = def; }
-template <class T> const TTree* MatrixBranch<T>::tree() const { return m_Vec.tree(); }
-template <class T> TTree* MatrixBranch<T>::tree() { return m_Vec.tree(); }
 template <class T> bool MatrixBranch<T>::initialized() const { return m_Vec.initialized(); }
-template <class T> std::vector<IMuonTesterBranch::DataDependency> MatrixBranch<T>::data_dependencies() { return {};}
+
 }
 #endif
\ No newline at end of file
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterBranch.h b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterBranch.h
index 03d01b6f2574..051a3a0d50ec 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterBranch.h
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterBranch.h
@@ -1,10 +1,11 @@
 /*
-  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 #ifndef MUONTESTER_MUONTESTERBRANCH_H
 #define MUONTESTER_MUONTESTERBRANCH_H
 
 #include <MuonTesterTree/IMuonTesterBranch.h>
+#include <AthenaBaseComps/AthMessaging.h>
 //
 #include <string>
 #include <vector>
@@ -17,7 +18,7 @@ class TTree;
 ///      to the TTree in the initialization stage
 namespace MuonVal {
 class MuonTesterTree;
-class MuonTesterBranch : virtual public IMuonTesterBranch {
+class MuonTesterBranch : public AthMessaging, virtual public IMuonTesterBranch {
 public:
     MuonTesterBranch(MuonTesterTree& tree, const std::string& br_name);
     /// Standard constructor taking the TTree object and the name of the branch to be added to the TTree
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterBranch.icc b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterBranch.icc
index fd2cf32d574c..7eda588967d9 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterBranch.icc
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterBranch.icc
@@ -1,6 +1,6 @@
 
 /*
-  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 #ifndef MUONTESTER_MUONTESTERBRANCH_IXX
 #define MUONTESTER_MUONTESTERBRANCH_IXX
@@ -11,22 +11,18 @@
 namespace MuonVal {
 template <class T> bool MuonTesterBranch::addToTree(T& variable) {
     if (initialized()) {
-        MsgStream log(Athena::getMessageSvc(), "MuonTesterBranch()");
-        log << MSG::INFO << "init()  -- " << name() << " is already initialized." << endmsg;
+        ATH_MSG_INFO("init()  -- " << name() << " is already initialized.");
         return true;
     }
     std::string bName = eraseWhiteSpaces(name());
     if (bName.empty() || !m_tree) {
-        MsgStream log(Athena::getMessageSvc(), "MuonTesterBranch()");
-        log << MSG::ERROR << "init()  -- Empty names are forbidden." << endmsg;
+        ATH_MSG_ERROR("init()  -- Empty names are forbidden.");
         return false;
     } else if (m_tree->FindBranch(bName.c_str())) {
-        MsgStream log(Athena::getMessageSvc(), "MuonTesterBranch()");
-        log << MSG::ERROR << "The branch " << name() << " already exists in TTree " << m_tree->GetName() << "." << endmsg;
+        ATH_MSG_ERROR("The branch " << name() << " already exists in TTree " << m_tree->GetName() << ".");
         return false;
     } else if (!m_tree->Branch(bName.c_str(), &variable)) {
-        MsgStream log(Athena::getMessageSvc(), "MuonTesterBranch()");
-        log << MSG::ERROR << "Could not create the branch " << name() << " in TTree " << m_tree->GetName() << "." << endmsg;
+        ATH_MSG_ERROR("Could not create the branch " << name() << " in TTree " << m_tree->GetName() << ".");
         return false;
     }
     m_init = true;
@@ -37,6 +33,7 @@ bool MuonTesterBranch::declare_dependency(Key& key) {
     if (std::find(m_dependencies.begin(), m_dependencies.end(),&key) != m_dependencies.end()) return true;
     if (!key.initialize(!key.empty())) return false;
     m_dependencies.emplace_back(&key);
+    ATH_MSG_DEBUG("Declared new dependency "<<key.fullKey()<<" to "<<name());
     return true;
 }
 }
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterTree.icc b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterTree.icc
index 6398abe3165a..dcc5355fc612 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterTree.icc
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterTree.icc
@@ -1,30 +1,31 @@
 /*
- Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+ Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 #ifndef MUONTESTER_MUONTESTERTREE_IXX
 #define MUONTESTER_MUONTESTERTREE_IXX
 #include <TTree.h>
+#include <GeoModelHelpers/throwExcept.h>
 
 
 //these are the template implementations included to MuonTesterTree.h
 namespace MuonVal {
 template <typename T> VectorBranch<T>& MuonTesterTree::newVector(const std::string& b_name) {
     if (!addBranch(std::make_shared<VectorBranch<T>>(*this, b_name))) {
-        throw std::runtime_error("Failed to create vector branch " + b_name);
+        THROW_EXCEPTION("Failed to create vector branch " + b_name);
     }
     std::shared_ptr<VectorBranch<T>> b = getBranch<VectorBranch<T>>(b_name);
     return *b;
 }
 template <typename T> ScalarBranch<T>& MuonTesterTree::newScalar(const std::string& b_name) {
     if (!addBranch(std::make_shared<ScalarBranch<T>>(*this, b_name))) {
-        throw std::runtime_error("Failed to create scalar branch " + b_name);
+        THROW_EXCEPTION("Failed to create scalar branch " + b_name);
     }
     std::shared_ptr<ScalarBranch<T>> b = getBranch<ScalarBranch<T>>(b_name);
     return *b;
 }
 template <typename T> MatrixBranch<T>& MuonTesterTree::newMatrix(const std::string& b_name) {
     if (!addBranch(std::make_shared<MatrixBranch<T>>(*this, b_name))) {
-        throw std::runtime_error("Failed to create matrix branch " + b_name);
+        THROW_EXCEPTION("Failed to create matrix branch " + b_name);
     }
     std::shared_ptr<MatrixBranch<T>> b = getBranch<MatrixBranch<T>>(b_name);
     return *b;
@@ -32,35 +33,35 @@ template <typename T> MatrixBranch<T>& MuonTesterTree::newMatrix(const std::stri
 
 template <typename T> VectorBranch<T>& MuonTesterTree::newVector(const std::string& b_name, const T def_val) {
     if (!addBranch(std::make_shared<VectorBranch<T>>(*this, b_name, def_val))) {
-        throw std::runtime_error("Failed to create vector branch " + b_name);
+        THROW_EXCEPTION("Failed to create vector branch " + b_name);
     }
     std::shared_ptr<VectorBranch<T>> b = getBranch<VectorBranch<T>>(b_name);
     return *b;
 }
 template <typename T> ScalarBranch<T>& MuonTesterTree::newScalar(const std::string& b_name, const T def_val) {
     if (!addBranch(std::make_shared<ScalarBranch<T>>(*this, b_name, def_val))) {
-        throw std::runtime_error("Failed to create scalar branch " + b_name);
+        THROW_EXCEPTION("Failed to create scalar branch " + b_name);
     }
     std::shared_ptr<ScalarBranch<T>> b = getBranch<ScalarBranch<T>>(b_name);
     return *b;
 }
 template <typename T> MatrixBranch<T>& MuonTesterTree::newMatrix(const std::string& b_name, const T def_val) {
     if (!addBranch(std::make_shared<MatrixBranch<T>>(*this, b_name, def_val))) {
-        throw std::runtime_error("Failed to create matrix branch " + b_name);
+        THROW_EXCEPTION("Failed to create matrix branch " + b_name);
     }
     std::shared_ptr<MatrixBranch<T>> b = getBranch<MatrixBranch<T>>(b_name);
     return *b;
 }
 template <typename T> SetBranch<T>& MuonTesterTree::newSet(const std::string& b_name) {
     if (!addBranch(std::make_shared<SetBranch<T>>(*this, b_name))) {
-        throw std::runtime_error("Failed to create matrix branch " + b_name);
+        THROW_EXCEPTION("Failed to create matrix branch " + b_name);
     }
     std::shared_ptr<SetBranch<T>> b = getBranch<SetBranch<T>>(b_name);
     return *b;
 }
 
 template <typename T> T& MuonTesterTree::newBranch(std::shared_ptr<T> br) {
-    if (!addBranch(br)) { throw std::runtime_error("Failed to create generic branch " + br->name()); }
+    if (!addBranch(br)) { THROW_EXCEPTION("Failed to create generic branch " + br->name()); }
     br = getBranch<T>(br->name());
     return *br;
 }
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/ScalarBranch.icc b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/ScalarBranch.icc
index dc599dc82efc..82c85dd1e00d 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/ScalarBranch.icc
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/ScalarBranch.icc
@@ -1,10 +1,10 @@
 /*
-  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 #ifndef MUONTESTER_MUONSCALARBRANCH_IXX
 #define MUONTESTER_MUONSCALARBRANCH_IXX
-#include <AthenaKernel/getMessageSvc.h>
-#include <GaudiKernel/MsgStream.h>
+
+
 namespace MuonVal {
 template <class T> ScalarBranch<T>::ScalarBranch(TTree* tree, const std::string& name) : MuonTesterBranch(tree, name) {}
 template <class T> ScalarBranch<T>::ScalarBranch(MuonTesterTree& tree, const std::string& name) : MuonTesterBranch(tree, name) {}
@@ -17,14 +17,12 @@ ScalarBranch<T>::ScalarBranch(MuonTesterTree& tree, const std::string& name, con
 }
 template <class T> bool ScalarBranch<T>::fill(const EventContext&) {
     if (!initialized()) {
-        MsgStream log(Athena::getMessageSvc(), "ScalarBranch()");
-        log << MSG::ERROR << "init()  -- The branch " << name() << " is not initialized yet." << endmsg;
+        ATH_MSG_ERROR("init()  -- The branch " << name() << " is not initialized yet.");
         return false;
     }
     if (!m_updated) {
         if (mustBeUpdated()) {
-            MsgStream log(Athena::getMessageSvc(), "ScalarBranch()");
-            log << MSG::ERROR << "The variable " << name() << " must always be filled between a fill call " << endmsg;
+            ATH_MSG_ERROR("The scalar variable " << name() << " must always be filled between a fill call ");
             return false;
         } else
             m_variable = getDefault();
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/SetBranch.icc b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/SetBranch.icc
index 41f64f86cc87..48d839cefefd 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/SetBranch.icc
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/SetBranch.icc
@@ -1,10 +1,8 @@
 /*
-  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 #ifndef MUONTESTER_MUONSSetBranch_IXX
 #define MUONTESTER_MUONSSetBranch_IXX
-#include <AthenaKernel/getMessageSvc.h>
-#include <GaudiKernel/MsgStream.h>
 
 namespace MuonVal {
 template <class T> SetBranch<T>::SetBranch(TTree* tree, const std::string& name) : MuonTesterBranch(tree, name) {}
@@ -13,8 +11,7 @@ template <class T> SetBranch<T>::SetBranch(MuonTesterTree& tree, const std::stri
 
 template <class T> bool SetBranch<T>::fill(const EventContext&) {
     if (!initialized()) {
-        MsgStream log(Athena::getMessageSvc(), "SetBranch()");
-        log << MSG::ERROR << "init()  -- The branch " << name() << " is not initialized yet." << endmsg;
+        ATH_MSG_ERROR("fill()  -- The  set branch " << name() << " is not initialized yet.");
         return false;
     }
     if (!m_updated) m_variable.clear();
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/EventInfoBranch.cxx b/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/EventInfoBranch.cxx
index 71e47aec7ae3..dc1e2cf6c063 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/EventInfoBranch.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/EventInfoBranch.cxx
@@ -1,10 +1,9 @@
 /*
-  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
-#include <AthenaKernel/getMessageSvc.h>
-#include <GaudiKernel/MsgStream.h>
 #include <MuonTesterTree/EventInfoBranch.h>
 #include <StoreGate/ReadHandle.h>
+#include <GeoModelHelpers/throwExcept.h>
 #include <stdexcept>
 namespace {
      static const SG::AuxElement::ConstAccessor<unsigned int> acc_Random("RandomRunNumber");
@@ -23,15 +22,15 @@ EventInfoBranch::EventInfoBranch(MuonTesterTree& tree, unsigned int write_mask):
             for (unsigned int lhe = 1; lhe < s_num_lhe ; ++lhe ) {
                 std::shared_ptr<ScalarBranch<double>>& new_br = m_lhe_weights[lhe];                
                 new_br = std::make_shared<ScalarBranch<double>>(tree.tree(),  "mcEventWeight_LHE_" + std::to_string(lhe),0.);
-                if (not tree.addBranch(new_br)) {
-                  throw std::runtime_error("EventInfoBranch: Failed to create Scalar branch in c'tor");
-                };
+                if (!tree.addBranch(new_br)) {
+                  THROW_EXCEPTION("EventInfoBranch: Failed to create Scalar branch in c'tor");
+                }
             }            
         }
     } else {
          tree.disableBranch(m_mcChannel.name());
          tree.disableBranch(m_weight.name()); 
-        m_writemask&= ~(WriteOpts::writePRW | WriteOpts::writeBeamSpot);   
+         m_writemask&= ~(WriteOpts::writePRW | WriteOpts::writeBeamSpot);   
     }
     
     if (m_writemask & WriteOpts::writePRW) {
@@ -56,8 +55,7 @@ EventInfoBranch::EventInfoBranch(MuonTesterTree& tree, unsigned int write_mask):
 bool EventInfoBranch::fill(const EventContext& ctx) {
     SG::ReadHandle<xAOD::EventInfo> evt_info{m_key, ctx};
     if (!evt_info.isValid()) {
-        MsgStream log(Athena::getMessageSvc(), "EventInfoBranch");
-        log << MSG::ERROR << "Could not retrieve the EventInfo " << m_key.fullKey() << endmsg;
+        ATH_MSG_ERROR("Could not retrieve the EventInfo " << m_key.fullKey());
         return false;
     }
 
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/MuonTesterBranch.cxx b/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/MuonTesterBranch.cxx
index a9dac7472107..2c038546ec87 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/MuonTesterBranch.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/MuonTesterBranch.cxx
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 #include <AthenaKernel/getMessageSvc.h>
 #include <GaudiKernel/MsgStream.h>
@@ -8,6 +8,7 @@ Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 #include <MuonTesterTree/MuonTesterTree.h>
 #include <MuonTesterTree/ScalarBranch.h>
 #include <MuonTesterTree/VectorBranch.h>
+#include <GeoModelHelpers/throwExcept.h>
 
 #include <functional>
 
@@ -35,15 +36,15 @@ MuonTesterBranch::MuonTesterBranch(MuonTesterTree& tree, const std::string& br_n
 }
 MuonTesterTree& MuonTesterBranch::parent() {
     if (!m_parent) {
-        MsgStream log(Athena::getMessageSvc(), "MuonTesterBranch()");
-        log << MSG::WARNING << "The parent of  " << name() << " is null." << endmsg;
+        ATH_MSG_WARNING("The parent of  " << name() << " is null.");
     }
     return *m_parent;
 }
 MuonTesterBranch::~MuonTesterBranch() {
     if (m_parent) m_parent->removeBranch(this);
 }
-MuonTesterBranch::MuonTesterBranch(TTree* tree, const std::string& br_name) : m_tree(tree), m_name(br_name) {}
+MuonTesterBranch::MuonTesterBranch(TTree* tree, const std::string& br_name) :
+    AthMessaging{"MuonTesterBranch"}, m_tree(tree), m_name(br_name) {}
 std::string MuonTesterBranch::name() const { return m_name; }
 bool MuonTesterBranch::initialized() const { return m_init; }
 TTree* MuonTesterBranch::tree() { return m_tree; }
@@ -57,7 +58,7 @@ std::string MuonTesterBranch::eraseWhiteSpaces(const std::string& In) {
 std::vector<MuonTesterBranch::DataDependency> MuonTesterBranch::data_dependencies() { return m_dependencies;}
 
 template <> bool& VectorBranch<bool>::get(size_t) {
-    throw std::runtime_error("For boolean branches the get() operator is cumbersome");
+    THROW_EXCEPTION("For boolean branches the get() operator is cumbersome");
     return m_default;
 }
 }
-- 
GitLab


From 924623d49b14308de6c2d2d6df434d1c8a2957b3 Mon Sep 17 00:00:00 2001
From: Johannes Junggeburth <johannes.josef.junggeburth@cern.ch>
Date: Tue, 26 Mar 2024 23:54:03 +0100
Subject: [PATCH 2/5] Apply 1 suggestion(s) to 1 file(s)

---
 .../MuonDetDescr/MuonGeoModelR4/src/RpcReadoutGeomTool.cxx      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/RpcReadoutGeomTool.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/RpcReadoutGeomTool.cxx
index 56a39bd8fa2d..8366a59ccd7f 100644
--- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/RpcReadoutGeomTool.cxx
+++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/RpcReadoutGeomTool.cxx
@@ -252,7 +252,7 @@ StatusCode RpcReadoutGeomTool::buildReadOutElements(MuonDetectorManager& mgr) {
         define.chambDesign = key_tokens[1];
         define.alignTransform = m_geoUtilTool->findAlignableTransform(define.physVol);
         define.detElId = elementID;
-        ATH_MSG_ALWAYS("Key  "<<key<<" lead to Identifier "<<m_idHelperSvc->toStringDetEl(elementID));
+        ATH_MSG_VERBOSE("Key  "<<key<<" lead to Identifier "<<m_idHelperSvc->toStringDetEl(elementID));
         ATH_CHECK(loadDimensions(define, facCache));
 #ifndef SIMULATIONBASE
         define.layerBounds = layerBounds;
-- 
GitLab


From 89fe583e8a2e17f00d69337f761c5e0819050a09 Mon Sep 17 00:00:00 2001
From: Johannes Junggeburth <johannes.josef.junggeburth@cern.ch>
Date: Wed, 27 Mar 2024 07:54:47 +0100
Subject: [PATCH 3/5] Fix compilation vol I

---
 .../MuonValidation/MuonPRDTest/MuonPRDTest/PrdTesterModule.h | 5 ++---
 .../MuonValidation/MuonPRDTest/Root/PrdTesterModule.cxx      | 5 +++--
 .../MuonValidation/MuonTesterTree/Root/MuonTesterBranch.cxx  | 3 ++-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/MuonPRDTest/PrdTesterModule.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/MuonPRDTest/PrdTesterModule.h
index 1ac822f98aab..07f65551eaf1 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/MuonPRDTest/PrdTesterModule.h
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/MuonPRDTest/PrdTesterModule.h
@@ -1,11 +1,10 @@
 /*
-  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef PRDTESTER_PrdTesterModule_H
 #define PRDTESTER_PrdTesterModule_H
 
-#include "AthenaBaseComps/AthMessaging.h"
 #include "MuonIdHelpers/IMuonIdHelperSvc.h"
 #include "MuonReadoutGeometry/MuonDetectorManager.h"
 #include "MuonTesterTree/MuonTesterTreeDict.h"
@@ -13,7 +12,7 @@
 namespace MuonPRDTest {
     using namespace MuonVal;
     
-    class PrdTesterModule : public MuonTesterBranch, public AthMessaging {
+    class PrdTesterModule : public MuonTesterBranch {
     public:
         PrdTesterModule(MuonTesterTree& tree, const std::string& grp_name, bool useCondGeo, MSG::Level msglvl);
 
diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/Root/PrdTesterModule.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/Root/PrdTesterModule.cxx
index 114006f15d29..df6a212ba798 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/Root/PrdTesterModule.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/Root/PrdTesterModule.cxx
@@ -1,12 +1,13 @@
 /*
-  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 
 #include <MuonPRDTest/PrdTesterModule.h>
 #include <StoreGate/ReadCondHandle.h>
 namespace MuonPRDTest {
     PrdTesterModule::PrdTesterModule(MuonTesterTree& tree, const std::string& grp_name, bool useCondGeo, MSG::Level msglvl) :
-        MuonTesterBranch(tree, " prd module " + grp_name), AthMessaging(grp_name), m_useCondDetMgr{useCondGeo} {
+        MuonTesterBranch(tree, " prd module " + grp_name),
+        m_useCondDetMgr{useCondGeo} {
         setLevel(msglvl);
         m_idHelperSvc.retrieve().ignore();
     }
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/MuonTesterBranch.cxx b/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/MuonTesterBranch.cxx
index 2c038546ec87..ba1e0a8045b9 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/MuonTesterBranch.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/MuonTesterBranch.cxx
@@ -30,7 +30,8 @@ SET_BRANCHSTRING(Float_t, "/F")
 SET_BRANCHSTRING(Double_t, "/D")
 SET_BRANCHSTRING(Bool_t, "/o")
 
-MuonTesterBranch::MuonTesterBranch(MuonTesterTree& tree, const std::string& br_name) : MuonTesterBranch(tree.tree(), br_name) {
+MuonTesterBranch::MuonTesterBranch(MuonTesterTree& tree, const std::string& br_name) : 
+    MuonTesterBranch(tree.tree(), br_name) {
     m_parent = &tree;
     m_parent->addBranch(this);
 }
-- 
GitLab


From 0c32915ba2c050ca8c72b21952373b768c41f04b Mon Sep 17 00:00:00 2001
From: Johannes Junggeburth <johannes.josef.junggeburth@cern.ch>
Date: Wed, 27 Mar 2024 08:17:41 +0100
Subject: [PATCH 4/5] Fix compiler errors in AthAnalysis

---
 .../MuonTesterTree/MuonTesterTree/throwExcept.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/throwExcept.h

diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/throwExcept.h b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/throwExcept.h
new file mode 100644
index 000000000000..afcf21f8c9a2
--- /dev/null
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/throwExcept.h
@@ -0,0 +1,17 @@
+/*
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
+*/
+#ifndef MuonTesterTree_THROWEXCEPT_H
+#define MuonTesterTree_THROWEXCEPT_H
+
+#include <exception>
+#include <sstream>
+
+#define THROW_EXCEPTION(MESSAGE)                      \
+    {                                                 \
+        std::stringstream except_str{};               \
+        except_str<<__FILE__<<":"<<__LINE__<<" --- "; \
+        except_str<<MESSAGE;                          \
+        throw std::runtime_error(except_str.str());   \
+    }
+#endif
\ No newline at end of file
-- 
GitLab


From 63526378dd16b4304ec2d6d12b86dcac4472c763 Mon Sep 17 00:00:00 2001
From: Johannes Junggeburth <johannes.josef.junggeburth@cern.ch>
Date: Wed, 27 Mar 2024 08:39:18 +0100
Subject: [PATCH 5/5] Should add the full changeset

---
 .../MuonTesterTree/ArrayBranch.h              | 28 ++------
 .../MuonTesterTree/ArrayBranch.icc            | 65 +++++++------------
 .../MuonTesterTree/MuonTesterBranch.icc       |  2 -
 .../MuonTesterTree/MuonTesterTree.icc         |  2 +-
 .../MuonTesterTree/SetBranch.icc              |  3 +-
 .../MuonTesterTree/VectorBranch.icc           | 12 ++--
 .../MuonTesterTree/Root/EventInfoBranch.cxx   |  2 +-
 .../MuonTesterTree/Root/MuonTesterBranch.cxx  |  2 +-
 8 files changed, 40 insertions(+), 76 deletions(-)

diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/ArrayBranch.h b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/ArrayBranch.h
index 5fa797ff1ae3..2c64bcde4fcf 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/ArrayBranch.h
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/ArrayBranch.h
@@ -1,16 +1,17 @@
 /*
-  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 #ifndef MUONTESTER_ARRAYBRANCH_H
 #define MUONTESTER_ARRAYBRANCH_H
 
 #include <MuonTesterTree/IMuonTesterBranch.h>
+#include <MuonTesterTree/MuonTesterBranch.h>
 #include <TTree.h>
 /// Class to store array like branches into the n-tuples
 
 namespace MuonVal {
 class MuonTesterTree;
-template <class T> class ArrayBranch : public IMuonTesterBranch {
+template <class T> class ArrayBranch : public MuonTesterBranch, virtual public IMuonTesterBranch {
 public:
     /// Constructor
     ArrayBranch(TTree* tree, const std::string& name, size_t size);
@@ -20,23 +21,12 @@ public:
     ArrayBranch(TTree* tree, const std::string& name, size_t size, const T& def_val);
     ArrayBranch(MuonTesterTree& tree, const std::string& name, size_t size, const T& def_val);
 
-    ArrayBranch(const ArrayBranch&) = delete;
-    void operator=(const ArrayBranch&) = delete;
-    virtual ~ArrayBranch();
+    virtual ~ArrayBranch() = default;
 
     /// Returns false if one of the array values is not updated
     bool fill(const EventContext&) override final;
     /// Connects the branch with the tree
     bool init() override final;
-    /// Returns the name of the branch
-    std::string name() const override final;
-    /// Returns the data dependencies of the branch (empty)
-    std::vector<DataDependency> data_dependencies() override final;
-
-    /// Underlying tree object
-    const TTree* tree() const override final;
-    TTree* tree() override final;
-    
 
     /// Is the branch initialized
     bool initialized() const;
@@ -64,21 +54,15 @@ private:
     std::string tree_data_type() const;
     /// Resets the check mask
     void reset();
-
-    TTree* m_tree{nullptr};
-    std::string m_name{};
-
     size_t m_size{0};
-    std::unique_ptr<T[]> m_data{nullptr};
-    std::unique_ptr<bool[]> m_updated{nullptr};
+    std::unique_ptr<T[]> m_data{new T[m_size]};
+    std::unique_ptr<bool[]> m_updated{new bool[m_size]};
 
     bool m_init{false};
 
     /// Default value in cases where the part are not updated
     T m_default{};
     bool m_failIfNotUpdated{true};
-
-    MuonTesterTree* m_parent{nullptr};
 };
 /// Specification of the branch data_type for the TTree initialize routine
 template <> std::string ArrayBranch<char*>::tree_data_type() const;
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/ArrayBranch.icc b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/ArrayBranch.icc
index a20bed56619e..9f86bbfd68a2 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/ArrayBranch.icc
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/ArrayBranch.icc
@@ -1,63 +1,55 @@
 /*
-  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 #ifndef MUONTESTER_ARRAYBRANCH_IXX
 #define MUONTESTER_ARRAYBRANCH_IXX
 
-#include <AthenaKernel/getMessageSvc.h>
-#include <GaudiKernel/MsgStream.h>
 #include <MuonTesterTree/MuonTesterTree.h>
-
+#include <MuonTesterTree/throwExcept.h>
 namespace MuonVal {
 template <class T>
 ArrayBranch<T>::ArrayBranch(TTree* t, const std::string& b_name, size_t size) :
-    m_tree(t), m_name(b_name), m_size(size), m_data(new T[size]), m_updated(new bool[size]) {
+    MuonTesterBranch{t,b_name},
+    m_size{size} {
     reset();
 }
 template <class T>
-ArrayBranch<T>::ArrayBranch(MuonTesterTree& t, const std::string& b_name, size_t size) : ArrayBranch(t.tree(), b_name, size) {
-    m_parent = &t;
-    m_parent->addBranch(this);
+ArrayBranch<T>::ArrayBranch(MuonTesterTree& t, const std::string& b_name, size_t size) : 
+    MuonTesterBranch{t, b_name},
+    m_size{size} {
+    reset();
 }
 
 template <class T>
-ArrayBranch<T>::ArrayBranch(TTree* tree, const std::string& name, size_t size, const T& def_val) : ArrayBranch(tree, name, size) {
+ArrayBranch<T>::ArrayBranch(TTree* tree, const std::string& name, size_t size, const T& def_val) : 
+    ArrayBranch(tree, name, size) {
     setDefault(def_val);
 }
 template <class T>
-ArrayBranch<T>::ArrayBranch(MuonTesterTree& tree, const std::string& name, size_t size, const T& def_val) : ArrayBranch(tree, name, size) {
+ArrayBranch<T>::ArrayBranch(MuonTesterTree& tree, const std::string& name, size_t size, const T& def_val) : 
+    ArrayBranch(tree, name, size) {
     setDefault(def_val);
 }
-template <class T> ArrayBranch<T>::~ArrayBranch() {
-    if (m_parent) m_parent->removeBranch(this);
-}
 template <class T> void ArrayBranch<T>::reset() {
     for (size_t i = 0; i < size(); ++i) m_updated[i] = false;
 }
-template <class T> std::string ArrayBranch<T>::name() const { return m_name; }
 template <class T> const T& ArrayBranch<T>::operator[](size_t s) const { return get(s); }
 template <class T> void ArrayBranch<T>::set(size_t s, const T& val) {
     if (s >= size()) { 
-        std::stringstream overflow{};
-        overflow<<"Index "<<s<<" is out of range for "<<name()<<".";
-        throw std::overflow_error(overflow.str()); 
+        THROW_EXCEPTION("Index "<<s<<" is out of range for "<<name());
     }
     m_updated[s] = true;
     m_data[s] = val;
 }
 template <class T> const T& ArrayBranch<T>::get(size_t s) const {
     if (s >= size()) { 
-        std::stringstream overflow{};
-        overflow<<"Index "<<s<<" is out of range for "<<name()<<".";
-        throw std::overflow_error(overflow.str()); 
+        THROW_EXCEPTION("Index "<<s<<" is out of range for "<<name());
     }
     return m_data[s];
 }
 template <class T> T& ArrayBranch<T>::operator[](size_t s) {
     if (s >= size()) { 
-        std::stringstream overflow{};
-        overflow<<"Index "<<s<<" is out of range for "<<name()<<".";
-        throw std::overflow_error(overflow.str()); 
+        THROW_EXCEPTION("Index "<<s<<" is out of range for "<<name());
     }
     m_updated[s] = true;
     return m_data[s];
@@ -65,42 +57,34 @@ template <class T> T& ArrayBranch<T>::operator[](size_t s) {
 template <class T> size_t ArrayBranch<T>::size() const { return m_size; }
 template <class T> bool ArrayBranch<T>::init() {
     if (initialized()) {
-        MsgStream log(Athena::getMessageSvc(), "ArrayBranch()");
-        log << MSG::WARNING << "init() -- The branch " << name() << " is already initialized. " << endmsg;
+        ATH_MSG_WARNING("init() -- The branch " << name() << " is already initialized. ");
         return true;
     }
     std::stringstream br_name{};
     br_name<<name()<<"["<<size()<<"]/"<<tree_data_type();
-    if (name().empty() || !m_tree) {
-        MsgStream log(Athena::getMessageSvc(), "ArrayBranch()");
-        log << MSG::ERROR << "init() -- Empty names are forbidden. " << endmsg;
+    if (name().empty() || !tree()) {
+        ATH_MSG_ERROR("init() -- Empty names are forbidden. ");
         return false;
-    } else if (m_tree->FindBranch(name().c_str())) {
-        MsgStream log(Athena::getMessageSvc(), "ArrayBranch()");
-        log << MSG::ERROR << "init() -- The branch " << name() << " already exists in TTree  " << m_tree->GetName() << "." << endmsg;
+    } else if (tree()->FindBranch(name().c_str())) {
+        ATH_MSG_ERROR("init() -- The branch " << name() << " already exists in TTree  " << tree()->GetName() << ".");
         return false;
-    } else if (!m_tree->Branch(name().c_str(), m_data.get(), br_name.str().c_str())) {
-        MsgStream log(Athena::getMessageSvc(), "ArrayBranch()");
-        log << MSG::ERROR << "init() -- Could not create branch " << name() << " in TTree " << m_tree->GetName() << endmsg;
+    } else if (!tree()->Branch(name().c_str(), m_data.get(), br_name.str().c_str())) {
+        ATH_MSG_ERROR("init() -- Could not create branch " << name() << " in TTree " << tree()->GetName());
         return false;
     }
     m_init = true;
     return true;
 }
-template <class T> const TTree* ArrayBranch<T>::tree() const {return m_tree;}
-template <class T> TTree* ArrayBranch<T>::tree(){ return m_tree;}
 template <class T> bool ArrayBranch<T>::initialized() const { return m_init; }
 template <class T> bool ArrayBranch<T>::fill(const EventContext&) {
     if (!initialized()) {
-        MsgStream log(Athena::getMessageSvc(), "ArrayBranch()");
-        log << MSG::ERROR << "init()  -- The branch " << name() << " is not initialized yet." << endmsg;
+        ATH_MSG_ERROR("init()  -- The branch " << name() << " is not initialized yet.");
         return false;
     }
     for (size_t i = 0; i < size(); ++i) {
         if (!m_updated[i]) {
             if (m_failIfNotUpdated) {
-                MsgStream log(Athena::getMessageSvc(), "ArrayBranch()");
-                log << MSG::ERROR << "init()  -- The " << i << "-th value is has not been updated. " << endmsg;
+                ATH_MSG_ERROR("init()  -- The " << i << "-th value is has not been updated. ");
                 return false;
             } else {
                 m_data[i] = m_default;
@@ -115,6 +99,5 @@ template <class T> void ArrayBranch<T>::setDefault(const T& val) {
     m_default = val;
     m_failIfNotUpdated = false;
 }
-template <class T> std::vector<IMuonTesterBranch::DataDependency> ArrayBranch<T>::data_dependencies() { return {};}
 }
 #endif
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterBranch.icc b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterBranch.icc
index 7eda588967d9..d2d8e3920064 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterBranch.icc
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterBranch.icc
@@ -4,8 +4,6 @@
 */
 #ifndef MUONTESTER_MUONTESTERBRANCH_IXX
 #define MUONTESTER_MUONTESTERBRANCH_IXX
-#include <AthenaKernel/getMessageSvc.h>
-#include <GaudiKernel/MsgStream.h>
 #include <TTree.h>
 #include <algorithm> //for std::find
 namespace MuonVal {
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterTree.icc b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterTree.icc
index dcc5355fc612..d2a20f75d335 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterTree.icc
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/MuonTesterTree.icc
@@ -4,7 +4,7 @@
 #ifndef MUONTESTER_MUONTESTERTREE_IXX
 #define MUONTESTER_MUONTESTERTREE_IXX
 #include <TTree.h>
-#include <GeoModelHelpers/throwExcept.h>
+#include <MuonTesterTree/throwExcept.h>
 
 
 //these are the template implementations included to MuonTesterTree.h
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/SetBranch.icc b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/SetBranch.icc
index 48d839cefefd..1519eaf1a4fe 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/SetBranch.icc
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/SetBranch.icc
@@ -4,6 +4,7 @@
 #ifndef MUONTESTER_MUONSSetBranch_IXX
 #define MUONTESTER_MUONSSetBranch_IXX
 
+#include "MuonTesterTree/throwExcept.h"
 namespace MuonVal {
 template <class T> SetBranch<T>::SetBranch(TTree* tree, const std::string& name) : MuonTesterBranch(tree, name) {}
 
@@ -43,7 +44,7 @@ template <class T> const std::set<T>& SetBranch<T>::get() const {
 template <class T> void SetBranch<T>::insert(const T& value) {
     if (!m_updated) m_variable.clear();
     // Throw an exception in cases where the branch is not initialized
-    if (!initialized()) { throw std::runtime_error(name() + " is not initialized yet"); }
+    if (!initialized()) { THROW_EXCEPTION(name() + " is not initialized yet"); }
     m_variable.insert(value);
     m_updated = true;
 }
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/VectorBranch.icc b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/VectorBranch.icc
index cf2d115c3b72..fd9f1403eb5e 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/VectorBranch.icc
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/MuonTesterTree/VectorBranch.icc
@@ -1,11 +1,10 @@
 /*
-  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 #ifndef MUONTESTER_MUONSVECTORBRANCH_IXX
 #define MUONTESTER_MUONSVECTORBRANCH_IXX
-#include <AthenaKernel/getMessageSvc.h>
-#include <GaudiKernel/MsgStream.h>
 
+#include <MuonTesterTree/throwExcept.h>
 namespace MuonVal {
 template <class T> VectorBranch<T>::VectorBranch(TTree* tree, const std::string& name) : MuonTesterBranch(tree, name) {}
 
@@ -20,8 +19,7 @@ VectorBranch<T>::VectorBranch(MuonTesterTree& tree, const std::string& name, con
 
 template <class T> bool VectorBranch<T>::fill(const EventContext&) {
     if (!initialized()) {
-        MsgStream log(Athena::getMessageSvc(), "VectorBranch()");
-        log << MSG::ERROR << "init()  -- The branch " << name() << " is not initialized yet." << endmsg;
+        ATH_MSG_ERROR("init()  -- The branch " << name() << " is not initialized yet.");
         return false;
     }
     if (!m_updated) m_variable.clear();
@@ -37,7 +35,7 @@ template <class T> T& VectorBranch<T>::operator[](size_t idx) { return get(idx);
 template <class T> T& VectorBranch<T>::get(size_t idx) {
     if (!m_updated) m_variable.clear();
     if (idx >= size()) {
-        if (!initialized()) { throw std::runtime_error(name() + " is not initialized yet"); }
+        if (!initialized()) { THROW_EXCEPTION(name() + " is not initialized yet"); }
         m_variable.resize(idx + 1, getDefault()); 
         m_updated = true;        
     }
@@ -47,7 +45,7 @@ template <class T> T& VectorBranch<T>::get(size_t idx) {
 template <class T> void VectorBranch<T>::push_back(const T& value) {
     if (!m_updated) m_variable.clear();
     // Throw an exception in cases where the branch is not initialized
-    if (!initialized()) { throw std::runtime_error(name() + " is not initialized yet"); }
+    if (!initialized()) { THROW_EXCEPTION(name() + " is not initialized yet"); }
     m_variable.push_back(value);
     m_updated = true;
 }
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/EventInfoBranch.cxx b/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/EventInfoBranch.cxx
index dc1e2cf6c063..62740f7136ca 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/EventInfoBranch.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/EventInfoBranch.cxx
@@ -3,7 +3,7 @@
 */
 #include <MuonTesterTree/EventInfoBranch.h>
 #include <StoreGate/ReadHandle.h>
-#include <GeoModelHelpers/throwExcept.h>
+#include <MuonTesterTree/throwExcept.h>
 #include <stdexcept>
 namespace {
      static const SG::AuxElement::ConstAccessor<unsigned int> acc_Random("RandomRunNumber");
diff --git a/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/MuonTesterBranch.cxx b/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/MuonTesterBranch.cxx
index ba1e0a8045b9..4e9bf4fb9a40 100644
--- a/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/MuonTesterBranch.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonTesterTree/Root/MuonTesterBranch.cxx
@@ -8,7 +8,7 @@ Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 #include <MuonTesterTree/MuonTesterTree.h>
 #include <MuonTesterTree/ScalarBranch.h>
 #include <MuonTesterTree/VectorBranch.h>
-#include <GeoModelHelpers/throwExcept.h>
+#include <MuonTesterTree/throwExcept.h>
 
 #include <functional>
 
-- 
GitLab