ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CylinderLayerTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CylinderLayerTests.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(CylinderLayerConstruction) {
41  // default constructor, copy and assignment are all deleted
42  // minimally need a Transform3D and a PlanarBounds object (e.g.
43  // CylinderBounds) to construct
44  Translation3D translation{0., 1., 2.};
45  auto pTransform = std::make_shared<const Transform3D>(translation);
46  double radius(0.5), halfz(10.);
47  auto pCylinder = std::make_shared<const CylinderBounds>(radius, halfz);
48  auto pCylinderLayer =
49  CylinderLayer::create(pTransform, pCylinder, nullptr, 1.);
50  BOOST_CHECK_EQUAL(pCylinderLayer->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 pCylinderLayerFromSurfaces =
61  CylinderLayer::create(pTransform, pCylinder, nullptr, thickness);
62  BOOST_CHECK_EQUAL(pCylinderLayerFromSurfaces->layerType(),
64  // construct with thickness:
65  auto pCylinderLayerWithThickness =
66  CylinderLayer::create(pTransform, pCylinder, nullptr, thickness);
67  CHECK_CLOSE_REL(pCylinderLayerWithThickness->thickness(), thickness, 1e-6);
68  // with an approach descriptor...
69  std::unique_ptr<ApproachDescriptor> ad(
70  new GenericApproachDescriptor(aSurfaces));
71  auto adPtr = ad.get();
72  auto pCylinderLayerWithApproachDescriptor = CylinderLayer::create(
73  pTransform, pCylinder, nullptr, thickness, std::move(ad));
74  BOOST_CHECK_EQUAL(pCylinderLayerWithApproachDescriptor->approachDescriptor(),
75  adPtr);
76  // with the layerType specified...
77  auto pCylinderLayerWithLayerType =
78  CylinderLayer::create(pTransform, pCylinder, nullptr, thickness,
79  std::move(ad), LayerType::passive);
80  BOOST_CHECK_EQUAL(pCylinderLayerWithLayerType->layerType(),
82 }
83 
85 BOOST_AUTO_TEST_CASE(CylinderLayerProperties /*, *utf::expected_failures(1)*/) {
86  Translation3D translation{0., 1., 2.};
87  auto pTransform = std::make_shared<const Transform3D>(translation);
88  double radius(0.5), halfz(10.);
89  auto pCylinder = std::make_shared<const CylinderBounds>(radius, halfz);
90  auto pCylinderLayer =
91  CylinderLayer::create(pTransform, pCylinder, nullptr, 1.);
92  // auto planeSurface = pCylinderLayer->surfaceRepresentation();
93  BOOST_CHECK_EQUAL(pCylinderLayer->surfaceRepresentation().name(),
94  std::string("Acts::CylinderSurface"));
95 }
96 
97 BOOST_AUTO_TEST_SUITE_END()
98 } // namespace Layers
99 } // namespace Test
100 
101 } // namespace Acts