Analysis Software
Documentation for sPHENIX simulation 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 
18 #include "Acts/Geometry/Layer.hpp"
25 
26 #include <memory>
27 #include <string>
28 #include <utility>
29 #include <vector>
30 
31 using boost::test_tools::output_test_stream;
32 namespace utf = boost::unit_test;
33 
34 namespace Acts {
35 
36 namespace Test {
37 
38 // Create a test context
40 
41 namespace Layers {
42 BOOST_AUTO_TEST_SUITE(Layers)
43 
44 
45 BOOST_AUTO_TEST_CASE(DiscLayerConstruction) {
46  // default constructor, copy and assignment are all deleted
47  // minimally need a Transform3 and a PlanarBounds object (e.g.
48  // RadialBounds) to construct
49  Translation3 translation{0., 1., 2.};
50  auto pTransform = Transform3(translation);
51  const double minRad(5.), maxRad(10.); // 20 x 10 disc
52  auto pDisc = std::make_shared<const RadialBounds>(minRad, maxRad);
53  auto pDiscLayer = DiscLayer::create(pTransform, pDisc, nullptr, 1.);
54  BOOST_CHECK_EQUAL(pDiscLayer->layerType(), LayerType::passive);
55  // next level: need an array of Surfaces;
56  // bounds object, rectangle type
57  auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
59  const std::vector<std::shared_ptr<const Surface>> aSurfaces{
60  Surface::makeShared<PlaneSurface>(Transform3::Identity(), rBounds),
61  Surface::makeShared<PlaneSurface>(Transform3::Identity(), rBounds)};
62  const double thickness(1.0);
63  auto pDiscLayerFromSurfaces =
64  DiscLayer::create(pTransform, pDisc, nullptr, 1.);
65  BOOST_CHECK_EQUAL(pDiscLayerFromSurfaces->layerType(), LayerType::passive);
66  // construct with thickness:
67  auto pDiscLayerWithThickness =
68  DiscLayer::create(pTransform, pDisc, nullptr, thickness);
69  BOOST_CHECK_EQUAL(pDiscLayerWithThickness->thickness(), thickness);
70  // with an approach descriptor...
71  std::unique_ptr<ApproachDescriptor> ad(
72  new GenericApproachDescriptor(aSurfaces));
73  auto adPtr = ad.get();
74  auto pDiscLayerWithApproachDescriptor =
75  DiscLayer::create(pTransform, pDisc, nullptr, thickness, std::move(ad));
76  BOOST_CHECK_EQUAL(pDiscLayerWithApproachDescriptor->approachDescriptor(),
77  adPtr);
78  // with the layerType specified...
79  auto pDiscLayerWithLayerType = DiscLayer::create(
80  pTransform, pDisc, nullptr, thickness, std::move(ad), LayerType::passive);
81  BOOST_CHECK_EQUAL(pDiscLayerWithLayerType->layerType(), LayerType::passive);
82 }
83 
85 BOOST_AUTO_TEST_CASE(DiscLayerProperties) {
86  Translation3 translation{0., 1., 2.};
87  auto pTransform = Transform3(translation);
88  const double minRad(5.), maxRad(10.); // 20 x 10 disc
89  auto pDisc = std::make_shared<const RadialBounds>(minRad, maxRad);
90  auto pDiscLayer = DiscLayer::create(pTransform, pDisc, nullptr, 1.);
91  // auto planeSurface = pDiscLayer->surfaceRepresentation();
92  BOOST_CHECK_EQUAL(pDiscLayer->surfaceRepresentation().name(),
93  std::string("Acts::DiscSurface"));
94 }
95 
96 BOOST_AUTO_TEST_SUITE_END()
97 } // namespace Layers
98 } // namespace Test
99 
100 } // namespace Acts