From a91ac6b4500dc206d4c11b7995744a8535bd1f29 Mon Sep 17 00:00:00 2001
From: Melissa Yexley <m.yexley@cern.ch>
Date: Wed, 6 Dec 2023 18:12:37 +0100
Subject: [PATCH] adding changes so can be seen in a draft MR for hackathon

---
 .../MuonCnv/MuonJiveXML/src/CscPrepDataRetriever.cxx        | 6 +++++-
 .../MuonCnv/MuonJiveXML/src/MMPrepDataRetriever.cxx         | 5 +++++
 .../MuonCnv/MuonJiveXML/src/MdtPrepDataRetriever.cxx        | 5 ++++-
 .../MuonCnv/MuonJiveXML/src/RpcPrepDataRetriever.cxx        | 5 +++++
 .../MuonCnv/MuonJiveXML/src/TgcPrepDataRetriever.cxx        | 5 +++++
 .../MuonCnv/MuonJiveXML/src/TrigMuonROIRetriever.cxx        | 6 +++++-
 .../MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx        | 5 +++++
 .../MuonCnv/MuonJiveXML/src/sTgcPrepDataRetriever.cxx       | 5 +++++
 8 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CscPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CscPrepDataRetriever.cxx
index 92d12ad8d84a..ee2283274c7e 100644
--- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CscPrepDataRetriever.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CscPrepDataRetriever.cxx
@@ -38,7 +38,11 @@ namespace JiveXML {
     ATH_MSG_VERBOSE("Retrieving " << dataTypeName()); 
 
     SG::ReadHandle<Muon::CscPrepDataContainer> cscContainer(m_sgKey);
-
+    
+    if (!cscContainer.isValid()) {
+      ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey);
+      return(StatusCode::SUCCESS);
+    }
 
     int ndata = 0;
     Muon::CscPrepDataContainer::const_iterator containerIt;
diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MMPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MMPrepDataRetriever.cxx
index 859ba5b11557..42cded98c194 100644
--- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MMPrepDataRetriever.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MMPrepDataRetriever.cxx
@@ -46,6 +46,11 @@ namespace JiveXML {
 
     SG::ReadHandle<Muon::MMPrepDataContainer> mmContainer(m_sgKey);
 
+    if (!mmContainer.isValid()) {
+      ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey);
+      return(StatusCode::SUCCESS);
+    }
+
     int ndata = 0;
     for (const auto mmCollection : *mmContainer){
        ndata += mmCollection->size();
diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MdtPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MdtPrepDataRetriever.cxx
index 767d3e6fb9da..f9f1fade1240 100644
--- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MdtPrepDataRetriever.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MdtPrepDataRetriever.cxx
@@ -40,7 +40,10 @@ namespace JiveXML {
     ATH_MSG_VERBOSE("Retrieving " << dataTypeName()); 
 
     SG::ReadHandle<Muon::MdtPrepDataContainer> mdtContainer(m_sgKey);
-
+    if (!mdtContainer.isValid()) {
+      ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey);
+      return(StatusCode::SUCCESS);
+    }
 
     int ndata = 0;
     Muon::MdtPrepDataContainer::const_iterator containerIt;
diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/RpcPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/RpcPrepDataRetriever.cxx
index 0d6247a68199..e07dc10a5eca 100644
--- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/RpcPrepDataRetriever.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/RpcPrepDataRetriever.cxx
@@ -40,6 +40,11 @@ namespace JiveXML {
 
     SG::ReadHandle<Muon::RpcPrepDataContainer> rpcContainer(m_sgKey);
 
+    if (!rpcContainer.isValid()) {
+      ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey);
+      return(StatusCode::SUCCESS);
+    }
+
     int ndata = 0;
     Muon::RpcPrepDataContainer::const_iterator containerIt;
     for (containerIt=rpcContainer->begin(); containerIt!=rpcContainer->end(); ++containerIt) {
diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TgcPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TgcPrepDataRetriever.cxx
index eeba935c39fa..ed3cb6279c87 100644
--- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TgcPrepDataRetriever.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TgcPrepDataRetriever.cxx
@@ -38,6 +38,11 @@ namespace JiveXML {
 
     SG::ReadHandle<Muon::TgcPrepDataContainer> tgcContainer(m_sgKey);
 
+    if (!tgcContainer.isValid()) {
+      ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey);
+      return(StatusCode::SUCCESS);
+    }
+
     int ndata = 0;
     Muon::TgcPrepDataContainer::const_iterator containerIt;
     for (containerIt=tgcContainer->begin(); containerIt!=tgcContainer->end(); ++containerIt) {
diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigMuonROIRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigMuonROIRetriever.cxx
index 75038032d627..798d0bff9870 100644
--- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigMuonROIRetriever.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigMuonROIRetriever.cxx
@@ -28,7 +28,11 @@ namespace JiveXML {
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieving " << dataTypeName() << endmsg; 
 
     SG::ReadHandle<LVL1_ROI> roi(m_sgKey);
-
+    
+    if (!roi.isValid()) {
+      ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey);
+      return(StatusCode::SUCCESS);
+    }
     int nRoIs = roi->getMuonROIs().size();
 
     DataVect phi; phi.reserve(nRoIs);
diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx
index 0d13e22735b7..2afc916114c8 100644
--- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx
@@ -42,6 +42,11 @@ namespace JiveXML {
     // retrieve the collection of RDO
     SG::ReadHandle<RpcPadContainer> rdoContainer(m_sgKey);
 
+    if (!rdoContainer.isValid()) {
+      ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey);
+      return(StatusCode::SUCCESS);
+    }
+
     int ndata=0;
     for (auto containerIt=rdoContainer->begin(); containerIt!=rdoContainer->end(); ++containerIt) {
       ndata += (*containerIt)->size();
diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/sTgcPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/sTgcPrepDataRetriever.cxx
index 6aae6cca1dac..89a2efe02d8e 100644
--- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/sTgcPrepDataRetriever.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/sTgcPrepDataRetriever.cxx
@@ -45,6 +45,11 @@ namespace JiveXML {
 
     SG::ReadHandle<Muon::sTgcPrepDataContainer> stgcContainer(m_sgKey);
 
+    if (!stgcContainer.isValid()) {
+      ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey);
+      return(StatusCode::SUCCESS);
+    }
+
     int ndata = 0;
     for (const auto stgcCollection : *stgcContainer){
        ndata += stgcCollection->size();
-- 
GitLab