Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NavigationLayerTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file NavigationLayerTests.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 #include "Acts/Geometry/Layer.hpp"
19 
20 #include <cmath>
21 #include <memory>
22 #include <utility>
23 
24 #include "../Surfaces/SurfaceStub.hpp"
25 
26 using boost::test_tools::output_test_stream;
27 namespace utf = boost::unit_test;
28 
29 namespace Acts {
30 
31 namespace Test {
32 
33 // Create a test context
35 
36 namespace Layers {
37 BOOST_AUTO_TEST_SUITE(Layers)
38 
39 
40 BOOST_AUTO_TEST_CASE(NavigationLayerConstruction) {
41  // default constructor, copy and assignment are all deleted
42  std::shared_ptr<const Surface> pSurface = Surface::makeShared<SurfaceStub>();
43  auto pNavigationLayer = NavigationLayer::create(std::move(pSurface));
44  BOOST_CHECK_EQUAL(pNavigationLayer->layerType(), LayerType::navigation);
45  // next level: with thickness
46  const double thickness = 0.1;
47  auto pSurface2 = Surface::makeShared<SurfaceStub>();
48  auto pThickNavigationLayer =
49  NavigationLayer::create(std::move(pSurface2), thickness);
50  BOOST_CHECK_EQUAL(pThickNavigationLayer->layerType(), LayerType::navigation);
51 }
52 
54 BOOST_AUTO_TEST_CASE(NavigationLayerProperties) {
55  const double thickness = 0.1;
56  std::shared_ptr<const Surface> pSurface = Surface::makeShared<SurfaceStub>();
57  auto rawSurfacePtr = pSurface.get();
58  auto pNavigationLayer =
59  NavigationLayer::create(std::move(pSurface), thickness);
61  Vector3 origin{0., 0., 0.};
62  // binningPosition(), needs a better test
63  BOOST_CHECK_EQUAL(pNavigationLayer->binningPosition(tgContext, b), origin);
64  // surfaceRepresentation() [looks dangerous]
65  BOOST_CHECK_EQUAL(rawSurfacePtr,
66  &(pNavigationLayer->surfaceRepresentation()));
67  // isOnLayer()
68  BOOST_CHECK(pNavigationLayer->isOnLayer(tgContext, origin, true));
69  // isOnLayer()
70  Vector3 crazyPosition{1000., 10000., std::nan("")};
71  // layer stub has hard-coded globalToLocal return value
72  BOOST_CHECK(pNavigationLayer->isOnLayer(tgContext, crazyPosition, true));
73  // resolve()
74  BOOST_CHECK(!pNavigationLayer->resolve(true, true, true));
75 }
76 
77 BOOST_AUTO_TEST_SUITE_END()
78 } // namespace Layers
79 } // namespace Test
80 
81 } // namespace Acts