Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:56

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/Geometry/CuboidVolumeBounds.hpp"
0013 #include "Acts/Geometry/CutoutCylinderVolumeBounds.hpp"
0014 #include "Acts/Geometry/CylinderVolumeBounds.hpp"
0015 #include "Acts/Utilities/BinAdjustmentVolume.hpp"
0016 #include "Acts/Utilities/BinUtility.hpp"
0017 #include "Acts/Utilities/BinningType.hpp"
0018 
0019 #include <cmath>
0020 #include <memory>
0021 #include <numbers>
0022 #include <vector>
0023 
0024 namespace Acts::Test {
0025 
0026 // Test Cylinder
0027 BOOST_AUTO_TEST_CASE(BinAdjustmentVolume_Cylinder) {
0028   CylinderVolumeBounds bound(10, 50, 150, std::numbers::pi / 2., 0);
0029   BinUtility bu;
0030   bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisR);
0031   bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisPhi);
0032   bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisZ);
0033 
0034   BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity());
0035 
0036   BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, 10);
0037   BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 50);
0038   BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min,
0039                     -static_cast<float>(std::numbers::pi / 2.));
0040   BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max,
0041                     static_cast<float>(std::numbers::pi / 2.));
0042   BOOST_CHECK_EQUAL(buAdjust.binningData()[2].min, -150);
0043   BOOST_CHECK_EQUAL(buAdjust.binningData()[2].max, 150);
0044 }
0045 
0046 // Test Cutout Cylinder
0047 BOOST_AUTO_TEST_CASE(BinAdjustmentVolume_CutoutCylinder) {
0048   CutoutCylinderVolumeBounds bound(10, 20, 50, 100, 15);
0049   BinUtility bu;
0050   bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisR);
0051   bu += BinUtility(1, 0, 1, Acts::closed, Acts::AxisDirection::AxisPhi);
0052   bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisZ);
0053 
0054   BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity());
0055 
0056   BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, 10);
0057   BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 50);
0058   BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, -std::numbers::pi_v<float>);
0059   BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, std::numbers::pi_v<float>);
0060   BOOST_CHECK_EQUAL(buAdjust.binningData()[2].min, -100);
0061   BOOST_CHECK_EQUAL(buAdjust.binningData()[2].max, 100);
0062 }
0063 
0064 // Test Cuboid
0065 BOOST_AUTO_TEST_CASE(BinAdjustmentVolume_Cuboid) {
0066   CuboidVolumeBounds bound(13, 23, 42);
0067   BinUtility bu;
0068   bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisX);
0069   bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisY);
0070   bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisZ);
0071 
0072   BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity());
0073 
0074   BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, -13);
0075   BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 13);
0076   BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, -23);
0077   BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, 23);
0078   BOOST_CHECK_EQUAL(buAdjust.binningData()[2].min, -42);
0079   BOOST_CHECK_EQUAL(buAdjust.binningData()[2].max, 42);
0080 }
0081 
0082 }  // namespace Acts::Test