From c180468c9d682f6d38b2991f7f125011ec12cdfc Mon Sep 17 00:00:00 2001
From: John Derek Chapman <chapman@hep.phy.cam.ac.uk>
Date: Fri, 22 May 2020 08:58:58 +0000
Subject: [PATCH] sweep MR33082 and resolve conflicts

---
 .../MuonPRDTest/src/CSCDigitVariables.cxx           |  4 +++-
 .../MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx | 13 ++++++-------
 .../MuonPRDTest/src/MDTSimHitVariables.cxx          |  7 ++-----
 .../MuonPRDTest/src/MMDigitVariables.cxx            |  6 ++++--
 .../MuonPRDTest/src/MMPRDVariables.cxx              |  5 +++--
 .../MuonPRDTest/src/MMRDOVariables.cxx              |  8 +++-----
 .../MuonPRDTest/src/MMSimHitVariables.cxx           |  7 ++-----
 .../MuonPRDTest/src/RPCSimHitVariables.cxx          |  7 ++-----
 .../MuonPRDTest/src/sTGCDigitVariables.cxx          |  5 +++--
 .../MuonPRDTest/src/sTGCPRDVariables.cxx            |  3 ++-
 .../MuonPRDTest/src/sTGCRDOVariables.cxx            |  8 +++-----
 .../MuonPRDTest/src/sTGCSDOVariables.cxx            | 10 +++-------
 .../MuonPRDTest/src/sTGCSimHitVariables.cxx         |  6 ++----
 13 files changed, 38 insertions(+), 51 deletions(-)

diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.cxx
index 0411bb9b98b..172ab6bf89e 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "CSCDigitVariables.h"
@@ -12,6 +12,7 @@
 
 #include "MuonReadoutGeometry/CscReadoutElement.h"
 
+#include <TString.h> // for Form
 #include "TTree.h"
 
 /** ---------- filling of variables */
@@ -74,6 +75,7 @@ StatusCode CSCDigitVariables::fillVariables(const MuonGM::MuonDetectorManager* M
       m_CSC_dig_channel->push_back(channel);
 
       const MuonGM::CscReadoutElement* rdoEl = MuonDetMgr->getCscReadoutElement(Id);
+      if (!rdoEl) throw std::runtime_error(Form("File: %s, Line: %d\nCSCDigitVariables::fillVariables() - Failed to retrieve CscReadoutElement for %s", __FILE__, __LINE__, m_CscIdHelper->print_to_string(Id).c_str()));
 
       // retrieve the MC truth associated with the digit (means the Geant4 hit information)
       if (csc_SdoContainer) {
diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx
index 19d683d33a6..58ff142d121 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx
@@ -7,6 +7,7 @@
 #include "xAODEventInfo/EventInfo.h"
 #include "GaudiKernel/ITHistSvc.h"
 #include "AtlasHepMC/GenParticle.h"
+#include "Identifier/Identifier.h"
 #include "TrackRecord/TrackRecordCollection.h"
 #include "MuonReadoutGeometry/MdtReadoutElement.h"
 #include "MuonSimEvent/MdtHitIdHelper.h"
@@ -20,12 +21,13 @@
 #include "TrkSurfaces/StraightLineSurface.h"
 #include "TrkGeometry/MagneticFieldProperties.h"
 
-#include <iostream>
-#include <fstream>
 #include "TTree.h"
+#include <TString.h> // for Form
 #include <string>
 #include <sstream>
 #include <map>
+#include <iostream>
+#include <fstream>
 
 using namespace MuonGM;
 
@@ -822,11 +824,8 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap
 	continue;
       }
 
-      const MuonGM::MdtReadoutElement* detEl = mdt->detectorElement() ;
-      if( !detEl ) {
-	ATH_MSG_WARNING(" no associated detectorElement!!! ");
-	continue;
-      }
+      const MuonGM::MdtReadoutElement* detEl = mdt->detectorElement();
+      if (!detEl) throw std::runtime_error(Form("File: %s, Line: %d\nMDTPRDValAlg::analyseHits() - no associated detectorElement", __FILE__, __LINE__));
 
       // transform to global coords
       Amg::Vector3D simHitPosLoc(simHit->localPosition().x(), simHit->localPosition().y(), simHit->localPosition().z());
diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTSimHitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTSimHitVariables.cxx
index 807ba187e89..d543f0ad34c 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTSimHitVariables.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTSimHitVariables.cxx
@@ -12,6 +12,7 @@
 #include "AtlasHepMC/GenParticle.h"
 
 #include "TTree.h"
+#include <TString.h> // for Form
 
 /** ---------- filling of variables */
 /** ---------- to be called on each evt i.e. execute level of main alg */
@@ -52,11 +53,7 @@ StatusCode MDTSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager*
     }
 
     const MuonGM::MdtReadoutElement* mdtdet = MuonDetMgr->getMdtReadoutElement(offid);
-    if (mdtdet == nullptr)
-    {
-       ATH_MSG_WARNING("MDT readout element not found for Id = " << m_MdtIdHelper->show_to_string(offid) << " skipping.");
-       continue;
-    }
+    if (!mdtdet) throw std::runtime_error(Form("File: %s, Line: %d\nMDTSimHitVariables::fillVariables() - Failed to retrieve MdtReadoutElement for %s", __FILE__, __LINE__, m_MdtIdHelper->print_to_string(offid).c_str()));
 
     m_MDT_Sim_stationName   ->push_back(stname);
     m_MDT_stationName   ->push_back(m_MdtIdHelper->stationName(offid));
diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx
index 8c809ca0a19..2f2110a9107 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "MMDigitVariables.h"
@@ -11,6 +11,7 @@
 #include "MuonReadoutGeometry/MMReadoutElement.h"
 
 #include "TTree.h"
+#include <TString.h> // for Form
 
 /** ---------- filling of variables */
 /** ---------- to be called on each evt i.e. execute level of main alg */
@@ -66,7 +67,8 @@ StatusCode MMDigitVariables::fillVariables(const MuonGM::MuonDetectorManager* Mu
 
       // get the readout element class where the digit is recorded
       int isSmall = (stName[2] == 'S');
-      const MuonGM::MMReadoutElement* rdoEl = MuonDetMgr->getMMRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet );
+      const MuonGM::MMReadoutElement* rdoEl = MuonDetMgr->getMMRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet);
+      if (!rdoEl) throw std::runtime_error(Form("File: %s, Line: %d\nMMDigitVariables::fillVariables() - Failed to retrieve MMReadoutElement for isSmall=%d, stationEta=%d, stationPhi=%d, multiplet=%d", __FILE__, __LINE__, isSmall, stationEta, stationPhi, multiplet));
 
       // information from VMM chip
       std::vector<float>  time          = digit->chipResponseTime();
diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.cxx
index b026d68d98d..603629547bd 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "MMPRDVariables.h"
@@ -11,10 +11,10 @@
 #include "MuonRDO/MM_RawDataContainer.h"
 #include "MuonSimData/MuonSimDataCollection.h"
 
-
 #include "MMRDOVariables.h"
 
 #include "MuonReadoutGeometry/MMReadoutElement.h"
+#include <TString.h> // for Form
 
 #include "TTree.h"
 
@@ -74,6 +74,7 @@ StatusCode MMPRDVariables::fillVariables(const MuonGM::MuonDetectorManager* Muon
       m_NSWMM_prd_time->push_back(prd->time());
 
       const MuonGM::MMReadoutElement* det = prd->detectorElement();
+      if (!det) throw std::runtime_error(Form("File: %s, Line: %d\nMMPRDVariables::fillVariables() - no associated detectorElement", __FILE__, __LINE__));
       Amg::Vector3D pos    = prd->globalPosition();
       const Amg::MatrixX & cov = prd->localCovariance();
       Amg::Vector2D loc_pos(0., 0.);
diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.cxx
index 184a0bdf2c2..d10ebbfd2f4 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.cxx
@@ -12,6 +12,7 @@
 #include "MuonReadoutGeometry/MMReadoutElement.h"
 
 #include "TTree.h"
+#include <TString.h> // for Form
 
 using namespace Muon;
 
@@ -69,11 +70,8 @@ StatusCode MMRDOVariables::fillVariables(const MuonGM::MuonDetectorManager* Muon
 
       // get the readout element class where the RDO is recorded
       int isSmall = (stName[2] == 'S');
-      const MuonGM::MMReadoutElement* rdoEl = MuonDetMgr->getMMRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet );
-      if (!rdoEl) {
-        ATH_MSG_WARNING("Could not retrieve MMReadoutElement from DetectorManager for isSmall=" << isSmall << ", stationEta=" << stationEta << ", stationPhi=" << stationPhi << ", multiplet=" << multiplet << ", skipping this entry...");
-        continue;
-      }
+      const MuonGM::MMReadoutElement* rdoEl = MuonDetMgr->getMMRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet);
+      if (!rdoEl) throw std::runtime_error(Form("File: %s, Line: %d\nMMRDOVariables::fillVariables() - Failed to retrieve MMReadoutElement for isSmall=%d, stationEta=%d, stationPhi=%d, multiplet=%d", __FILE__, __LINE__, isSmall, stationEta, stationPhi, multiplet));
 
       Amg::Vector2D localStripPos(0.,0.);
       if ( rdoEl->stripPosition(Id,localStripPos) )  {
diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.cxx
index 87066e5d8e0..ebd5cea13fd 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.cxx
@@ -13,6 +13,7 @@
 #include "MuonAGDDDescription/MMDetectorDescription.h"
 #include "MuonAGDDDescription/MMDetectorHelper.h"
 
+#include <TString.h> // for Form
 #include "TTree.h"
 
 StatusCode MMSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) 
@@ -133,11 +134,7 @@ StatusCode MMSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager* M
                   << " phi " << m_MmIdHelper->stationPhi(offId) << " ml " << m_MmIdHelper->multilayer(offId) );
 
     const MuonGM::MMReadoutElement* detEl = MuonDetMgr->getMMReadoutElement(offId);
-
-    if( !detEl ){
-      ATH_MSG_WARNING("MicroMegas geometry, failed to retrieve detector element for: " << m_MmIdHelper->print_to_string(offId) );
-      continue;
-    }
+    if (!detEl) throw std::runtime_error(Form("File: %s, Line: %d\nMMSimHitVariables::fillVariables() - Failed to retrieve MMReadoutElement for %s", __FILE__, __LINE__, m_MmIdHelper->print_to_string(offId).c_str()));
 
     // surface
     const Trk::PlaneSurface& surf = detEl->surface(offId);
diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/RPCSimHitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/RPCSimHitVariables.cxx
index cf8281f6f69..ac5993abd27 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/RPCSimHitVariables.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/RPCSimHitVariables.cxx
@@ -12,6 +12,7 @@
 #include "AtlasHepMC/GenParticle.h"
 
 #include "TTree.h"
+#include <TString.h> // for Form
 
 /** ---------- filling of variables */
 /** ---------- to be called on each evt i.e. execute level of main alg */
@@ -59,11 +60,7 @@ StatusCode RPCSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager*
     }
 
     const MuonGM::RpcReadoutElement* rpcdet = MuonDetMgr->getRpcReadoutElement(offid);
-    if (rpcdet == nullptr)
-    {
-       ATH_MSG_WARNING("RPC readout element not found for Id = " << m_RpcIdHelper->show_to_string(offid) << " skipping.");
-       continue;
-    }
+    if (!rpcdet) throw std::runtime_error(Form("File: %s, Line: %d\nRPCSimHitVariables::fillVariables() - Failed to retrieve RpcReadoutElement for %s", __FILE__, __LINE__, m_RpcIdHelper->print_to_string(offid).c_str()));
 
     m_RPC_Sim_stationName   ->push_back(stname);
     m_RPC_stationName   ->push_back(m_RpcIdHelper->stationName(offid));
diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx
index 6f0548591b4..256fceb14b0 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx
@@ -13,6 +13,7 @@
 #include "MuonDigitContainer/sTgcDigitCollection.h"
 
 #include "TTree.h"
+#include <TString.h> // for Form
 
 /** ---------- filling of variables */
 /** ---------- to be called on each evt i.e. execute level of main alg */
@@ -71,8 +72,8 @@ StatusCode sTGCDigitVariables::fillVariables(const MuonGM::MuonDetectorManager*
                          << " Station PhiMax ["  << stationPhiMax      << "]");
 
       int isSmall = stName[2] == 'S';
-      const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet );
-
+      const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet);
+      if (!rdoEl) throw std::runtime_error(Form("File: %s, Line: %d\nsTGCDigitVariables::fillVariables() - Failed to retrieve sTgcReadoutElement for isSmall=%d, stationEta=%d, stationPhi=%d, multiplet=%d", __FILE__, __LINE__, isSmall, stationEta, stationPhi, multiplet));
       int channelNumber = 0;
       const Identifier phiId, etaId;
       Amg::Vector3D gpos(0.,0.,0.);
diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.cxx
index aa7ac9764ea..db22c4ab377 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.cxx
@@ -8,7 +8,7 @@
 #include "MuonPrepRawData/sTgcPrepDataContainer.h"
 
 #include "TTree.h"
-
+#include <TString.h> // for Form
 
 StatusCode sTGCPRDVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr)
 {
@@ -56,6 +56,7 @@ StatusCode sTGCPRDVariables::fillVariables(const MuonGM::MuonDetectorManager* Mu
       m_NSWsTGC_prd_bcTag->push_back(bcTag);
 
       const MuonGM::sTgcReadoutElement* det = prd->detectorElement();
+      if (!det) throw std::runtime_error(Form("File: %s, Line: %d\nsTGCPRDVariables::fillVariables() - no associated detectorElement", __FILE__, __LINE__));
       Amg::Vector3D pos = prd->globalPosition();
       Amg::Vector2D loc_pos(0., 0.);
        det->surface(Id).globalToLocal(pos, Amg::Vector3D(0., 0., 0.), loc_pos);
diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.cxx
index c5aeea59fa8..dd4a02350e0 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.cxx
@@ -11,6 +11,7 @@
 #include "MuonRDO/STGC_RawDataContainer.h"
 
 #include "TTree.h"
+#include <TString.h> // for Form
 
 using namespace Muon;
 
@@ -73,11 +74,8 @@ StatusCode sTGCRDOVariables::fillVariables(const MuonGM::MuonDetectorManager* Mu
 
       // get the readout element class where the RDO is recorded
       int isSmall = stName[2] == 'S';
-      const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet );
-      if (!rdoEl) {
-        ATH_MSG_WARNING("Could not retrieve sTgcReadoutElement from DetectorManager for isSmall=" << isSmall << ", stationEta=" << stationEta << ", stationPhi=" << stationPhi << ", multiplet=" << multiplet << ", skipping this entry...");
-        continue;
-      }
+      const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet);
+      if (!rdoEl) throw std::runtime_error(Form("File: %s, Line: %d\nsTGCRDOVariables::fillVariables() - Failed to retrieve sTgcReadoutElement for isSmall=%d, stationEta=%d, stationPhi=%d, multiplet=%d", __FILE__, __LINE__, isSmall, stationEta, stationPhi, multiplet));
 
       Amg::Vector2D localStripPos(0.,0.);
       if ( rdoEl->stripPosition(Id,localStripPos) )  {
diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.cxx
index 7e0d06fc996..440ecc5d8eb 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.cxx
@@ -9,7 +9,7 @@
 #include "MuonReadoutGeometry/sTgcReadoutElement.h"
 
 #include "TTree.h"
-
+#include <TString.h> // for Form
 
 StatusCode sTGCSDOVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr)
 {
@@ -80,12 +80,8 @@ StatusCode sTGCSDOVariables::fillVariables(const MuonGM::MuonDetectorManager* Mu
 
     // Retrive the detector element and local SDO coordinates
     bool isSmall = stName[2] == 'S';
-    const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet );
-
-    if( !rdoEl ){
-      ATH_MSG_WARNING("sTGC geometry, failed to retrieve detector element for: isSmall " << isSmall << " eta " << stationEta
-                      << " phi " << stationPhi << " multiplet " << multiplet );
-    }
+    const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet);
+    if (!rdoEl) throw std::runtime_error(Form("File: %s, Line: %d\nsTGCSDOVariables::fillVariables() - Failed to retrieve sTgcReadoutElement for isSmall=%d, stationEta=%d, stationPhi=%d, multiplet=%d", __FILE__, __LINE__, isSmall, stationEta, stationPhi, multiplet));
 
     Amg::Vector2D loc_pos(0., 0.);
     rdoEl->surface(Id).globalToLocal(hit_gpos, Amg::Vector3D(0., 0., 0.), loc_pos);
diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.cxx
index cbef17f2cdf..fa778a002ad 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.cxx
@@ -11,6 +11,7 @@
 #include "MuonReadoutGeometry/sTgcReadoutElement.h"
 
 #include "TTree.h"
+#include <TString.h> // for Form
 
 StatusCode sTGCSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) 
 {
@@ -88,10 +89,7 @@ StatusCode sTGCSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager*
       }
 
       const MuonGM::sTgcReadoutElement* detEl = MuonDetMgr->getsTgcReadoutElement(offId);
-      if( !detEl ){
-        ATH_MSG_WARNING("sTGC geometry, failed to retrieve detector element for: isSmall " << isSmall << " eta " << m_sTgcIdHelper->stationEta(offId)
-                        << " phi " << m_sTgcIdHelper->stationPhi(offId) << " ml " << m_sTgcIdHelper->multilayer(offId) );
-      }
+      if (!detEl) throw std::runtime_error(Form("File: %s, Line: %d\nsTGCSimHitVariables::fillVariables() - Failed to retrieve sTgcReadoutElement for %s", __FILE__, __LINE__, m_sTgcIdHelper->print_to_string(offId).c_str()));
 
       if( !m_sTgcIdHelper->is_stgc(offId) ){
           ATH_MSG_WARNING("sTgc id is not a stgc id! " << m_sTgcIdHelper->print_to_string(offId));
-- 
GitLab