-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
|
||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2024 CERN for the benefit of the Acts project | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#include "ActsExamples/EventData/Measurement.hpp" | ||
|
||
namespace ActsExamples { | ||
|
||
MeasurementContainer::MeasurementContainer() = default; | ||
|
||
std::size_t MeasurementContainer::size() const { | ||
return m_entries.size(); | ||
} | ||
|
||
void MeasurementContainer::reserve(std::size_t size) { | ||
m_sourceLinks.reserve(size); | ||
m_parameters.reserve(size * 2); | ||
m_covariances.reserve(size * 2 * 2); | ||
m_subspaceIndices.reserve(size * 2); | ||
} | ||
|
||
std::size_t MeasurementContainer::addMeasurement(std::uint8_t size) { | ||
m_subspaceIndices.resize(m_subspaceIndices.size() + size); | ||
m_entries.push_back({m_parameters.size(), m_covariances.size(), | ||
m_subspaceIndices.size(), size}); | ||
m_parameters.resize(m_parameters.size() + size); | ||
m_covariances.resize(m_covariances.size() + size * size); | ||
return m_entries.size() - 1; | ||
} | ||
|
||
MeasurementContainer::VariableProxy MeasurementContainer::getMeasurement( | ||
std::size_t index) { | ||
return VariableProxy{*this, index}; | ||
} | ||
|
||
MeasurementContainer::ConstVariableProxy MeasurementContainer::getMeasurement( | ||
std::size_t index) const { | ||
return ConstVariableProxy{*this, index}; | ||
} | ||
|
||
MeasurementContainer::VariableProxy MeasurementContainer::makeMeasurement( | ||
std::uint8_t size) { | ||
return getMeasurement(addMeasurement(size)); | ||
} | ||
|
||
MeasurementContainer::Iterator MeasurementContainer::begin() { | ||
return Iterator{*this, 0}; | ||
} | ||
|
||
MeasurementContainer::Iterator MeasurementContainer::end() { | ||
return Iterator{*this, m_entries.size()}; | ||
} | ||
|
||
MeasurementContainer::ConstIterator MeasurementContainer::begin() const { | ||
return ConstIterator{*this, 0}; | ||
} | ||
|
||
MeasurementContainer::ConstIterator MeasurementContainer::end() const { | ||
return ConstIterator{*this, m_entries.size()}; | ||
} | ||
|
||
} // namespace ActsExamples |