Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:23:57

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 #pragma once
0010 
0011 // Project include(s)
0012 #include "detray/definitions/detail/qualifiers.hpp"
0013 
0014 // System include(s)
0015 #include <cstdint>
0016 #include <ostream>
0017 
0018 namespace detray {
0019 
0020 /// Shape of a detector volume.
0021 ///
0022 /// cylinder: cylinder and two disc portals (shape: cylinder2D or cylinder3D).
0023 /// cone: a cone portal and a disc portal (shape: missing).
0024 /// rectangle: six rectangular portals that form a box (shape: cuboid3D).
0025 /// trapezoid: six trapezoid portals (shape: cuboid3D).
0026 /// cuboid: general cuboid form, excluding the previous ones (shape: cuboid3D).
0027 enum class volume_id : std::uint_least8_t {
0028   e_cylinder = 0u,
0029   e_rectangle = 1u,
0030   e_trapezoid = 2u,
0031   e_cone = 3u,
0032   e_cuboid = 4u,
0033   e_unknown = 5u
0034 };
0035 
0036 /// surface type, resolved during navigation.
0037 ///
0038 /// sensitive: can provide measurements and have material.
0039 /// passive: no measurements, but can have material.
0040 /// portal: boundary surface between two detector volumes, can have material.
0041 enum class surface_id : std::uint_least8_t {
0042   e_portal = 0u,
0043   e_sensitive = 1u,
0044   e_passive = 2u,
0045   e_unknown = 3u,
0046   e_all = e_unknown
0047 };
0048 
0049 // Print the values of an enum by identifier
0050 #define ENUM_PRINT(x) \
0051   case x:             \
0052     os << #x;         \
0053     break
0054 
0055 DETRAY_HOST inline std::ostream& operator<<(std::ostream& os, volume_id vid) {
0056   switch (vid) {
0057     using enum volume_id;
0058     ENUM_PRINT(e_cylinder);
0059     ENUM_PRINT(e_rectangle);
0060     ENUM_PRINT(e_trapezoid);
0061     ENUM_PRINT(e_cone);
0062     ENUM_PRINT(e_cuboid);
0063     ENUM_PRINT(e_unknown);
0064   }
0065   return os;
0066 }
0067 
0068 DETRAY_HOST inline std::ostream& operator<<(std::ostream& os, surface_id sid) {
0069   switch (sid) {
0070     using enum surface_id;
0071     ENUM_PRINT(e_portal);
0072     ENUM_PRINT(e_sensitive);
0073     ENUM_PRINT(e_passive);
0074     case e_unknown:
0075       // e_all has same value (3u)
0076       os << "e_unknown/e_all";
0077       break;
0078   }
0079   return os;
0080 }
0081 
0082 #undef ENUM_PRINT
0083 }  // namespace detray