ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DiscLayerTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DiscLayerTests.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 
24 
25 #include "LayerStub.hpp"
26 
27 using boost::test_tools::output_test_stream;
28 namespace utf = boost::unit_test;
29 
30 namespace Acts {
31 
32 namespace Test {
33 
34 // Create a test context
36 
37 namespace Layers {
38 BOOST_AUTO_TEST_SUITE(Layers)
39 
40 
41 BOOST_AUTO_TEST_CASE(DiscLayerConstruction) {
42  // default constructor, copy and assignment are all deleted
43  // minimally need a Transform3D and a PlanarBounds object (e.g.
44  // RadialBounds) to construct
45  Translation3D translation{0., 1., 2.};
46  auto pTransform = std::make_shared<const Transform3D>(translation);
47  const double minRad(5.), maxRad(10.); // 20 x 10 disc
48  auto pDisc = std::make_shared<const RadialBounds>(minRad, maxRad);
49  auto pDiscLayer = DiscLayer::create(pTransform, pDisc, nullptr, 1.);
50  BOOST_CHECK_EQUAL(pDiscLayer->layerType(), LayerType::passive);
51  // next level: need an array of Surfaces;
52  // bounds object, rectangle type
53  auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
55  std::shared_ptr<const Transform3D> pNullTransform{};
56  const std::vector<std::shared_ptr<const Surface>> aSurfaces{
57  Surface::makeShared<PlaneSurface>(pNullTransform, rBounds),
58  Surface::makeShared<PlaneSurface>(pNullTransform, rBounds)};
59  const double thickness(1.0);
60  auto pDiscLayerFromSurfaces =
61  DiscLayer::create(pTransform, pDisc, nullptr, 1.);
62  BOOST_CHECK_EQUAL(pDiscLayerFromSurfaces->layerType(), LayerType::passive);
63  // construct with thickness:
64  auto pDiscLayerWithThickness =
65  DiscLayer::create(pTransform, pDisc, nullptr, thickness);
66  BOOST_CHECK_EQUAL(pDiscLayerWithThickness->thickness(), thickness);
67  // with an approach descriptor...
68  std::unique_ptr<ApproachDescriptor> ad(
69  new GenericApproachDescriptor(aSurfaces));
70  auto adPtr = ad.get();
71  auto pDiscLayerWithApproachDescriptor =
72  DiscLayer::create(pTransform, pDisc, nullptr, thickness, std::move(ad));
73  BOOST_CHECK_EQUAL(pDiscLayerWithApproachDescriptor->approachDescriptor(),
74  adPtr);
75  // with the layerType specified...
76  auto pDiscLayerWithLayerType = DiscLayer::create(
77  pTransform, pDisc, nullptr, thickness, std::move(ad), LayerType::passive);
78  BOOST_CHECK_EQUAL(pDiscLayerWithLayerType->layerType(), LayerType::passive);
79 }
80 
82 BOOST_AUTO_TEST_CASE(DiscLayerProperties /*, *utf::expected_failures(1)*/) {
83  Translation3D translation{0., 1., 2.};
84  auto pTransform = std::make_shared<const Transform3D>(translation);
85  const double minRad(5.), maxRad(10.); // 20 x 10 disc
86  auto pDisc = std::make_shared<const RadialBounds>(minRad, maxRad);
87  auto pDiscLayer = DiscLayer::create(pTransform, pDisc, nullptr, 1.);
88  // auto planeSurface = pDiscLayer->surfaceRepresentation();
89  BOOST_CHECK_EQUAL(pDiscLayer->surfaceRepresentation().name(),
90  std::string("Acts::DiscSurface"));
91 }
92 
93 BOOST_AUTO_TEST_SUITE_END()
94 } // namespace Layers
95 } // namespace Test
96 
97 } // namespace Acts