diff --git a/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.cxx b/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.cxx index 4a480c30c9e5f9ecc67d641771797c39270e72d9..8c4abc47967cacac332ed4d7e8d1024e0d41dbf5 100755 --- a/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.cxx +++ b/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.cxx @@ -160,7 +160,7 @@ StatusCode GeoModelSvc::geoInit() ? PathResolver::find_file (sqliteDbName, "DATAPATH") : m_sqliteDbFullPath.value(); if(sqliteDbPath.empty() && m_sqliteDbFullPath.empty()) { - ATH_MSG_FATAL("Filed to find SQLite database file " << sqliteDbName << " for reading in persistent GeoModel tree"); + ATH_MSG_FATAL("Failed to find SQLite database file " << sqliteDbName << " for reading in persistent GeoModel tree"); return StatusCode::FAILURE; } else { diff --git a/DetectorDescription/GeoModel/GeoModelSvc/src/RDBMaterialManager.cxx b/DetectorDescription/GeoModel/GeoModelSvc/src/RDBMaterialManager.cxx index 4de4fb44a0530730b82bb2af001b067f21949151..c9855015cd2364b6b24a94ae2b9e0d5e97c4f6d4 100755 --- a/DetectorDescription/GeoModel/GeoModelSvc/src/RDBMaterialManager.cxx +++ b/DetectorDescription/GeoModel/GeoModelSvc/src/RDBMaterialManager.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 "RDBMaterialManager.h" @@ -7,7 +7,6 @@ #include "GeoModelInterfaces/IGeoModelSvc.h" #include "GeoModelKernel/GeoMaterial.h" -#include "GeoModelKernel/GeoElement.h" #include "GeoModelKernel/Units.h" #include "StoreGate/DataHandle.h" @@ -323,16 +322,10 @@ StatusCode RDBMaterialManager::readMaterialsFromDB(ISvcLocator* pSvcLocator) // Destructor: RDBMaterialManager::~RDBMaterialManager() { - // Unreference the materials: for (auto &p : m_materialMap) { p.second->unref(); } - - // Unreference the elements: - for (GeoElement *elt : m_elementVector) { - elt->unref(); - } } GeoMaterial* RDBMaterialManager::searchMaterialMap(const std::string & name) const @@ -359,7 +352,7 @@ GeoElement *RDBMaterialManager::searchElementVector(const std::string & name) c MsgStream log(Athena::getMessageSvc(), "GeoModelSvc::RDBMaterialManager"); NameEquals matchByName(name); - std::vector<GeoElement *>::const_iterator e=std::find_if(m_elementVector.begin(), m_elementVector.end(),matchByName); + GeoEleVec::const_iterator e=std::find_if(m_elementVector.begin(), m_elementVector.end(),matchByName); if (e!=m_elementVector.end()) { if(log.level()==MSG::VERBOSE) @@ -379,7 +372,7 @@ GeoElement *RDBMaterialManager::searchElementVector(const unsigned int atomicNum MsgStream log(Athena::getMessageSvc(), "GeoModelSvc::RDBMaterialManager"); NumberEquals matchByNumber(atomicNumber); - std::vector<GeoElement *>::const_iterator e=std::find_if(m_elementVector.begin(), m_elementVector.end(), matchByNumber); + GeoEleVec::const_iterator e=std::find_if(m_elementVector.begin(), m_elementVector.end(), matchByNumber); if (e!=m_elementVector.end()) { if(log.level()==MSG::VERBOSE) @@ -636,7 +629,6 @@ const GeoElement *RDBMaterialManager::getElement(const std::string & name) { pelement = new GeoElement( element_name , element_symbol ,element_z , element_a *(GeoModelKernelUnits::gram/Gaudi::Units::mole)); // a table to keep the memory allocation, and easy for delete - pelement->ref(); m_elementVector.push_back( pelement); break; @@ -679,7 +671,6 @@ const GeoElement *RDBMaterialManager::getElement(unsigned int atomicNumber) { pelement = new GeoElement( element_name , element_symbol ,element_z , element_a *(GeoModelKernelUnits::gram/Gaudi::Units::mole)); // a table to keep the memory allocation, and easy for delete - pelement->ref(); m_elementVector.push_back( pelement); break; @@ -746,7 +737,6 @@ void RDBMaterialManager::buildSpecialMaterials() { // Create special materials GeoElement* ethElement = new GeoElement("Ether","ET",500.0,0.0); - ethElement->ref(); m_elementVector.push_back(ethElement); GeoMaterial* ether = new GeoMaterial("special::Ether",0.0); ether->add(ethElement,1.); diff --git a/DetectorDescription/GeoModel/GeoModelSvc/src/RDBMaterialManager.h b/DetectorDescription/GeoModel/GeoModelSvc/src/RDBMaterialManager.h index 5f6fc3ee178f2f43f0f2f2400afa4bc1cc3bc21b..4db40d339f3586b61f24287f5cced8958d3c4e9f 100755 --- a/DetectorDescription/GeoModel/GeoModelSvc/src/RDBMaterialManager.h +++ b/DetectorDescription/GeoModel/GeoModelSvc/src/RDBMaterialManager.h @@ -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 */ #ifndef GEOMODELSVC_RDBMATERIALMANAGER_H @@ -15,6 +15,8 @@ //---------------------------------------------------------// #include "GeoModelInterfaces/StoredMaterialManager.h" #include "RDBAccessSvc/IRDBAccessSvc.h" +#include "GeoModelKernel/GeoIntrusivePtr.h" +#include "GeoModelKernel/GeoElement.h" #include <string> #include <map> @@ -90,7 +92,8 @@ class RDBMaterialManager final : public StoredMaterialManager { IRDBRecordset_ptr m_toromaterials; IRDBRecordset_ptr m_toromatcomponents; - std::vector < GeoElement *> m_elementVector; + using GeoEleVec = std::vector<GeoIntrusivePtr<GeoElement>>; + GeoEleVec m_elementVector; StoredMaterialManager::MaterialMap m_materialMap; };