Skip to content
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
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ endif()
# In order to generate specializations for our kernels, we need to have both
# a working Python interpreter, and a list of supported detectors.
find_package (Python COMPONENTS Interpreter REQUIRED)
set(TRACCC_SUPPORTED_DETECTORS "default_detector;telescope_detector;toy_detector")
# The detector types supported by this build of traccc.
set( TRACCC_SUPPORTED_DETECTORS
"default_detector;odd_detector;telescope_detector"
CACHE STRING
"Semicolon-separated list of detector types to support in this build" )

# Set up build profiling for the project.
if( CTEST_USE_LAUNCHERS )
Expand Down
14 changes: 14 additions & 0 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,17 @@ target_compile_definitions( traccc_core
# Set the algebra-plugins plugin to use.
message(STATUS "Building with plugin type: " ${TRACCC_ALGEBRA_PLUGINS})
target_compile_definitions(traccc_core PUBLIC ALGEBRA_PLUGINS_INCLUDE_${TRACCC_ALGEBRA_PLUGINS})

string(REPLACE ";" ", " TRACCC_DETECTOR_TYPES "${TRACCC_SUPPORTED_DETECTORS}")
message(STATUS "Building with detector types: ${TRACCC_DETECTOR_TYPES}")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/include/traccc/geometry/detector_type_list.hpp.in"
"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/traccc/geometry/detector_type_list.hpp"
@ONLY)

target_include_directories(traccc_core
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include> )

install(
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" )
17 changes: 13 additions & 4 deletions core/include/traccc/geometry/detector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// Detray include(s).
#include <detray/core/detector.hpp>
#include <detray/detectors/default_metadata.hpp>
#include <detray/detectors/itk_metadata.hpp>
#include <detray/detectors/odd_metadata.hpp>
#include <detray/detectors/telescope_metadata.hpp>
#include <detray/detectors/toy_metadata.hpp>

Expand Down Expand Up @@ -75,17 +77,24 @@ concept is_detector_traits = requires {
typename T::buffer;
};

/// Default detector (also used for ODD)
/// Default detector (can contain any detector data)
using default_detector =
detector_traits<detray::default_metadata<traccc::default_algebra>>;

/// Telescope detector
/// ATLAS Inner Tracker (ITk) detector
using itk_detector =
detector_traits<detray::itk_metadata<traccc::default_algebra>>;

/// Open Data Detector (ODD) detector
using odd_detector =
detector_traits<detray::odd_metadata<traccc::default_algebra>>;

/// Detray telescope detector (test detector)
using telescope_detector = detector_traits<
detray::telescope_metadata<traccc::default_algebra, detray::rectangle2D>>;

/// Toy detector
/// Detray toy detector (test detector)
using toy_detector =
detector_traits<detray::toy_metadata<traccc::default_algebra>>;

using detector_type_list = std::tuple<default_detector, telescope_detector>;
} // namespace traccc
1 change: 1 addition & 0 deletions core/include/traccc/geometry/detector_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

// Project include(s).
#include "traccc/geometry/detector.hpp"
#include "traccc/geometry/detector_type_list.hpp"
#include "traccc/geometry/host_detector.hpp"
#include "traccc/geometry/move_only_any.hpp"

Expand Down
21 changes: 21 additions & 0 deletions core/include/traccc/geometry/detector_type_list.hpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2024-2025 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Local include(s).
#include "traccc/geometry/detector.hpp"

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

namespace traccc {

/// Detector types supported by the built libraries.
using detector_type_list = std::tuple<@TRACCC_DETECTOR_TYPES@>;

} // namespace traccc
3 changes: 2 additions & 1 deletion core/include/traccc/geometry/host_detector.hpp
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 CERN for the benefit of the ACTS project
* (c) 2025 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand All @@ -9,6 +9,7 @@

// Project include(s).
#include "traccc/geometry/detector.hpp"
#include "traccc/geometry/detector_type_list.hpp"
#include "traccc/geometry/move_only_any.hpp"

// Detray include(s).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

// Project include(s).
#include "traccc/bfield/magnetic_field_types.hpp"
#include "traccc/geometry/detector_type_list.hpp"
#include "traccc/utils/detector_buffer_bfield_visitor.hpp"
#include "traccc/utils/propagation.hpp"

Expand All @@ -35,7 +36,7 @@ combinatorial_kalman_filter_algorithm::operator()(

// Perform the track finding using the templated implementation.
return detector_buffer_magnetic_field_visitor<
detector_type_list, sycl::bfield_type_list<scalar>>(
traccc::detector_type_list, sycl::bfield_type_list<scalar>>(
detector, field,
[&]<typename detector_t, typename bfield_view_t>(
const typename detector_t::view& det, const bfield_view_t& bfield) {
Expand Down
19 changes: 16 additions & 3 deletions device/sycl/src/utils/detector_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "traccc/definitions/primitives.hpp"
#include "traccc/geometry/detector.hpp"
#include "traccc/geometry/detector_type_list.hpp"

namespace traccc::sycl {

Expand All @@ -18,20 +19,32 @@ namespace traccc::sycl {
*/
struct default_detector_kernel_tag {};
struct telescope_detector_kernel_tag {};
struct odd_detector_kernel_tag {};
struct itk_detector_kernel_tag {};

template <typename T>
struct detector_tag_selector {};

template <>
struct detector_tag_selector<default_detector> {
struct detector_tag_selector<traccc::default_detector> {
using type = default_detector_kernel_tag;
};

template <>
struct detector_tag_selector<telescope_detector> {
struct detector_tag_selector<traccc::telescope_detector> {
using type = telescope_detector_kernel_tag;
};

template <>
struct detector_tag_selector<traccc::odd_detector> {
using type = odd_detector_kernel_tag;
};

template <>
struct detector_tag_selector<traccc::itk_detector> {
using type = itk_detector_kernel_tag;
};

template <typename T>
using detector_tag_selector_t = typename detector_tag_selector<T>::type;

Expand All @@ -48,7 +61,7 @@ struct detector_tag_existance_validator<std::tuple<Ts...>> {
};

static_assert(
detector_tag_existance_validator<detector_type_list>::value,
detector_tag_existance_validator<traccc::detector_type_list>::value,
"Not all detector types registered for SYCL have an accompanying tag");

} // namespace traccc::sycl
7 changes: 5 additions & 2 deletions io/src/read_detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ void read_detector(host_detector& detector, vecmem::memory_resource& mr,

// TODO: Update this
if (header.detector == "Cylindrical detector from DD4hep blueprint") {
::read_detector<default_detector>(detector, mr, geometry_file,
material_file, grid_file);
::read_detector<odd_detector>(detector, mr, geometry_file,
material_file, grid_file);
} else if (header.detector == "detray_detector") {
::read_detector<itk_detector>(detector, mr, geometry_file,
material_file, grid_file);
} else {
// TODO: Warning here
::read_detector<default_detector>(detector, mr, geometry_file,
Expand Down
20 changes: 16 additions & 4 deletions io/src/read_detector_description.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

// Detray include(s)
#include <detray/geometry/tracking_surface.hpp>
#include <detray/io/frontend/impl/json_readers.hpp>
#include <detray/utils/type_registry.hpp>

// VecMem include(s).
Expand Down Expand Up @@ -49,8 +50,8 @@
const traccc::digitization_config& digi)
requires(traccc::is_detector_traits<detector_traits_t>)
{
const traccc::default_detector::host& detector_host =
detector.as<traccc::default_detector>();
const typename detector_traits_t::host& detector_host =
detector.as<detector_traits_t>();

// Iterate over the surfaces of the detector.
const typename detector_traits_t::host::surface_lookup_container& surfaces =
Expand Down Expand Up @@ -99,7 +100,7 @@
std::ostringstream msg;
msg << "Could not find digitization config for geometry ID: "
<< acts_geom_id;
throw std::runtime_error(msg.str());

Check warning on line 103 in io/src/read_detector_description.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define and throw a dedicated exception instead of using a generic one.

See more on https://sonarcloud.io/project/issues?id=acts-project_traccc&issues=AZqnkhu585D-l9bgLgfS&open=AZqnkhu585D-l9bgLgfS&pullRequest=1209
}

// Fill the new element with the digitization configuration for the
Expand All @@ -118,8 +119,19 @@
traccc::host_detector detector;
traccc::io::read_detector(detector, mr, geometry_file);

read_json_dd_impl<traccc::default_detector>(dd, detector, digi);
// detector_buffer_visitor
// TODO: Implement detector visitor!

Check warning on line 122 in io/src/read_detector_description.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this "TODO" comment.

See more on https://sonarcloud.io/project/issues?id=acts-project_traccc&issues=AZqnkhu585D-l9bgLgfQ&open=AZqnkhu585D-l9bgLgfQ&pullRequest=1209
// Peek at the header to determine the kind of detector that is needed
const auto header = detray::io::detail::deserialize_json_header(
traccc::io::get_absolute_path(geometry_file));

if (header.detector == "Cylindrical detector from DD4hep blueprint") {
read_json_dd_impl<traccc::odd_detector>(dd, detector, digi);
} else if (header.detector == "detray_detector") {
read_json_dd_impl<traccc::itk_detector>(dd, detector, digi);
} else {
// TODO: Warning here

Check warning on line 132 in io/src/read_detector_description.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this "TODO" comment.

See more on https://sonarcloud.io/project/issues?id=acts-project_traccc&issues=AZqnkhu585D-l9bgLgfR&open=AZqnkhu585D-l9bgLgfR&pullRequest=1209
read_json_dd_impl<traccc::default_detector>(dd, detector, digi);
}
}

} // namespace
Expand Down
Loading