Analysis Software
Documentation for sPHENIX simulation 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 
15 
16 #include <algorithm>
17 #include <vector>
18 
19 #include <Eigen/Geometry>
20 
21 namespace utf = boost::unit_test;
22 
23 namespace Acts {
24 
25 namespace detail {
26 
27 namespace Test {
28 
29 BOOST_AUTO_TEST_SUITE(Surfaces)
30 
31 BOOST_AUTO_TEST_CASE(VerticesHelperOnHyperPlane) {
32  // Create the transform
33  Transform3 transform(AngleAxis3(0.234, Vector3(0., 1., 0.)) *
34  AngleAxis3(-0.734, Vector3(1., 1., 1.).normalized()) *
35  Translation3(Vector3(-1., 2., 3.)));
36 
37  auto trfSpace = [](std::vector<Vector3>& vtxs,
38  const Transform3& trf) -> void {
39  std::transform(vtxs.begin(), vtxs.end(), vtxs.begin(),
40  [&](auto& v) { return (trf * v); });
41  };
42 
43  // x-y plane test
44  std::vector<Vector3> xyplane = {Vector3(1., 3., 0.), Vector3(-2., 1., 0.),
45  Vector3(5., 8., 0.), Vector3(-9., -9., 0.),
46  Vector3(5., 0., 0.), Vector3(3., 1., 0.)};
47 
48  trfSpace(xyplane, transform);
49 
50  // All on a hyper plane
51  BOOST_CHECK(VerticesHelper::onHyperPlane(xyplane));
52  // One outside the s_onSurfaceTolerance
53  xyplane.push_back(transform * Vector3(3., -4., 0.05));
54  BOOST_CHECK(!VerticesHelper::onHyperPlane(xyplane));
55  // But inside extended tolerance
56  BOOST_CHECK(VerticesHelper::onHyperPlane(xyplane, 0.6));
57 }
58 
59 BOOST_AUTO_TEST_SUITE_END()
60 
61 } // namespace Test
62 } // namespace detail
63 } // namespace Acts