Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:45

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 <boost/test/unit_test.hpp>
0010 #include <boost/test/unit_test_log_formatter.hpp>
0011 
0012 #include "Acts/Definitions/Algebra.hpp"
0013 #include "Acts/Definitions/TrackParametrization.hpp"
0014 #include "Acts/Definitions/Units.hpp"
0015 #include "Acts/EventData/TransformationHelpers.hpp"
0016 #include "Acts/Geometry/GeometryContext.hpp"
0017 #include "Acts/MagneticField/ConstantBField.hpp"
0018 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0019 #include "Acts/Propagator/EigenStepper.hpp"
0020 #include "Acts/Propagator/Navigator.hpp"
0021 #include "Acts/Propagator/Propagator.hpp"
0022 #include "Acts/Propagator/StraightLineStepper.hpp"
0023 #include "Acts/Propagator/VoidNavigator.hpp"
0024 #include "Acts/Propagator/detail/JacobianEngine.hpp"
0025 #include "Acts/Surfaces/DiscSurface.hpp"
0026 #include "Acts/Surfaces/PlaneSurface.hpp"
0027 
0028 #include <cmath>
0029 #include <cstdlib>
0030 #include <exception>
0031 #include <iomanip>
0032 #include <iostream>
0033 #include <typeinfo>
0034 
0035 using namespace Acts;
0036 using namespace Acts::UnitLiterals;
0037 
0038 bool isDebugOutputEnabled() {
0039   std::array<boost::unit_test::output_format, 1> formats{
0040       boost::unit_test::OF_CLF};
0041   for (auto a_format : formats) {
0042     auto formatter = ::boost::unit_test::unit_test_log.get_formatter(a_format);
0043     if (formatter != nullptr) {
0044       return formatter->get_log_level() < boost::unit_test::log_test_units;
0045     }
0046   }
0047   return false;
0048 }
0049 
0050 #define MSG_DEBUG(a)               \
0051   if (isDebugOutputEnabled()) {    \
0052     std::stringstream msg;         \
0053     msg << a;                      \
0054     BOOST_TEST_MESSAGE(msg.str()); \
0055   }                                \
0056   do {                             \
0057   } while (0)
0058 
0059 namespace {
0060 /** Helper function to compute dt/ds
0061  * Helper function to compute the derivative of the time as function of the path
0062  * length
0063  */
0064 template <class T_ParticleHypothesis>
0065 double computeDtDs(const T_ParticleHypothesis &hypothesis, double qop) {
0066   return std::hypot(1., hypothesis.mass() / hypothesis.extractMomentum(qop));
0067 }
0068 
0069 /** Compute the path length derivatives for the free/bound to curvilinear
0070  * parameter transform.
0071  * @param direction the direction of trajectory at the location in question
0072  * @param qop q/p of the particle at the location in question in Acts units
0073  * @param bfield the magnetic field at the location in question in Acts units
0074  * @param particle_hypothesis the particle hypothesis e.g. Acts::ParticleHypothesis::pion()
0075  * @return path length derivatives ( dr(...)/ds, dt/ds, dr(...)/ds2, d qop/ds [== 0] )
0076  */
0077 template <class T_ParticleHypothesis>
0078 FreeToPathMatrix computeFreeToPathDerivatives(
0079     const Vector3 &direction, double qop, const Vector3 &bfield,
0080     const T_ParticleHypothesis &particle_hypothis) {
0081   FreeToPathMatrix path_length_deriv;
0082 #if defined(EIGEN_HAS_CONSTEXPR) && EIGEN_VERSION_AT_LEAST(3, 4, 0)
0083   static_assert(path_length_deriv.cols() ==
0084                 8);  // ensure that all elements are initialized
0085 #endif
0086   path_length_deriv.segment<3>(eFreePos0) = direction;
0087   path_length_deriv(0, eFreeTime) = computeDtDs(particle_hypothis, qop);
0088   path_length_deriv.segment<3>(eFreeDir0) =
0089       (qop * direction.cross(bfield)).transpose();
0090   path_length_deriv(0, Acts::eFreeQOverP) = 0.;
0091   return path_length_deriv;
0092 }
0093 template <typename T, std::size_t Rows, std::size_t Cols>
0094 constexpr Eigen::Matrix<T, Rows, Cols> makeMatrix(
0095     std::initializer_list<double> elements) {
0096   // static_assert( elements.size() == Rows*Cols )
0097   if (!(elements.size() == Rows * Cols)) {
0098     // throw std::range_error("Initializer list size does not match matrix
0099     // dimensions.");
0100     std::abort();
0101   }
0102   Eigen::Matrix<T, Rows, Cols> matrix;
0103   auto iter = elements.begin();
0104   for (unsigned int row_i = 0; row_i < matrix.rows(); ++row_i) {
0105     for (unsigned int col_i = 0; col_i < matrix.cols(); ++col_i) {
0106       matrix(row_i, col_i) = *iter;
0107       ++iter;
0108     }
0109   }
0110   return matrix;
0111 }
0112 template <typename T, std::size_t Rows>
0113 constexpr Eigen::Matrix<T, Rows, 1> makeVector(
0114     std::initializer_list<double> elements) {
0115   return makeMatrix<T, Rows, 1>(elements);
0116 }
0117 
0118 template <typename T_Matrix>
0119 T_Matrix matrixRatio(const T_Matrix &a, const T_Matrix &b) {
0120   if (a.rows() != b.rows() || a.cols() != b.cols()) {
0121     std::abort();
0122   }
0123   T_Matrix ret;
0124   for (unsigned int row_i = 0; row_i < a.rows(); ++row_i) {
0125     for (unsigned int col_i = 0; col_i < a.cols(); ++col_i) {
0126       if (b(row_i, col_i) == 0.) {
0127         ret(row_i, col_i) = a(row_i, col_i) - b(row_i, col_i);
0128       } else {
0129         ret(row_i, col_i) = a(row_i, col_i) / b(row_i, col_i);
0130       }
0131     }
0132   }
0133   return ret;
0134 }
0135 
0136 }  // namespace
0137 
0138 struct TestData {
0139   enum ESurfaceType { kPlane, kPolarDisk, kCylinder };
0140   TestData(Vector3 &&a_surface_center, SquareMatrix3 &&a_surface_rot,
0141            ESurfaceType a_surface_type, BoundVector &&a_param_vec,
0142            BoundSquareMatrix &&a_param_cov, Vector3 &&a_bfield)
0143       : surface_center(std::move(a_surface_center)),
0144         surface_rot(std::move(a_surface_rot)),
0145         surface_type(a_surface_type),
0146         param_vec(std::move(a_param_vec)),
0147         param_cov(std::move(a_param_cov)),
0148         bfield(std::move(a_bfield)) {}
0149 
0150   Vector3 surface_center;
0151   SquareMatrix3 surface_rot;
0152   ESurfaceType surface_type;
0153   BoundVector param_vec;
0154   BoundSquareMatrix param_cov;
0155   Vector3 bfield;
0156 };
0157 
0158 template <typename T_StepperCreator>
0159 void test_bound_to_curvilinear(const std::vector<TestData> &test_data_list,
0160                                const T_StepperCreator &stepper_creator) {
0161   GeometryContext geoCtx;
0162   MagneticFieldContext magFieldContext;
0163 
0164   for (const auto &test_data : test_data_list) {
0165     // create a constant magnetic field provider for the test_data
0166     std::shared_ptr<Acts::MagneticFieldProvider> bField =
0167         std::dynamic_pointer_cast<Acts::MagneticFieldProvider>(
0168             std::make_shared<ConstantBField>(test_data.bfield));
0169 
0170     // create bound parameters from test data
0171     const Vector3 &surface_center = test_data.surface_center;
0172     const SquareMatrix3 &surface_rot = test_data.surface_rot;
0173     const BoundVector &param_vec = test_data.param_vec;
0174     const BoundSquareMatrix &cov = test_data.param_cov;
0175 
0176     AngleAxis3 surface_transform0;
0177     surface_transform0 = surface_rot;
0178 
0179     std::shared_ptr<Surface> surface;
0180     switch (test_data.surface_type) {
0181       case TestData::kPlane: {
0182         surface = std::dynamic_pointer_cast<Surface>(
0183             Surface::makeShared<PlaneSurface>(Translation3(surface_center) *
0184                                               surface_transform0));
0185         break;
0186       }
0187       case TestData::kPolarDisk: {
0188         surface =
0189             std::dynamic_pointer_cast<Surface>(Surface::makeShared<DiscSurface>(
0190                 Translation3(surface_center) * surface_transform0));
0191         break;
0192       }
0193       default: {
0194         throw std::runtime_error("Unhandled surface type.");
0195         std::abort();
0196       }
0197     }
0198 
0199     Vector3 direction{cos(param_vec[2]) * sin(param_vec[3]),
0200                       sin(param_vec[2]) * sin(param_vec[3]), cos(param_vec[3])};
0201     Vector3 position(surface->localToGlobal(
0202         geoCtx, Vector2{param_vec[0], param_vec[1]}, direction));
0203     BoundTrackParameters params(surface, param_vec,
0204                                 std::optional<BoundSquareMatrix>(cov),
0205                                 ParticleHypothesis::pion());
0206 
0207     // compute curvilinear parameters by using the propagator with
0208     // a small step size : ==0, >0 but below path limit,  > path limit, *10 and
0209     // > path limit
0210     for (unsigned int i = 0; i < 4; ++i) {
0211       MagneticFieldProvider::Cache cache = bField->makeCache(magFieldContext);
0212 
0213       Result<Acts::Vector3> local_bfield = bField->getField(position, cache);
0214       assert(local_bfield.ok());
0215 
0216       auto path_length_derivatives = computeFreeToPathDerivatives(
0217           direction, params.parameters()[eBoundQOverP], local_bfield.value(),
0218           ParticleHypothesis::pion());
0219       MSG_DEBUG("derivatives : " << path_length_derivatives);
0220 
0221       // compute Jacobian for bound to curvilinear covariance transformation
0222       Acts::BoundMatrix b2c;
0223       Acts::detail::boundToCurvilinearTransportJacobian(
0224           direction, surface->boundToFreeJacobian(geoCtx, position, direction),
0225           Acts::FreeMatrix::Identity(),
0226           computeFreeToPathDerivatives(
0227               direction, params.parameters()[eBoundQOverP],
0228               local_bfield.value(), ParticleHypothesis::pion()),
0229           b2c);
0230 
0231       auto curvi_cov_alt = b2c * cov * b2c.transpose();
0232 
0233       MSG_DEBUG("curvilinear covariance alt.:" << std::endl << curvi_cov_alt);
0234 
0235       auto stepper = stepper_creator(bField);
0236       MSG_DEBUG("Stepper type " << typeid(stepper).name());
0237 
0238       using Stepper = decltype(stepper);
0239       using Propagator = Acts::Propagator<Stepper>;
0240       using PropagatorOptions = typename Propagator::template Options<>;
0241 
0242       // configure propagator for tiny step size
0243       PropagatorOptions null_propagation_options(geoCtx, magFieldContext);
0244 
0245       null_propagation_options.pathLimit =
0246           i == 0 ? 0 : 1e-12 * 1_m * std::pow(10, i - 1);
0247       if (null_propagation_options.pathLimit > 0 && i > 1) {
0248         null_propagation_options.stepping.stepTolerance =
0249             null_propagation_options.pathLimit * .99;
0250         null_propagation_options.surfaceTolerance =
0251             null_propagation_options.pathLimit * .99;
0252       }
0253 
0254       auto log_level = (isDebugOutputEnabled() ? Acts::Logging::VERBOSE
0255                                                : Acts::Logging::INFO);
0256 
0257       // Use propagator with small step size to compute parameters in
0258       // curvilinear parameterisation
0259       Propagator propagator(std::move(stepper), Acts::VoidNavigator(),
0260                             Acts::getDefaultLogger("Propagator", log_level));
0261       auto result =
0262           propagator.propagate(params, null_propagation_options, true);
0263       {
0264         const auto &curvilinear_parameters = result.value().endParameters;
0265         if (curvilinear_parameters.has_value() &&
0266             curvilinear_parameters.value().covariance().has_value()) {
0267           MSG_DEBUG(i << " | "
0268                       << "limit: " << null_propagation_options.pathLimit
0269                       << " tolerance: "
0270                       << null_propagation_options.stepping.stepTolerance
0271                       << std::endl);
0272 
0273           Acts::BoundSquareMatrix curvi_cov =
0274               curvilinear_parameters.value().covariance().value();
0275           MSG_DEBUG("curvilinear covariance:" << std::endl
0276                                               << curvi_cov << std::endl);
0277           if (isDebugOutputEnabled()) {
0278             Acts::BoundSquareMatrix b(curvi_cov_alt);
0279             auto ratio = matrixRatio(curvi_cov, b);
0280             MSG_DEBUG("ratio:" << std::endl << ratio << std::endl);
0281           }
0282           // test that result from propagation and explicit computation are
0283           // compatible.
0284           BOOST_CHECK(curvi_cov_alt.isApprox(curvi_cov));
0285         }
0286       }
0287     }
0288   }
0289 }
0290 
0291 std::vector<TestData> make_test_data(double mag_field_scale = 1.) {
0292   std::vector<TestData> test_data_list{
0293       TestData(
0294           makeVector<double, 3>(
0295               {-442.883, -624.094, 857.272}),  // surface center
0296           makeMatrix<double, 3, 3>({0.677197, 0.0176111, -0.735591, -0.735342,
0297                                     -0.0191232, -0.677426, -0.0259971, 0.999662,
0298                                     -2.22045e-16}),  // surface rot
0299           TestData::kPlane,
0300           makeVector<double, eBoundSize>({46.5758, 4.5564, -2.38067, 0.72974,
0301                                           0.73159, 1163.57}),  // param_vec
0302           makeMatrix<double, eBoundSize, eBoundSize>(
0303               {0.00025406,   0.00334274,  2.9713e-06,   -6.40317e-06,
0304                2.52229e-05,  0.00291208,  0.00334274,   9.77017,
0305                0.00109081,   -0.0106064,  -0.00340842,  7.25206,
0306                2.9713e-06,   0.00109081,  4.86984e-07,  -1.68459e-06,
0307                2.0707e-06,   0.000848693, -6.40317e-06, -0.0106064,
0308                -1.68459e-06, 1.58516e-05, 4.40043e-06,  -0.00786289,
0309                2.52229e-05,  -0.00340842, 2.0707e-06,   4.40043e-06,
0310                2.786e-05,    -0.00210611, 0.00291208,   7.25206,
0311                0.000848693,  -0.00786289, -0.00210611,  89880.9}),  // param cov
0312           makeVector<double, 3>({-2.64634e-05 * 1000_T, -4.38183e-05 * 1000_T,
0313                                  0.00197353 * 1000_T})),  // magnetic field
0314 
0315       TestData(
0316           makeVector<double, 3>(
0317               {-215.895, 979.521, 808.928}),  // surface center
0318           makeMatrix<double, 3, 3>(
0319               {-0.999319, -0.0259882, -0.0261772, -0.0261683, -0.00068053,
0320                0.999657, -0.0259971, 0.999662, -2.22045e-16}),  // surface rot
0321           TestData::kPlane,
0322           makeVector<double, eBoundSize>({-47.2414, -20.7881, 1.46297, 0.926114,
0323                                           0.723167, 1318.63}),  // param_vec
0324           makeMatrix<double, eBoundSize, eBoundSize>(
0325               {0.000299382,  -0.00331811,  -9.93116e-06,
0326                4.79934e-06,  9.50183e-06,  -0.00184948,
0327                -0.00331811,  0.212531,     -3.5517e-05,
0328                -0.00030374,  3.77471e-05,  0.129021,
0329                -9.93116e-06, -3.5517e-05,  1.26087e-06,
0330                2.63359e-08,  -1.11054e-06, -4.07474e-05,
0331                4.79934e-06,  -0.00030374,  2.63359e-08,
0332                2.42802e-06,  1.77196e-07,  -0.000180912,
0333                9.50183e-06,  3.77471e-05,  -1.11054e-06,
0334                1.77196e-07,  2.13352e-05,  0.000394159,
0335                -0.00184948,  0.129021,     -4.07474e-05,
0336                -0.000180912, 0.000394159,  89875.6}),  // param cov
0337           makeVector<double, 3>({-7.28154e-06 * 1000_T, 4.91679e-05 * 1000_T,
0338                                  0.00200021 * 1000_T})),  // magnetic field
0339 
0340       TestData(
0341           makeVector<double, 3>({-100.1, 9.9476e-14, 2623}),  // surface center
0342           makeMatrix<double, 3, 3>({-9.4369e-16, -1, -2.22045e-16, -1,
0343                                     9.4369e-16, 2.09541e-31, 0, 2.22045e-16,
0344                                     -1}),  // surface rot
0345           TestData::kPlane,
0346           makeVector<double, eBoundSize>({5.1223, 16.6267, -3.08166, 0.0439704,
0347                                           -0.0358564, 2625.58}),  // param_vec
0348           makeMatrix<double, eBoundSize, eBoundSize>(
0349               {0.00017846,   6.32301e-09,  1.31319e-05,
0350                3.28335e-08,  -1.37002e-07, 6.412e-07,
0351                6.32301e-09,  0.000178573,  -7.46352e-07,
0352                5.77821e-07,  1.22545e-08,  7.82577e-06,
0353                1.31319e-05,  -7.46352e-07, 4.27034e-05,
0354                -2.44549e-13, -2.98712e-09, 5.95667e-09,
0355                3.28335e-08,  5.77821e-07,  -2.44549e-13,
0356                8.26179e-08,  8.02087e-11,  2.53174e-08,
0357                -1.37002e-07, 1.22545e-08,  -2.98712e-09,
0358                8.02087e-11,  1.36315e-06,  -1.7853e-06,
0359                6.412e-07,    7.82577e-06,  5.95667e-09,
0360                2.53174e-08,  -1.7853e-06,  89875.5}),  // param cov
0361           makeVector<double, 3>({-5.04066e-05 * 1000_T, -1.84572e-06 * 1000_T,
0362                                  0.00107321 * 1000_T})),  // magnetic field
0363 
0364       TestData(
0365           makeVector<double, 3>(
0366               {-2.79072, 18.1615, 1962.71}),  // surface center
0367           makeMatrix<double, 3, 3>(
0368               {-0.986831, -0.161755, -2.38917e-17, -0.161755, 0.986831,
0369                -2.35312e-18, 2.39577e-17, 1.54245e-18, -1}),  // surface rot
0370           TestData::kPolarDisk,
0371           makeVector<double, eBoundSize>({874.522, -0.0199525, -2.87012,
0372                                           0.412785, -0.218474,
0373                                           2144.77}),  // param_vec
0374           makeMatrix<double, eBoundSize, eBoundSize>(
0375               {0.268052,     6.23529e-06,  -2.89316e-05,
0376                0.000334472,  6.69436e-06,  0.107219,
0377                6.23529e-06,  4.51554e-10,  -5.00139e-09,
0378                7.5944e-09,   1.32896e-09,  2.47693e-06,
0379                -2.89316e-05, -5.00139e-09, 1.10493e-06,
0380                -8.28542e-08, -1.11202e-07, -1.05201e-05,
0381                0.000334472,  7.5944e-09,   -8.28542e-08,
0382                7.43596e-07,  3.40043e-08,  0.00013338,
0383                6.69436e-06,  1.32896e-09,  -1.11202e-07,
0384                3.40043e-08,  2.28008e-06,  -1.3933e-05,
0385                0.107219,     2.47693e-06,  -1.05201e-05,
0386                0.00013338,   -1.3933e-05,  89875.6}),  // param cov
0387           makeVector<double, 3>({-0.000238594 * 1000_T, -3.95897e-05 * 1000_T,
0388                                  0.00170904 * 1000_T})),  // magnetic field
0389 
0390       TestData(
0391           makeVector<double, 3>(
0392               {-1.04461, -18.345, -2232.72}),  // surface center
0393           makeMatrix<double, 3, 3>(
0394               {-0.997764, 0.0668313, 1.22465e-16, 0.0668313, 0.997764,
0395                1.22465e-16, -1.14006e-16, 1.30375e-16, -1}),  // surface rot
0396           TestData::kPolarDisk,
0397           makeVector<double, eBoundSize>({919.923, -0.0334805, 3.06771, 2.75516,
0398                                           0.106936, 2410.21}),  // param_vec
0399           makeMatrix<double, eBoundSize, eBoundSize>(
0400               {0.249495,     -5.22193e-06, -3.13362e-06,
0401                -0.000237539, -8.44559e-08, 0.0938443,
0402                -5.22193e-06, 4.17316e-10,  -3.62456e-09,
0403                4.90101e-09,  2.09791e-10,  -1.95858e-06,
0404                -3.13362e-06, -3.62456e-09, 9.69964e-07,
0405                -1.38253e-08, -2.38732e-08, -1.43246e-06,
0406                -0.000237539, 4.90101e-09,  -1.38253e-08,
0407                4.54156e-07,  3.99992e-09,  -8.93313e-05,
0408                -8.44559e-08, 2.09791e-10,  -2.38732e-08,
0409                3.99992e-09,  5.6852e-07,   4.62431e-06,
0410                0.0938443,    -1.95858e-06, -1.43246e-06,
0411                -8.93313e-05, 4.62431e-06,  89875.6}),  // param cov
0412           makeVector<double, 3>({0.00036598 * 1000_T, -5.73626e-06 * 1000_T,
0413                                  0.0015599 * 1000_T})),  // magnetic field
0414 
0415       TestData(
0416           makeVector<double, 3>({2.25897, 16.0914, 1962.71}),  // surface center
0417           makeMatrix<double, 3, 3>({-0.99163, 0.129111, 2.38917e-17, 0.129111,
0418                                     0.99163, -2.35312e-18, -2.39955e-17,
0419                                     7.51254e-19, -1}),  // surface rot
0420           TestData::kPolarDisk,
0421           makeVector<double, eBoundSize>({855.523, -0.00206235, 2.78002,
0422                                           0.430255, 0.430811,
0423                                           2164.93}),  // param_vec
0424           makeMatrix<double, eBoundSize, eBoundSize>(
0425               {0.46359,      9.75743e-06,  0.000448092,
0426                0.000688107,  -0.000233571, 0.188268,
0427                9.75743e-06,  6.10067e-10,  -4.97007e-10,
0428                1.52396e-08,  3.93299e-09,  4.13675e-06,
0429                0.000448092,  -4.97007e-10, 4.44146e-06,
0430                8.69542e-07,  -2.28873e-06, 0.00014712,
0431                0.000688107,  1.52396e-08,  8.69542e-07,
0432                2.0094e-06,   -8.25987e-07, 0.000271189,
0433                -0.000233571, 3.93299e-09,  -2.28873e-06,
0434                -8.25987e-07, 4.58208e-05,  0.000645024,
0435                0.188268,     4.13675e-06,  0.00014712,
0436                0.000271189,  0.000645024,  89875.6}),  // param cov
0437           makeVector<double, 3>({-0.000235096 * 1000_T, 3.37809e-05 * 1000_T,
0438                                  0.00170337 * 1000_T})),  // magnetic field
0439 
0440       TestData(
0441           makeVector<double, 3>(
0442               {-956.977, -300.445, -563.272}),  // surface center
0443           makeMatrix<double, 3, 3>({0.113165, 0.00294296, -0.993572, -0.993236,
0444                                     -0.02583, -0.113203, -0.0259971, 0.999662,
0445                                     -9.95799e-17}),  // surface rot
0446           TestData::kPlane,
0447           makeVector<double, eBoundSize>({43.1027, -20.0508, -2.58378, 2.04794,
0448                                           -0.61896, 1281.4}),  // param_vec
0449           makeMatrix<double, eBoundSize, eBoundSize>(
0450               {0.000415869,  -0.00624916,  4.30188e-06,
0451                1.11988e-05,  -8.34103e-07, 0.00297658,
0452                -0.00624916,  0.287414,     0.000262654,
0453                -0.000530088, -1.45312e-05, -0.131126,
0454                4.30188e-06,  0.000262654,  2.57536e-06,
0455                -4.80124e-07, -2.45959e-07, -0.000110478,
0456                1.11988e-05,  -0.000530088, -4.80124e-07,
0457                3.87906e-06,  6.73799e-08,  0.0002415,
0458                -8.34103e-07, -1.45312e-05, -2.45959e-07,
0459                6.73799e-08,  4.23156e-06,  -4.9642e-05,
0460                0.00297658,   -0.131126,    -0.000110478,
0461                0.0002415,    -4.9642e-05,  89875.6}),  // param cov
0462           makeVector<double, 3>({3.50239e-05 * 1000_T, 1.16125e-05 * 1000_T,
0463                                  0.00201393 * 1000_T})),  // magnetic field
0464 
0465       TestData(
0466           makeVector<double, 3>(
0467               {-14.6729, -11.0605, 2860.72}),  // surface center
0468           makeMatrix<double, 3, 3>(
0469               {0.609896, -0.792481, -1.01826e-16, -0.792481, -0.609896,
0470                -1.90502e-16, 8.88665e-17, 1.96882e-16, -1}),  // surface rot
0471           TestData::kPolarDisk,
0472           makeVector<double, eBoundSize>({878.179, 0.0377489, -0.917117,
0473                                           0.298851, -0.155266,
0474                                           2993.62}),  // param_vec
0475           makeMatrix<double, eBoundSize, eBoundSize>(
0476               {0.247492,     5.75149e-06,  -7.25055e-06,
0477                0.000186384,  2.26831e-05,  0.0724092,
0478                5.75149e-06,  4.34292e-10,  -3.3005e-09,
0479                4.28514e-09,  1.10915e-10,  1.68264e-06,
0480                -7.25055e-06, -3.3005e-09,  5.13085e-07,
0481                -2.15014e-08, 1.38502e-07,  -3.13833e-06,
0482                0.000186384,  4.28514e-09,  -2.15014e-08,
0483                2.64484e-07,  4.58027e-08,  5.43642e-05,
0484                2.26831e-05,  1.10915e-10,  1.38502e-07,
0485                4.58027e-08,  5.0017e-06,   -3.05689e-05,
0486                0.0724092,    1.68264e-06,  -3.13833e-06,
0487                5.43642e-05,  -3.05689e-05, 89875.5}),  // param cov
0488           makeVector<double, 3>({0.000246188 * 1000_T, -0.000361053 * 1000_T,
0489                                  0.000756348 * 1000_T})),  // magnetic field
0490 
0491       TestData(
0492           makeVector<double, 3>({-748.018, 127.04, 1249.27}),  // surface center
0493           makeMatrix<double, 3, 3>({-0.368695, 0.00958824, -0.929501, -0.929187,
0494                                     0.0241643, 0.36882, 0.0259971, 0.999662,
0495                                     -2.22045e-16}),  // surface rot
0496           TestData::kPlane,
0497           makeVector<double, eBoundSize>({-12.7967, -0.0111021, 2.81269,
0498                                           0.548845, 0.365828,
0499                                           1466.51}),  // param_vec
0500           makeMatrix<double, eBoundSize, eBoundSize>(
0501               {0.000407068, 0.00585003,  -5.06759e-06, -1.4351e-06, 3.49367e-07,
0502                0.00501982,  0.00585003,  0.220933,     -5.8514e-05, 7.21617e-06,
0503                3.69039e-05, 0.189194,    -5.06759e-06, -5.8514e-05, 6.93556e-07,
0504                3.87361e-07, 2.09743e-07, -4.8068e-05,  -1.4351e-06, 7.21617e-06,
0505                3.87361e-07, 1.61864e-06, -3.89113e-08, 5.41601e-06, 3.49367e-07,
0506                3.69039e-05, 2.09743e-07, -3.89113e-08, 3.38809e-06, 6.8792e-05,
0507                0.00501982,  0.189194,    -4.8068e-05,  5.41601e-06, 6.8792e-05,
0508                89875.7}),  // param cov
0509           makeVector<double, 3>({-8.32767e-05 * 1000_T, 1.42907e-05 * 1000_T,
0510                                  0.00191073 * 1000_T})),  // magnetic field
0511 
0512       TestData(
0513           makeVector<double, 3>(
0514               {-522.319, -215.962, 1139.19}),  // surface center
0515           makeMatrix<double, 3, 3>({0.182174, 0.00473759, -0.983255, -0.982923,
0516                                     -0.0255617, -0.182236, -0.0259971, 0.999662,
0517                                     -2.22045e-16}),  // surface rot
0518           TestData::kPlane,
0519           makeVector<double, eBoundSize>({-15.9238, -9.71785, -2.58798,
0520                                           0.458544, -0.490701,
0521                                           1263.01}),  // param_vec
0522           makeMatrix<double, eBoundSize, eBoundSize>(
0523               {0.000388298,  -0.00663415, -4.45582e-06, -2.98583e-06,
0524                -1.79271e-07, -0.00594178, -0.00663415,  0.28281,
0525                0.000192569,  3.50465e-05, 4.73666e-05,  0.253947,
0526                -4.45582e-06, 0.000192569, 4.58913e-07,  -3.91615e-07,
0527                3.05147e-07,  0.000170095, -2.98583e-06, 3.50465e-05,
0528                -3.91615e-07, 9.06356e-07, 1.00807e-08,  3.10251e-05,
0529                -1.79271e-07, 4.73666e-05, 3.05147e-07,  1.00807e-08,
0530                3.51684e-06,  4.83158e-06, -0.00594178,  0.253947,
0531                0.000170095,  3.10251e-05, 4.83158e-06,  89875.7}),  // param cov
0532           makeVector<double, 3>({-5.25166e-05 * 1000_T, -2.12894e-05 * 1000_T,
0533                                  0.00191577 * 1000_T})),  // magnetic field
0534 
0535       TestData(
0536           makeVector<double, 3>({889.91, 463.263, 269.272}),  // surface center
0537           makeMatrix<double, 3, 3>({-0.28392, -0.00738357, 0.95882, 0.958496,
0538                                     0.0249265, 0.284016, -0.0259971, 0.999662,
0539                                     -2.22045e-16}),  // surface rot
0540           TestData::kPlane,
0541           makeVector<double, eBoundSize>({-31.3391, 22.7156, 0.668348, 1.23223,
0542                                           -0.672912, 887.012}),  // param_vec
0543           makeMatrix<double, eBoundSize, eBoundSize>(
0544               {0.000401596,  -0.00580898,  3.84845e-06,
0545                1.07378e-05,  -7.00551e-06, -0.00176611,
0546                -0.00580898,  0.260857,     0.000203293,
0547                -0.000491391, 1.75445e-05,  0.0869615,
0548                3.84845e-06,  0.000203293,  2.13361e-06,
0549                -3.99989e-07, -1.30627e-06, 8.83175e-05,
0550                1.07378e-05,  -0.000491391, -3.99989e-07,
0551                3.41664e-06,  1.46081e-07,  -0.000166376,
0552                -7.00551e-06, 1.75445e-05,  -1.30627e-06,
0553                1.46081e-07,  2.06909e-05,  -0.000261632,
0554                -0.00176611,  0.0869615,    8.83175e-05,
0555                -0.000166376, -0.000261632, 89875.6}),  // param cov
0556           makeVector<double, 3>({1.43009e-05 * 1000_T, 7.04031e-06 * 1000_T,
0557                                  0.00202663 * 1000_T}))  // magnetic field
0558 
0559   };
0560   if (mag_field_scale != 1.) {
0561     for (TestData &test_data : test_data_list) {
0562       test_data.bfield *= mag_field_scale;
0563     }
0564   }
0565   return test_data_list;
0566 }
0567 
0568 BOOST_AUTO_TEST_CASE(BoundToCurvilinearEigenStepper) {
0569   // Compare covariance in curvilinear parameterisation:
0570   // explicit computation vs. dummy propagation using EigenStepper
0571   std::vector<TestData> test_data_list(make_test_data());
0572   test_bound_to_curvilinear(
0573       test_data_list,
0574       [](const std::shared_ptr<Acts::MagneticFieldProvider> &bField) {
0575         return EigenStepper<>(bField);
0576       });
0577 }
0578 
0579 BOOST_AUTO_TEST_CASE(BoundToCurvilinearStraightLineStepper) {
0580   // Compare covariance in curvilinear parameterisation for vanishing magnetic
0581   // field: explicit computation vs. dummy propagation using StraightLineStepper
0582   std::vector<TestData> test_data_list(
0583       make_test_data(0.));  // scale magnetic field in test data to zero.
0584   test_bound_to_curvilinear(
0585       test_data_list,
0586       []([[maybe_unused]] const std::shared_ptr<Acts::MagneticFieldProvider>
0587              &bField) { return StraightLineStepper(); });
0588 }