Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MeasurementHelpersTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MeasurementHelpersTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <boost/test/unit_test.hpp>
10 
13 
14 BOOST_AUTO_TEST_SUITE(EventDataMeasurementHelpers)
15 
16 BOOST_AUTO_TEST_CASE(visit_measurement_test) {
17  // Overallocated full size parameter vector and covariance
18  Acts::BoundVector parFull = Acts::BoundVector::Random();
19  Acts::BoundMatrix covFull = Acts::BoundMatrix::Random();
20  // constant variants
21  const auto& parFullConst = parFull;
22  const auto& covFullConst = covFull;
23 
24  for (Acts::BoundVector::Index dim = 1; dim <= parFull.size(); ++dim) {
25  Acts::visit_measurement(parFull, covFull, dim, [&](auto param, auto cov) {
26  BOOST_CHECK_EQUAL(param, parFull.head(dim));
27  BOOST_CHECK_EQUAL(cov, covFull.topLeftCorner(dim, dim));
28  });
30  parFull, covFull, dim, [&](const auto& param, const auto& cov) {
31  BOOST_CHECK_EQUAL(param, parFull.head(dim));
32  BOOST_CHECK_EQUAL(cov, covFull.topLeftCorner(dim, dim));
33  });
34  Acts::visit_measurement(parFullConst, covFullConst, dim,
35  [&](const auto& param, const auto& cov) {
36  BOOST_CHECK_EQUAL(param, parFullConst.head(dim));
37  BOOST_CHECK_EQUAL(
38  cov, covFullConst.topLeftCorner(dim, dim));
39  });
40  }
41 }
42 
43 BOOST_AUTO_TEST_SUITE_END()