|
| 1 | +# Detray library, part of the ACTS project (R&D line) |
| 2 | +# |
| 3 | +# (c) 2025 CERN for the benefit of the ACTS project |
| 4 | +# |
| 5 | +# Mozilla Public License Version 2.0 |
| 6 | + |
| 7 | +# Project includes |
| 8 | +from .type_helpers import cpp_class |
| 9 | + |
| 10 | +# python includes |
| 11 | +from enum import Enum |
| 12 | + |
| 13 | + |
| 14 | +""" Fundamental types """ |
| 15 | + |
| 16 | + |
| 17 | +class Type(Enum): |
| 18 | + SINGLE = "float" |
| 19 | + DOUBLE = "double" |
| 20 | + UINT_8 = "std::uint8_t" |
| 21 | + UINT_16 = "std::uint16_t" |
| 22 | + UINT_32 = "std::uint32_t" |
| 23 | + UINT_64 = "std::uint64_t" |
| 24 | + UINT_128 = "std::uint128_t" |
| 25 | + UINT_LEAST_8 = "std::uint_least8_t" |
| 26 | + UINT_LEAST_16 = "std::uint_least16_t" |
| 27 | + UINT_LEAST_32 = "std::uint_least32_t" |
| 28 | + UINT_LEAST_64 = "std::uint_least64_t" |
| 29 | + UINT_LEAST_128 = "std::uint_least128_t" |
| 30 | + |
| 31 | + def __str__(self) -> str: |
| 32 | + return self.value |
| 33 | + |
| 34 | + |
| 35 | +""" Available linear algebra bachends """ |
| 36 | + |
| 37 | + |
| 38 | +class Algebra(Enum): |
| 39 | + ANY = "concepts::algebra algebra_t" |
| 40 | + ARRAY = "detray::array" |
| 41 | + EIGEN = "detray::eigen" |
| 42 | + FASTOR = "detray::fastor" |
| 43 | + SMATRIX = "detray::smatrix" |
| 44 | + VC_AOS = "detray::vc_aos" |
| 45 | + VC_SOA = "detray::vc_soa" |
| 46 | + |
| 47 | + def __str__(self) -> str: |
| 48 | + return self.value |
| 49 | + |
| 50 | + |
| 51 | +""" Available geometric shape types """ |
| 52 | + |
| 53 | + |
| 54 | +class Shape: |
| 55 | + # ITk stereo annulus (r, phi) |
| 56 | + ANNULUS = cpp_class(specifier="detray::annulus2D") |
| 57 | + # 2D cylinder, at the origin, no rotation, single inters. sol. (r*phi, z) |
| 58 | + CONCENTRIC_CYLINDER = cpp_class(specifier="detray::concentric_cylinder2D") |
| 59 | + # 3D cubiod (x, y, z) |
| 60 | + CUBOID = cpp_class(specifier="detray::cuboid3D") |
| 61 | + # 2D cylinder (r*phi, z) |
| 62 | + CYLINDER2D = cpp_class(specifier="detray::cylinder2D") |
| 63 | + # 3D cylinder (r, phi, z) |
| 64 | + CYLINDER3D = cpp_class(specifier="detray::cylinder3D") |
| 65 | + # line, square cross sec, (+-r, z) |
| 66 | + DRIFT_CELL = cpp_class(specifier="detray::line_square") |
| 67 | + # line, circular cross sec, (+-r, z) |
| 68 | + STRAW_TUBE = cpp_class(specifier="detray::line_circular") |
| 69 | + # 2D rectangle (x, y) |
| 70 | + RECTANGLE = cpp_class(specifier="detray::rectangle2D") |
| 71 | + # 2D ring / disc (r, phi) |
| 72 | + RING = cpp_class(specifier="detray::ring2D") |
| 73 | + # 2D trapezoid (x, y) |
| 74 | + TRAPEZOID = cpp_class(specifier="detray::trapezoid2D") |
| 75 | + # Mask of any shape (to be added as 'param'), always 'inside'= true |
| 76 | + UNBOUNDED = cpp_class(specifier="detray::unbounded") |
| 77 | + # No shape |
| 78 | + UNMASKED = cpp_class(specifier="detray::unmasked") |
| 79 | + |
| 80 | + |
| 81 | +""" Available material types """ |
| 82 | + |
| 83 | + |
| 84 | +class Material: |
| 85 | + # Slab of material of given thickness |
| 86 | + SLAB = cpp_class(specifier="detray::material_slab") |
| 87 | + # Material with round cross sec, of given r |
| 88 | + ROD = cpp_class(specifier="detray::material_rod") |
| 89 | + # Raw material type, used e.g. for homogeneous volume material |
| 90 | + RAW = cpp_class(specifier="detray::material") |
| 91 | + # Surface material map, annulus shape 2D |
| 92 | + ANNULUS_MAP2D = cpp_class( |
| 93 | + specifier="detray::material_map", param={"shape": Shape.ANNULUS} |
| 94 | + ) |
| 95 | + # Surface material map, concentric cyl. |
| 96 | + CONCENTIRC_CYLINDER_MAP2D = cpp_class( |
| 97 | + specifier="detray::material_map", param={"shape": Shape.CONCENTRIC_CYLINDER} |
| 98 | + ) |
| 99 | + # Surface material map, cylindrical 2D |
| 100 | + CYLINDER_MAP2D = cpp_class( |
| 101 | + specifier="detray::material_map", param={"shape": Shape.CYLINDER2D} |
| 102 | + ) |
| 103 | + # Volume material map, cylindrical 3D |
| 104 | + CYLINDER_MAP3D = cpp_class( |
| 105 | + specifier="detray::material_map", param={"shape": Shape.CYLINDER3D} |
| 106 | + ) |
| 107 | + # Volume material map, cuboid 3D |
| 108 | + CUBOID_MAP3D = cpp_class( |
| 109 | + specifier="detray::material_map", param={"shape": Shape.CUBOID} |
| 110 | + ) |
| 111 | + # Surface material map, rectangular 2D |
| 112 | + RECTANGLE_MAP2D = cpp_class( |
| 113 | + specifier="detray::material_map", param={"shape": Shape.RECTANGLE} |
| 114 | + ) |
| 115 | + # Surface material map, disc 2D |
| 116 | + DISC_MAP2D = cpp_class( |
| 117 | + specifier="detray::material_map", param={"shape": Shape.RING} |
| 118 | + ) |
| 119 | + # Surface material map, trapezoidal 2D |
| 120 | + TRAPEZOID_MAP2D = cpp_class( |
| 121 | + specifier="detray::material_map", param={"shape": Shape.TRAPEZOID} |
| 122 | + ) |
| 123 | + |
| 124 | + |
| 125 | +""" Available surface/volume acceleration structure types """ |
| 126 | + |
| 127 | + |
| 128 | +class Accelerator: |
| 129 | + # Test all registered surfaces |
| 130 | + BRUTE_FORCE = cpp_class(specifier="detray::brute_force") |
| 131 | + # Surface grid, cylindrical 2D (barrel) |
| 132 | + CONCENTRIC_CYLINDER_GRID2D = cpp_class( |
| 133 | + specifier="detray::spatial_grid", param={"shape": Shape.CONCENTRIC_CYLINDER} |
| 134 | + ) |
| 135 | + # Surface grid, cylindrical 2D (barrel) |
| 136 | + CYLINDER_GRID2D = cpp_class( |
| 137 | + specifier="detray::spatial_grid", param={"shape": Shape.CYLINDER2D} |
| 138 | + ) |
| 139 | + # Surface grid, cylindrical 3D (barrel) |
| 140 | + CYLINDER_GRID3D = cpp_class( |
| 141 | + specifier="detray::spatial_grid", param={"shape": Shape.CYLINDER3D} |
| 142 | + ) |
| 143 | + # Surface grid, disc (endcap) |
| 144 | + DISC_GRID2D = cpp_class( |
| 145 | + specifier="detray::spatial_grid", param={"shape": Shape.RING} |
| 146 | + ) |
| 147 | + # Surface grid, reactangular (telescope) |
| 148 | + RECTANGLE_GRID2D = cpp_class( |
| 149 | + specifier="detray::spatial_grid", param={"shape": Shape.RECTANGLE} |
| 150 | + ) |
| 151 | + # Surface grid, cuboid 3D (telescope) |
| 152 | + CUBOID_GRID3D = cpp_class( |
| 153 | + specifier="detray::spatial_grid", param={"shape": Shape.CUBOID} |
| 154 | + ) |
0 commit comments