ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
definitions.hpp
1// This file is part of the ACTS project.
2//
3// Copyright (C) 2016 CERN for the benefit of the ACTS project
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9#pragma once
10
11// Project iunclude(s)
12#include "detray/definitions/detail/qualifiers.hpp"
13#include "detray/geometry/coordinates/coordinates.hpp"
14#include "detray/geometry/shapes.hpp"
15#include "detray/material/material_map.hpp"
16#include "detray/material/material_rod.hpp"
17#include "detray/material/material_slab.hpp"
18#include "detray/utils/type_registry.hpp"
19
20// System include(s)
21#include <ostream>
22
24namespace detray::io {
25
27using scalar = double;
28
30enum class format { json = 0u };
31
33enum class shape_id : unsigned int {
34 annulus2 = 0u,
35 cuboid3 = 1u,
36 cylinder2 = 2u,
37 cylinder3 = 3u,
38 portal_cylinder2 = 4u,
39 rectangle2 = 5u,
40 ring2 = 6u,
41 trapezoid2 = 7u,
42 drift_cell = 8u,
43 straw_tube = 9u,
44 single1 = 10u,
45 single2 = 11u,
46 single3 = 12u,
47 n_shapes = 13u,
48 unknown = n_shapes
49};
50
57
59enum class material_id : unsigned int {
60 // Material texture (grid) shapes
61 annulus2_map = 0u,
62 rectangle2_map = 1u,
63 cuboid3_map = 2u,
64 concentric_cylinder2_map = 3u,
65 cylinder2_map = 4u,
66 cylinder3_map = 5u,
67 ring2_map = 0u,
68 trapezoid2_map = 1u,
69 // Homogeneous materials
70 slab = 6u,
71 rod = 7u,
72 raw_material = 8u,
73 n_mats = 9u,
74 unknown = n_mats
75};
76
78template <detray::concepts::algebra algebra_t>
86
88enum class accel_id : unsigned int {
89 brute_force = 0u, // try all
90 cartesian2_grid = 1u, // rectangle, trapezoid, (triangle) grids
91 cuboid3_grid = 2u, // cuboid grid
92 polar2_grid = 3u, // ring/disc, annulus grids
93 concentric_cylinder2_grid = 4u, // 2D concentric cylinder grid
94 cylinder2_grid = 5u, // 2D cylinder grid
95 cylinder3_grid = 6u, // 3D cylinder grid
96 n_accel = 7u,
97 unknown = n_accel
98};
99
103template <detray::concepts::algebra algebra_t>
109
110#define _enum_print(x) \
111 case x: \
112 os << #x; \
113 break
114
119DETRAY_HOST inline std::ostream& operator<<(std::ostream& os, shape_id sid) {
120 switch (sid) {
121 using enum shape_id;
122 _enum_print(annulus2);
123 _enum_print(cuboid3);
124 _enum_print(cylinder2);
125 _enum_print(cylinder3);
126 _enum_print(portal_cylinder2);
127 _enum_print(rectangle2);
128 _enum_print(ring2);
129 _enum_print(trapezoid2);
130 _enum_print(drift_cell);
131 _enum_print(straw_tube);
132 _enum_print(single1);
133 _enum_print(single2);
134 _enum_print(single3);
135 case unknown:
136 // n_shapes has same value (13u)
137 os << "unknown/n_shapes";
138 break;
139 }
140 return os;
141}
142
147DETRAY_HOST inline std::ostream& operator<<(std::ostream& os, material_id mid) {
148 switch (mid) {
149 using enum material_id;
150 case annulus2_map:
151 // ring2_map has same value (0u)
152 os << "annulus2_map/ring2_map";
153 break;
154 case rectangle2_map:
155 // trapezoid2_map has same value (1u)
156 os << "rectangle2_map/trapezoid2_map";
157 break;
158 _enum_print(cuboid3_map);
159 _enum_print(concentric_cylinder2_map);
160 _enum_print(cylinder2_map);
161 _enum_print(cylinder3_map);
162 _enum_print(slab);
163 _enum_print(rod);
164 _enum_print(raw_material);
165 case unknown:
166 // n_mats has same value (9u)
167 os << "unknown/n_mats";
168 break;
169 }
170 return os;
171}
172
177DETRAY_HOST inline std::ostream& operator<<(std::ostream& os, accel_id aid) {
178 switch (aid) {
179 using enum accel_id;
180 _enum_print(brute_force);
181 _enum_print(cartesian2_grid);
182 _enum_print(cuboid3_grid);
183 _enum_print(polar2_grid);
184 _enum_print(concentric_cylinder2_grid);
185 _enum_print(cylinder2_grid);
186 _enum_print(cylinder3_grid);
187 _enum_print(unknown);
188 }
189 return os;
190}
191
192#undef _enum_print
193
194} // namespace detray::io
Geometrical shape of a stereo annulus that is used for the ITk strip endcaps.
Definition annulus2D.hpp:48
Geometrical shape of a 2D concentric cylinder.
Definition concentric_cylinder2D.hpp:32
Geometrical shape of a full 3D cuboid.
Definition cuboid3D.hpp:32
Geometrical shape of a 2D cylinder.
Definition cylinder2D.hpp:33
Geometrical shape of a full 3D cylinder.
Definition cylinder3D.hpp:32
Geometrical shape of a rectangle2D.
Definition rectangle2D.hpp:30
Geometrical shape of a closed ring.
Definition ring2D.hpp:34
Underlying geometry for a single parameter bound mask.
Definition single3D.hpp:34
Geometrical shape of a trapezoid2D.
Definition trapezoid2D.hpp:34
match types with indices/identifiers and vice versa.
Definition type_registry.hpp:33
The following enums are global for all detectors.
Definition concepts.hpp:18
types::registry< io::accel_id, void, cartesian2D< algebra_t >, cartesian3D< algebra_t >, polar2D< algebra_t >, concentric_cylindrical2D< algebra_t >, cylindrical2D< algebra_t >, cylindrical3D< algebra_t > > frame_registry
Register the grid shapes to the accel_id enum.
Definition definitions.hpp:104
std::ostream & operator<<(std::ostream &os, shape_id sid)
Write a surface-shape identifier using its enumerator name.
Definition definitions.hpp:119
shape_id
Enumerate the shape primitives globally.
Definition definitions.hpp:33
double scalar
Default scalar precision used for serialized geometry payloads.
Definition definitions.hpp:27
accel_id
Enumerate the different acceleration data structures.
Definition definitions.hpp:88
types::registry< shape_id, annulus2D, cuboid3D, cylinder2D, cylinder3D, concentric_cylinder2D, rectangle2D, ring2D, trapezoid2D, line_square, line_circular, single3D< 0 >, single3D< 1 >, single3D< 2 > > shape_registry
Register the mask shapes to the IO shape_id enum.
Definition definitions.hpp:52
types::registry< io::material_id, polar2D< algebra_t >, cartesian2D< algebra_t >, cartesian3D< algebra_t >, concentric_cylindrical2D< algebra_t >, cylindrical2D< algebra_t >, cylindrical3D< algebra_t >, material_slab< dscalar< algebra_t > >, material_rod< dscalar< algebra_t > >, material< dscalar< algebra_t > > > material_registry
Register the material types to the material_id enum.
Definition definitions.hpp:79
material_id
Enumerate the different material types.
Definition definitions.hpp:59
format
Supported serialization formats.
Definition definitions.hpp:30
line< false > line_circular
Radial crossection, boundary check in polar coordinates.
Definition line.hpp:340
line< true > line_square
Square crossection, boundary check in cartesian coordinates.
Definition line.hpp:342
Projection into a 2D cartesian coordinate frame.
Definition cartesian2D.hpp:19
Projection into a 3D cartesian coordinate frame.
Definition cartesian3D.hpp:19
Projection into a 2D concentric cylindrical frame (No rotation in coordinate transformation).
Definition concentric_cylindrical2D.hpp:21
Projection into a 2D cylindrical coordinate frame.
Definition cylindrical2D.hpp:20
Projection into a 3D cylindrical coordinate frame.
Definition cylindrical3D.hpp:20
Rod structure to be mapped on the line mask.
Definition material_rod.hpp:26
Slab structure to be mapped on the mask (plane, cylinder).
Definition material_slab.hpp:25
Material composition properties and density data used by interactions.
Definition material.hpp:36
Projection into a polar coordinate frame.
Definition polar2D.hpp:20