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 
22 
23 #include "LayerStub.hpp"
24 
25 using boost::test_tools::output_test_stream;
26 namespace utf = boost::unit_test;
27 
28 namespace Acts {
29 
30 namespace Test {
31 
32 // Create a test context
34 
35 namespace Layers {
36 BOOST_AUTO_TEST_SUITE(Layers)
37 
38 
39 BOOST_AUTO_TEST_CASE(CylinderLayerConstruction) {
40  // default constructor, copy and assignment are all deleted
41  // minimally need a Transform3D and a PlanarBounds object (e.g.
42  // CylinderBounds) to construct
43  Translation3D translation{0., 1., 2.};
44  auto pTransform = Transform3D(translation);
45  double radius(0.5), halfz(10.);
46  auto pCylinder = std::make_shared<const CylinderBounds>(radius, halfz);
47  auto pCylinderLayer =
48  CylinderLayer::create(pTransform, pCylinder, nullptr, 1.);
49  BOOST_CHECK_EQUAL(pCylinderLayer->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 pCylinderLayerFromSurfaces =
59  CylinderLayer::create(pTransform, pCylinder, nullptr, thickness);
60  BOOST_CHECK_EQUAL(pCylinderLayerFromSurfaces->layerType(),
62  // construct with thickness:
63  auto pCylinderLayerWithThickness =
64  CylinderLayer::create(pTransform, pCylinder, nullptr, thickness);
65  CHECK_CLOSE_REL(pCylinderLayerWithThickness->thickness(), thickness, 1e-6);
66  // with an approach descriptor...
67  std::unique_ptr<ApproachDescriptor> ad(
68  new GenericApproachDescriptor(aSurfaces));
69  auto adPtr = ad.get();
70  auto pCylinderLayerWithApproachDescriptor = CylinderLayer::create(
71  pTransform, pCylinder, nullptr, thickness, std::move(ad));
72  BOOST_CHECK_EQUAL(pCylinderLayerWithApproachDescriptor->approachDescriptor(),
73  adPtr);
74  // with the layerType specified...
75  auto pCylinderLayerWithLayerType =
76  CylinderLayer::create(pTransform, pCylinder, nullptr, thickness,
77  std::move(ad), LayerType::passive);
78  BOOST_CHECK_EQUAL(pCylinderLayerWithLayerType->layerType(),
80 }
81 
83 BOOST_AUTO_TEST_CASE(CylinderLayerProperties /*, *utf::expected_failures(1)*/) {
84  Translation3D translation{0., 1., 2.};
85  auto pTransform = Transform3D(translation);
86  double radius(0.5), halfz(10.);
87  auto pCylinder = std::make_shared<const CylinderBounds>(radius, halfz);
88  auto pCylinderLayer =
89  CylinderLayer::create(pTransform, pCylinder, nullptr, 1.);
90  // auto planeSurface = pCylinderLayer->surfaceRepresentation();
91  BOOST_CHECK_EQUAL(pCylinderLayer->surfaceRepresentation().name(),
92  std::string("Acts::CylinderSurface"));
93 }
94 
95 BOOST_AUTO_TEST_SUITE_END()
96 } // namespace Layers
97 } // namespace Test
98 
99 } // namespace Acts