File indexing completed on 2025-01-18 09:13:04
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/data/test_case.hpp>
0010 #include <boost/test/unit_test.hpp>
0011
0012 #include "Acts/Definitions/Algebra.hpp"
0013 #include "Acts/Definitions/TrackParametrization.hpp"
0014 #include "Acts/EventData/detail/GenerateParameters.hpp"
0015 #include "Acts/Geometry/GeometryIdentifier.hpp"
0016 #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp"
0017 #include "ActsExamples/EventData/Measurement.hpp"
0018
0019 #include <algorithm>
0020 #include <array>
0021 #include <cmath>
0022 #include <limits>
0023 #include <random>
0024 #include <tuple>
0025 #include <utility>
0026 #include <variant>
0027 #include <vector>
0028
0029 using namespace Acts;
0030 using namespace Acts::detail::Test;
0031 using namespace ActsExamples;
0032 namespace bd = boost::unit_test::data;
0033
0034 namespace {
0035 constexpr BoundIndices boundIndices[] = {
0036 eBoundLoc0, eBoundLoc1, eBoundTime, eBoundPhi, eBoundTheta, eBoundQOverP,
0037 };
0038 constexpr Acts::GeometryIdentifier geoId = 1;
0039
0040 std::default_random_engine rng(123);
0041 }
0042
0043
0044
0045
0046
0047 BOOST_AUTO_TEST_SUITE(EventDataMeasurement)
0048
0049 BOOST_DATA_TEST_CASE(VariableBoundOne, bd::make(boundIndices), index) {
0050 MeasurementContainer container;
0051
0052 auto [params, cov] = generateParametersCovariance<double, 1u>(rng);
0053
0054 FixedBoundMeasurementProxy<1> meas = container.makeMeasurement<1>(geoId);
0055 meas.setSubspaceIndices(std::array{index});
0056 meas.parameters() = params;
0057 meas.covariance() = cov;
0058
0059 BOOST_CHECK_EQUAL(meas.size(), 1);
0060 for (auto i : boundIndices) {
0061 BOOST_CHECK_EQUAL(meas.contains(i), i == index);
0062 }
0063 BOOST_CHECK_EQUAL(meas.parameters(), params);
0064 BOOST_CHECK_EQUAL(meas.covariance(), cov);
0065 BOOST_CHECK_EQUAL(meas.geometryId(), geoId);
0066 }
0067
0068 BOOST_DATA_TEST_CASE(VariableBoundOneEmplace, bd::make(boundIndices), index) {
0069 MeasurementContainer container;
0070
0071 auto [params, cov] = generateParametersCovariance<double, 1u>(rng);
0072
0073 FixedBoundMeasurementProxy<1> meas =
0074 container.emplaceMeasurement<1>(geoId, std::array{index}, params, cov);
0075
0076 BOOST_CHECK_EQUAL(meas.size(), 1);
0077 for (auto i : boundIndices) {
0078 BOOST_CHECK_EQUAL(meas.contains(i), i == index);
0079 }
0080 BOOST_CHECK_EQUAL(meas.parameters(), params);
0081 BOOST_CHECK_EQUAL(meas.covariance(), cov);
0082 BOOST_CHECK_EQUAL(meas.geometryId(), geoId);
0083 }
0084
0085 BOOST_AUTO_TEST_CASE(VariableBoundAll) {
0086 MeasurementContainer container;
0087
0088 auto [params, cov] = generateParametersCovariance<double, eBoundSize>(rng);
0089
0090 FixedBoundMeasurementProxy<eBoundSize> meas =
0091 container.makeMeasurement<eBoundSize>(geoId);
0092 meas.setSubspaceIndices(std::array{eBoundLoc0, eBoundLoc1, eBoundTime,
0093 eBoundPhi, eBoundTheta, eBoundQOverP});
0094 meas.parameters() = params;
0095 meas.covariance() = cov;
0096
0097 BOOST_CHECK_EQUAL(meas.size(), eBoundSize);
0098 for (auto i : boundIndices) {
0099 BOOST_CHECK(meas.contains(i));
0100 }
0101 BOOST_CHECK_EQUAL(meas.parameters(), params);
0102 BOOST_CHECK_EQUAL(meas.covariance(), cov);
0103 BOOST_CHECK_EQUAL(meas.geometryId(), geoId);
0104 }
0105
0106 BOOST_AUTO_TEST_CASE(VariableBoundAllEmplace) {
0107 MeasurementContainer container;
0108
0109 auto [params, cov] = generateParametersCovariance<double, eBoundSize>(rng);
0110
0111 FixedBoundMeasurementProxy<eBoundSize> meas =
0112 container.emplaceMeasurement<eBoundSize>(
0113 geoId,
0114 std::array{eBoundLoc0, eBoundLoc1, eBoundTime, eBoundPhi, eBoundTheta,
0115 eBoundQOverP},
0116 params, cov);
0117
0118 BOOST_CHECK_EQUAL(meas.size(), eBoundSize);
0119 for (auto i : boundIndices) {
0120 BOOST_CHECK(meas.contains(i));
0121 }
0122 BOOST_CHECK_EQUAL(meas.parameters(), params);
0123 BOOST_CHECK_EQUAL(meas.covariance(), cov);
0124 BOOST_CHECK_EQUAL(meas.geometryId(), geoId);
0125 }
0126
0127 BOOST_AUTO_TEST_CASE(VariableBoundReassign) {
0128 MeasurementContainer container;
0129
0130
0131 auto [params1, cov1] = generateParametersCovariance<double, 2u>(rng);
0132
0133 VariableBoundMeasurementProxy meas = container.makeMeasurement(2, geoId);
0134 meas.setSubspaceIndices(std::array{eBoundPhi, eBoundTheta});
0135 meas.parameters() = params1;
0136 meas.covariance() = cov1;
0137
0138 BOOST_CHECK_EQUAL(meas.size(), 2);
0139 BOOST_CHECK(!meas.contains(eBoundLoc0));
0140 BOOST_CHECK(!meas.contains(eBoundLoc1));
0141 BOOST_CHECK(!meas.contains(eBoundTime));
0142 BOOST_CHECK(meas.contains(eBoundPhi));
0143 BOOST_CHECK(meas.contains(eBoundTheta));
0144 BOOST_CHECK(!meas.contains(eBoundQOverP));
0145
0146
0147 auto [paramsN, covN] = generateParametersCovariance<double, eBoundSize>(rng);
0148
0149 meas = container.makeMeasurement(eBoundSize, geoId);
0150 meas.setSubspaceIndices(std::array{eBoundLoc0, eBoundLoc1, eBoundTime,
0151 eBoundPhi, eBoundTheta, eBoundQOverP});
0152 meas.parameters() = paramsN;
0153 meas.covariance() = covN;
0154
0155 BOOST_CHECK_EQUAL(meas.size(), eBoundSize);
0156 BOOST_CHECK(meas.contains(eBoundLoc0));
0157 BOOST_CHECK(meas.contains(eBoundLoc1));
0158 BOOST_CHECK(meas.contains(eBoundTime));
0159 BOOST_CHECK(meas.contains(eBoundPhi));
0160 BOOST_CHECK(meas.contains(eBoundTheta));
0161 BOOST_CHECK(meas.contains(eBoundQOverP));
0162 }
0163
0164 BOOST_AUTO_TEST_SUITE_END()