Skip to content

Commit 3c8c670

Browse files
authored
Merge pull request #1290 from krasznaa/EDMDeAlgebraification-main-20260410
EDM De-Algebraification #2, main branch (2026.04.10.)
2 parents 831d8b2 + d4921b7 commit 3c8c670

12 files changed

Lines changed: 165 additions & 37 deletions

core/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ traccc_add_library( traccc_core core TYPE SHARED
3232
"include/traccc/edm/silicon_cluster_collection.hpp"
3333
"include/traccc/edm/spacepoint_collection.hpp"
3434
"include/traccc/edm/impl/spacepoint_collection.ipp"
35+
"include/traccc/edm/spacepoint_helpers.hpp"
36+
"include/traccc/edm/impl/spacepoint_helpers.ipp"
3537
"include/traccc/edm/seed_collection.hpp"
3638
"include/traccc/edm/impl/seed_collection.ipp"
3739
"include/traccc/edm/track_state_collection.hpp"

core/include/traccc/edm/impl/spacepoint_collection.ipp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** TRACCC library, part of the ACTS project (R&D line)
22
*
3-
* (c) 2021-2025 CERN for the benefit of the ACTS project
3+
* (c) 2021-2026 CERN for the benefit of the ACTS project
44
*
55
* Mozilla Public License Version 2.0
66
*/
@@ -51,8 +51,8 @@ TRACCC_HOST_DEVICE const auto& spacepoint<BASE>::z() const {
5151
template <typename BASE>
5252
TRACCC_HOST_DEVICE auto spacepoint<BASE>::radius() const {
5353

54-
const scalar xx = x();
55-
const scalar yy = y();
54+
const float xx = x();
55+
const float yy = y();
5656
return math::sqrt(xx * xx + yy * yy);
5757
}
5858

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/** TRACCC library, part of the ACTS project (R&D line)
2+
*
3+
* (c) 2026 CERN for the benefit of the ACTS project
4+
*
5+
* Mozilla Public License Version 2.0
6+
*/
7+
8+
#pragma once
9+
10+
// Local include(s).
11+
#include "traccc/utils/detray_conversion.hpp"
12+
13+
namespace traccc::edm {
14+
15+
template <detray::concepts::algebra algebra_t, typename spacepoint_backend_t>
16+
TRACCC_HOST_DEVICE detray::dpoint3D<algebra_t> get_spacepoint_global(
17+
const edm::spacepoint<spacepoint_backend_t>& sp) {
18+
19+
return utils::to_dpoint3D<algebra_t>(sp.global());
20+
}
21+
22+
} // namespace traccc::edm

core/include/traccc/edm/spacepoint_collection.hpp

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
/** TRACCC library, part of the ACTS project (R&D line)
22
*
3-
* (c) 2021-2025 CERN for the benefit of the ACTS project
3+
* (c) 2021-2026 CERN for the benefit of the ACTS project
44
*
55
* Mozilla Public License Version 2.0
66
*/
77

88
#pragma once
99

1010
// Local include(s).
11-
#include "traccc/definitions/primitives.hpp"
1211
#include "traccc/definitions/qualifiers.hpp"
1312

1413
// VecMem include(s).
1514
#include <vecmem/edm/container.hpp>
1615

16+
// System include(s).
17+
#include <array>
18+
#include <compare>
19+
#include <limits>
20+
1721
namespace traccc::edm {
1822

1923
/// Interface for the @c traccc::edm::spacepoint_collection class.
@@ -71,12 +75,12 @@ class spacepoint : public BASE {
7175

7276
/// Global / 3D position of the spacepoint
7377
///
74-
/// @return A (non-const) vector of @c traccc::point3 values
78+
/// @return A (non-const) vector of @c std::array<float,3> values
7579
///
7680
TRACCC_HOST_DEVICE auto& global() { return BASE::template get<2>(); }
7781
/// Global / 3D position of the spacepoint
7882
///
79-
/// @return A (const) vector of @c traccc::point3 values
83+
/// @return A (const) vector of @c std::array<float,3> values
8084
///
8185
TRACCC_HOST_DEVICE const auto& global() const {
8286
return BASE::template get<2>();
@@ -87,7 +91,7 @@ class spacepoint : public BASE {
8791
/// @note This function must only be used on proxy objects, not on
8892
/// containers!
8993
///
90-
/// @return A (non-const) reference to a @c traccc::scalar value
94+
/// @return A (non-const) reference to a @c float value
9195
///
9296
TRACCC_HOST_DEVICE
9397
auto& x();
@@ -96,7 +100,7 @@ class spacepoint : public BASE {
96100
/// @note This function must only be used on proxy objects, not on
97101
/// containers!
98102
///
99-
/// @return A (const) reference to a @c traccc::scalar value
103+
/// @return A (const) reference to a @c float value
100104
///
101105
TRACCC_HOST_DEVICE
102106
const auto& x() const;
@@ -106,13 +110,13 @@ class spacepoint : public BASE {
106110
/// @note This function must only be used on proxy objects, not on
107111
/// containers!
108112
///
109-
/// @return A (non-const) reference to a @c traccc::scalar value
113+
/// @return A (non-const) reference to a @c float value
110114
///
111115
TRACCC_HOST_DEVICE
112116
auto& y();
113117
/// The Y position of the spacepoint (const)
114118
///
115-
/// @return A (const) reference to a @c traccc::scalar value
119+
/// @return A (const) reference to a @c float value
116120
///
117121
TRACCC_HOST_DEVICE
118122
const auto& y() const;
@@ -122,7 +126,7 @@ class spacepoint : public BASE {
122126
/// @note This function must only be used on proxy objects, not on
123127
/// containers!
124128
///
125-
/// @return A (non-const) reference to a @c traccc::scalar value
129+
/// @return A (non-const) reference to a @c float value
126130
///
127131
TRACCC_HOST_DEVICE
128132
auto& z();
@@ -131,19 +135,19 @@ class spacepoint : public BASE {
131135
/// @note This function must only be used on proxy objects, not on
132136
/// containers!
133137
///
134-
/// @return A (const) reference to a @c traccc::scalar value
138+
/// @return A (const) reference to a @c float value
135139
///
136140
TRACCC_HOST_DEVICE
137141
const auto& z() const;
138142

139143
/// The variation on the spacepoint's Z coordinate (non-const)
140144
///
141-
/// @return A (non-const) vector of @c traccc::scalar values
145+
/// @return A (non-const) vector of @c float values
142146
///
143147
TRACCC_HOST_DEVICE auto& z_variance() { return BASE::template get<3>(); }
144148
/// The variation on the spacepoint's Z coordinate (const)
145149
///
146-
/// @return A (const) vector of @c traccc::scalar values
150+
/// @return A (const) vector of @c float values
147151
///
148152
TRACCC_HOST_DEVICE const auto& z_variance() const {
149153
return BASE::template get<3>();
@@ -154,20 +158,20 @@ class spacepoint : public BASE {
154158
/// @note This function must only be used on proxy objects, not on
155159
/// containers!
156160
///
157-
/// @return A @c traccc::scalar value
161+
/// @return A @c float value
158162
///
159163
TRACCC_HOST_DEVICE auto radius() const;
160164

161165
/// The variation on the spacepoint radious (non-const)
162166
///
163-
/// @return A (non-const) vector of @c traccc::scalar values
167+
/// @return A (non-const) vector of @c float values
164168
///
165169
TRACCC_HOST_DEVICE auto& radius_variance() {
166170
return BASE::template get<4>();
167171
}
168172
/// The variation on the spacepoint radious (const)
169173
///
170-
/// @return A (non-const) vector of @c traccc::scalar values
174+
/// @return A (non-const) vector of @c float values
171175
///
172176
TRACCC_HOST_DEVICE const auto& radius_variance() const {
173177
return BASE::template get<4>();
@@ -178,7 +182,7 @@ class spacepoint : public BASE {
178182
/// @note This function must only be used on proxy objects, not on
179183
/// containers!
180184
///
181-
/// @return A @c traccc::scalar value
185+
/// @return A @c float value
182186
///
183187
TRACCC_HOST_DEVICE auto phi() const;
184188

@@ -216,10 +220,18 @@ class spacepoint : public BASE {
216220
}; // class spacepoint
217221

218222
/// SoA container describing reconstructed spacepoints
219-
using spacepoint_collection = vecmem::edm::container<
220-
spacepoint, vecmem::edm::type::vector<unsigned int>,
221-
vecmem::edm::type::vector<unsigned int>, vecmem::edm::type::vector<point3>,
222-
vecmem::edm::type::vector<scalar>, vecmem::edm::type::vector<scalar> >;
223+
using spacepoint_collection =
224+
vecmem::edm::container<spacepoint,
225+
// measurement_index_1
226+
vecmem::edm::type::vector<unsigned int>,
227+
// measurement_index_2
228+
vecmem::edm::type::vector<unsigned int>,
229+
// global
230+
vecmem::edm::type::vector<std::array<float, 3u>>,
231+
// z_variance
232+
vecmem::edm::type::vector<float>,
233+
// radius_variance
234+
vecmem::edm::type::vector<float>>;
223235

224236
} // namespace traccc::edm
225237

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/** TRACCC library, part of the ACTS project (R&D line)
2+
*
3+
* (c) 2026 CERN for the benefit of the ACTS project
4+
*
5+
* Mozilla Public License Version 2.0
6+
*/
7+
8+
#pragma once
9+
10+
// Local include(s).
11+
#include "traccc/definitions/qualifiers.hpp"
12+
#include "traccc/edm/spacepoint_collection.hpp"
13+
14+
// Detray include(s).
15+
#include <detray/definitions/algebra.hpp>
16+
17+
namespace traccc::edm {
18+
19+
/// Get the global position of a spacepoint as a 3D point
20+
///
21+
/// @tparam algebra_t The algebra type used to describe the tracks
22+
///
23+
/// @param sp The spacepoint to extract the global position from
24+
/// @param pos The 3D point to fill with the global position of the spacepoint
25+
///
26+
template <detray::concepts::algebra algebra_t, typename spacepoint_backend_t>
27+
TRACCC_HOST_DEVICE detray::dpoint3D<algebra_t> get_spacepoint_global(
28+
const edm::spacepoint<spacepoint_backend_t>& sp);
29+
30+
} // namespace traccc::edm
31+
32+
// Implementation include(s).
33+
#include "traccc/edm/impl/spacepoint_helpers.ipp"

core/include/traccc/seeding/impl/spacepoint_formation.ipp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ TRACCC_HOST_DEVICE inline void fill_pixel_spacepoint(
3939
{});
4040

4141
// Fill the spacepoint with the global position and the measurement.
42-
sp.x() = getter::element(global, 0u);
43-
sp.y() = getter::element(global, 1u);
44-
sp.z() = getter::element(global, 2u);
42+
sp.x() = static_cast<float>(getter::element(global, 0u));
43+
sp.y() = static_cast<float>(getter::element(global, 1u));
44+
sp.z() = static_cast<float>(getter::element(global, 2u));
4545
sp.radius_variance() = 0.f;
4646
sp.z_variance() = 0.f;
4747
}

core/include/traccc/seeding/track_params_estimation_helper.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "traccc/edm/measurement_collection.hpp"
1313
#include "traccc/edm/seed_collection.hpp"
1414
#include "traccc/edm/spacepoint_collection.hpp"
15+
#include "traccc/edm/spacepoint_helpers.hpp"
1516
#include "traccc/edm/track_parameters.hpp"
1617

1718
// System include(s).
@@ -57,8 +58,10 @@ inline TRACCC_HOST_DEVICE void seed_to_bound_param_vector(
5758
const edm::spacepoint_collection::const_device::const_proxy_type spT =
5859
spacepoints.at(seed.top_index());
5960

60-
std::array<vector3, 3> sp_global_positions{spB.global(), spM.global(),
61-
spT.global()};
61+
std::array<vector3, 3> sp_global_positions{
62+
edm::get_spacepoint_global<default_algebra>(spB),
63+
edm::get_spacepoint_global<default_algebra>(spM),
64+
edm::get_spacepoint_global<default_algebra>(spT)};
6265

6366
// Define a new coordinate frame with its origin at the bottom space
6467
// point, z axis long the magnetic field direction and y axis

core/include/traccc/utils/detray_conversion.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ template <detray::concepts::algebra ALGEBRA_TYPE>
2828
TRACCC_HOST_DEVICE std::array<float, 2u> to_float_array(
2929
const detray::dpoint2D<ALGEBRA_TYPE>& point);
3030

31+
/// Convert an algebra specific 3D point to a float array of size 3
32+
///
33+
/// @tparam ALGEBRA_TYPE The algebra type of the input point
34+
/// @param point The input 3D point to be converted
35+
/// @return An @c std::array of size 3 containing the converted float values
36+
///
37+
template <detray::concepts::algebra ALGEBRA_TYPE>
38+
TRACCC_HOST_DEVICE std::array<float, 3u> to_float_array(
39+
const detray::dpoint3D<ALGEBRA_TYPE>& point);
40+
3141
/// Convert a float array of size 2 to an algebra specific 2D point
3242
///
3343
/// @tparam ALGEBRA_TYPE The algebra type of the output point
@@ -38,6 +48,16 @@ template <detray::concepts::algebra ALGEBRA_TYPE>
3848
TRACCC_HOST_DEVICE detray::dpoint2D<ALGEBRA_TYPE> to_dpoint2D(
3949
const std::array<float, 2u>& arr);
4050

51+
/// Convert a float array of size 3 to an algebra specific 3D point
52+
///
53+
/// @tparam ALGEBRA_TYPE The algebra type of the output point
54+
/// @param arr The input @c std::array of size 3 containing the float values
55+
/// @return A 3D point of type @c detray::dpoint3D with the converted values
56+
///
57+
template <detray::concepts::algebra ALGEBRA_TYPE>
58+
TRACCC_HOST_DEVICE detray::dpoint3D<ALGEBRA_TYPE> to_dpoint3D(
59+
const std::array<float, 3u>& arr);
60+
4161
} // namespace traccc::utils
4262

4363
// Implementation include(s).

core/include/traccc/utils/impl/detray_conversion.ipp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ TRACCC_HOST_DEVICE std::array<float, 2u> to_float_array(
1717
static_cast<float>(getter::element(point, 1u))};
1818
}
1919

20+
template <detray::concepts::algebra ALGEBRA_TYPE>
21+
TRACCC_HOST_DEVICE std::array<float, 3u> to_float_array(
22+
const detray::dpoint3D<ALGEBRA_TYPE>& point) {
23+
24+
return {static_cast<float>(getter::element(point, 0u)),
25+
static_cast<float>(getter::element(point, 1u)),
26+
static_cast<float>(getter::element(point, 2u))};
27+
}
28+
2029
template <detray::concepts::algebra ALGEBRA_TYPE>
2130
TRACCC_HOST_DEVICE detray::dpoint2D<ALGEBRA_TYPE> to_dpoint2D(
2231
const std::array<float, 2u>& arr) {
@@ -29,4 +38,18 @@ TRACCC_HOST_DEVICE detray::dpoint2D<ALGEBRA_TYPE> to_dpoint2D(
2938
return point;
3039
}
3140

41+
template <detray::concepts::algebra ALGEBRA_TYPE>
42+
TRACCC_HOST_DEVICE detray::dpoint3D<ALGEBRA_TYPE> to_dpoint3D(
43+
const std::array<float, 3u>& arr) {
44+
45+
detray::dpoint3D<ALGEBRA_TYPE> point;
46+
getter::element(point, 0u) =
47+
static_cast<typename ALGEBRA_TYPE::value_type>(arr[0u]);
48+
getter::element(point, 1u) =
49+
static_cast<typename ALGEBRA_TYPE::value_type>(arr[1u]);
50+
getter::element(point, 2u) =
51+
static_cast<typename ALGEBRA_TYPE::value_type>(arr[2u]);
52+
return point;
53+
}
54+
3255
} // namespace traccc::utils

device/cuda/src/gbts_seeding/kernels/GbtsNodesMakingKernels.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ __global__ void count_sp_by_layer(
8686
// count and store x,y,z,cw info
8787
atomicAdd(&d_layerCounts[layerIdx], 1);
8888
spacepointsLayer[spIdx] = layerIdx;
89-
const traccc::point3 pos = spacepoint.global();
89+
const std::array<float, 3u> pos = spacepoint.global();
9090
reducedSP[spIdx] =
9191
make_float4(pos[0], pos[1], pos[2], cluster_diameter);
9292
}

0 commit comments

Comments
 (0)