Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:23:03

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/EventData/SeedContainer2.hpp"
0010 
0011 #include "Acts/EventData/Types.hpp"
0012 
0013 namespace Acts {
0014 
0015 SeedContainer2::SeedContainer2() noexcept = default;
0016 
0017 SeedContainer2::SeedContainer2(const SeedContainer2 &other) noexcept
0018     : m_size(other.m_size) {
0019   knownColumns() = other.knownColumns();
0020 }
0021 
0022 SeedContainer2::SeedContainer2(SeedContainer2 &&other) noexcept
0023     : m_size(other.m_size) {
0024   knownColumns() = std::move(other).knownColumns();
0025 
0026   other.m_size = 0;
0027 }
0028 
0029 SeedContainer2 &SeedContainer2::operator=(
0030     const SeedContainer2 &other) noexcept {
0031   if (this == &other) {
0032     return *this;
0033   }
0034 
0035   m_size = other.m_size;
0036   knownColumns() = other.knownColumns();
0037 
0038   return *this;
0039 }
0040 
0041 SeedContainer2 &SeedContainer2::operator=(SeedContainer2 &&other) noexcept {
0042   if (this == &other) {
0043     return *this;
0044   }
0045 
0046   m_size = other.m_size;
0047   knownColumns() = std::move(other).knownColumns();
0048 
0049   other.m_size = 0;
0050 
0051   return *this;
0052 }
0053 
0054 void SeedContainer2::reserve(std::size_t size,
0055                              float averageSpacePoints) noexcept {
0056   m_spacePointOffsets.reserve(size);
0057   m_spacePointCounts.reserve(size);
0058   m_qualities.reserve(size);
0059   m_vertexZs.reserve(size);
0060   m_spacePoints.reserve(static_cast<std::size_t>(size * averageSpacePoints));
0061 }
0062 
0063 void SeedContainer2::clear() noexcept {
0064   m_size = 0;
0065 
0066   m_spacePointOffsets.clear();
0067   m_spacePointCounts.clear();
0068   m_qualities.clear();
0069   m_vertexZs.clear();
0070   m_spacePoints.clear();
0071 }
0072 
0073 void SeedContainer2::assignSpacePointIndices(
0074     Index index, std::span<const SpacePointIndex2> spacePointIndices) {
0075   if (index >= size()) {
0076     throw std::out_of_range("Index out of range in SpacePointContainer2");
0077   }
0078   if (m_spacePointCounts[index] != 0) {
0079     throw std::logic_error("Space points already assigned to the seed");
0080   }
0081 
0082   m_spacePointOffsets[index] =
0083       static_cast<SpacePointIndex2>(m_spacePoints.size());
0084   m_spacePointCounts[index] =
0085       static_cast<std::uint8_t>(spacePointIndices.size());
0086   m_spacePoints.insert(m_spacePoints.end(), spacePointIndices.begin(),
0087                        spacePointIndices.end());
0088 }
0089 
0090 }  // namespace Acts