Skip to content

Commit 28587fd

Browse files
authored
EDM De-Algebraification #1, main branch (2026.04.08.) (#1287)
* Concretized the cells and measurements. Made both of them use a concrete, FP32 interface. One that doesn't depend on how traccc was built exactly. Updated all clients in the core library to successfully use that fixed interface. Even when traccc is built in FP64 mode. * Adapted traccc::io to the concretized measurements. * Adapted the core device code to the cell+measurement concretization. * Adapted traccc::alpaka to the cell+measurement concretization. * Adapted traccc::cuda to the cell+measurement concretization. * Adapted traccc::sycl to the cell+measurement concretization. * Adapted traccc::performance to the cell+measurement concretization. * Adapted all examples to the cell+measurement concretization. * Adapted all tests to the cell+measurement concretization. * Modified the API of edm::measurement. According to PR recommendations.
1 parent 7d4e222 commit 28587fd

163 files changed

Lines changed: 903 additions & 900 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
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

@@ -59,6 +59,8 @@ traccc_add_library( traccc_core core TYPE SHARED
5959
"include/traccc/geometry/detector_conditions_description.hpp"
6060
# Utilities.
6161
"include/traccc/utils/algorithm.hpp"
62+
"include/traccc/utils/detray_conversion.hpp"
63+
"include/traccc/utils/impl/detray_conversion.ipp"
6264
"include/traccc/utils/type_traits.hpp"
6365
"include/traccc/utils/memory_resource.hpp"
6466
"include/traccc/utils/seed_generator.hpp"

core/include/traccc/clusterization/clusterization_algorithm.hpp

Lines changed: 2 additions & 2 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
*/
@@ -32,7 +32,7 @@ namespace traccc::host {
3232
/// module from the cells of the modules.
3333
///
3434
class clusterization_algorithm
35-
: public algorithm<edm::measurement_collection<default_algebra>::host(
35+
: public algorithm<edm::measurement_collection::host(
3636
const edm::silicon_cell_collection::const_view&,
3737
const detector_design_description::const_view&,
3838
const detector_conditions_description::const_view&)>,

core/include/traccc/clusterization/impl/measurement_creation.ipp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
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

10+
// Library include(s).
11+
#include "traccc/utils/detray_conversion.hpp"
12+
13+
// System include(s).
1014
#include <cassert>
1115

1216
namespace traccc::details {
@@ -155,12 +159,11 @@ TRACCC_HOST_DEVICE inline void fill_measurement(
155159
measurement.surface_link() = module_cd.geometry_id();
156160

157161
// apply lorentz shift to the cell position
158-
std::array<scalar, 2> shift = module_cd.measurement_translation();
159-
measurement.local_position() = {static_cast<float>(mean[0]) + shift[0],
160-
static_cast<float>(mean[1]) + shift[1]};
162+
measurement.local_position() = utils::to_float_array<default_algebra>(
163+
mean + module_cd.measurement_translation());
161164

162165
// plus pitch^2 / 12
163-
measurement.local_variance() = var;
166+
measurement.local_variance() = utils::to_float_array<default_algebra>(var);
164167

165168
// For the ambiguity resolution algorithm, give a unique measurement ID
166169
measurement.identifier() = index;
@@ -170,7 +173,7 @@ TRACCC_HOST_DEVICE inline void fill_measurement(
170173
measurement.dimensions() = module_dd.dimensions();
171174

172175
// Set the measurement's subspace.
173-
measurement.subspace() = module_dd.subspace();
176+
measurement.set_subspace(module_dd.subspace());
174177

175178
// Save the index of the cluster that produced this measurement
176179
measurement.cluster_index() = static_cast<unsigned int>(index);

core/include/traccc/clusterization/measurement_creation_algorithm.hpp

Lines changed: 2 additions & 2 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
*/
@@ -31,7 +31,7 @@ namespace traccc::host {
3131
/// module.
3232
///
3333
class measurement_creation_algorithm
34-
: public algorithm<edm::measurement_collection<default_algebra>::host(
34+
: public algorithm<edm::measurement_collection::host(
3535
const edm::silicon_cell_collection::const_view &,
3636
const edm::silicon_cluster_collection::const_view &,
3737
const detector_design_description::const_view &,

core/include/traccc/clusterization/measurement_sorting_algorithm.hpp

Lines changed: 5 additions & 5 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) 2024-2025 CERN for the benefit of the ACTS project
3+
* (c) 2024-2026 CERN for the benefit of the ACTS project
44
*
55
* Mozilla Public License Version 2.0
66
*/
@@ -30,8 +30,8 @@ namespace traccc::host {
3030
/// measurements "correctly" in place.
3131
///
3232
class measurement_sorting_algorithm
33-
: public algorithm<edm::measurement_collection<default_algebra>::host(
34-
const edm::measurement_collection<default_algebra>::const_view&)>,
33+
: public algorithm<edm::measurement_collection::host(
34+
const edm::measurement_collection::const_view&)>,
3535
public messaging {
3636

3737
public:
@@ -49,8 +49,8 @@ class measurement_sorting_algorithm
4949
/// @param measurements The measurements to sort
5050
///
5151
[[nodiscard]] output_type operator()(
52-
const edm::measurement_collection<default_algebra>::const_view&
53-
measurements) const override;
52+
const edm::measurement_collection::const_view& measurements)
53+
const override;
5454

5555
private:
5656
/// The memory resource to use

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

Lines changed: 10 additions & 1 deletion
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) 2025 CERN for the benefit of the ACTS project
3+
* (c) 2025-2026 CERN for the benefit of the ACTS project
44
*
55
* Mozilla Public License Version 2.0
66
*/
@@ -13,6 +13,15 @@
1313

1414
namespace traccc::edm {
1515

16+
template <typename BASE>
17+
template <std::integral TYPE>
18+
TRACCC_HOST_DEVICE void measurement<BASE>::set_subspace(
19+
const std::array<TYPE, 2u>& subs) {
20+
21+
subspace()[0] = static_cast<std::uint8_t>(subs[0]);
22+
subspace()[1] = static_cast<std::uint8_t>(subs[1]);
23+
}
24+
1625
template <typename BASE>
1726
template <typename T>
1827
TRACCC_HOST_DEVICE bool measurement<BASE>::operator==(

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

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

88
#pragma once
99

10+
// Local include(s).
11+
#include "traccc/utils/detray_conversion.hpp"
12+
1013
namespace traccc::edm {
1114

15+
template <detray::concepts::algebra algebra_t, typename measurement_backend_t>
16+
TRACCC_HOST_DEVICE detray::dpoint2D<algebra_t> get_measurement_local(
17+
const edm::measurement<measurement_backend_t>& meas) {
18+
19+
return utils::to_dpoint2D<algebra_t>(meas.local_position());
20+
}
21+
1222
template <detray::concepts::algebra algebra_t, typename measurement_backend_t,
1323
std::integral size_t, size_t D>
1424
TRACCC_HOST_DEVICE void get_measurement_local(
@@ -18,22 +28,28 @@ TRACCC_HOST_DEVICE void get_measurement_local(
1828
static_assert(((D == 1u) || (D == 2u)),
1929
"The measurement dimension must be 1 or 2");
2030

21-
assert((meas.subspace()[0] == e_bound_loc0) ||
22-
(meas.subspace()[0] == e_bound_loc1));
23-
24-
const point2& local = meas.local_position();
31+
assert((meas.subspace()[0] == detray::e_bound_loc0) ||
32+
(meas.subspace()[0] == detray::e_bound_loc1));
2533

2634
switch (meas.subspace()[0]) {
27-
case e_bound_loc0:
28-
getter::element(pos, 0, 0) = local[0];
35+
case detray::e_bound_loc0:
36+
getter::element(pos, 0, 0) =
37+
static_cast<typename algebra_t::value_type>(
38+
meas.local_position()[0]);
2939
if constexpr (D == 2u) {
30-
getter::element(pos, 1, 0) = local[1];
40+
getter::element(pos, 1, 0) =
41+
static_cast<typename algebra_t::value_type>(
42+
meas.local_position()[1]);
3143
}
3244
break;
33-
case e_bound_loc1:
34-
getter::element(pos, 0, 0) = local[1];
45+
case detray::e_bound_loc1:
46+
getter::element(pos, 0, 0) =
47+
static_cast<typename algebra_t::value_type>(
48+
meas.local_position()[1]);
3549
if constexpr (D == 2u) {
36-
getter::element(pos, 1, 0) = local[0];
50+
getter::element(pos, 1, 0) =
51+
static_cast<typename algebra_t::value_type>(
52+
meas.local_position()[0]);
3753
}
3854
break;
3955
default:
@@ -43,6 +59,13 @@ TRACCC_HOST_DEVICE void get_measurement_local(
4359
}
4460
}
4561

62+
template <detray::concepts::algebra algebra_t, typename measurement_backend_t>
63+
TRACCC_HOST_DEVICE detray::dvector2D<algebra_t> get_measurement_variance(
64+
const edm::measurement<measurement_backend_t>& meas) {
65+
66+
return utils::to_dpoint2D<algebra_t>(meas.local_variance());
67+
}
68+
4669
template <detray::concepts::algebra algebra_t, typename measurement_backend_t,
4770
std::integral size_t, size_t D>
4871
TRACCC_HOST_DEVICE void get_measurement_covariance(
@@ -52,26 +75,32 @@ TRACCC_HOST_DEVICE void get_measurement_covariance(
5275
static_assert(((D == 1u) || (D == 2u)),
5376
"The measurement dimension must be 1 or 2");
5477

55-
assert((meas.subspace()[0] == e_bound_loc0) ||
56-
(meas.subspace()[0] == e_bound_loc1));
57-
58-
const variance2& variance = meas.local_variance();
78+
assert((meas.subspace()[0] == detray::e_bound_loc0) ||
79+
(meas.subspace()[0] == detray::e_bound_loc1));
5980

6081
switch (meas.subspace()[0]) {
61-
case e_bound_loc0:
62-
getter::element(cov, 0, 0) = variance[0];
82+
case detray::e_bound_loc0:
83+
getter::element(cov, 0, 0) =
84+
static_cast<typename algebra_t::value_type>(
85+
meas.local_variance()[0]);
6386
if constexpr (D == 2u) {
6487
getter::element(cov, 0, 1) = 0.f;
6588
getter::element(cov, 1, 0) = 0.f;
66-
getter::element(cov, 1, 1) = variance[1];
89+
getter::element(cov, 1, 1) =
90+
static_cast<typename algebra_t::value_type>(
91+
meas.local_variance()[1]);
6792
}
6893
break;
69-
case e_bound_loc1:
70-
getter::element(cov, 0, 0) = variance[1];
94+
case detray::e_bound_loc1:
95+
getter::element(cov, 0, 0) =
96+
static_cast<typename algebra_t::value_type>(
97+
meas.local_variance()[1]);
7198
if constexpr (D == 2u) {
7299
getter::element(cov, 0, 1) = 0.f;
73100
getter::element(cov, 1, 0) = 0.f;
74-
getter::element(cov, 1, 1) = variance[0];
101+
getter::element(cov, 1, 1) =
102+
static_cast<typename algebra_t::value_type>(
103+
meas.local_variance()[0]);
75104
}
76105
break;
77106
default:

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

Lines changed: 2 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) 2025 CERN for the benefit of the ACTS project
3+
* (c) 2025-2026 CERN for the benefit of the ACTS project
44
*
55
* Mozilla Public License Version 2.0
66
*/
@@ -12,8 +12,7 @@ namespace traccc::edm {
1212
template <typename algebra_t>
1313
TRACCC_HOST_DEVICE
1414
typename track_state_collection<algebra_t>::device::object_type
15-
make_track_state(const typename measurement_collection<
16-
algebra_t>::const_device& measurements,
15+
make_track_state(const measurement_collection::const_device& measurements,
1716
unsigned int mindex) {
1817

1918
// Create the result object.

0 commit comments

Comments
 (0)