From 71be0a8dc30fbef697cd7984426a164928817793 Mon Sep 17 00:00:00 2001 From: Susumu Oda <susumu.oda@cern.ch> Date: Mon, 15 Jun 2020 17:40:53 +0200 Subject: [PATCH] Remove delete from SiElementPropertiesTable --- .../SiSpacePointFormation/SiElementProperties.h | 10 +++++----- .../SiElementPropertiesTable.h | 10 +++++----- .../src/SiElementPropertiesTable.cxx | 15 +++------------ 3 files changed, 13 insertions(+), 22 deletions(-) diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiElementProperties.h b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiElementProperties.h index e0b2fb1b8a3..04c9527cc2c 100755 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiElementProperties.h +++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiElementProperties.h @@ -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 */ /*************************************************************************** @@ -34,8 +34,8 @@ public: ~SiElementProperties(); - const std::vector<IdentifierHash>* neighbours (void); - float halfWidth (void); + const std::vector<IdentifierHash>* neighbours (void) const; + float halfWidth (void) const; private: std::vector<IdentifierHash> m_neighbours; @@ -50,14 +50,14 @@ private: //-------------------------------------------------------------------------- inline const std::vector<IdentifierHash>* -SiElementProperties::neighbours() +SiElementProperties::neighbours() const { return &m_neighbours; } //---------------------------------------------------------------------------- inline float -SiElementProperties::halfWidth() +SiElementProperties::halfWidth() const { return m_halfWidth; } diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiElementPropertiesTable.h b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiElementPropertiesTable.h index 18d4d21ca29..a87c4491420 100755 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiElementPropertiesTable.h +++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiElementPropertiesTable.h @@ -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 */ /*************************************************************************** @@ -29,13 +29,13 @@ public: SiElementPropertiesTable(const SCT_ID& idHelper, const InDetDD::SiDetectorElementCollection& elements, float epsilonWidth); - ~SiElementPropertiesTable(); + ~SiElementPropertiesTable() = default; const std::vector<IdentifierHash>* neighbours(const IdentifierHash& waferID) const; float halfWidth(IdentifierHash hashID) const; private: - std::vector<SiElementProperties*> m_properties; + std::vector<SiElementProperties> m_properties; }; @@ -43,13 +43,13 @@ private: inline const std::vector<IdentifierHash>* SiElementPropertiesTable::neighbours(const IdentifierHash& waferID) const { - return (m_properties[(unsigned int)waferID])->neighbours(); + return (m_properties[(unsigned int)waferID]).neighbours(); } inline float SiElementPropertiesTable::halfWidth(IdentifierHash waferID) const { - return (m_properties[(unsigned int)waferID])->halfWidth(); + return (m_properties[(unsigned int)waferID]).halfWidth(); } } diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTable.cxx b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTable.cxx index 55c5cfc43de..47d0c581e44 100755 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTable.cxx +++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTable.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 */ /*************************************************************************** @@ -21,24 +21,15 @@ SiElementPropertiesTable::SiElementPropertiesTable(const SCT_ID& idHelper, float epsilonWidth) { size_t maxSCT = idHelper.wafer_hash_max(); - m_properties.assign(maxSCT, nullptr); + m_properties.reserve(maxSCT); for (size_t i = 0; i < maxSCT; ++i){ IdentifierHash hash(i); const InDetDD::SiDetectorElement* element = elements[hash]; if (element != 0){ - SiElementProperties* props = new SiElementProperties(hash, idHelper,*element,epsilonWidth); - m_properties[i] = props; + m_properties.emplace_back(hash, idHelper,*element,epsilonWidth); } } } //-------------------------------------------------------------------------- -SiElementPropertiesTable::~SiElementPropertiesTable(){ - size_t maxSCT = m_properties.size(); - for (size_t i=0; i < maxSCT; ++i){ - delete m_properties[i];m_properties[i] =0; - } -} -//-------------------------------------------------------------------------- - } -- GitLab