EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VerticesHelperTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file VerticesHelperTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2018 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/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
12 
16 
17 #include <algorithm>
18 #include <limits>
19 
20 #include <Eigen/Geometry>
21 
22 namespace utf = boost::unit_test;
23 
24 namespace Acts {
25 
26 namespace detail {
27 
28 namespace Test {
29 
30 BOOST_AUTO_TEST_SUITE(Surfaces)
31 
32 BOOST_AUTO_TEST_CASE(VerticesHelperOnHyperPlane) {
33  // Create the transform
34  Transform3D transform(AngleAxis3D(0.234, Vector3D(0., 1., 0.)) *
35  AngleAxis3D(-0.734, Vector3D(1., 1., 1.).normalized()) *
36  Translation3D(Vector3D(-1., 2., 3.)));
37 
38  auto trfSpace = [](std::vector<Vector3D>& vtxs,
39  const Transform3D& trf) -> void {
40  std::transform(vtxs.begin(), vtxs.end(), vtxs.begin(),
41  [&](auto& v) { return (trf * v); });
42  };
43 
44  // x-y plane test
45  std::vector<Vector3D> xyplane = {Vector3D(1., 3., 0.), Vector3D(-2., 1., 0.),
46  Vector3D(5., 8., 0.), Vector3D(-9., -9., 0.),
47  Vector3D(5., 0., 0.), Vector3D(3., 1., 0.)};
48 
49  trfSpace(xyplane, transform);
50 
51  // All on a hyper plane
52  BOOST_CHECK(VerticesHelper::onHyperPlane(xyplane));
53  // One outside the s_onSurfaceTolerance
54  xyplane.push_back(transform * Vector3D(3., -4., 0.05));
55  BOOST_CHECK(!VerticesHelper::onHyperPlane(xyplane));
56  // But inside extended tolerance
57  BOOST_CHECK(VerticesHelper::onHyperPlane(xyplane, 0.6));
58 }
59 
60 BOOST_AUTO_TEST_SUITE_END()
61 
62 } // namespace Test
63 } // namespace detail
64 } // namespace Acts