Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:11:19

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2016-2020 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #include <boost/test/unit_test.hpp>
0010 
0011 #include "Acts/Definitions/TrackParametrization.hpp"
0012 #include "Acts/EventData/MeasurementHelpers.hpp"
0013 
0014 BOOST_AUTO_TEST_SUITE(EventDataMeasurementHelpers)
0015 
0016 BOOST_AUTO_TEST_CASE(visit_measurement_test) {
0017   // Overallocated full size parameter vector and covariance
0018   Acts::BoundVector parFull = Acts::BoundVector::Random();
0019   Acts::BoundMatrix covFull = Acts::BoundMatrix::Random();
0020   // constant variants
0021   const auto& parFullConst = parFull;
0022   const auto& covFullConst = covFull;
0023 
0024   for (Acts::BoundVector::Index dim = 1; dim <= parFull.size(); ++dim) {
0025     Acts::visit_measurement(parFull, covFull, dim, [&](auto param, auto cov) {
0026       BOOST_CHECK_EQUAL(param, parFull.head(dim));
0027       BOOST_CHECK_EQUAL(cov, covFull.topLeftCorner(dim, dim));
0028     });
0029     Acts::visit_measurement(
0030         parFull, covFull, dim, [&](const auto& param, const auto& cov) {
0031           BOOST_CHECK_EQUAL(param, parFull.head(dim));
0032           BOOST_CHECK_EQUAL(cov, covFull.topLeftCorner(dim, dim));
0033         });
0034     Acts::visit_measurement(parFullConst, covFullConst, dim,
0035                             [&](const auto& param, const auto& cov) {
0036                               BOOST_CHECK_EQUAL(param, parFullConst.head(dim));
0037                               BOOST_CHECK_EQUAL(
0038                                   cov, covFullConst.topLeftCorner(dim, dim));
0039                             });
0040   }
0041 }
0042 
0043 BOOST_AUTO_TEST_SUITE_END()