Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the spacepoint formation #719

Merged
Merged
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
10 changes: 4 additions & 6 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ traccc_add_library( traccc_core core TYPE SHARED
"src/clusterization/measurement_creation_algorithm.cpp"
"include/traccc/clusterization/measurement_sorting_algorithm.hpp"
"src/clusterization/measurement_sorting_algorithm.cpp"
"include/traccc/clusterization/details/spacepoint_formation.hpp"
"include/traccc/clusterization/impl/spacepoint_formation.ipp"
"include/traccc/clusterization/spacepoint_formation_algorithm.hpp"
"src/clusterization/spacepoint_formation_algorithm.cpp"
"include/traccc/clusterization/clusterization_algorithm.hpp"
"src/clusterization/clusterization_algorithm.cpp"
# Finding algorithmic code
Expand All @@ -82,8 +78,6 @@ traccc_add_library( traccc_core core TYPE SHARED
"include/traccc/seeding/detail/singlet.hpp"
"include/traccc/seeding/detail/seeding_config.hpp"
"include/traccc/seeding/detail/spacepoint_grid.hpp"
"include/traccc/seeding/experimental/spacepoint_formation.hpp"
"include/traccc/seeding/experimental/spacepoint_formation.ipp"
"include/traccc/seeding/seed_selecting_helper.hpp"
"include/traccc/seeding/seed_filtering.hpp"
"src/seeding/seed_filtering.cpp"
Expand All @@ -101,6 +95,10 @@ traccc_add_library( traccc_core core TYPE SHARED
"src/seeding/seed_finding.cpp"
"include/traccc/seeding/spacepoint_binning.hpp"
"src/seeding/spacepoint_binning.cpp"
"include/traccc/seeding/spacepoint_formation_algorithm.hpp"
"include/traccc/seeding/impl/spacepoint_formation_algorithm.ipp"
"include/traccc/seeding/detail/spacepoint_formation.hpp"
"include/traccc/seeding/impl/spacepoint_formation.ipp"
# Ambiguity resolution
"include/traccc/ambiguity_resolution/greedy_ambiguity_resolution_algorithm.hpp"
"src/ambiguity_resolution/greedy_ambiguity_resolution_algorithm.cpp" )
Expand Down
25 changes: 0 additions & 25 deletions core/include/traccc/clusterization/impl/spacepoint_formation.ipp

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@
#include "traccc/definitions/qualifiers.hpp"
#include "traccc/edm/measurement.hpp"
#include "traccc/edm/spacepoint.hpp"
#include "traccc/geometry/silicon_detector_description.hpp"

namespace traccc::details {

/// Function helping with filling/setting up a spacepoint object
///
/// @param[out] sp The spacepoint to fill / set up
/// @param[in] det The tracking geometry
/// @param[in] measurement The measurement to create the spacepoint out of
/// @param[in] dd The detector description
///
TRACCC_HOST_DEVICE inline void fill_spacepoint(
spacepoint& sp, const measurement& meas,
const silicon_detector_description::const_device& dd);
template <typename detector_t>
TRACCC_HOST_DEVICE inline spacepoint create_spacepoint(const detector_t& det,
const measurement& meas);

} // namespace traccc::details

// Include the implementation.
#include "traccc/clusterization/impl/spacepoint_formation.ipp"
#include "traccc/seeding/impl/spacepoint_formation.ipp"
47 changes: 0 additions & 47 deletions core/include/traccc/seeding/experimental/spacepoint_formation.ipp

This file was deleted.

33 changes: 33 additions & 0 deletions core/include/traccc/seeding/impl/spacepoint_formation.ipp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Project include(s).
#include "traccc/definitions/primitives.hpp"

// Detray include(s).
#include "detray/geometry/tracking_surface.hpp"

namespace traccc::details {

template <typename detector_t>
TRACCC_HOST_DEVICE inline spacepoint create_spacepoint(
const detector_t& det, const measurement& meas) {

const detray::tracking_surface sf{det, meas.surface_link};

// This local to global transformation only works for 2D planar
// measurement
// (e.g. barrel pixel and endcap pixel detector)
const auto global = sf.bound_to_global({}, meas.local, {});

// Return the spacepoint with this spacepoint
return spacepoint{global, meas};
}

} // namespace traccc::details
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

// Project include(s).
#include "traccc/seeding/detail/spacepoint_formation.hpp"

namespace traccc::host {

template <typename detector_t>
spacepoint_formation_algorithm<detector_t>::spacepoint_formation_algorithm(
vecmem::memory_resource& mr)
: m_mr(mr) {}

template <typename detector_t>
spacepoint_collection_types::host
spacepoint_formation_algorithm<detector_t>::operator()(
const detector_t& det,
const measurement_collection_types::const_view& measurements_view) const {

// Create device containers for the inputs.
const measurement_collection_types::const_device measurements{
measurements_view};

// Create the result container.
spacepoint_collection_types::host result(&(m_mr.get()));
result.reserve(measurements.size());

// Set up each spacepoint in the result container.
for (const auto& meas : measurements) {

result.push_back(details::create_spacepoint(det, meas));
}

// Return the created container.
return result;
}

} // namespace traccc::host
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) 2023 CERN for the benefit of the ACTS project
* (c) 2021-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand All @@ -18,24 +18,24 @@
// System include(s).
#include <functional>

namespace traccc::experimental {
namespace traccc::host {

/// Algorithm forming space points out of measurements
///
/// This algorithm performs the local-to-global transformation of the 2D
/// measurements made on every detector module, into 3D spacepoint coordinates.
///
template <typename detector_t>
class spacepoint_formation
class spacepoint_formation_algorithm
: public algorithm<spacepoint_collection_types::host(
const detector_t&, const measurement_collection_types::host&)> {
const detector_t&, const measurement_collection_types::const_view&)> {

public:
/// Constructor for spacepoint_formation
///
/// @param mr is the memory resource
///
spacepoint_formation(vecmem::memory_resource& mr);
spacepoint_formation_algorithm(vecmem::memory_resource& mr);

/// Callable operator for the space point formation, based on one single
/// module
Expand All @@ -47,12 +47,12 @@ class spacepoint_formation
///
spacepoint_collection_types::host operator()(
const detector_t& det,
const measurement_collection_types::host& measurements) const override;
const measurement_collection_types::const_view&) const override;

private:
std::reference_wrapper<vecmem::memory_resource> m_mr;
};

} // namespace traccc::experimental
} // namespace traccc::host

#include "traccc/seeding/experimental/spacepoint_formation.ipp"
#include "traccc/seeding/impl/spacepoint_formation_algorithm.ipp"
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/

// Library include(s).
#include "traccc/clusterization/spacepoint_formation_algorithm.hpp"
#include "traccc/seeding/spacepoint_formation_algorithm.hpp"

#include "traccc/clusterization/details/spacepoint_formation.hpp"
#include "traccc/seeding/details/spacepoint_formation.hpp"

namespace traccc::host {

Expand Down
4 changes: 2 additions & 2 deletions device/alpaka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ traccc_add_alpaka_library( traccc_alpaka alpaka TYPE SHARED
"src/clusterization/clusterization_algorithm.cpp"
"include/traccc/alpaka/clusterization/measurement_sorting_algorithm.hpp"
"src/clusterization/measurement_sorting_algorithm.cpp"
"include/traccc/alpaka/clusterization/spacepoint_formation_algorithm.hpp"
"src/clusterization/spacepoint_formation_algorithm.cpp"
"include/traccc/alpaka/seeding/spacepoint_formation_algorithm.hpp"
"src/seeding/spacepoint_formation_algorithm.cpp"
# Seeding code
"src/seeding/spacepoint_binning.cpp"
"src/seeding/seed_finding.cpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "traccc/edm/cell.hpp"
#include "traccc/edm/measurement.hpp"
#include "traccc/edm/spacepoint.hpp"
#include "traccc/geometry/silicon_detector_description.hpp"
#include "traccc/utils/algorithm.hpp"
#include "traccc/utils/memory_resource.hpp"

Expand All @@ -28,10 +27,11 @@ namespace traccc::alpaka {
/// This algorithm performs the local-to-global transformation of the 2D
/// measurements made on every detector module, into 3D spacepoint coordinates.
///
template <typename detector_t>
class spacepoint_formation_algorithm
: public algorithm<spacepoint_collection_types::buffer(
const measurement_collection_types::const_view&,
const silicon_detector_description::const_view&)> {
const typename detector_t::view_type&,
const measurement_collection_types::const_view&)> {

public:
/// Constructor for spacepoint_formation
Expand All @@ -44,14 +44,14 @@ class spacepoint_formation_algorithm
/// Callable operator for the space point formation, based on one single
/// module
///
/// @param measurements_view A collection of measurements
/// @param det_descr The detector description
/// @param det_view A view type object of tracking geometry
/// @param measurements All reconstructed measurements in an event
/// @return A spacepoint container, with one spacepoint for every
/// measurement
///
output_type operator()(
const measurement_collection_types::const_view& measurements_view,
const silicon_detector_description::const_view& det_descr)
spacepoint_collection_types::buffer operator()(
const typename detector_t::view_type& det_view,
const measurement_collection_types::const_view& measurements_view)
const override;

private:
Expand Down
Loading
Loading