Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2017-2018 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/data/test_case.hpp>
0010 #include <boost/test/tools/output_test_stream.hpp>
0011 #include <boost/test/unit_test.hpp>
0012 
0013 #include "Acts/Definitions/Algebra.hpp"
0014 #include "Acts/Surfaces/detail/VerticesHelper.hpp"
0015 
0016 #include <algorithm>
0017 #include <vector>
0018 
0019 #include <Eigen/Geometry>
0020 
0021 namespace Acts {
0022 namespace detail {
0023 namespace Test {
0024 BOOST_AUTO_TEST_SUITE(Surfaces)
0025 
0026 BOOST_AUTO_TEST_CASE(VerticesHelperOnHyperPlane) {
0027   // Create the transform
0028   Transform3 transform(AngleAxis3(0.234, Vector3(0., 1., 0.)) *
0029                        AngleAxis3(-0.734, Vector3(1., 1., 1.).normalized()) *
0030                        Translation3(Vector3(-1., 2., 3.)));
0031 
0032   auto trfSpace = [](std::vector<Vector3>& vtxs,
0033                      const Transform3& trf) -> void {
0034     std::transform(vtxs.begin(), vtxs.end(), vtxs.begin(),
0035                    [&](auto& v) { return (trf * v); });
0036   };
0037 
0038   // x-y plane test
0039   std::vector<Vector3> xyplane = {Vector3(1., 3., 0.), Vector3(-2., 1., 0.),
0040                                   Vector3(5., 8., 0.), Vector3(-9., -9., 0.),
0041                                   Vector3(5., 0., 0.), Vector3(3., 1., 0.)};
0042 
0043   trfSpace(xyplane, transform);
0044 
0045   // All on a hyper plane
0046   BOOST_CHECK(VerticesHelper::onHyperPlane(xyplane));
0047   // One outside the s_onSurfaceTolerance
0048   xyplane.push_back(transform * Vector3(3., -4., 0.05));
0049   BOOST_CHECK(!VerticesHelper::onHyperPlane(xyplane));
0050   // But inside extended tolerance
0051   BOOST_CHECK(VerticesHelper::onHyperPlane(xyplane, 0.6));
0052 }
0053 
0054 BOOST_AUTO_TEST_SUITE_END()
0055 }  // namespace Test
0056 }  // namespace detail
0057 }  // namespace Acts