diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.cxx index 0411bb9b98b7ae22285cca92542f09ea18aaf940..172ab6bf89ee67d8b997a3ba09ab6d825bdd43fb 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 19d683d33a657032ea6a3653c3689c85a4aded0c..58ff142d121afd7061b0f4c910c9c658c1038dd1 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 807ba187e898b378c1dc63c0bbc7d2c79401ced5..d543f0ad34c570e9756f427165a160b0e7c44ad0 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 8c809ca0a19fa1f54a47e84a900ae124ed6935bb..2f2110a9107c7d91b51fa760710490776fceb4f9 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 b026d68d98d17e1a6750fe6a02944ad7266348e9..603629547bd91c194510abbd642f15e3a6bc0f11 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 184a0bdf2c243531362143de604d3f7c11335930..d10ebbfd2f413675259bf507ecf790897096a10b 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 87066e5d8e000e02ed4231939602364334e591f9..ebd5cea13fd3b44b49a9d0afddb2b5e40739672e 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 cf8281f6f697b0ca25b660acb681c752000fc34c..ac5993abd27caec7e52bf0a717185f61667e5362 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 6f0548591b413a3007090493e9333b7bee1f1dd8..256fceb14b039aca624a0efd4301b71bfe74e280 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 aa7ac9764eaf9b66326d13793fb5b080b997f13f..db22c4ab3776f4f2cac2bfd7aabec5db084ab9c3 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 c5aeea59fa8a6b5d588552976aa99425ba77e117..dd4a02350e0c2947056963f0a9663922a120e654 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 7e0d06fc996145bcc3b01ca13d0c98116c4c6f7b..440ecc5d8eb9a7122766b53c97f2fdce32d54157 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 cbef17f2cdfdf2fd26d4010b7ae354fb290003d8..fa778a002ad8d2fc0ce7850866f42754cdcbdcfc 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));