Back to home page

EIC code displayed by LXR

 
 

    


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

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 
0011 #include "Acts/Definitions/TrackParametrization.hpp"
0012 #include "Acts/EventData/TrackParameterHelpers.hpp"
0013 #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp"
0014 
0015 BOOST_AUTO_TEST_SUITE(TrackParameterHelpers)
0016 
0017 BOOST_AUTO_TEST_CASE(isBoundVectorValid) {
0018   BOOST_CHECK(!Acts::isBoundVectorValid({1, 2, 3, 4, 5, 6}, true));
0019   BOOST_CHECK(Acts::isBoundVectorValid({1, 2, 1, 1, 5, 6}, true));
0020 }
0021 
0022 BOOST_AUTO_TEST_CASE(isFreeVectorValid) {
0023   BOOST_CHECK(!Acts::isFreeVectorValid({1, 2, 3, 4, 5, 6, 7, 8}));
0024   BOOST_CHECK(Acts::isFreeVectorValid({1, 2, 3, 4, 1, 0, 0, 8}));
0025 }
0026 
0027 BOOST_AUTO_TEST_CASE(normalizeBoundParameters) {
0028   CHECK_CLOSE_OR_SMALL(Acts::normalizeBoundParameters({1, 2, 3, 4, 5, 6}),
0029                        Acts::BoundVector(1, 2, -0.141593, 2.28319, 5, 6), 1e-3,
0030                        1e-3);
0031 }
0032 
0033 BOOST_AUTO_TEST_CASE(addBoundParameters) {
0034   CHECK_CLOSE_OR_SMALL(
0035       Acts::addBoundParameters({1, 2, 3, 4, 5, 6}, {0, 0, 0, 0, 0, 0}),
0036       Acts::normalizeBoundParameters({1, 2, 3, 4, 5, 6}), 1e-3, 1e-3);
0037   CHECK_CLOSE_OR_SMALL(
0038       Acts::addBoundParameters({1, 2, 3, 4, 5, 6}, {0, 0, 1, 1, 0, 0}),
0039       Acts::normalizeBoundParameters({1, 2, 4, 5, 5, 6}), 1e-3, 1e-3);
0040 }
0041 
0042 BOOST_AUTO_TEST_CASE(subtractBoundParameters) {
0043   CHECK_CLOSE_OR_SMALL(
0044       Acts::subtractBoundParameters({1, 2, 3, 4, 5, 6}, {1, 2, 3, 4, 5, 6}),
0045       Acts::BoundVector(0, 0, 0, 0, 0, 0), 1e-3, 1e-3);
0046   CHECK_CLOSE_OR_SMALL(
0047       Acts::addBoundParameters(
0048           Acts::subtractBoundParameters({1, 2, 3, 4, 5, 6}, {0, 0, 1, 1, 0, 0}),
0049           {0, 0, 1, 1, 0, 0}),
0050       Acts::normalizeBoundParameters({1, 2, 3, 4, 5, 6}), 1e-3, 1e-3);
0051 }
0052 
0053 BOOST_AUTO_TEST_SUITE_END()