ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
external_surface.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
15
16#pragma once
17
18// Project include(s)
19#include "detray/definitions/detail/qualifiers.hpp"
20#include "detray/definitions/geometry.hpp"
21#include "detray/definitions/indexing.hpp"
22#include "detray/definitions/units.hpp"
23#include "detray/geometry/identifier.hpp"
24#include "detray/geometry/mask.hpp"
25
26namespace detray {
27
30template <typename algebra_t, typename shape_t, typename material_t,
31 typename nav_link_t>
33 public:
39 using material_type = material_t;
41 using navigation_link = nav_link_t;
42
44 constexpr external_surface() = default;
45
53 DETRAY_HOST_DEVICE
54 constexpr external_surface(const transform3_type& trf, const mask_type& mask,
55 const material_type& material, const dindex volume,
56 const surface_id sf_id)
57 : m_transform{trf},
58 m_mask(mask),
59 m_material(material),
60 m_barcode{geometry::identifier{}.set_volume(volume).set_id(sf_id)} {}
61
69 DETRAY_HOST_DEVICE
72 const surface_id sf_id)
73 : m_transform{std::move(trf)},
74 m_mask(std::move(mask)),
75 m_material(std::move(material)),
76 m_barcode{geometry::identifier{}.set_volume(volume).set_id(sf_id)} {}
77
82 DETRAY_HOST_DEVICE
83 constexpr auto operator==(const external_surface& rhs) const -> bool {
84 return (m_barcode == rhs.m_barcode);
85 }
86
89 DETRAY_HOST_DEVICE
90 auto set_barcode(const geometry::identifier bcd) -> void { m_barcode = bcd; }
91
93 DETRAY_HOST_DEVICE
94 constexpr auto barcode() const -> geometry::identifier { return m_barcode; }
95
97 DETRAY_HOST_DEVICE
98 constexpr auto identifier() const -> geometry::identifier {
99 return m_barcode;
100 }
101
103 DETRAY_HOST_DEVICE
104 explicit operator geometry::identifier() const { return m_barcode; }
105
108 DETRAY_HOST_DEVICE
109 auto set_id(const surface_id new_id) -> void { m_barcode.set_id(new_id); }
110
112 DETRAY_HOST_DEVICE
113 constexpr auto id() const -> surface_id { return m_barcode.id(); }
114
117 DETRAY_HOST_DEVICE
118 auto set_volume(const dindex new_idx) -> void {
119 m_barcode.set_volume(new_idx);
120 }
121
123 DETRAY_HOST_DEVICE
124 constexpr auto volume() const -> dindex { return m_barcode.volume(); }
125
128 DETRAY_HOST_DEVICE
129 auto set_index(const dindex new_idx) -> void { m_barcode.set_index(new_idx); }
130
132 DETRAY_HOST_DEVICE
133 constexpr auto index() const -> dindex { return m_barcode.index(); }
134
138 DETRAY_HOST_DEVICE
139 void set_transform(const transform3_type& trf) { m_transform = trf; }
140
142 DETRAY_HOST_DEVICE
143 constexpr auto transform() const -> const transform3_type& {
144 return m_transform;
145 }
146
150 DETRAY_HOST_DEVICE
151 void set_mask(const mask_type m) { m_mask = m; }
152
154 DETRAY_HOST_DEVICE
155 constexpr auto mask() const -> const mask_type& { return m_mask; }
156
160 DETRAY_HOST_DEVICE
161 void set_material(const material_type& offset) { m_material.shift(offset); }
162
165 DETRAY_HOST_DEVICE
166 constexpr auto material() -> material_type& { return m_material; }
167
169 DETRAY_HOST_DEVICE
170 constexpr auto material() const -> const material_type& { return m_material; }
171
173 DETRAY_HOST_DEVICE
174 constexpr auto has_material() const -> bool { return false; }
175
177 DETRAY_HOST_DEVICE
178 constexpr auto is_sensitive() const -> bool {
179 return m_barcode.id() == surface_id::e_sensitive;
180 }
181
183 DETRAY_HOST_DEVICE
184 constexpr auto is_portal() const -> bool {
185 return m_barcode.id() == surface_id::e_portal;
186 }
187
189 DETRAY_HOST_DEVICE
190 constexpr auto is_passive() const -> bool {
191 return m_barcode.id() == surface_id::e_passive;
192 }
193
194 private:
196 transform3_type m_transform{};
198 mask_type m_mask{};
200 material_type m_material{};
202 geometry::identifier m_barcode{};
203};
204
205} // namespace detray
auto set_volume(const dindex new_idx) -> void
Definition external_surface.hpp:118
constexpr auto transform() const -> const transform3_type &
Definition external_surface.hpp:143
constexpr external_surface()=default
Default constructor.
auto set_index(const dindex new_idx) -> void
Sets a new surface index (index in surface collection of surface store).
Definition external_surface.hpp:129
dtransform3D< algebra_t > transform3_type
Transform type describing the surface placement.
Definition external_surface.hpp:35
nav_link_t navigation_link
Link type of the mask to a volume.
Definition external_surface.hpp:41
constexpr auto is_passive() const -> bool
Definition external_surface.hpp:190
constexpr auto id() const -> surface_id
Definition external_surface.hpp:113
constexpr auto material() -> material_type &
Definition external_surface.hpp:166
constexpr auto identifier() const -> geometry::identifier
Definition external_surface.hpp:98
constexpr auto is_sensitive() const -> bool
Definition external_surface.hpp:178
constexpr auto volume() const -> dindex
Definition external_surface.hpp:124
constexpr external_surface(transform3_type &&trf, mask_type &&mask, material_type &&material, const dindex volume, const surface_id sf_id)
Constructor with full arguments - move semantics.
Definition external_surface.hpp:70
auto set_id(const surface_id new_id) -> void
Definition external_surface.hpp:109
detray::mask< shape_t, algebra_t, nav_link_t > mask_type
Mask type describing the surface shape and extent.
Definition external_surface.hpp:37
void set_material(const material_type &offset)
Update the material link.
Definition external_surface.hpp:161
constexpr auto index() const -> dindex
Definition external_surface.hpp:133
constexpr auto mask() const -> const mask_type &
Definition external_surface.hpp:155
constexpr auto material() const -> const material_type &
Definition external_surface.hpp:170
auto set_barcode(const geometry::identifier bcd) -> void
Sets a new surface barcode.
Definition external_surface.hpp:90
void set_mask(const mask_type m)
Update the mask link.
Definition external_surface.hpp:151
void set_transform(const transform3_type &trf)
Update the transform index.
Definition external_surface.hpp:139
constexpr auto has_material() const -> bool
Definition external_surface.hpp:174
material_t material_type
Material representation attached to this surface.
Definition external_surface.hpp:39
constexpr auto barcode() const -> geometry::identifier
Definition external_surface.hpp:94
constexpr external_surface(const transform3_type &trf, const mask_type &mask, const material_type &material, const dindex volume, const surface_id sf_id)
Constructor with full arguments.
Definition external_surface.hpp:54
constexpr auto is_portal() const -> bool
Definition external_surface.hpp:184
constexpr auto operator==(const external_surface &rhs) const -> bool
Equality operator.
Definition external_surface.hpp:83
Unique identifier for geometry objects, based on the ACTS GeometryIdentifier.
Definition identifier.hpp:36
Mask a region on a surface and link it to a volume.
Definition mask.hpp:46
Detray include(s).
Definition array_operators.hpp:18
unsigned int dindex
Default index type.
Definition indexing.hpp:18
surface_id
surface type, resolved during navigation.
Definition geometry.hpp:41
get_transform3D_t< A, T > dtransform3D
Three-dimensional transform type for algebra A and value type T.
Definition algebra.hpp:84