Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:24:21

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 // Project include(s)
0010 #include "detray/geometry/shapes/unmasked.hpp"
0011 
0012 #include "detray/geometry/concepts.hpp"
0013 #include "detray/geometry/mask.hpp"
0014 
0015 // Detray test include(s)
0016 #include "detray/test/framework/types.hpp"
0017 
0018 // GTest include
0019 #include <gtest/gtest.h>
0020 
0021 using namespace detray;
0022 
0023 using test_algebra = test::algebra;
0024 using scalar = test::scalar;
0025 using point3 = test::point3;
0026 
0027 constexpr scalar tol{1e-7f};
0028 
0029 /// This tests the basic functionality of an unmasked plane
0030 GTEST_TEST(detray_masks, unmasked) {
0031   static_assert(concepts::shape<unmasked<>, test_algebra>);
0032 
0033   point3 p2 = {0.5f, -9.f, 0.f};
0034 
0035   mask<unmasked<>, test_algebra> u{};
0036 
0037   ASSERT_TRUE(u.is_inside(p2, 0.f));
0038 
0039   // Check bounding box
0040   constexpr scalar envelope{0.01f};
0041   const auto loc_bounds = u.local_min_bounds(envelope);
0042   ASSERT_TRUE(detail::is_invalid_value(loc_bounds[cuboid3D::e_min_x]));
0043   ASSERT_TRUE(detail::is_invalid_value(loc_bounds[cuboid3D::e_min_y]));
0044   ASSERT_TRUE(detail::is_invalid_value(loc_bounds[cuboid3D::e_min_z]));
0045   ASSERT_TRUE(detail::is_invalid_value(loc_bounds[cuboid3D::e_max_x]));
0046   ASSERT_TRUE(detail::is_invalid_value(loc_bounds[cuboid3D::e_max_y]));
0047   ASSERT_TRUE(detail::is_invalid_value(loc_bounds[cuboid3D::e_max_z]));
0048 
0049   // Check area
0050   const scalar a{u.area()};
0051   EXPECT_NEAR(a, std::numeric_limits<scalar>::max(), tol);
0052   ASSERT_EQ(a, u.measure());
0053 
0054   const auto centroid = u.centroid();
0055   ASSERT_NEAR(centroid[0], 0.f, tol);
0056   ASSERT_NEAR(centroid[1], 0.f, tol);
0057   ASSERT_NEAR(centroid[2], 0.f, tol);
0058 }