Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-03 08:58:39

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include <boost/test/unit_test.hpp>
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Detector/detail/ReferenceGenerators.hpp"
0013 #include "Acts/Geometry/GeometryContext.hpp"
0014 #include "Acts/Surfaces/PlaneSurface.hpp"
0015 #include "Acts/Surfaces/RectangleBounds.hpp"
0016 #include "Acts/Surfaces/Surface.hpp"
0017 #include "Acts/Utilities/BinningType.hpp"
0018 
0019 #include <memory>
0020 #include <utility>
0021 #include <vector>
0022 
0023 using namespace Acts;
0024 using namespace Acts::Experimental::detail;
0025 
0026 GeometryContext tContext;
0027 
0028 auto rBounds = std::make_shared<RectangleBounds>(10, 20);
0029 auto sTransform = Transform3::Identity();
0030 auto pSurface = Surface::makeShared<PlaneSurface>(
0031     sTransform.pretranslate(Vector3(20., 20., 100.)), std::move(rBounds));
0032 
0033 namespace ActsTests {
0034 
0035 BOOST_AUTO_TEST_SUITE(DetectorSuite)
0036 
0037 BOOST_AUTO_TEST_CASE(CenterReference) {
0038   // Simply return the cetner
0039   auto center = CenterReferenceGenerator{}.references(tContext, *pSurface);
0040   BOOST_CHECK_EQUAL(center.size(), 1u);
0041   BOOST_CHECK(center.front().isApprox(Vector3(20., 20., 100.)));
0042 }
0043 
0044 BOOST_AUTO_TEST_CASE(BinningPositionReference) {
0045   // Simply return binning position, we test only the behavior of the generator
0046   // not the output
0047   auto referencePosition =
0048       AxisDirectionReferenceGenerator<AxisDirection::AxisZ>{}.references(
0049           tContext, *pSurface);
0050   BOOST_CHECK_EQUAL(referencePosition.size(), 1u);
0051 }
0052 
0053 BOOST_AUTO_TEST_CASE(PolyhedronReference) {
0054   // Simply return binning position, we test only the behavior of the generator
0055   // not the output
0056   auto referencePositions =
0057       PolyhedronReferenceGenerator<>{}.references(tContext, *pSurface);
0058   // 4 corners with center of gravity
0059   BOOST_CHECK_EQUAL(referencePositions.size(), 5u);
0060 }
0061 
0062 BOOST_AUTO_TEST_SUITE_END()
0063 
0064 }  // namespace ActsTests