Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:48

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 "ActsExamples/EventData/Measurement.hpp"
0010 
0011 #include "Acts/Geometry/GeometryIdentifier.hpp"
0012 #include "ActsExamples/EventData/IndexSourceLink.hpp"
0013 
0014 namespace ActsExamples {
0015 
0016 MeasurementContainer::MeasurementContainer() = default;
0017 
0018 std::size_t MeasurementContainer::size() const {
0019   return m_entries.size();
0020 }
0021 
0022 void MeasurementContainer::reserve(std::size_t size) {
0023   m_geometryIds.reserve(size);
0024   m_subspaceIndices.reserve(size * 2);
0025   m_parameters.reserve(size * 2);
0026   m_covariances.reserve(size * 2 * 2);
0027 }
0028 
0029 std::size_t MeasurementContainer::addMeasurement(
0030     std::uint8_t size, Acts::GeometryIdentifier geometryId) {
0031   m_entries.push_back({m_subspaceIndices.size(), m_parameters.size(),
0032                        m_covariances.size(), size});
0033   m_geometryIds.emplace_back(geometryId);
0034   m_subspaceIndices.resize(m_subspaceIndices.size() + size);
0035   m_parameters.resize(m_parameters.size() + size);
0036   m_covariances.resize(m_covariances.size() + size * size);
0037 
0038   std::size_t index = m_entries.size() - 1;
0039   IndexSourceLink sourceLink(geometryId, index);
0040   m_orderedIndices.emplace_hint(m_orderedIndices.end(), sourceLink);
0041 
0042   return index;
0043 }
0044 
0045 MeasurementContainer::VariableProxy MeasurementContainer::at(
0046     std::size_t index) {
0047   return VariableProxy{*this, index};
0048 }
0049 
0050 MeasurementContainer::ConstVariableProxy MeasurementContainer::at(
0051     std::size_t index) const {
0052   return ConstVariableProxy{*this, index};
0053 }
0054 
0055 MeasurementContainer::VariableProxy MeasurementContainer::getMeasurement(
0056     std::size_t index) {
0057   return VariableProxy{*this, index};
0058 }
0059 
0060 MeasurementContainer::ConstVariableProxy MeasurementContainer::getMeasurement(
0061     std::size_t index) const {
0062   return ConstVariableProxy{*this, index};
0063 }
0064 
0065 MeasurementContainer::VariableProxy MeasurementContainer::makeMeasurement(
0066     std::uint8_t size, Acts::GeometryIdentifier geometryId) {
0067   return getMeasurement(addMeasurement(size, geometryId));
0068 }
0069 
0070 const MeasurementContainer::OrderedIndices&
0071 MeasurementContainer::orderedIndices() const {
0072   return m_orderedIndices;
0073 }
0074 
0075 MeasurementContainer::iterator MeasurementContainer::begin() {
0076   return iterator{*this, 0};
0077 }
0078 
0079 MeasurementContainer::iterator MeasurementContainer::end() {
0080   return iterator{*this, m_entries.size()};
0081 }
0082 
0083 MeasurementContainer::const_iterator MeasurementContainer::begin() const {
0084   return const_iterator{*this, 0};
0085 }
0086 
0087 MeasurementContainer::const_iterator MeasurementContainer::end() const {
0088   return const_iterator{*this, m_entries.size()};
0089 }
0090 
0091 MeasurementContainer::const_iterator MeasurementContainer::cbegin() const {
0092   return const_iterator{*this, 0};
0093 }
0094 
0095 MeasurementContainer::const_iterator MeasurementContainer::cend() const {
0096   return const_iterator{*this, m_entries.size()};
0097 }
0098 
0099 }  // namespace ActsExamples