From e49a98f3d106487c41b95a024c267554f7d1df69 Mon Sep 17 00:00:00 2001 From: scott snyder Date: Mon, 16 Sep 2019 14:36:32 +0200 Subject: [PATCH] MuonHoughPatternTools: Fix clang warnings. clang warnings: References cannot be null, so it doesn't make sense to test them for null. --- .../src/MuonLayerHoughTool.cxx | 130 ++++++++---------- 1 file changed, 60 insertions(+), 70 deletions(-) diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx index 17892aaade4..942e4410ec0 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx @@ -2276,90 +2276,80 @@ namespace Muon { } // loop over all available RPC collection identifiers and order them per sector - if (&(m_idHelper->rpcIdHelper())) { - it = m_idHelper->rpcIdHelper().module_begin(); - it_end = m_idHelper->rpcIdHelper().module_end(); - for( ;it!=it_end; ++it ){ - IdentifierHash hash; - m_idHelper->rpcIdHelper().get_module_hash(*it,hash); - insertHash(hash,*it); - } + it = m_idHelper->rpcIdHelper().module_begin(); + it_end = m_idHelper->rpcIdHelper().module_end(); + for( ;it!=it_end; ++it ){ + IdentifierHash hash; + m_idHelper->rpcIdHelper().get_module_hash(*it,hash); + insertHash(hash,*it); } // loop over all available CSC collection identifiers and order them per sector - if (&(m_idHelper->cscIdHelper())) { - it = m_idHelper->cscIdHelper().module_begin(); - it_end = m_idHelper->cscIdHelper().module_end(); - for( ;it!=it_end; ++it ){ - IdentifierHash hash; - m_idHelper->cscIdHelper().get_module_hash(*it,hash); - insertHash(hash,*it); - } + it = m_idHelper->cscIdHelper().module_begin(); + it_end = m_idHelper->cscIdHelper().module_end(); + for( ;it!=it_end; ++it ){ + IdentifierHash hash; + m_idHelper->cscIdHelper().get_module_hash(*it,hash); + insertHash(hash,*it); } // loop over all available MM collection identifiers and order them per sector - if (&(m_idHelper->mmIdHelper())) { - it = m_idHelper->mmIdHelper().detectorElement_begin(); - it_end = m_idHelper->mmIdHelper().detectorElement_end(); - for( ;it!=it_end; ++it ){ - IdentifierHash hash; - m_idHelper->mmIdHelper().get_module_hash(*it,hash); - insertHash(hash,*it); - } + it = m_idHelper->mmIdHelper().detectorElement_begin(); + it_end = m_idHelper->mmIdHelper().detectorElement_end(); + for( ;it!=it_end; ++it ){ + IdentifierHash hash; + m_idHelper->mmIdHelper().get_module_hash(*it,hash); + insertHash(hash,*it); } // loop over all available STGC collection identifiers and order them per sector - if (&(m_idHelper->stgcIdHelper())) { - it = m_idHelper->stgcIdHelper().detectorElement_begin(); - it_end = m_idHelper->stgcIdHelper().detectorElement_end(); - for( ;it!=it_end; ++it ){ - IdentifierHash hash; - m_idHelper->stgcIdHelper().get_module_hash(*it,hash); - int sector = m_idHelper->sector(*it); - insertHash(sector,hash,*it); - int sectorU = sector != 1 ? sector-1 : 16; - int sectorD = sector != 16 ? sector+1 : 1; - insertHash(sectorU,hash,*it); - insertHash(sectorD,hash,*it); - } + it = m_idHelper->stgcIdHelper().detectorElement_begin(); + it_end = m_idHelper->stgcIdHelper().detectorElement_end(); + for( ;it!=it_end; ++it ){ + IdentifierHash hash; + m_idHelper->stgcIdHelper().get_module_hash(*it,hash); + int sector = m_idHelper->sector(*it); + insertHash(sector,hash,*it); + int sectorU = sector != 1 ? sector-1 : 16; + int sectorD = sector != 16 ? sector+1 : 1; + insertHash(sectorU,hash,*it); + insertHash(sectorD,hash,*it); } // loop over all available TGC collection identifiers and order them per sector - if (&(m_idHelper->tgcIdHelper())) { - it = m_idHelper->tgcIdHelper().module_begin(); - it_end = m_idHelper->tgcIdHelper().module_end(); - for( ;it!=it_end; ++it ){ - const MuonGM::TgcReadoutElement* detEl = m_detMgr->getTgcReadoutElement(*it); - if( !detEl ) { - ATH_MSG_DEBUG(" No detector element found for " << m_idHelper->toString(*it) ); - continue; - } - IdentifierHash hash; - m_idHelper->tgcIdHelper().get_module_hash(*it,hash); - int nstrips = detEl->getNStrips(1); - Amg::Vector3D p1 = detEl->channelPos(1,1,1); - Amg::Vector3D p2 = detEl->channelPos(1,1,nstrips); - std::vector sectors1; - getSectors(p1,sectors1); - std::set added; - std::vector::iterator sit = sectors1.begin(); - std::vector::iterator sit_end = sectors1.end(); - for( ;sit!=sit_end; ++sit ){ - insertHash(*sit,hash,*it); - added.insert(*sit); - } - - std::vector sectors2; - getSectors(p2,sectors2); - sit = sectors2.begin(); - sit_end = sectors2.end(); - for( ;sit!=sit_end; ++sit ){ - if( added.count(*sit) ) continue; - added.insert(*sit); - insertHash(*sit,hash,*it); - } + it = m_idHelper->tgcIdHelper().module_begin(); + it_end = m_idHelper->tgcIdHelper().module_end(); + for( ;it!=it_end; ++it ){ + const MuonGM::TgcReadoutElement* detEl = m_detMgr->getTgcReadoutElement(*it); + if( !detEl ) { + ATH_MSG_DEBUG(" No detector element found for " << m_idHelper->toString(*it) ); + continue; + } + IdentifierHash hash; + m_idHelper->tgcIdHelper().get_module_hash(*it,hash); + int nstrips = detEl->getNStrips(1); + Amg::Vector3D p1 = detEl->channelPos(1,1,1); + Amg::Vector3D p2 = detEl->channelPos(1,1,nstrips); + std::vector sectors1; + getSectors(p1,sectors1); + std::set added; + std::vector::iterator sit = sectors1.begin(); + std::vector::iterator sit_end = sectors1.end(); + for( ;sit!=sit_end; ++sit ){ + insertHash(*sit,hash,*it); + added.insert(*sit); + } + std::vector sectors2; + getSectors(p2,sectors2); + sit = sectors2.begin(); + sit_end = sectors2.end(); + for( ;sit!=sit_end; ++sit ){ + if( added.count(*sit) ) continue; + added.insert(*sit); + insertHash(*sit,hash,*it); } + } if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << " Printing collections per sector, number of technologies " << m_ntechnologies; -- GitLab