Skip to content

Commit

Permalink
Merge branch 'main' into refactor-direct-navigator-initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand authored May 24, 2024
2 parents 7719ab1 + 273278b commit 7bfd0f0
Show file tree
Hide file tree
Showing 180 changed files with 2,104 additions and 4,603 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ IncludeCategories:
# Acts headers before system headers to ensure that they include what they use
- Regex: '^(<|")Acts.*'
Priority: 1
- Regex: '^(<|")ACTFW/.*'
- Regex: '^(<|")ActsExamples/.*'
Priority: 1
# standard library includes: '<...>' without any '/' or '.' in the path
- Regex: '^<[^/.]*>'
Expand Down
46 changes: 1 addition & 45 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -515,48 +515,4 @@ jobs:
run: cmake --build build-downstream
- name: Downstream run
run: ./build-downstream/bin/ShowActsVersion


sycl:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2004_oneapi:v41
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4

- name: Restore ccache
uses: actions/cache/restore@v4
id: ccache-restore
with:
path: ${{ github.workspace }}/ccache
key: ${{ runner.os }}-ccache-sycl_${{ env.CCACHE_KEY_SUFFIX }}_${{ github.sha }}
restore-keys: |
${{ runner.os }}-ccache-sycl_${{ env.CCACHE_KEY_SUFFIX }}_
- name: Configure
run: >
source /opt/intel/oneapi/setvars.sh
&& ccache -z
&& cmake -B build -S .
-GNinja
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER=/opt/intel/oneapi/compiler/2022.0.2/linux/bin-llvm/clang++
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_CXX_FLAGS=-Werror
-DACTS_SETUP_VECMEM=ON
-DACTS_BUILD_PLUGIN_SYCL=ON
-DACTS_BUILD_UNITTESTS=ON
- name: Build
run: >
source /opt/intel/oneapi/setvars.sh
&& cmake --build build
- name: ccache stats
run: ccache -s
- name: Save ccache
uses: actions/cache/save@v4
if: always()
with:
path: ${{ github.workspace }}/ccache
key: ${{ steps.ccache-restore.outputs.cache-primary-key }}

70 changes: 59 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ option(ACTS_BUILD_PLUGIN_PODIO "Build Podio plugin" OFF)
option(ACTS_BUILD_PLUGIN_EDM4HEP "Build EDM4hep plugin" OFF)
option(ACTS_BUILD_PLUGIN_FPEMON "Build FPE monitoring plugin" OFF)
option(ACTS_BUILD_PLUGIN_GEOMODEL "Build GeoModel plugin" OFF)
option(ACTS_BUILD_PLUGIN_COVFIE "Build Covfie plugin" OFF)
option(ACTS_BUILD_PLUGIN_DETRAY "Build Detray plugin" OFF)
option(ACTS_BUILD_PLUGIN_TRACCC "Build Traccc plugin" OFF)
option(ACTS_USE_SYSTEM_GEOMODEL "Use a system-provided GeoModel installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_BUILD_PLUGIN_GEANT4 "Build Geant4 plugin" OFF)
option(ACTS_BUILD_PLUGIN_EXATRKX "Build the Exa.TrkX plugin" OFF)
Expand All @@ -46,9 +49,18 @@ option(ACTS_BUILD_PLUGIN_JSON "Build json plugin" OFF)
option(ACTS_USE_SYSTEM_NLOHMANN_JSON "Use nlohmann::json provided by the system instead of the bundled version" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_BUILD_PLUGIN_LEGACY "Build legacy plugin" OFF)
option(ACTS_BUILD_PLUGIN_ONNX "Build ONNX plugin" OFF)
option(ACTS_SETUP_COVFIE "Explicitly set up covfie for the project" OFF)
option(ACTS_USE_SYSTEM_COVFIE "Use a system-provided covfie installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_SETUP_DETRAY "Explicitly set up detray for the project" OFF)
option(ACTS_USE_SYSTEM_DETRAY "Use a system-provided detray installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_SETUP_TRACCC "Explicitly set up traccc for the project" OFF)
option(ACTS_USE_SYSTEM_TRACCC "Use a system-provided traccc installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_SETUP_DFELIBS "Explicitly set up dfelibs for the project" ON)
option(ACTS_USE_SYSTEM_DFELIBS "Use a system-provided dfelibs installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_SETUP_VECMEM "Explicitly set up vecmem for the project" OFF)
option(ACTS_USE_SYSTEM_VECMEM "Use a system-provided vecmem installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_BUILD_PLUGIN_SYCL "Build SYCL plugin" OFF)
option(ACTS_SETUP_ALGEBRAPLUGINS "Explicitly set up algebra-plugins for the project" OFF)
option(ACTS_USE_SYSTEM_ALGEBRAPLUGINS "Use a system-provided algebra-plugins installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_BUILD_PLUGIN_TGEO "Build TGeo plugin" OFF)
# fatras related options
option(ACTS_BUILD_FATRAS "Build FAst TRAcking Simulation package" OFF)
Expand Down Expand Up @@ -119,6 +131,7 @@ set_option_if(
OR ACTS_BUILD_EXAMPLES_BINARIES
OR ACTS_BUILD_EVERYTHING)
# core plugins might be required by examples or depend on each other

set_option_if(
ACTS_BUILD_PLUGIN_DD4HEP
ACTS_BUILD_EXAMPLES_DD4HEP OR ACTS_BUILD_EVERYTHING OR
Expand Down Expand Up @@ -185,9 +198,9 @@ set(_acts_boost_version 1.71.0)
set(_acts_dd4hep_version 1.21)
set(_acts_edm4hep_version 0.7)
set(_acts_geomodel_version 4.6.0)
set(_acts_eigen3_version 3.3.7)
set(_acts_podio_version 0.16)
set(_acts_doxygen_version 1.9.4)
set(_acts_eigen3_version 3.3.7)
set(_acts_hepmc3_version 3.2.1)
set(_acts_nlohmanjson_version 3.2.0)
set(_acts_onnxruntime_version 1.12.0)
Expand All @@ -198,6 +211,9 @@ set(_acts_tbb_version 2020.1)
# this version we will try so.
set(_acts_boost_recommended_version 1.78.0)

# Include the sources for the external dependencies.
include(ActsExternSources)

# required packages
if (ACTS_SETUP_BOOST)
if (ACTS_USE_SYSTEM_BOOST)
Expand Down Expand Up @@ -228,11 +244,29 @@ if (ACTS_SETUP_EIGEN3)
endif()
endif()

if (ACTS_SETUP_DFELIBS)
if (ACTS_USE_SYSTEM_DFELIBS)
find_package(dfelibs ${_acts_dfelibs_version} REQUIRED)
else()
add_subdirectory(thirdparty/dfelibs)
endif()
endif()

if (ACTS_SETUP_VECMEM)
if (ACTS_USE_SYSTEM_VECMEM)
find_package(vecmem REQUIRED)
find_package(vecmem ${_acts_vecmem_version} REQUIRED)
else()
add_subdirectory(thirdparty/vecmem)
# Make the "VecMem language code" available for the whole project.
include( "${VECMEM_LANGUAGE_DIR}/vecmem-check-language.cmake" )
endif()
endif()

if (ACTS_SETUP_ALGEBRAPLUGINS)
if (ACTS_USE_SYSTEM_ALGEBRAPLUGINS)
find_package(algebra-plugins ${_acts_algebraplugins_version} REQUIRED)
else()
add_subdirectory(thirdparty/algebra-plugins)
endif()
endif()

Expand Down Expand Up @@ -270,9 +304,30 @@ endmacro()
# when a particular package is actually needed.

# plugin dependencies
if(ACTS_SETUP_COVFIE)
if(ACTS_USE_SYSTEM_COVFIE)
find_package(covfie ${_acts_covfie_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/covfie)
endif()
endif()
if(ACTS_SETUP_DETRAY)
if(ACTS_USE_SYSTEM_DETRAY)
find_package(detray ${_acts_detray_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/detray)
endif()
endif()
if(ACTS_SETUP_TRACCC)
if(ACTS_USE_SYSTEM_TRACCC)
find_package(traccc ${_acts_traccc_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/traccc)
endif()
endif()

if(ACTS_BUILD_PLUGIN_ACTSVG)
if(ACTS_USE_SYSTEM_ACTSVG)
message(STATUS "Using system installation of actsvg")
find_package(actsvg ${_acts_actsvg_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/actsvg)
Expand All @@ -288,24 +343,18 @@ if(ACTS_BUILD_PLUGIN_DD4HEP)
endif()
if(ACTS_BUILD_PLUGIN_JSON)
if(ACTS_USE_SYSTEM_NLOHMANN_JSON)
message(STATUS "Using system installation of nlohmann::json")
find_package(nlohmann_json ${_acts_nlohmanjson_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/nlohmann_json)
endif()
endif()
if(ACTS_BUILD_PLUGIN_GEOMODEL)
if(ACTS_USE_SYSTEM_GEOMODEL)
message(STATUS "Using system installation of GeoModel")
find_package(GeoModel ${_acts_geomodel_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/GeoModel)
endif()
endif()

if(ACTS_BUILD_PLUGIN_SYCL)
find_package(SYCL REQUIRED)
endif()
if(ACTS_BUILD_PLUGIN_TGEO)
find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Geom Graf)
check_root_compatibility()
Expand Down Expand Up @@ -357,7 +406,6 @@ if(ACTS_BUILD_EXAMPLES)
# for simplicity always request all potentially required components.
find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Core Geom Graf GenVector Hist Tree TreePlayer)
check_root_compatibility()
add_subdirectory(thirdparty/dfelibs)
endif()
if(ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS)
find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development)
Expand Down
15 changes: 8 additions & 7 deletions Core/include/Acts/Detector/Detector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ class Detector : public std::enable_shared_from_this<Detector> {
///
/// @param name the detecor name
/// @param rootVolumes the volumes contained by this detector
/// @param detectorVolumeUpdater is a Delegate to find the associated volume
/// @param detectorVolumeFinder is a Delegate to find the associated volume
///
/// @note will throw an exception if volumes vector is empty
/// @note will throw an exception if duplicate volume names exist
/// @note will throw an exception if the delegate is not connected
Detector(std::string name,
std::vector<std::shared_ptr<DetectorVolume>> rootVolumes,
DetectorVolumeUpdater detectorVolumeUpdater) noexcept(false);
ExternalNavigationDelegate detectorVolumeFinder) noexcept(false);

public:
/// Factory for producing memory managed instances of Detector.
static std::shared_ptr<Detector> makeShared(
std::string name,
std::vector<std::shared_ptr<DetectorVolume>> rootVolumes,
DetectorVolumeUpdater detectorVolumeUpdater);
ExternalNavigationDelegate detectorVolumeFinder);

/// Retrieve a @c std::shared_ptr for this surface (non-const version)
///
Expand Down Expand Up @@ -213,11 +213,12 @@ class Detector : public std::enable_shared_from_this<Detector> {

/// Update the volume finder
///
/// @param detectorVolumeUpdater the new volume finder
void updateDetectorVolumeFinder(DetectorVolumeUpdater detectorVolumeUpdater);
/// @param detectorVolumeFinder the new volume finder
void updateDetectorVolumeFinder(
ExternalNavigationDelegate detectorVolumeFinder);

/// Const access to the volume finder
const DetectorVolumeUpdater& detectorVolumeFinder() const;
const ExternalNavigationDelegate& detectorVolumeFinder() const;

/// Return the name of the detector
const std::string& name() const;
Expand All @@ -233,7 +234,7 @@ class Detector : public std::enable_shared_from_this<Detector> {
DetectorVolume::ObjectStore<std::shared_ptr<DetectorVolume>> m_volumes;

/// A volume finder delegate
DetectorVolumeUpdater m_detectorVolumeUpdater;
ExternalNavigationDelegate m_volumeFinder;

/// Name/index map to find volumes by name and detect duplicates
std::unordered_map<std::string, std::size_t> m_volumeNameIndex;
Expand Down
10 changes: 5 additions & 5 deletions Core/include/Acts/Detector/DetectorComponents.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Detector/PortalGenerators.hpp"
#include "Acts/Navigation/DetectorVolumeUpdaters.hpp"
#include "Acts/Navigation/SurfaceCandidatesUpdaters.hpp"
#include "Acts/Navigation/InternalNavigation.hpp"
#include "Acts/Navigation/PortalNavigation.hpp"

#include <map>
#include <memory>
Expand Down Expand Up @@ -39,7 +39,7 @@ struct RootDetectorVolumes {
/// The list of root volumes
std::vector<std::shared_ptr<DetectorVolume>> volumes = {};
/// The Root volumes finder
DetectorVolumeUpdater volumeFinder;
ExternalNavigationDelegate volumeFinder;
};

/// @brief The currently built detector components
Expand Down Expand Up @@ -82,9 +82,9 @@ struct InternalStructure {
/// Contained volumes of this volume, handled by the volumeUpdater
std::vector<std::shared_ptr<DetectorVolume>> volumes = {};
/// Navigation delegate for surfaces
SurfaceCandidatesUpdater surfacesUpdater;
InternalNavigationDelegate surfacesUpdater;
// Navigation delegate for volumes
DetectorVolumeUpdater volumeUpdater;
ExternalNavigationDelegate volumeUpdater;
};

} // namespace Experimental
Expand Down
Loading

0 comments on commit 7bfd0f0

Please sign in to comment.