Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TRACCC library, part of the ACTS project (R&D line)
#
# (c) 2021-2025 CERN for the benefit of the ACTS project
# (c) 2021-2026 CERN for the benefit of the ACTS project
#
# Mozilla Public License Version 2.0

Expand Down Expand Up @@ -59,6 +59,8 @@ traccc_add_library( traccc_core core TYPE SHARED
"include/traccc/geometry/detector_conditions_description.hpp"
# Utilities.
"include/traccc/utils/algorithm.hpp"
"include/traccc/utils/detray_conversion.hpp"
"include/traccc/utils/impl/detray_conversion.ipp"
"include/traccc/utils/type_traits.hpp"
"include/traccc/utils/memory_resource.hpp"
"include/traccc/utils/seed_generator.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2021-2025 CERN for the benefit of the ACTS project
* (c) 2021-2026 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand Down Expand Up @@ -32,7 +32,7 @@ namespace traccc::host {
/// module from the cells of the modules.
///
class clusterization_algorithm
: public algorithm<edm::measurement_collection<default_algebra>::host(
: public algorithm<edm::measurement_collection::host(
const edm::silicon_cell_collection::const_view&,
const detector_design_description::const_view&,
const detector_conditions_description::const_view&)>,
Expand Down
15 changes: 9 additions & 6 deletions core/include/traccc/clusterization/impl/measurement_creation.ipp
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2021-2025 CERN for the benefit of the ACTS project
* (c) 2021-2026 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Library include(s).
#include "traccc/utils/detray_conversion.hpp"

// System include(s).
#include <cassert>

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

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

// plus pitch^2 / 12
measurement.local_variance() = var;
measurement.local_variance() = utils::to_float_array<default_algebra>(var);

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

// Set the measurement's subspace.
measurement.subspace() = module_dd.subspace();
measurement.set_subspace(module_dd.subspace());

// Save the index of the cluster that produced this measurement
measurement.cluster_index() = static_cast<unsigned int>(index);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2021-2025 CERN for the benefit of the ACTS project
* (c) 2021-2026 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand Down Expand Up @@ -31,7 +31,7 @@ namespace traccc::host {
/// module.
///
class measurement_creation_algorithm
: public algorithm<edm::measurement_collection<default_algebra>::host(
: public algorithm<edm::measurement_collection::host(
const edm::silicon_cell_collection::const_view &,
const edm::silicon_cluster_collection::const_view &,
const detector_design_description::const_view &,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2024-2025 CERN for the benefit of the ACTS project
* (c) 2024-2026 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand Down Expand Up @@ -30,8 +30,8 @@ namespace traccc::host {
/// measurements "correctly" in place.
///
class measurement_sorting_algorithm
: public algorithm<edm::measurement_collection<default_algebra>::host(
const edm::measurement_collection<default_algebra>::const_view&)>,
: public algorithm<edm::measurement_collection::host(
const edm::measurement_collection::const_view&)>,
public messaging {

public:
Expand All @@ -49,8 +49,8 @@ class measurement_sorting_algorithm
/// @param measurements The measurements to sort
///
[[nodiscard]] output_type operator()(
const edm::measurement_collection<default_algebra>::const_view&
measurements) const override;
const edm::measurement_collection::const_view& measurements)
const override;

private:
/// The memory resource to use
Expand Down
11 changes: 10 additions & 1 deletion core/include/traccc/edm/impl/measurement_collection.ipp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2025 CERN for the benefit of the ACTS project
* (c) 2025-2026 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand All @@ -13,6 +13,15 @@

namespace traccc::edm {

template <typename BASE>
template <std::integral TYPE>
TRACCC_HOST_DEVICE void measurement<BASE>::set_subspace(
const std::array<TYPE, 2u>& subs) {

subspace()[0] = static_cast<std::uint8_t>(subs[0]);
subspace()[1] = static_cast<std::uint8_t>(subs[1]);
}

template <typename BASE>
template <typename T>
TRACCC_HOST_DEVICE bool measurement<BASE>::operator==(
Expand Down
71 changes: 50 additions & 21 deletions core/include/traccc/edm/impl/measurement_helpers.ipp
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2025 CERN for the benefit of the ACTS project
* (c) 2025-2026 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Local include(s).
#include "traccc/utils/detray_conversion.hpp"

namespace traccc::edm {

template <detray::concepts::algebra algebra_t, typename measurement_backend_t>
TRACCC_HOST_DEVICE detray::dpoint2D<algebra_t> get_measurement_local(
const edm::measurement<measurement_backend_t>& meas) {

return utils::to_dpoint2D<algebra_t>(meas.local_position());
}

template <detray::concepts::algebra algebra_t, typename measurement_backend_t,
std::integral size_t, size_t D>
TRACCC_HOST_DEVICE void get_measurement_local(
Expand All @@ -18,22 +28,28 @@ TRACCC_HOST_DEVICE void get_measurement_local(
static_assert(((D == 1u) || (D == 2u)),
"The measurement dimension must be 1 or 2");

assert((meas.subspace()[0] == e_bound_loc0) ||
(meas.subspace()[0] == e_bound_loc1));

const point2& local = meas.local_position();
assert((meas.subspace()[0] == detray::e_bound_loc0) ||
(meas.subspace()[0] == detray::e_bound_loc1));

switch (meas.subspace()[0]) {
case e_bound_loc0:
getter::element(pos, 0, 0) = local[0];
case detray::e_bound_loc0:
getter::element(pos, 0, 0) =
static_cast<typename algebra_t::value_type>(
meas.local_position()[0]);
if constexpr (D == 2u) {
getter::element(pos, 1, 0) = local[1];
getter::element(pos, 1, 0) =
static_cast<typename algebra_t::value_type>(
meas.local_position()[1]);
}
break;
case e_bound_loc1:
getter::element(pos, 0, 0) = local[1];
case detray::e_bound_loc1:
getter::element(pos, 0, 0) =
static_cast<typename algebra_t::value_type>(
meas.local_position()[1]);
if constexpr (D == 2u) {
getter::element(pos, 1, 0) = local[0];
getter::element(pos, 1, 0) =
static_cast<typename algebra_t::value_type>(
meas.local_position()[0]);
}
break;
default:
Expand All @@ -43,6 +59,13 @@ TRACCC_HOST_DEVICE void get_measurement_local(
}
}

template <detray::concepts::algebra algebra_t, typename measurement_backend_t>
TRACCC_HOST_DEVICE detray::dvector2D<algebra_t> get_measurement_variance(
const edm::measurement<measurement_backend_t>& meas) {

return utils::to_dpoint2D<algebra_t>(meas.local_variance());
}

template <detray::concepts::algebra algebra_t, typename measurement_backend_t,
std::integral size_t, size_t D>
TRACCC_HOST_DEVICE void get_measurement_covariance(
Expand All @@ -52,26 +75,32 @@ TRACCC_HOST_DEVICE void get_measurement_covariance(
static_assert(((D == 1u) || (D == 2u)),
"The measurement dimension must be 1 or 2");

assert((meas.subspace()[0] == e_bound_loc0) ||
(meas.subspace()[0] == e_bound_loc1));

const variance2& variance = meas.local_variance();
assert((meas.subspace()[0] == detray::e_bound_loc0) ||
(meas.subspace()[0] == detray::e_bound_loc1));

switch (meas.subspace()[0]) {
case e_bound_loc0:
getter::element(cov, 0, 0) = variance[0];
case detray::e_bound_loc0:
getter::element(cov, 0, 0) =
static_cast<typename algebra_t::value_type>(
meas.local_variance()[0]);
if constexpr (D == 2u) {
getter::element(cov, 0, 1) = 0.f;
getter::element(cov, 1, 0) = 0.f;
getter::element(cov, 1, 1) = variance[1];
getter::element(cov, 1, 1) =
static_cast<typename algebra_t::value_type>(
meas.local_variance()[1]);
}
break;
case e_bound_loc1:
getter::element(cov, 0, 0) = variance[1];
case detray::e_bound_loc1:
getter::element(cov, 0, 0) =
static_cast<typename algebra_t::value_type>(
meas.local_variance()[1]);
if constexpr (D == 2u) {
getter::element(cov, 0, 1) = 0.f;
getter::element(cov, 1, 0) = 0.f;
getter::element(cov, 1, 1) = variance[0];
getter::element(cov, 1, 1) =
static_cast<typename algebra_t::value_type>(
meas.local_variance()[0]);
}
break;
default:
Expand Down
5 changes: 2 additions & 3 deletions core/include/traccc/edm/impl/track_state_helpers.ipp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2025 CERN for the benefit of the ACTS project
* (c) 2025-2026 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand All @@ -12,8 +12,7 @@ namespace traccc::edm {
template <typename algebra_t>
TRACCC_HOST_DEVICE
typename track_state_collection<algebra_t>::device::object_type
make_track_state(const typename measurement_collection<
algebra_t>::const_device& measurements,
make_track_state(const measurement_collection::const_device& measurements,
unsigned int mindex) {

// Create the result object.
Expand Down
Loading
Loading