Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow copy of measurements in Examples #3911

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions Examples/Framework/include/ActsExamples/EventData/Measurement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,16 @@

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/TrackParametrization.hpp"
#include "Acts/EventData/MeasurementHelpers.hpp"
#include "Acts/EventData/SubspaceHelpers.hpp"
#include "Acts/EventData/Types.hpp"
#include "Acts/EventData/detail/ParameterTraits.hpp"
#include "Acts/EventData/detail/PrintParameters.hpp"
#include "Acts/Geometry/GeometryIdentifier.hpp"
#include "Acts/Utilities/Iterator.hpp"
#include "ActsExamples/EventData/GeometryContainers.hpp"
#include "ActsExamples/EventData/IndexSourceLink.hpp"
#include "ActsExamples/EventData/MeasurementConcept.hpp"

#include <array>
#include <compare>
#include <concepts>
#include <cstddef>
#include <iosfwd>
#include <iterator>
#include <type_traits>
#include <variant>
#include <vector>

#include <boost/container/static_vector.hpp>
Expand Down Expand Up @@ -138,6 +129,11 @@ class MeasurementContainer {
return getMeasurement<Size>(addMeasurement(Size, geometryId));
}

template <MeasurementConcept OtherDerived>
VariableProxy copyMeasurement(const OtherDerived& other);
template <MeasurementConcept OtherDerived, std::size_t Size>
FixedProxy<Size> copyMeasurement(const OtherDerived& other);

template <typename... Args>
VariableProxy emplaceMeasurement(std::uint8_t size,
Acts::GeometryIdentifier geometryId,
Expand Down Expand Up @@ -494,6 +490,22 @@ class VariableMeasurementProxy
}
};

template <MeasurementConcept OtherDerived>
MeasurementContainer::VariableProxy MeasurementContainer::copyMeasurement(
const OtherDerived& other) {
VariableProxy meas = makeMeasurement(other.size(), other.geometryId());
meas.copyFrom(other);
return meas;
}

template <MeasurementConcept OtherDerived, std::size_t Size>
MeasurementContainer::FixedProxy<Size> MeasurementContainer::copyMeasurement(
const OtherDerived& other) {
FixedProxy<Size> meas = makeMeasurement<Size>(other.geometryId());
meas.copyFrom(other);
return meas;
}
andiwand marked this conversation as resolved.
Show resolved Hide resolved

template <typename... Args>
MeasurementContainer::VariableProxy MeasurementContainer::emplaceMeasurement(
std::uint8_t size, Acts::GeometryIdentifier geometryId, Args&&... args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#pragma once

#include "Acts/EventData/SourceLink.hpp"
#include "Acts/Geometry/GeometryIdentifier.hpp"

#include <concepts>
Expand All @@ -23,4 +22,5 @@ concept MeasurementConcept = requires(const T& m) {
{ m.parameters() };
{ m.covariance() };
};

} // namespace ActsExamples
Loading