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 
23 
24 #include "LayerStub.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(DiscLayerConstruction) {
41  // default constructor, copy and assignment are all deleted
42  // minimally need a Transform3D and a PlanarBounds object (e.g.
43  // RadialBounds) to construct
44  Translation3D translation{0., 1., 2.};
45  auto pTransform = Transform3D(translation);
46  const double minRad(5.), maxRad(10.); // 20 x 10 disc
47  auto pDisc = std::make_shared<const RadialBounds>(minRad, maxRad);
48  auto pDiscLayer = DiscLayer::create(pTransform, pDisc, nullptr, 1.);
49  BOOST_CHECK_EQUAL(pDiscLayer->layerType(), LayerType::passive);
50  // next level: need an array of Surfaces;
51  // bounds object, rectangle type
52  auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
54  const std::vector<std::shared_ptr<const Surface>> aSurfaces{
55  Surface::makeShared<PlaneSurface>(Transform3D::Identity(), rBounds),
56  Surface::makeShared<PlaneSurface>(Transform3D::Identity(), rBounds)};
57  const double thickness(1.0);
58  auto pDiscLayerFromSurfaces =
59  DiscLayer::create(pTransform, pDisc, nullptr, 1.);
60  BOOST_CHECK_EQUAL(pDiscLayerFromSurfaces->layerType(), LayerType::passive);
61  // construct with thickness:
62  auto pDiscLayerWithThickness =
63  DiscLayer::create(pTransform, pDisc, nullptr, thickness);
64  BOOST_CHECK_EQUAL(pDiscLayerWithThickness->thickness(), thickness);
65  // with an approach descriptor...
66  std::unique_ptr<ApproachDescriptor> ad(
67  new GenericApproachDescriptor(aSurfaces));
68  auto adPtr = ad.get();
69  auto pDiscLayerWithApproachDescriptor =
70  DiscLayer::create(pTransform, pDisc, nullptr, thickness, std::move(ad));
71  BOOST_CHECK_EQUAL(pDiscLayerWithApproachDescriptor->approachDescriptor(),
72  adPtr);
73  // with the layerType specified...
74  auto pDiscLayerWithLayerType = DiscLayer::create(
75  pTransform, pDisc, nullptr, thickness, std::move(ad), LayerType::passive);
76  BOOST_CHECK_EQUAL(pDiscLayerWithLayerType->layerType(), LayerType::passive);
77 }
78 
80 BOOST_AUTO_TEST_CASE(DiscLayerProperties /*, *utf::expected_failures(1)*/) {
81  Translation3D translation{0., 1., 2.};
82  auto pTransform = Transform3D(translation);
83  const double minRad(5.), maxRad(10.); // 20 x 10 disc
84  auto pDisc = std::make_shared<const RadialBounds>(minRad, maxRad);
85  auto pDiscLayer = DiscLayer::create(pTransform, pDisc, nullptr, 1.);
86  // auto planeSurface = pDiscLayer->surfaceRepresentation();
87  BOOST_CHECK_EQUAL(pDiscLayer->surfaceRepresentation().name(),
88  std::string("Acts::DiscSurface"));
89 }
90 
91 BOOST_AUTO_TEST_SUITE_END()
92 } // namespace Layers
93 } // namespace Test
94 
95 } // namespace Acts