diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 366796f4eec..843980dd82a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -373,19 +373,6 @@ linux_ubuntu_2204_clang: - ctest --test-dir build -j$(nproc) -lcg_104: - <<: *lcg_base_job - - variables: - LCG_VERSION: "104" - - parallel: - matrix: - - OS: [alma9] - COMPILER: - - gcc13 - - clang16 - lcg_105: <<: *lcg_base_job diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 908c2c8e2aa..9000c17f6e9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,9 @@ repos: rev: v3.2.0 hooks: - id: trailing-whitespace + exclude: \.(diff|patch)$ - id: end-of-file-fixer + exclude: \.(diff|patch)$ - id: check-yaml - id: check-added-large-files @@ -20,3 +22,9 @@ repos: rev: 24.4.2 hooks: - id: black-jupyter + + - repo: https://github.com/BlankSpruce/gersemi + rev: 0.15.0 + hooks: + - id: gersemi + args: ["-i", "--no-warn-about-unknown-commands"] diff --git a/Alignment/CMakeLists.txt b/Alignment/CMakeLists.txt index e33424fc5a0..460b2c09674 100644 --- a/Alignment/CMakeLists.txt +++ b/Alignment/CMakeLists.txt @@ -1,21 +1,18 @@ -add_library(ActsAlignment SHARED - src/Kernel/detail/AlignmentEngine.cpp) +add_library(ActsAlignment SHARED src/Kernel/detail/AlignmentEngine.cpp) target_include_directories( - ActsAlignment - PUBLIC - $ - $) + ActsAlignment + PUBLIC + $ + $ +) -target_link_libraries( - ActsAlignment - PUBLIC ActsCore) +target_link_libraries(ActsAlignment PUBLIC ActsCore) install( - TARGETS ActsAlignment - EXPORT ActsAlignmentTargets + TARGETS ActsAlignment + EXPORT ActsAlignmentTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -install( - DIRECTORY include/ActsAlignment - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) +install(DIRECTORY include/ActsAlignment DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/CI/physmon/reference/trackfitting_gsf/performance_trackfitting.root b/CI/physmon/reference/trackfitting_gsf/performance_trackfitting.root index 02975d42572..d8ebdb910ed 100644 Binary files a/CI/physmon/reference/trackfitting_gsf/performance_trackfitting.root and b/CI/physmon/reference/trackfitting_gsf/performance_trackfitting.root differ diff --git a/CMakeLists.txt b/CMakeLists.txt index ce643320eee..a132cce73d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,8 @@ project(Acts VERSION ${_acts_version} LANGUAGES CXX) # that it is off/empty by default. if you think that is not possible, then # it probably is not an optional component. # core related options +# Formatting needs to be preserved here for parsing +# gersemi: off set(ACTS_PARAMETER_DEFINITIONS_HEADER "" CACHE FILEPATH "Use a different (track) parameter definitions header") set(ACTS_SOURCELINK_SBO_SIZE "" CACHE STRING "Customize the SBO size used by SourceLink") option(ACTS_FORCE_ASSERTIONS "Force assertions regardless of build type" OFF) @@ -95,6 +97,7 @@ set(ACTS_GPERF_INSTALL_DIR "" CACHE STRING "Hint to help find gperf if profiling option(ACTS_ENABLE_LOG_FAILURE_THRESHOLD "Enable failing on log messages with level above certain threshold" OFF) set(ACTS_LOG_FAILURE_THRESHOLD "" CACHE STRING "Log level above which an exception should be automatically thrown. If ACTS_ENABLE_LOG_FAILURE_THRESHOLD is set and this is unset, this will enable a runtime check of the log level.") +# gersemi: on # handle option inter-dependencies and the everything flag # NOTE: ordering is important here. dependencies must come before dependees @@ -109,59 +112,75 @@ set_option_if( OR ACTS_BUILD_EXAMPLES_HEPMC3 OR ACTS_BUILD_EXAMPLES_PYTHIA8 OR ACTS_BUILD_EXAMPLES_EXATRKX - OR ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS) + OR ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS +) # 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_EXAMPLES_EDM4HEP) + ACTS_BUILD_EXAMPLES_EDM4HEP +) set_option_if( ACTS_BUILD_PLUGIN_EDM4HEP - ACTS_BUILD_EXAMPLES_EDM4HEP) + ACTS_BUILD_EXAMPLES_EDM4HEP +) set_option_if( ACTS_BUILD_PLUGIN_PODIO - ACTS_BUILD_EXAMPLES_EDM4HEP) + ACTS_BUILD_EXAMPLES_EDM4HEP +) set_option_if( ACTS_BUILD_PLUGIN_GEANT4 - ACTS_BUILD_EXAMPLES_GEANT4) + ACTS_BUILD_EXAMPLES_GEANT4 +) set_option_if( ACTS_BUILD_PLUGIN_TGEO ACTS_BUILD_PLUGIN_DD4HEP OR - ACTS_BUILD_EXAMPLES) + ACTS_BUILD_EXAMPLES +) set_option_if( ACTS_BUILD_PLUGIN_IDENTIFICATION ACTS_BUILD_PLUGIN_TGEO OR ACTS_BUILD_PLUGIN_PODIO OR - ACTS_BUILD_EXAMPLES) + ACTS_BUILD_EXAMPLES +) set_option_if( ACTS_BUILD_PLUGIN_JSON - ACTS_BUILD_EXAMPLES) + ACTS_BUILD_EXAMPLES +) set_option_if( ACTS_BUILD_FATRAS - ACTS_BUILD_EXAMPLES) + ACTS_BUILD_EXAMPLES +) set_option_if( ACTS_BUILD_PLUGIN_EXATRKX - ACTS_BUILD_EXAMPLES_EXATRKX) + ACTS_BUILD_EXAMPLES_EXATRKX +) set_option_if( ACTS_BUILD_PLUGIN_FPEMON - ACTS_BUILD_EXAMPLES) + ACTS_BUILD_EXAMPLES +) set_option_if( ACTS_BUILD_PLUGIN_JSON - ACTS_BUILD_PLUGIN_TRACCC) + ACTS_BUILD_PLUGIN_TRACCC +) # feature tests include(CheckCXXSourceCompiles) # function that tests if the root installation is compatible function(check_root_compatibility) - get_target_property(ROOT_INCLUDE_DIR ROOT::Core INTERFACE_INCLUDE_DIRECTORIES) - set(CMAKE_REQUIRED_INCLUDES ${ROOT_INCLUDE_DIR}) - #yolo - #check_cxx_source_compiles(" #include \n #include \nint main(){}" ROOT_COMPATIBILITY_CHECK) - #if(NOT ROOT_COMPATIBILITY_CHECK) - # message(FATAL_ERROR "Root installation is misconfigured. Ensure that your Root installation was compiled.") - #endif() + get_target_property( + ROOT_INCLUDE_DIR + ROOT::Core + INTERFACE_INCLUDE_DIRECTORIES + ) + set(CMAKE_REQUIRED_INCLUDES ${ROOT_INCLUDE_DIR}) + #yolo + #check_cxx_source_compiles(" #include \n #include \nint main(){}" ROOT_COMPATIBILITY_CHECK) + #if(NOT ROOT_COMPATIBILITY_CHECK) + # message(FATAL_ERROR "Root installation is misconfigured. Ensure that your Root installation was compiled.") + #endif() endfunction() # additional configuration and tools @@ -171,13 +190,24 @@ include(ActsComponentsHelpers) # handle components via add_..._if commands include(ActsStaticAnalysis) # place build products in `/bin` and `/lib` for simple use -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY + "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}" +) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY + "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}" +) # This needs to happen before we set up any targets if(ACTS_FORCE_ASSERTIONS) - message(STATUS "Injecting headers to force assertions. This can have side-effects, USE WITH CAUTION!") - include_directories(BEFORE SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/cmake/assert_include) + message( + STATUS + "Injecting headers to force assertions. This can have side-effects, USE WITH CAUTION!" + ) + include_directories( + BEFORE + SYSTEM + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/assert_include + ) endif() # minimal dependency versions. they are defined here in a single place so @@ -214,37 +244,56 @@ include(ActsExternSources) # Controls behavior of DOWNLOAD_EXTRACT_TIMESTAMP if(POLICY CMP0135) - cmake_policy(SET CMP0135 NEW) + cmake_policy(SET CMP0135 NEW) endif() # required packages -if (ACTS_SETUP_BOOST) - if(POLICY CMP0167) - cmake_policy(SET CMP0167 NEW) - endif() - - # Enable both program_options and unit_test_framework to reduce complexity - # Also Cuda tests seem to use program_options - if( ACTS_BUILD_ANALYSIS_APPS OR ACTS_BUILD_UNITTESTS OR ACTS_BUILD_INTEGRATIONTESTS OR ACTS_BUILD_BENCHMARKS ) - find_package(Boost ${_acts_boost_version} REQUIRED COMPONENTS program_options unit_test_framework) - else() - find_package(Boost ${_acts_boost_version} REQUIRED COMPONENTS) - endif() - - if(Boost_VERSION VERSION_LESS _acts_boost_recommended_version) - message(WARNING "Found Boost ${Boost_VERSION} - recommended is at least ${_acts_boost_recommended_version}") - endif() +if(ACTS_SETUP_BOOST) + if(POLICY CMP0167) + cmake_policy(SET CMP0167 NEW) + endif() + + # Enable both program_options and unit_test_framework to reduce complexity + # Also Cuda tests seem to use program_options + if( + ACTS_BUILD_ANALYSIS_APPS + OR ACTS_BUILD_UNITTESTS + OR ACTS_BUILD_INTEGRATIONTESTS + OR ACTS_BUILD_BENCHMARKS + ) + find_package( + Boost + ${_acts_boost_version} + REQUIRED + COMPONENTS program_options unit_test_framework + ) + else() + find_package(Boost ${_acts_boost_version} REQUIRED COMPONENTS) + endif() + + if(Boost_VERSION VERSION_LESS _acts_boost_recommended_version) + message( + WARNING + "Found Boost ${Boost_VERSION} - recommended is at least ${_acts_boost_recommended_version}" + ) + endif() + + if(Boost_VERSION VERSION_EQUAL "1.85.0") + message( + WARNING + "Boost 1.85.0 is known to be broken (https://github.com/boostorg/container/issues/273). Please use a different version." + ) + endif() endif() -if (ACTS_SETUP_EIGEN3) - if (ACTS_USE_SYSTEM_EIGEN3) - find_package(Eigen3 ${_acts_eigen3_version} REQUIRED CONFIG) - else() - add_subdirectory(thirdparty/eigen3) - endif() +if(ACTS_SETUP_EIGEN3) + if(ACTS_USE_SYSTEM_EIGEN3) + find_package(Eigen3 ${_acts_eigen3_version} REQUIRED CONFIG) + else() + add_subdirectory(thirdparty/eigen3) + endif() endif() - find_package(Filesystem REQUIRED) # the `_VERSION` variables set by `setup(... VERSION ...)` have @@ -254,22 +303,28 @@ find_package(Filesystem REQUIRED) # global scope and is accessible within the main project later on. cmake_policy(SET CMP0048 NEW) macro(project) - _project(${ARGN}) - set(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "") + _project(${ARGN}) + set(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "") endmacro() # CUDA settings are collected here in a macro, so that they can be reused by different plugins macro(enable_cuda) - enable_language(CUDA) - set(CMAKE_CUDA_STANDARD 14 CACHE STRING "CUDA C++ standard to use") - set(CMAKE_CUDA_STANDARD_REQUIRED ON CACHE BOOL - "Force the C++ standard requirement") - if(NOT CMAKE_CUDA_ARCHITECTURES) - set(CMAKE_CUDA_ARCHITECTURES "35;52;75" CACHE STRING - "CUDA architectures to generate code for") - endif() - set(CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG} -g -G") - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda") + enable_language(CUDA) + set(CMAKE_CUDA_STANDARD 14 CACHE STRING "CUDA C++ standard to use") + set(CMAKE_CUDA_STANDARD_REQUIRED + ON + CACHE BOOL + "Force the C++ standard requirement" + ) + if(NOT CMAKE_CUDA_ARCHITECTURES) + set(CMAKE_CUDA_ARCHITECTURES + "35;52;75" + CACHE STRING + "CUDA architectures to generate code for" + ) + endif() + set(CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG} -g -G") + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda") endmacro() # optional packages @@ -278,152 +333,194 @@ endmacro() # the same package twice. This avoids having complex if/else trees to sort out # when a particular package is actually needed. if(ACTS_BUILD_PLUGIN_ACTSVG) - if(ACTS_USE_SYSTEM_ACTSVG) - find_package(actsvg ${_acts_actsvg_version} REQUIRED CONFIG) - else() - add_subdirectory(thirdparty/actsvg) - endif() + if(ACTS_USE_SYSTEM_ACTSVG) + find_package(actsvg ${_acts_actsvg_version} REQUIRED CONFIG) + else() + add_subdirectory(thirdparty/actsvg) + endif() endif() if(ACTS_BUILD_PLUGIN_CUDA) - enable_cuda() + enable_cuda() endif() if(ACTS_BUILD_PLUGIN_DD4HEP) - # Explicitly find python so we can more easily override the version - find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development) - find_package(DD4hep ${_acts_dd4hep_version} REQUIRED CONFIG COMPONENTS DDCore DDDetectors) + # Explicitly find python so we can more easily override the version + find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development) + find_package( + DD4hep + ${_acts_dd4hep_version} + REQUIRED + CONFIG + COMPONENTS DDCore DDDetectors + ) endif() if(ACTS_BUILD_PLUGIN_JSON) - if(ACTS_USE_SYSTEM_NLOHMANN_JSON) - find_package(nlohmann_json ${_acts_nlohmanjson_version} REQUIRED CONFIG) - else() - add_subdirectory(thirdparty/nlohmann_json) - endif() + if(ACTS_USE_SYSTEM_NLOHMANN_JSON) + find_package(nlohmann_json ${_acts_nlohmanjson_version} REQUIRED CONFIG) + else() + add_subdirectory(thirdparty/nlohmann_json) + endif() endif() if(ACTS_BUILD_PLUGIN_GEOMODEL) - find_package(GeoModelCore ${_acts_geomodel_version} REQUIRED CONFIG) - find_package(GeoModelIO ${_acts_geomodel_version} REQUIRED CONFIG) + find_package(GeoModelCore ${_acts_geomodel_version} REQUIRED CONFIG) + find_package(GeoModelIO ${_acts_geomodel_version} REQUIRED CONFIG) endif() if(ACTS_BUILD_PLUGIN_TGEO) - find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Geom Graf) - check_root_compatibility() + find_package( + ROOT + ${_acts_root_version} + REQUIRED + CONFIG + COMPONENTS Geom Graf + ) + check_root_compatibility() endif() if(ACTS_BUILD_ANALYSIS_APPS) - find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Geom Graf) - check_root_compatibility() + find_package( + ROOT + ${_acts_root_version} + REQUIRED + CONFIG + COMPONENTS Geom Graf + ) + check_root_compatibility() endif() if(ACTS_BUILD_PLUGIN_EXATRKX) - find_package(Torch REQUIRED) - if(ACTS_EXATRKX_ENABLE_CUDA) - find_package(CUDAToolkit REQUIRED) - enable_cuda() - add_subdirectory(thirdparty/FRNN) - message(STATUS "Build Exa.TrkX plugin with CUDA") - else() - message(STATUS "Build Exa.TrkX plugin for CPU only") - endif() - if(NOT (ACTS_EXATRKX_ENABLE_ONNX OR ACTS_EXATRKX_ENABLE_TORCH)) - message(FATAL_ERROR - "When building the Exa.TrkX plugin, at least one of ACTS_EXATRKX_ENABLE_ONNX \ + find_package(Torch REQUIRED) + if(ACTS_EXATRKX_ENABLE_CUDA) + find_package(CUDAToolkit REQUIRED) + enable_cuda() + add_subdirectory(thirdparty/FRNN) + message(STATUS "Build Exa.TrkX plugin with CUDA") + else() + message(STATUS "Build Exa.TrkX plugin for CPU only") + endif() + if(NOT (ACTS_EXATRKX_ENABLE_ONNX OR ACTS_EXATRKX_ENABLE_TORCH)) + message( + FATAL_ERROR + "When building the Exa.TrkX plugin, at least one of ACTS_EXATRKX_ENABLE_ONNX \ and ACTS_EXATRKX_ENABLE_TORCHSCRIPT must be enabled." - ) - endif() - if(ACTS_EXATRKX_ENABLE_ONNX) - find_package(cugraph REQUIRED) - endif() - if(ACTS_EXATRKX_ENABLE_TORCH) - find_package(TorchScatter REQUIRED) - endif() + ) + endif() + if(ACTS_EXATRKX_ENABLE_ONNX) + find_package(cugraph REQUIRED) + endif() + if(ACTS_EXATRKX_ENABLE_TORCH) + find_package(TorchScatter REQUIRED) + endif() endif() if(ACTS_BUILD_PLUGIN_ONNX OR ACTS_EXATRKX_ENABLE_ONNX) - find_package(OnnxRuntime ${_acts_onnxruntime_version} REQUIRED) + find_package(OnnxRuntime ${_acts_onnxruntime_version} REQUIRED) endif() if(ACTS_BUILD_PLUGIN_EDM4HEP OR ACTS_BUILD_PLUGIN_PODIO) - find_package(podio ${_acts_podio_version} CONFIG) - if(NOT podio_FOUND) - message(STATUS "Podio not found, trying ${_acts_podio_fallback_version} version") - find_package(podio ${_acts_podio_fallback_version} CONFIG REQUIRED) - endif() - find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Core) + find_package(podio ${_acts_podio_version} CONFIG) + if(NOT podio_FOUND) + message( + STATUS + "Podio not found, trying ${_acts_podio_fallback_version} version" + ) + find_package(podio ${_acts_podio_fallback_version} CONFIG REQUIRED) + endif() + find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Core) endif() if(ACTS_BUILD_PLUGIN_EDM4HEP) - find_package(EDM4HEP ${_acts_edm4hep_version} REQUIRED CONFIG) + find_package(EDM4HEP ${_acts_edm4hep_version} REQUIRED CONFIG) endif() if(ACTS_BUILD_PLUGIN_GEANT4) - find_package(Geant4 REQUIRED CONFIG COMPONENTS gdml) + find_package(Geant4 REQUIRED CONFIG COMPONENTS gdml) endif() if(ACTS_BUILD_PLUGIN_TRACCC) - if (ACTS_USE_SYSTEM_ALGEBRAPLUGINS) - find_package(algebra-plugins ${_acts_algebraplugins_version} REQUIRED) - else() - add_subdirectory(thirdparty/algebra-plugins) - endif() - - if(ACTS_USE_SYSTEM_DETRAY) - find_package(detray ${_acts_detray_version} REQUIRED CONFIG) - else() - add_subdirectory(thirdparty/detray) - endif() - - if (ACTS_USE_SYSTEM_VECMEM) - 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() - - if(ACTS_USE_SYSTEM_COVFIE) - find_package(covfie ${_acts_covfie_version} REQUIRED CONFIG) - else() - add_subdirectory(thirdparty/covfie) - endif() - - # traccc also depends on vecmem and covfie, but those plugins should always - # be enabled if traccc is. - if(ACTS_USE_SYSTEM_TRACCC) - find_package(traccc ${_acts_traccc_version} REQUIRED CONFIG) - else() - add_subdirectory(thirdparty/traccc) - endif() + if(ACTS_USE_SYSTEM_ALGEBRAPLUGINS) + find_package(algebra-plugins ${_acts_algebraplugins_version} REQUIRED) + else() + add_subdirectory(thirdparty/algebra-plugins) + endif() + + if(ACTS_USE_SYSTEM_DETRAY) + find_package(detray ${_acts_detray_version} REQUIRED CONFIG) + else() + add_subdirectory(thirdparty/detray) + endif() + + if(ACTS_USE_SYSTEM_VECMEM) + 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() + + if(ACTS_USE_SYSTEM_COVFIE) + find_package(covfie ${_acts_covfie_version} REQUIRED CONFIG) + else() + add_subdirectory(thirdparty/covfie) + endif() + + # traccc also depends on vecmem and covfie, but those plugins should always + # be enabled if traccc is. + if(ACTS_USE_SYSTEM_TRACCC) + find_package(traccc ${_acts_traccc_version} REQUIRED CONFIG) + else() + add_subdirectory(thirdparty/traccc) + endif() endif() - # examples dependencies if(ACTS_BUILD_EXAMPLES) - set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) - # 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() + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + # 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() endif() if(ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS) - find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development) - if(ACTS_USE_SYSTEM_PYBIND11) - find_package(pybind11 CONFIG REQUIRED) - else() - add_subdirectory(thirdparty/pybind11) - endif() + find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development) + if(ACTS_USE_SYSTEM_PYBIND11) + find_package(pybind11 CONFIG REQUIRED) + else() + add_subdirectory(thirdparty/pybind11) + endif() endif() if(ACTS_BUILD_EXAMPLES_DD4HEP AND ACTS_BUILD_EXAMPLES_GEANT4) - find_package(DD4hep ${_acts_dd4hep_version} REQUIRED CONFIG COMPONENTS DDCore DDG4 DDDetectors) + find_package( + DD4hep + ${_acts_dd4hep_version} + REQUIRED + CONFIG + COMPONENTS DDCore DDG4 DDDetectors + ) elseif(ACTS_BUILD_EXAMPLES_DD4HEP) - find_package(DD4hep ${_acts_dd4hep_version} REQUIRED CONFIG COMPONENTS DDCore DDDetectors) + find_package( + DD4hep + ${_acts_dd4hep_version} + REQUIRED + CONFIG + COMPONENTS DDCore DDDetectors + ) endif() if(ACTS_BUILD_EXAMPLES_HEPMC3) - find_package(HepMC3 ${_acts_hepmc3_version} REQUIRED CONFIG) + find_package(HepMC3 ${_acts_hepmc3_version} REQUIRED CONFIG) endif() if(ACTS_BUILD_EXAMPLES_PYTHIA8) - find_package(Pythia8 ${_acts_pythia8_version} REQUIRED) + find_package(Pythia8 ${_acts_pythia8_version} REQUIRED) endif() # other dependencies if(ACTS_BUILD_DOCS) - find_package(Doxygen ${_acts_doxygen_version} REQUIRED) - find_package(Sphinx REQUIRED) + find_package(Doxygen ${_acts_doxygen_version} REQUIRED) + find_package(Sphinx REQUIRED) endif() if(ACTS_CUSTOM_SCALARTYPE) - message(STATUS "Building Acts with custom scalar type: ${ACTS_CUSTOM_SCALARTYPE}") + message( + STATUS + "Building Acts with custom scalar type: ${ACTS_CUSTOM_SCALARTYPE}" + ) endif() # core library, core plugins, and other components @@ -433,28 +530,32 @@ add_component_if(Fatras Fatras ACTS_BUILD_FATRAS) add_component_if(Alignment Alignment ACTS_BUILD_ALIGNMENT) if(ACTS_BUILD_ODD) - if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/thirdparty/OpenDataDetector/CMakeLists.txt") - add_subdirectory_if(thirdparty/OpenDataDetector ACTS_BUILD_ODD) - else() - message(FATAL_ERROR "ODD build was requested, but the ODD directory seems not to be present. " - "Did you init and update the submodule?") - endif() + if( + EXISTS + "${CMAKE_CURRENT_LIST_DIR}/thirdparty/OpenDataDetector/CMakeLists.txt" + ) + add_subdirectory_if(thirdparty/OpenDataDetector ACTS_BUILD_ODD) + else() + message( + FATAL_ERROR + "ODD build was requested, but the ODD directory seems not to be present. " + "Did you init and update the submodule?" + ) + endif() endif() - # examples add_subdirectory_if(Examples ACTS_BUILD_EXAMPLES) # automated tests and benchmarks if(ACTS_BUILD_BENCHMARKS OR ACTS_BUILD_INTEGRATIONTESTS OR ACTS_BUILD_UNITTESTS) - enable_testing() # must be set in the main CMakeLists.txt - add_subdirectory(Tests) + enable_testing() # must be set in the main CMakeLists.txt + add_subdirectory(Tests) endif() # documentation add_subdirectory_if(docs ACTS_BUILD_DOCS) - # create cmake configuration files and environment setup script include(ActsCreatePackageConfig) include(ActsCreateSetup) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 901139b5b51..e680cab96ba 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -189,8 +189,7 @@ Developers can use the provided Docker image to format their project or install clang-format locally. Developers should be aware that clang-format will behave differently for different versions, so installing `the same clang version as used in the -CI `_ -is recommended. There are several instructions available on how to +CI is recommended. There are several instructions available on how to integrate clang-format with your favourite IDE (e.g. `Xcode `_, `emacs `_). The Acts CI system will automatically check code formatting using the diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index 192fe05f6bf..b760ba576ed 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -1,117 +1,105 @@ configure_file( - ActsVersion.hpp.in - ${CMAKE_CURRENT_BINARY_DIR}/Acts/ActsVersion.hpp) + ActsVersion.hpp.in + ${CMAKE_CURRENT_BINARY_DIR}/Acts/ActsVersion.hpp +) # source files will be added later -add_library( - ActsCore SHARED "") +add_library(ActsCore SHARED "") -target_sources( - ActsCore - PRIVATE - src/ActsVersion.cpp) +target_sources(ActsCore PRIVATE src/ActsVersion.cpp) -target_compile_features( - ActsCore - PUBLIC ${ACTS_CXX_STANDARD_FEATURE}) +target_compile_features(ActsCore PUBLIC ${ACTS_CXX_STANDARD_FEATURE}) target_include_directories( - ActsCore - PUBLIC - $ - # for the generated version header - $ - $) -target_link_libraries( - ActsCore - PUBLIC Boost::boost Eigen3::Eigen) - + ActsCore + PUBLIC + $ + # for the generated version header + $ + $ +) +target_link_libraries(ActsCore PUBLIC Boost::boost Eigen3::Eigen) if(ACTS_PARAMETER_DEFINITIONS_HEADER) - target_compile_definitions( - ActsCore - PUBLIC -DACTS_PARAMETER_DEFINITIONS_HEADER="${ACTS_PARAMETER_DEFINITIONS_HEADER}") + target_compile_definitions( + ActsCore + PUBLIC + -DACTS_PARAMETER_DEFINITIONS_HEADER="${ACTS_PARAMETER_DEFINITIONS_HEADER}" + ) endif() if(ACTS_SOURCELINK_SBO_SIZE) - target_compile_definitions( - ActsCore - PUBLIC -DACTS_SOURCELINK_SBO_SIZE=${ACTS_SOURCELINK_SBO_SIZE}) + target_compile_definitions( + ActsCore + PUBLIC -DACTS_SOURCELINK_SBO_SIZE=${ACTS_SOURCELINK_SBO_SIZE} + ) endif() if(ACTS_CUSTOM_SCALARTYPE) - target_compile_definitions( - ActsCore - PUBLIC -DACTS_CUSTOM_SCALARTYPE=${ACTS_CUSTOM_SCALARTYPE}) + target_compile_definitions( + ActsCore + PUBLIC -DACTS_CUSTOM_SCALARTYPE=${ACTS_CUSTOM_SCALARTYPE} + ) endif() if(ACTS_LOG_FAILURE_THRESHOLD) - message(STATUS "Enable log failure threshold, set to ${ACTS_LOG_FAILURE_THRESHOLD}") - target_compile_definitions( - ActsCore - PUBLIC - -DACTS_LOG_FAILURE_THRESHOLD=${ACTS_LOG_FAILURE_THRESHOLD} - -DACTS_ENABLE_LOG_FAILURE_THRESHOLD) - + message( + STATUS + "Enable log failure threshold, set to ${ACTS_LOG_FAILURE_THRESHOLD}" + ) + target_compile_definitions( + ActsCore + PUBLIC + -DACTS_LOG_FAILURE_THRESHOLD=${ACTS_LOG_FAILURE_THRESHOLD} + -DACTS_ENABLE_LOG_FAILURE_THRESHOLD + ) else() - -if(ACTS_ENABLE_LOG_FAILURE_THRESHOLD) - message(STATUS "Enable log failure threshold") - target_compile_definitions( - ActsCore - PUBLIC - -DACTS_ENABLE_LOG_FAILURE_THRESHOLD) -endif() - + if(ACTS_ENABLE_LOG_FAILURE_THRESHOLD) + message(STATUS "Enable log failure threshold") + target_compile_definitions( + ActsCore + PUBLIC -DACTS_ENABLE_LOG_FAILURE_THRESHOLD + ) + endif() endif() if(ACTS_ENABLE_CPU_PROFILING) - message(STATUS "added lprofiler") + message(STATUS "added lprofiler") - if(NOT ACTS_GPERF_INSTALL_DIR STREQUAL "") - find_library(PROFILER_LIBRARY profiler HINTS ${ACTS_GPERF_INSTALL_DIR}) + if(NOT ACTS_GPERF_INSTALL_DIR STREQUAL "") + find_library(PROFILER_LIBRARY profiler HINTS ${ACTS_GPERF_INSTALL_DIR}) - target_link_libraries( - ActsCore - PUBLIC ${PROFILER_LIBRARY}) - else() - target_link_libraries( - ActsCore - PUBLIC -lprofiler) - endif() + target_link_libraries(ActsCore PUBLIC ${PROFILER_LIBRARY}) + else() + target_link_libraries(ActsCore PUBLIC -lprofiler) + endif() - target_link_options( - ActsCore - PUBLIC "LINKER:-no-as-needed") + target_link_options(ActsCore PUBLIC "LINKER:-no-as-needed") endif() if(ACTS_ENABLE_MEMORY_PROFILING) - message(STATUS "added ltcmalloc") - - if(NOT ACTS_GPERF_INSTALL_DIR STREQUAL "") - find_library(TCMALLOC_LIBRARY tcmalloc HINTS ${ACTS_GPERF_INSTALL_DIR}) - - target_link_libraries( - ActsCore - PUBLIC ${TCMALLOC_LIBRARY}) - else() - target_link_libraries( - ActsCore - PUBLIC -ltcmalloc) - endif() + message(STATUS "added ltcmalloc") + + if(NOT ACTS_GPERF_INSTALL_DIR STREQUAL "") + find_library(TCMALLOC_LIBRARY tcmalloc HINTS ${ACTS_GPERF_INSTALL_DIR}) + + target_link_libraries(ActsCore PUBLIC ${TCMALLOC_LIBRARY}) + else() + target_link_libraries(ActsCore PUBLIC -ltcmalloc) + endif() endif() install( - TARGETS ActsCore - EXPORT ActsCoreTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -install( - DIRECTORY include/Acts - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + TARGETS ActsCore + EXPORT ActsCoreTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) +install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/Acts/ActsVersion.hpp - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Acts) + FILES ${CMAKE_CURRENT_BINARY_DIR}/Acts/ActsVersion.hpp + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Acts +) # target source files are added separately add_subdirectory(src/EventData) diff --git a/Core/include/Acts/Definitions/Algebra.hpp b/Core/include/Acts/Definitions/Algebra.hpp index a8b54653d23..fa5edcc2252 100644 --- a/Core/include/Acts/Definitions/Algebra.hpp +++ b/Core/include/Acts/Definitions/Algebra.hpp @@ -12,7 +12,7 @@ #if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmisleading-indentation" -#if __GNUC__ == 13 +#if __GNUC__ >= 12 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif #include diff --git a/Core/include/Acts/Propagator/DenseEnvironmentExtension.hpp b/Core/include/Acts/Propagator/DenseEnvironmentExtension.hpp index 68868de8a92..eed51e1e847 100644 --- a/Core/include/Acts/Propagator/DenseEnvironmentExtension.hpp +++ b/Core/include/Acts/Propagator/DenseEnvironmentExtension.hpp @@ -124,7 +124,12 @@ struct DenseEnvironmentExtension { // i = 0 is used for setup and evaluation of k if (i == 0) { // Set up container for energy loss - auto volumeMaterial = navigator.currentVolumeMaterial(state.navigation); + const auto* volumeMaterial = + navigator.currentVolumeMaterial(state.navigation); + if (volumeMaterial == nullptr) { + // This function is very hot, so we prefer to terminate here + std::terminate(); + } ThisVector3 position = stepper.position(state.stepping); material = volumeMaterial->material(position.template cast()); initialMomentum = stepper.absoluteMomentum(state.stepping); diff --git a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp index 41e68890c94..dce5c475bc8 100644 --- a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp +++ b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp @@ -48,6 +48,10 @@ using namespace Acts::UnitLiterals; /// @brief Reducer struct for the Loop MultiEigenStepper which reduces the /// multicomponent state to simply by summing the weighted values +/// +/// @note Usage is not encouraged, since it can lead to navigation failures +/// as the global position might not be on surface, even if all components +/// are on surface struct WeightedComponentReducerLoop { template static Vector3 toVector3(const component_range_t& comps, @@ -140,74 +144,96 @@ struct WeightedComponentReducerLoop { } }; -struct MaxMomentumReducerLoop { +namespace detail { + +struct MaxMomentumComponent { template - static const auto& maxAbsoluteMomentumIt(const component_range_t& cmps) { - return *std::max_element(cmps.begin(), cmps.end(), - [&](const auto& a, const auto& b) { - return std::abs(a.state.pars[eFreeQOverP]) > - std::abs(b.state.pars[eFreeQOverP]); - }); + auto operator()(const component_range_t& cmps) const { + return std::max_element(cmps.begin(), cmps.end(), + [&](const auto& a, const auto& b) { + return std::abs(a.state.pars[eFreeQOverP]) > + std::abs(b.state.pars[eFreeQOverP]); + }); } +}; +struct MaxWeightComponent { + template + auto operator()(const component_range_t& cmps) { + return std::max_element( + cmps.begin(), cmps.end(), + [&](const auto& a, const auto& b) { return a.weight < b.weight; }); + } +}; + +template +struct SingleComponentReducer { template static Vector3 position(const stepper_state_t& s) { - return maxAbsoluteMomentumIt(s.components) - .state.pars.template segment<3>(eFreePos0); + return component_chooser_t{}(s.components) + ->state.pars.template segment<3>(eFreePos0); } template static Vector3 direction(const stepper_state_t& s) { - return maxAbsoluteMomentumIt(s.components) - .state.pars.template segment<3>(eFreeDir0); + return component_chooser_t{}(s.components) + ->state.pars.template segment<3>(eFreeDir0); } template static ActsScalar qOverP(const stepper_state_t& s) { - const auto& cmp = maxAbsoluteMomentumIt(s.components); - return cmp.state.pars[eFreeQOverP]; + const auto cmp = component_chooser_t{}(s.components); + return cmp->state.pars[eFreeQOverP]; } template static ActsScalar absoluteMomentum(const stepper_state_t& s) { - const auto& cmp = maxAbsoluteMomentumIt(s.components); - return std::abs(cmp.state.absCharge / cmp.state.pars[eFreeQOverP]); + const auto cmp = component_chooser_t{}(s.components); + return s.particleHypothesis.extractMomentum(cmp->state.pars[eFreeQOverP]); } template static Vector3 momentum(const stepper_state_t& s) { - const auto& cmp = maxAbsoluteMomentumIt(s.components); - return std::abs(cmp.state.absCharge / cmp.state.pars[eFreeQOverP]) * - cmp.state.pars.template segment<3>(eFreeDir0); + const auto cmp = component_chooser_t{}(s.components); + return s.particleHypothesis.extractMomentum(cmp->state.pars[eFreeQOverP]) * + cmp->state.pars.template segment<3>(eFreeDir0); } template static ActsScalar charge(const stepper_state_t& s) { - return maxAbsoluteMomentumIt(s.components).state.absCharge; + const auto cmp = component_chooser_t{}(s.components); + return s.particleHypothesis.extractCharge(cmp->state.pars[eFreeQOverP]); } template static ActsScalar time(const stepper_state_t& s) { - return maxAbsoluteMomentumIt(s.components).state.pars[eFreeTime]; + return component_chooser_t{}(s.components)->state.pars[eFreeTime]; } template static FreeVector pars(const stepper_state_t& s) { - return maxAbsoluteMomentumIt(s.components).state.pars; + return component_chooser_t{}(s.components)->state.pars; } template static FreeVector cov(const stepper_state_t& s) { - return maxAbsoluteMomentumIt(s.components).state.cov; + return component_chooser_t{}(s.components)->state.cov; } }; +} // namespace detail + +using MaxMomentumReducerLoop = + detail::SingleComponentReducer; +using MaxWeightReducerLoop = + detail::SingleComponentReducer; + /// @brief Stepper based on the EigenStepper, but handles Multi-Component Tracks /// (e.g., for the GSF). Internally, this only manages a vector of /// EigenStepper::States. This simplifies implementation, but has several /// drawbacks: -/// * There are certain redundancies between the global State and the component -/// states +/// * There are certain redundancies between the global State and the +/// component states /// * The components do not share a single magnetic-field-cache /// @tparam extensionlist_t See EigenStepper for details /// @tparam component_reducer_t How to map the multi-component state to a single @@ -396,11 +422,11 @@ class MultiEigenStepperLoop /// proxy internally holding a reference auto componentIterable(State& state) const { struct Iterator { - using difference_type = std::ptrdiff_t; - using value_type = ComponentProxy; - using reference = ComponentProxy; - using pointer = void; - using iterator_category = std::forward_iterator_tag; + using difference_type [[maybe_unused]] = std::ptrdiff_t; + using value_type [[maybe_unused]] = ComponentProxy; + using reference [[maybe_unused]] = ComponentProxy; + using pointer [[maybe_unused]] = void; + using iterator_category [[maybe_unused]] = std::forward_iterator_tag; typename decltype(state.components)::iterator it; const State& s; @@ -414,8 +440,6 @@ class MultiEigenStepperLoop }; struct Iterable { - using iterator = Iterator; - State& s; // clang-format off @@ -433,11 +457,11 @@ class MultiEigenStepperLoop /// proxy internally holding a reference auto constComponentIterable(const State& state) const { struct ConstIterator { - using difference_type = std::ptrdiff_t; - using value_type = ConstComponentProxy; - using reference = ConstComponentProxy; - using pointer = void; - using iterator_category = std::forward_iterator_tag; + using difference_type [[maybe_unused]] = std::ptrdiff_t; + using value_type [[maybe_unused]] = ConstComponentProxy; + using reference [[maybe_unused]] = ConstComponentProxy; + using pointer [[maybe_unused]] = void; + using iterator_category [[maybe_unused]] = std::forward_iterator_tag; typename decltype(state.components)::const_iterator it; const State& s; @@ -451,7 +475,6 @@ class MultiEigenStepperLoop }; struct Iterable { - using iterator = ConstIterator; const State& s; // clang-format off diff --git a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp index f4e776bbd58..51730f33adf 100644 --- a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp +++ b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp @@ -255,9 +255,6 @@ struct CombinatorialKalmanFilterResult { /// Indices into `tracks` which mark active branches std::vector collectedTracks; - /// This is used internally to store candidate trackstates - std::shared_ptr stateBuffer; - /// Track state candidates buffer std::vector trackStateCandidates; @@ -364,8 +361,6 @@ class CombinatorialKalmanFilter { trackStateCandidates.reserve(std::distance(slBegin, slEnd)); } - bufferTrajectory.clear(); - // Calibrate all the source links on the surface since the selection has // to be done based on calibrated measurement for (auto it = slBegin; it != slEnd; ++it) { @@ -734,7 +729,7 @@ class CombinatorialKalmanFilter { Acts::Result>; TrackStatesResult tsRes = trackStateCandidateCreator( state.geoContext, *calibrationContextPtr, *surface, boundState, - slBegin, slEnd, prevTip, *result.stateBuffer, + slBegin, slEnd, prevTip, *result.trackStates, result.trackStateCandidates, *result.trackStates, logger()); if (!tsRes.ok()) { ACTS_ERROR( @@ -1232,7 +1227,6 @@ class CombinatorialKalmanFilter { track_container_t& trackContainer) const -> Result::TrackProxy>> { - using TrackContainer = typename std::decay_t; using SourceLinkAccessor = SourceLinkAccessorDelegate; @@ -1290,7 +1284,6 @@ class CombinatorialKalmanFilter { .template get>(); r.tracks = &trackContainer; r.trackStates = &trackContainer.trackStateContainer(); - r.stateBuffer = std::make_shared(); auto rootBranch = trackContainer.makeTrack(); r.activeBranches.push_back(rootBranch); diff --git a/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp b/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp index cd5cacce204..0b1f9d5e78d 100644 --- a/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp +++ b/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp @@ -349,8 +349,6 @@ struct GaussianSumFitter { ? *options.referenceSurface : sParameters.referenceSurface(); - using PM = TrackStatePropMask; - const auto& params = *fwdGsfResult.lastMeasurementState; auto state = m_propagator.template makeState()) { // construct into local buffer /*U* ptr =*/new (m_data.data()) U(std::forward(args)...); - _ACTS_ANY_VERBOSE( - "Construct local (this=" << this << ") at: " << (void*)m_data.data()); + _ACTS_ANY_VERBOSE("Construct local (this=" + << this + << ") at: " << static_cast(m_data.data())); } else { // too large, heap allocate U* heap = new U(std::forward(args)...); @@ -181,16 +182,16 @@ class AnyBase : public AnyBaseAll { return; } - _ACTS_ANY_VERBOSE( - "Copy construct (this=" << this << ") at: " << (void*)m_data.data()); + _ACTS_ANY_VERBOSE("Copy construct (this=" + << this << ") at: " << static_cast(m_data.data())); m_handler = other.m_handler; copyConstruct(other); } AnyBase& operator=(const AnyBase& other) { - _ACTS_ANY_VERBOSE("Copy assign (this=" << this - << ") at: " << (void*)m_data.data()); + _ACTS_ANY_VERBOSE("Copy assign (this=" + << this << ") at: " << static_cast(m_data.data())); if (m_handler == nullptr && other.m_handler == nullptr) { // both are empty, noop @@ -213,8 +214,8 @@ class AnyBase : public AnyBaseAll { } AnyBase(AnyBase&& other) { - _ACTS_ANY_VERBOSE( - "Move construct (this=" << this << ") at: " << (void*)m_data.data()); + _ACTS_ANY_VERBOSE("Move construct (this=" + << this << ") at: " << static_cast(m_data.data())); if (m_handler == nullptr && other.m_handler == nullptr) { // both are empty, noop return; @@ -225,8 +226,8 @@ class AnyBase : public AnyBaseAll { } AnyBase& operator=(AnyBase&& other) { - _ACTS_ANY_VERBOSE("Move assign (this=" << this - << ") at: " << (void*)m_data.data()); + _ACTS_ANY_VERBOSE("Move assign (this=" + << this << ") at: " << static_cast(m_data.data())); if (m_handler == nullptr && other.m_handler == nullptr) { // both are empty, noop return *this; diff --git a/Core/include/Acts/Utilities/GridBinFinder.hpp b/Core/include/Acts/Utilities/GridBinFinder.hpp index 9d57790459d..da2f9ecbfde 100644 --- a/Core/include/Acts/Utilities/GridBinFinder.hpp +++ b/Core/include/Acts/Utilities/GridBinFinder.hpp @@ -29,6 +29,7 @@ namespace Acts { template class GridBinFinder { public: + static constexpr std::size_t dimCubed = Acts::detail::ipow(3, DIM); /// @brief Constructor /// @tparam args ... Input parameters provided by the user /// @@ -63,9 +64,9 @@ class GridBinFinder { /// /// @pre The provided local position must be a valid local bins configuration in the grid template - boost::container::small_vector - findBins(const std::array& locPosition, - const Acts::Grid& grid) const; + boost::container::small_vector findBins( + const std::array& locPosition, + const Acts::Grid& grid) const; private: /// @brief Store the values provided by the user for each axis in the grid diff --git a/Core/include/Acts/Utilities/GridBinFinder.ipp b/Core/include/Acts/Utilities/GridBinFinder.ipp index 082a8efc475..344ef07137c 100644 --- a/Core/include/Acts/Utilities/GridBinFinder.ipp +++ b/Core/include/Acts/Utilities/GridBinFinder.ipp @@ -62,10 +62,10 @@ std::array, DIM> Acts::GridBinFinder::getSizePerAxis( template template -boost::container::small_vector -Acts::GridBinFinder::findBins( +auto Acts::GridBinFinder::findBins( const std::array& locPosition, - const Acts::Grid& grid) const { + const Acts::Grid& grid) const + -> boost::container::small_vector { static_assert(sizeof...(Axes) == DIM); assert(isGridCompatible(grid)); std::array, DIM> sizePerAxis = diff --git a/Core/src/AmbiguityResolution/CMakeLists.txt b/Core/src/AmbiguityResolution/CMakeLists.txt index 83a50d68501..04f099979a7 100644 --- a/Core/src/AmbiguityResolution/CMakeLists.txt +++ b/Core/src/AmbiguityResolution/CMakeLists.txt @@ -1,6 +1,4 @@ target_sources( - ActsCore - PRIVATE - GreedyAmbiguityResolution.cpp - ScoreBasedAmbiguityResolution.cpp + ActsCore + PRIVATE GreedyAmbiguityResolution.cpp ScoreBasedAmbiguityResolution.cpp ) diff --git a/Core/src/Definitions/CMakeLists.txt b/Core/src/Definitions/CMakeLists.txt index c83d3dedf7f..7ab7a2d43cf 100644 --- a/Core/src/Definitions/CMakeLists.txt +++ b/Core/src/Definitions/CMakeLists.txt @@ -1,7 +1 @@ -target_sources( - ActsCore - PRIVATE - Common.cpp - Direction.cpp - ParticleData.cpp -) +target_sources(ActsCore PRIVATE Common.cpp Direction.cpp ParticleData.cpp) diff --git a/Core/src/Detector/CMakeLists.txt b/Core/src/Detector/CMakeLists.txt index 49b5c4d4996..71e6a9d4d9f 100644 --- a/Core/src/Detector/CMakeLists.txt +++ b/Core/src/Detector/CMakeLists.txt @@ -1,27 +1,27 @@ target_sources( - ActsCore - PRIVATE - detail/BlueprintHelper.cpp - detail/BlueprintDrawer.cpp - detail/CuboidalDetectorHelper.cpp - detail/CylindricalDetectorHelper.cpp - detail/DetectorVolumeConsistency.cpp - detail/PortalHelper.cpp - detail/ProtoMaterialHelper.cpp - detail/SupportSurfacesHelper.cpp - detail/IndexedGridFiller.cpp - CylindricalContainerBuilder.cpp - CuboidalContainerBuilder.cpp - Detector.cpp - DetectorBuilder.cpp - DetectorVolume.cpp - DetectorVolumeBuilder.cpp - IndexedRootVolumeFinderBuilder.cpp - LayerStructureBuilder.cpp - Portal.cpp - PortalGenerators.cpp - ProtoDetector.cpp - GeometryIdGenerator.cpp - VolumeStructureBuilder.cpp - MultiWireStructureBuilder.cpp + ActsCore + PRIVATE + detail/BlueprintHelper.cpp + detail/BlueprintDrawer.cpp + detail/CuboidalDetectorHelper.cpp + detail/CylindricalDetectorHelper.cpp + detail/DetectorVolumeConsistency.cpp + detail/PortalHelper.cpp + detail/ProtoMaterialHelper.cpp + detail/SupportSurfacesHelper.cpp + detail/IndexedGridFiller.cpp + CylindricalContainerBuilder.cpp + CuboidalContainerBuilder.cpp + Detector.cpp + DetectorBuilder.cpp + DetectorVolume.cpp + DetectorVolumeBuilder.cpp + IndexedRootVolumeFinderBuilder.cpp + LayerStructureBuilder.cpp + Portal.cpp + PortalGenerators.cpp + ProtoDetector.cpp + GeometryIdGenerator.cpp + VolumeStructureBuilder.cpp + MultiWireStructureBuilder.cpp ) diff --git a/Core/src/EventData/CMakeLists.txt b/Core/src/EventData/CMakeLists.txt index 7b43dfb74ba..08a69711378 100644 --- a/Core/src/EventData/CMakeLists.txt +++ b/Core/src/EventData/CMakeLists.txt @@ -1,11 +1,11 @@ target_sources( - ActsCore - PRIVATE - PrintParameters.cpp - TrackParameters.cpp - TransformationHelpers.cpp - CorrectedTransformationFreeToBound.cpp - TrackStatePropMask.cpp - VectorMultiTrajectory.cpp - VectorTrackContainer.cpp + ActsCore + PRIVATE + PrintParameters.cpp + TrackParameters.cpp + TransformationHelpers.cpp + CorrectedTransformationFreeToBound.cpp + TrackStatePropMask.cpp + VectorMultiTrajectory.cpp + VectorTrackContainer.cpp ) diff --git a/Core/src/Geometry/CMakeLists.txt b/Core/src/Geometry/CMakeLists.txt index fcacff5ec76..0391a99b2fb 100644 --- a/Core/src/Geometry/CMakeLists.txt +++ b/Core/src/Geometry/CMakeLists.txt @@ -1,38 +1,38 @@ target_sources( - ActsCore - PRIVATE - ConeLayer.cpp - ConeVolumeBounds.cpp - CuboidVolumeBounds.cpp - CuboidVolumeBuilder.cpp - CutoutCylinderVolumeBounds.cpp - CylinderLayer.cpp - CylinderVolumeBounds.cpp - CylinderVolumeBuilder.cpp - CylinderVolumeHelper.cpp - Extent.cpp - KDTreeTrackingGeometryBuilder.cpp - DiscLayer.cpp - GenericApproachDescriptor.cpp - GenericCuboidVolumeBounds.cpp - GeometryIdentifier.cpp - GlueVolumesDescriptor.cpp - Layer.cpp - LayerArrayCreator.cpp - LayerCreator.cpp - NavigationLayer.cpp - PassiveLayerBuilder.cpp - PlaneLayer.cpp - Polyhedron.cpp - ProtoLayer.cpp - ProtoLayerHelper.cpp - SurfaceArrayCreator.cpp - TrackingGeometry.cpp - TrackingGeometryBuilder.cpp - TrackingVolume.cpp - TrackingVolumeArrayCreator.cpp - TrapezoidVolumeBounds.cpp - Volume.cpp - VolumeBounds.cpp - CylinderVolumeStack.cpp + ActsCore + PRIVATE + ConeLayer.cpp + ConeVolumeBounds.cpp + CuboidVolumeBounds.cpp + CuboidVolumeBuilder.cpp + CutoutCylinderVolumeBounds.cpp + CylinderLayer.cpp + CylinderVolumeBounds.cpp + CylinderVolumeBuilder.cpp + CylinderVolumeHelper.cpp + Extent.cpp + KDTreeTrackingGeometryBuilder.cpp + DiscLayer.cpp + GenericApproachDescriptor.cpp + GenericCuboidVolumeBounds.cpp + GeometryIdentifier.cpp + GlueVolumesDescriptor.cpp + Layer.cpp + LayerArrayCreator.cpp + LayerCreator.cpp + NavigationLayer.cpp + PassiveLayerBuilder.cpp + PlaneLayer.cpp + Polyhedron.cpp + ProtoLayer.cpp + ProtoLayerHelper.cpp + SurfaceArrayCreator.cpp + TrackingGeometry.cpp + TrackingGeometryBuilder.cpp + TrackingVolume.cpp + TrackingVolumeArrayCreator.cpp + TrapezoidVolumeBounds.cpp + Volume.cpp + VolumeBounds.cpp + CylinderVolumeStack.cpp ) diff --git a/Core/src/MagneticField/CMakeLists.txt b/Core/src/MagneticField/CMakeLists.txt index 3f2e4333a69..4b9ebb0be0f 100644 --- a/Core/src/MagneticField/CMakeLists.txt +++ b/Core/src/MagneticField/CMakeLists.txt @@ -1,7 +1,4 @@ target_sources( - ActsCore - PRIVATE - BFieldMapUtils.cpp - SolenoidBField.cpp - MagneticFieldError.cpp + ActsCore + PRIVATE BFieldMapUtils.cpp SolenoidBField.cpp MagneticFieldError.cpp ) diff --git a/Core/src/Material/CMakeLists.txt b/Core/src/Material/CMakeLists.txt index d988867c85f..52e0e690dbb 100644 --- a/Core/src/Material/CMakeLists.txt +++ b/Core/src/Material/CMakeLists.txt @@ -1,24 +1,24 @@ target_sources( - ActsCore - PRIVATE - AccumulatedMaterialSlab.cpp - AccumulatedSurfaceMaterial.cpp - AccumulatedVolumeMaterial.cpp - AverageMaterials.cpp - BinnedSurfaceMaterial.cpp - BinnedSurfaceMaterialAccumulater.cpp - HomogeneousSurfaceMaterial.cpp - HomogeneousVolumeMaterial.cpp - Interactions.cpp - IntersectionMaterialAssigner.cpp - Material.cpp - MaterialGridHelper.cpp - MaterialInteractionAssignment.cpp - MaterialMapUtils.cpp - MaterialMapper.cpp - MaterialSlab.cpp - MaterialValidater.cpp - ProtoVolumeMaterial.cpp - SurfaceMaterialMapper.cpp - VolumeMaterialMapper.cpp + ActsCore + PRIVATE + AccumulatedMaterialSlab.cpp + AccumulatedSurfaceMaterial.cpp + AccumulatedVolumeMaterial.cpp + AverageMaterials.cpp + BinnedSurfaceMaterial.cpp + BinnedSurfaceMaterialAccumulater.cpp + HomogeneousSurfaceMaterial.cpp + HomogeneousVolumeMaterial.cpp + Interactions.cpp + IntersectionMaterialAssigner.cpp + Material.cpp + MaterialGridHelper.cpp + MaterialInteractionAssignment.cpp + MaterialMapUtils.cpp + MaterialMapper.cpp + MaterialSlab.cpp + MaterialValidater.cpp + ProtoVolumeMaterial.cpp + SurfaceMaterialMapper.cpp + VolumeMaterialMapper.cpp ) diff --git a/Core/src/Material/SurfaceMaterialMapper.cpp b/Core/src/Material/SurfaceMaterialMapper.cpp index 1a5ae1ba382..a8d62f0e75c 100644 --- a/Core/src/Material/SurfaceMaterialMapper.cpp +++ b/Core/src/Material/SurfaceMaterialMapper.cpp @@ -286,8 +286,6 @@ void Acts::SurfaceMaterialMapper::mapInteraction( // To remember the bins of this event using MapBin = std::pair>; - using MaterialBin = std::pair>; std::map> touchedMapBins; std::map> diff --git a/Core/src/Propagator/CMakeLists.txt b/Core/src/Propagator/CMakeLists.txt index 6643438df21..b179a33e3c2 100644 --- a/Core/src/Propagator/CMakeLists.txt +++ b/Core/src/Propagator/CMakeLists.txt @@ -1,14 +1,14 @@ target_sources( - ActsCore - PRIVATE - EigenStepperError.cpp - MultiStepperError.cpp - SympyStepper.cpp - PropagatorError.cpp - StraightLineStepper.cpp - detail/PointwiseMaterialInteraction.cpp - detail/CovarianceEngine.cpp - detail/JacobianEngine.cpp - detail/SympyCovarianceEngine.cpp - detail/SympyJacobianEngine.cpp + ActsCore + PRIVATE + EigenStepperError.cpp + MultiStepperError.cpp + SympyStepper.cpp + PropagatorError.cpp + StraightLineStepper.cpp + detail/PointwiseMaterialInteraction.cpp + detail/CovarianceEngine.cpp + detail/JacobianEngine.cpp + detail/SympyCovarianceEngine.cpp + detail/SympyJacobianEngine.cpp ) diff --git a/Core/src/Propagator/SympyStepper.cpp b/Core/src/Propagator/SympyStepper.cpp index 77b075be31c..669e17ee7cb 100644 --- a/Core/src/Propagator/SympyStepper.cpp +++ b/Core/src/Propagator/SympyStepper.cpp @@ -116,9 +116,8 @@ Result SympyStepper::stepImpl( double m = particleHypothesis(state).mass(); double p_abs = absoluteMomentum(state); - auto getB = [&](const double* p) -> Vector3 { - auto fieldRes = getField(state, {p[0], p[1], p[2]}); - return *fieldRes; + auto getB = [&](const double* p) -> Result { + return getField(state, {p[0], p[1], p[2]}); }; const auto calcStepSizeScaling = [&](const double errorEstimate_) -> double { @@ -155,17 +154,20 @@ Result SympyStepper::stepImpl( nStepTrials++; // For details about the factor 4 see ATL-SOFT-PUB-2009-001 - bool ok = + Result res = rk4(pos.data(), dir.data(), t, h, qop, m, p_abs, getB, &errorEstimate, 4 * stepTolerance, state.pars.template segment<3>(eFreePos0).data(), state.pars.template segment<3>(eFreeDir0).data(), state.pars.template segment<1>(eFreeTime).data(), state.derivative.data(), state.covTransport ? state.jacTransport.data() : nullptr); + if (!res.ok()) { + return res.error(); + } // Protect against division by zero errorEstimate = std::max(1e-20, errorEstimate); - if (ok) { + if (*res) { break; } diff --git a/Core/src/Propagator/codegen/sympy_stepper_math.hpp b/Core/src/Propagator/codegen/sympy_stepper_math.hpp index aa0017f3d1d..e65c911cb51 100644 --- a/Core/src/Propagator/codegen/sympy_stepper_math.hpp +++ b/Core/src/Propagator/codegen/sympy_stepper_math.hpp @@ -11,13 +11,20 @@ #pragma once +#include + #include template -bool rk4(const T* p, const T* d, const T t, const T h, const T lambda, - const T m, const T p_abs, GetB getB, T* err, const T errTol, T* new_p, - T* new_d, T* new_time, T* path_derivatives, T* J) { - const auto B1 = getB(p); +Acts::Result rk4(const T* p, const T* d, const T t, const T h, + const T lambda, const T m, const T p_abs, GetB getB, + T* err, const T errTol, T* new_p, T* new_d, T* new_time, + T* path_derivatives, T* J) { + const auto B1res = getB(p); + if (!B1res.ok()) { + return Acts::Result::failure(B1res.error()); + } + const auto B1 = *B1res; const auto x5 = std::pow(h, 2); const auto x0 = B1[1] * d[2]; const auto x1 = B1[0] * d[2]; @@ -35,7 +42,11 @@ bool rk4(const T* p, const T* d, const T t, const T h, const T lambda, p2[0] = (1.0 / 2.0) * x4 + x6 * k1[0] + p[0]; p2[1] = x6 * k1[1] + (1.0 / 2.0) * x7 + p[1]; p2[2] = x6 * k1[2] + (1.0 / 2.0) * x8 + p[2]; - const auto B2 = getB(p2); + const auto B2res = getB(p2); + if (!B2res.ok()) { + return Acts::Result::failure(B2res.error()); + } + const auto B2 = *B2res; const auto x9 = (1.0 / 2.0) * h; const auto x19 = (1.0 / 2.0) * x5; const auto x11 = lambda * B2[2]; @@ -62,7 +73,11 @@ bool rk4(const T* p, const T* d, const T t, const T h, const T lambda, p3[0] = x19 * k3[0] + x20; p3[1] = x19 * k3[1] + x21; p3[2] = x19 * k3[2] + x22; - const auto B3 = getB(p3); + const auto B3res = getB(p3); + if (!B3res.ok()) { + return Acts::Result::failure(B3res.error()); + } + const auto B3 = *B3res; const auto x24 = lambda * B3[2]; const auto x26 = lambda * B3[1]; const auto x28 = lambda * B3[0]; @@ -80,7 +95,7 @@ bool rk4(const T* p, const T* d, const T t, const T h, const T lambda, x5 * (std::fabs(-x29 + k2[0] + k3[0]) + std::fabs(-x30 + k2[1] + k3[1]) + std::fabs(-x31 + k2[2] + k3[2])); if (*err > errTol) { - return false; + return Acts::Result::success(false); } const auto x32 = (1.0 / 6.0) * x5; new_p[0] = x20 + x32 * (k1[0] + k2[0] + k3[0]); @@ -101,7 +116,7 @@ bool rk4(const T* p, const T* d, const T t, const T h, const T lambda, const auto dtds = std::sqrt(std::pow(p_abs, 2) + x35) / p_abs; *new_time = dtds * h + t; if (J == nullptr) { - return true; + return Acts::Result::success(true); } path_derivatives[0] = new_d[0]; path_derivatives[1] = new_d[1]; @@ -345,5 +360,5 @@ bool rk4(const T* p, const T* d, const T t, const T h, const T lambda, J[61] = new_J[61]; J[62] = new_J[62]; J[63] = new_J[63]; - return true; + return Acts::Result::success(true); } diff --git a/Core/src/Surfaces/CMakeLists.txt b/Core/src/Surfaces/CMakeLists.txt index da8d198c407..2f704f595c6 100644 --- a/Core/src/Surfaces/CMakeLists.txt +++ b/Core/src/Surfaces/CMakeLists.txt @@ -1,33 +1,33 @@ target_sources( - ActsCore - PRIVATE - AnnulusBounds.cpp - BoundaryTolerance.cpp - ConeBounds.cpp - ConeSurface.cpp - ConvexPolygonBounds.cpp - CylinderBounds.cpp - CylinderSurface.cpp - DiamondBounds.cpp - DiscSurface.cpp - DiscTrapezoidBounds.cpp - EllipseBounds.cpp - IntersectionHelper2D.cpp - LineBounds.cpp - LineSurface.cpp - PerigeeSurface.cpp - PlaneSurface.cpp - RadialBounds.cpp - RectangleBounds.cpp - StrawSurface.cpp - Surface.cpp - SurfaceArray.cpp - SurfaceError.cpp - TrapezoidBounds.cpp - VerticesHelper.cpp - RegularSurface.cpp - CurvilinearSurface.cpp - detail/AlignmentHelper.cpp - detail/AnnulusBoundsHelper.cpp - detail/MergeHelper.cpp + ActsCore + PRIVATE + AnnulusBounds.cpp + BoundaryTolerance.cpp + ConeBounds.cpp + ConeSurface.cpp + ConvexPolygonBounds.cpp + CylinderBounds.cpp + CylinderSurface.cpp + DiamondBounds.cpp + DiscSurface.cpp + DiscTrapezoidBounds.cpp + EllipseBounds.cpp + IntersectionHelper2D.cpp + LineBounds.cpp + LineSurface.cpp + PerigeeSurface.cpp + PlaneSurface.cpp + RadialBounds.cpp + RectangleBounds.cpp + StrawSurface.cpp + Surface.cpp + SurfaceArray.cpp + SurfaceError.cpp + TrapezoidBounds.cpp + VerticesHelper.cpp + RegularSurface.cpp + CurvilinearSurface.cpp + detail/AlignmentHelper.cpp + detail/AnnulusBoundsHelper.cpp + detail/MergeHelper.cpp ) diff --git a/Core/src/TrackFinding/CMakeLists.txt b/Core/src/TrackFinding/CMakeLists.txt index de56fca703e..6033a160742 100644 --- a/Core/src/TrackFinding/CMakeLists.txt +++ b/Core/src/TrackFinding/CMakeLists.txt @@ -1,9 +1,9 @@ target_sources( - ActsCore - PRIVATE - CombinatorialKalmanFilterError.cpp - MeasurementSelector.cpp - GbtsConnector.cpp - RoiDescriptor.cpp - AmbiguityTrackClustering.cpp + ActsCore + PRIVATE + CombinatorialKalmanFilterError.cpp + MeasurementSelector.cpp + GbtsConnector.cpp + RoiDescriptor.cpp + AmbiguityTrackClustering.cpp ) diff --git a/Core/src/TrackFitting/CMakeLists.txt b/Core/src/TrackFitting/CMakeLists.txt index 04ccbf3559e..7f5c94d922e 100644 --- a/Core/src/TrackFitting/CMakeLists.txt +++ b/Core/src/TrackFitting/CMakeLists.txt @@ -1,32 +1,30 @@ target_sources( - ActsCore - PRIVATE - KalmanFitterError.cpp - GainMatrixUpdater.cpp - GainMatrixSmoother.cpp - GlobalChiSquareFitterError.cpp - GsfError.cpp - GsfUtils.cpp - BetheHeitlerApprox.cpp - GsfMixtureReduction.cpp - GlobalChiSquareFitter.cpp - MbfSmoother.cpp + ActsCore + PRIVATE + KalmanFitterError.cpp + GainMatrixUpdater.cpp + GainMatrixSmoother.cpp + GlobalChiSquareFitterError.cpp + GsfError.cpp + GsfUtils.cpp + BetheHeitlerApprox.cpp + GsfMixtureReduction.cpp + GlobalChiSquareFitter.cpp + MbfSmoother.cpp ) foreach(DIM RANGE 1 6) + set(dim_file ${CMAKE_CURRENT_BINARY_DIR}/GainMatrixUpdaterImpl${DIM}.cpp) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/GainMatrixUpdaterImpl.cpp.in + ${dim_file} + @ONLY + ) - set(dim_file ${CMAKE_CURRENT_BINARY_DIR}/GainMatrixUpdaterImpl${DIM}.cpp) - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/GainMatrixUpdaterImpl.cpp.in - ${dim_file} - @ONLY - ) - - set_source_files_properties( - ${dim_file} - PROPERTIES COMPILE_DEFINITIONS ACTS_GAIN_MATRIX_UPDATER_INSTANTIATE=${DIM}) - target_sources(ActsCore - PRIVATE - ${dim_file}) - + set_source_files_properties( + ${dim_file} + PROPERTIES + COMPILE_DEFINITIONS ACTS_GAIN_MATRIX_UPDATER_INSTANTIATE=${DIM} + ) + target_sources(ActsCore PRIVATE ${dim_file}) endforeach() diff --git a/Core/src/Utilities/CMakeLists.txt b/Core/src/Utilities/CMakeLists.txt index 17d0492d51e..be3a4f83dfe 100644 --- a/Core/src/Utilities/CMakeLists.txt +++ b/Core/src/Utilities/CMakeLists.txt @@ -1,11 +1,11 @@ target_sources( - ActsCore - PRIVATE - AnnealingUtility.cpp - BinUtility.cpp - Logger.cpp - SpacePointUtility.cpp - TrackHelpers.cpp - BinningType.cpp - Intersection.cpp + ActsCore + PRIVATE + AnnealingUtility.cpp + BinUtility.cpp + Logger.cpp + SpacePointUtility.cpp + TrackHelpers.cpp + BinningType.cpp + Intersection.cpp ) diff --git a/Core/src/Vertexing/CMakeLists.txt b/Core/src/Vertexing/CMakeLists.txt index d0e8caa3c74..cf977ff0765 100644 --- a/Core/src/Vertexing/CMakeLists.txt +++ b/Core/src/Vertexing/CMakeLists.txt @@ -1,24 +1,24 @@ target_sources( - ActsCore - PRIVATE - AdaptiveGridTrackDensity.cpp - KalmanVertexUpdater.cpp - KalmanVertexUpdaterImpl3.cpp - KalmanVertexUpdaterImpl4.cpp - FsmwMode1dFinder.cpp - VertexingError.cpp - IterativeVertexFinder.cpp - AdaptiveMultiVertexFitter.cpp - AdaptiveGridDensityVertexFinder.cpp - ZScanVertexFinder.cpp - HelicalTrackLinearizer.cpp - FullBilloirVertexFitter.cpp - AdaptiveMultiVertexFinder.cpp - Vertex.cpp - NumericalTrackLinearizer.cpp - TrackDensityVertexFinder.cpp - GaussianTrackDensity.cpp - ImpactPointEstimator.cpp - GaussianGridTrackDensity.cpp - GridDensityVertexFinder.cpp + ActsCore + PRIVATE + AdaptiveGridTrackDensity.cpp + KalmanVertexUpdater.cpp + KalmanVertexUpdaterImpl3.cpp + KalmanVertexUpdaterImpl4.cpp + FsmwMode1dFinder.cpp + VertexingError.cpp + IterativeVertexFinder.cpp + AdaptiveMultiVertexFitter.cpp + AdaptiveGridDensityVertexFinder.cpp + ZScanVertexFinder.cpp + HelicalTrackLinearizer.cpp + FullBilloirVertexFitter.cpp + AdaptiveMultiVertexFinder.cpp + Vertex.cpp + NumericalTrackLinearizer.cpp + TrackDensityVertexFinder.cpp + GaussianTrackDensity.cpp + ImpactPointEstimator.cpp + GaussianGridTrackDensity.cpp + GridDensityVertexFinder.cpp ) diff --git a/Core/src/Visualization/CMakeLists.txt b/Core/src/Visualization/CMakeLists.txt index d838e6e2058..ea2bd2427e6 100644 --- a/Core/src/Visualization/CMakeLists.txt +++ b/Core/src/Visualization/CMakeLists.txt @@ -1,7 +1,4 @@ target_sources( - ActsCore - PRIVATE - IVisualization3D.cpp - GeometryView3D.cpp - EventDataView3D.cpp + ActsCore + PRIVATE IVisualization3D.cpp GeometryView3D.cpp EventDataView3D.cpp ) diff --git a/Examples/Algorithms/Alignment/CMakeLists.txt b/Examples/Algorithms/Alignment/CMakeLists.txt index 59c7b1d9a08..992efd9e1bb 100644 --- a/Examples/Algorithms/Alignment/CMakeLists.txt +++ b/Examples/Algorithms/Alignment/CMakeLists.txt @@ -1,16 +1,23 @@ add_library( - ActsExamplesAlignment SHARED - src/AlignmentAlgorithm.cpp - src/AlignmentAlgorithmFunction.cpp) + ActsExamplesAlignment + SHARED + src/AlignmentAlgorithm.cpp + src/AlignmentAlgorithmFunction.cpp +) target_include_directories( - ActsExamplesAlignment - PUBLIC $) + ActsExamplesAlignment + PUBLIC $ +) target_link_libraries( - ActsExamplesAlignment - PUBLIC - ActsCore ActsAlignment - ActsExamplesFramework ActsExamplesMagneticField) + ActsExamplesAlignment + PUBLIC + ActsCore + ActsAlignment + ActsExamplesFramework + ActsExamplesMagneticField +) install( - TARGETS ActsExamplesAlignment - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesAlignment + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Algorithms/AmbiguityResolution/CMakeLists.txt b/Examples/Algorithms/AmbiguityResolution/CMakeLists.txt index de338ec8fb3..2027a45079d 100644 --- a/Examples/Algorithms/AmbiguityResolution/CMakeLists.txt +++ b/Examples/Algorithms/AmbiguityResolution/CMakeLists.txt @@ -1,23 +1,21 @@ add_library( - ActsExamplesAmbiguityResolution SHARED - src/GreedyAmbiguityResolutionAlgorithm.cpp - src/ScoreBasedAmbiguityResolutionAlgorithm.cpp + ActsExamplesAmbiguityResolution + SHARED + src/GreedyAmbiguityResolutionAlgorithm.cpp + src/ScoreBasedAmbiguityResolutionAlgorithm.cpp ) target_include_directories( - ActsExamplesAmbiguityResolution - PUBLIC $ + ActsExamplesAmbiguityResolution + PUBLIC $ ) target_link_libraries( - ActsExamplesAmbiguityResolution - PUBLIC - ActsCore - ActsExamplesFramework - ActsPluginJson + ActsExamplesAmbiguityResolution + PUBLIC ActsCore ActsExamplesFramework ActsPluginJson ) install( - TARGETS ActsExamplesAmbiguityResolution - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + TARGETS ActsExamplesAmbiguityResolution + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) diff --git a/Examples/Algorithms/Digitization/CMakeLists.txt b/Examples/Algorithms/Digitization/CMakeLists.txt index 7590d85c06b..14729f2784f 100644 --- a/Examples/Algorithms/Digitization/CMakeLists.txt +++ b/Examples/Algorithms/Digitization/CMakeLists.txt @@ -1,18 +1,22 @@ add_library( - ActsExamplesDigitization SHARED - src/DigitizationAlgorithm.cpp - src/DigitizationConfig.cpp - src/MeasurementCreation.cpp - src/DigitizationConfigurator.cpp - src/ModuleClusters.cpp) + ActsExamplesDigitization + SHARED + src/DigitizationAlgorithm.cpp + src/DigitizationConfig.cpp + src/MeasurementCreation.cpp + src/DigitizationConfigurator.cpp + src/ModuleClusters.cpp +) target_include_directories( - ActsExamplesDigitization - PUBLIC $) + ActsExamplesDigitization + PUBLIC $ +) target_link_libraries( - ActsExamplesDigitization - PUBLIC - ActsCore ActsExamplesFramework) + ActsExamplesDigitization + PUBLIC ActsCore ActsExamplesFramework +) install( - TARGETS ActsExamplesDigitization - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesDigitization + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Algorithms/Fatras/CMakeLists.txt b/Examples/Algorithms/Fatras/CMakeLists.txt index 69bcd9cac2d..922414440d9 100644 --- a/Examples/Algorithms/Fatras/CMakeLists.txt +++ b/Examples/Algorithms/Fatras/CMakeLists.txt @@ -1,15 +1,11 @@ -add_library( - ActsExamplesFatras SHARED - src/FatrasSimulation.cpp) +add_library(ActsExamplesFatras SHARED src/FatrasSimulation.cpp) target_include_directories( - ActsExamplesFatras - PUBLIC $) + ActsExamplesFatras + PUBLIC $ +) target_link_libraries( - ActsExamplesFatras - PUBLIC - ActsCore ActsFatras - ActsExamplesFramework ActsExamplesMagneticField) + ActsExamplesFatras + PUBLIC ActsCore ActsFatras ActsExamplesFramework ActsExamplesMagneticField +) -install( - TARGETS ActsExamplesFatras - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS ActsExamplesFatras LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/Examples/Algorithms/Geant4/CMakeLists.txt b/Examples/Algorithms/Geant4/CMakeLists.txt index efa5d2280b7..a7dd786bccf 100644 --- a/Examples/Algorithms/Geant4/CMakeLists.txt +++ b/Examples/Algorithms/Geant4/CMakeLists.txt @@ -1,5 +1,6 @@ add_library( - ActsExamplesGeant4 SHARED + ActsExamplesGeant4 + SHARED src/GdmlDetectorConstruction.cpp src/TelescopeG4DetectorConstruction.cpp src/Geant4Simulation.cpp @@ -13,49 +14,61 @@ add_library( src/SimParticleTranslation.cpp src/ParticleKillAction.cpp src/PhysicsListFactory.cpp - src/Geant4Manager.cpp) + src/Geant4Manager.cpp +) -target_compile_definitions( - ActsExamplesGeant4 - PUBLIC ${Geant4_DEFINITIONS}) -target_include_directories( - ActsExamplesGeant4 - SYSTEM PUBLIC ${Geant4_INCLUDE_DIRS}) +target_compile_definitions(ActsExamplesGeant4 PUBLIC ${Geant4_DEFINITIONS}) target_include_directories( - ActsExamplesGeant4 - PUBLIC $) -target_link_libraries( - ActsExamplesGeant4 - PUBLIC ActsCore ActsExamplesFramework ActsExamplesDetectorTelescope Boost::headers ${Geant4_LIBRARIES}) - -if (ACTS_BUILD_EXAMPLES_DD4HEP) - if(${DD4hep_VERSION} VERSION_LESS 1.11) - target_include_directories( ActsExamplesGeant4 - PRIVATE ${DD4hep_INCLUDE_DIRS}) - target_link_libraries( + SYSTEM + PUBLIC ${Geant4_INCLUDE_DIRS} +) +target_include_directories( ActsExamplesGeant4 - PRIVATE ${DD4hep_DDCORE_LIBRARY} ${DD4hep_DDG4_LIBRARY}) - else() - target_link_libraries( + PUBLIC $ +) +target_link_libraries( ActsExamplesGeant4 - PUBLIC ActsExamplesDetectorDD4hep DD4hep::DDCore DD4hep::DDG4) - endif() + PUBLIC + ActsCore + ActsExamplesFramework + ActsExamplesDetectorTelescope + Boost::headers + ${Geant4_LIBRARIES} +) - target_sources(ActsExamplesGeant4 PUBLIC src/DDG4DetectorConstruction.cpp) -endif() +if(ACTS_BUILD_EXAMPLES_DD4HEP) + if(${DD4hep_VERSION} VERSION_LESS 1.11) + target_include_directories( + ActsExamplesGeant4 + PRIVATE ${DD4hep_INCLUDE_DIRS} + ) + target_link_libraries( + ActsExamplesGeant4 + PRIVATE ${DD4hep_DDCORE_LIBRARY} ${DD4hep_DDG4_LIBRARY} + ) + else() + target_link_libraries( + ActsExamplesGeant4 + PUBLIC ActsExamplesDetectorDD4hep DD4hep::DDCore DD4hep::DDG4 + ) + endif() -if (ACTS_BUILD_PLUGIN_GEOMODEL) + target_sources(ActsExamplesGeant4 PUBLIC src/DDG4DetectorConstruction.cpp) +endif() - target_sources(ActsExamplesGeant4 PUBLIC src/GeoModelDetectorConstruction.cpp) +if(ACTS_BUILD_PLUGIN_GEOMODEL) + target_sources( + ActsExamplesGeant4 + PUBLIC src/GeoModelDetectorConstruction.cpp + ) - find_library(GeoModel2G4_LIBRARY GeoModel2G4 REQUIRED) + find_library(GeoModel2G4_LIBRARY GeoModel2G4 REQUIRED) - target_link_libraries( - ActsExamplesGeant4 - PUBLIC ActsPluginGeoModel ${GeoModel2G4_LIBRARY}) + target_link_libraries( + ActsExamplesGeant4 + PUBLIC ActsPluginGeoModel ${GeoModel2G4_LIBRARY} + ) endif() -install( - TARGETS ActsExamplesGeant4 - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS ActsExamplesGeant4 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/Examples/Algorithms/Geant4/src/Geant4Simulation.cpp b/Examples/Algorithms/Geant4/src/Geant4Simulation.cpp index d2376950564..bf13136e376 100644 --- a/Examples/Algorithms/Geant4/src/Geant4Simulation.cpp +++ b/Examples/Algorithms/Geant4/src/Geant4Simulation.cpp @@ -50,6 +50,7 @@ #include #include #include +#include ActsExamples::Geant4SimulationBase::Geant4SimulationBase( const Config& cfg, std::string name, Acts::Logging::Level level) diff --git a/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp b/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp index 2bdbc7e34a7..ec07dc5f3a6 100644 --- a/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp +++ b/Examples/Algorithms/Geant4/src/SensitiveSteppingAction.cpp @@ -30,6 +30,7 @@ #include #include #include +#include class G4PrimaryParticle; @@ -130,6 +131,10 @@ void ActsExamples::SensitiveSteppingAction::UserSteppingAction( // Get the physical volume & check if it has the sensitive string name const G4VPhysicalVolume* volume = track->GetVolume(); + if (volume == nullptr) { + ACTS_ERROR("No volume found for track " << track->GetTrackID()); + std::terminate(); + } std::string volumeName = volume->GetName(); if (volumeName.find(SensitiveSurfaceMapper::mappingPrefix) == diff --git a/Examples/Algorithms/Geant4HepMC/CMakeLists.txt b/Examples/Algorithms/Geant4HepMC/CMakeLists.txt index b2a4cd3cbf2..53e0f2a410b 100644 --- a/Examples/Algorithms/Geant4HepMC/CMakeLists.txt +++ b/Examples/Algorithms/Geant4HepMC/CMakeLists.txt @@ -1,20 +1,27 @@ add_library( - ActsExamplesEventRecording SHARED - src/EventAction.cpp - src/EventRecording.cpp - src/PrimaryGeneratorAction.cpp - src/RunAction.cpp - src/SteppingAction.cpp) + ActsExamplesEventRecording + SHARED + src/EventAction.cpp + src/EventRecording.cpp + src/PrimaryGeneratorAction.cpp + src/RunAction.cpp + src/SteppingAction.cpp +) target_include_directories( - ActsExamplesEventRecording - SYSTEM PUBLIC ${HEPMC3_INCLUDE_DIR}) + ActsExamplesEventRecording + SYSTEM + PUBLIC ${HEPMC3_INCLUDE_DIR} +) target_include_directories( - ActsExamplesEventRecording - PUBLIC $) + ActsExamplesEventRecording + PUBLIC $ +) target_link_libraries( - ActsExamplesEventRecording - PUBLIC ActsCore ActsExamplesFramework ActsExamplesGeant4 ${HEPMC3_LIBRARIES}) + ActsExamplesEventRecording + PUBLIC ActsCore ActsExamplesFramework ActsExamplesGeant4 ${HEPMC3_LIBRARIES} +) install( - TARGETS ActsExamplesEventRecording - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesEventRecording + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Algorithms/Generators/CMakeLists.txt b/Examples/Algorithms/Generators/CMakeLists.txt index 52c067f8ede..a7c1096cc19 100644 --- a/Examples/Algorithms/Generators/CMakeLists.txt +++ b/Examples/Algorithms/Generators/CMakeLists.txt @@ -1,14 +1,19 @@ add_library( - ActsExamplesGenerators SHARED - ActsExamples/Generators/EventGenerator.cpp - ActsExamples/Generators/ParametricParticleGenerator.cpp) + ActsExamplesGenerators + SHARED + ActsExamples/Generators/EventGenerator.cpp + ActsExamples/Generators/ParametricParticleGenerator.cpp +) target_include_directories( - ActsExamplesGenerators - PUBLIC $) + ActsExamplesGenerators + PUBLIC $ +) target_link_libraries( - ActsExamplesGenerators - PUBLIC ActsCore ActsExamplesFramework) + ActsExamplesGenerators + PUBLIC ActsCore ActsExamplesFramework +) install( - TARGETS ActsExamplesGenerators - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesGenerators + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Algorithms/GeneratorsPythia8/CMakeLists.txt b/Examples/Algorithms/GeneratorsPythia8/CMakeLists.txt index 29e4c3b86fa..bba231291be 100644 --- a/Examples/Algorithms/GeneratorsPythia8/CMakeLists.txt +++ b/Examples/Algorithms/GeneratorsPythia8/CMakeLists.txt @@ -1,17 +1,19 @@ add_library( - ActsExamplesGeneratorsPythia8 SHARED - ActsExamples/Generators/Pythia8ProcessGenerator.cpp) + ActsExamplesGeneratorsPythia8 + SHARED + ActsExamples/Generators/Pythia8ProcessGenerator.cpp +) target_include_directories( - ActsExamplesGeneratorsPythia8 - PUBLIC $) + ActsExamplesGeneratorsPythia8 + PUBLIC $ +) target_link_libraries( - ActsExamplesGeneratorsPythia8 - PUBLIC - ActsCore - ActsExamplesFramework ActsExamplesGenerators - PRIVATE - Pythia8) + ActsExamplesGeneratorsPythia8 + PUBLIC ActsCore ActsExamplesFramework ActsExamplesGenerators + PRIVATE Pythia8 +) install( - TARGETS ActsExamplesGeneratorsPythia8 - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesGeneratorsPythia8 + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Algorithms/Geometry/CMakeLists.txt b/Examples/Algorithms/Geometry/CMakeLists.txt index a82e0c1e885..ddf97691ac2 100644 --- a/Examples/Algorithms/Geometry/CMakeLists.txt +++ b/Examples/Algorithms/Geometry/CMakeLists.txt @@ -1,14 +1,16 @@ -add_library(ActsExamplesGeometry SHARED - src/VolumeAssociationTest.cpp) +add_library(ActsExamplesGeometry SHARED src/VolumeAssociationTest.cpp) target_include_directories( ActsExamplesGeometry - PUBLIC $) + PUBLIC $ +) target_link_libraries( ActsExamplesGeometry - PUBLIC ActsCore ActsExamplesFramework) + PUBLIC ActsCore ActsExamplesFramework +) install( - TARGETS ActsExamplesGeometry - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesGeometry + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Algorithms/HepMC/CMakeLists.txt b/Examples/Algorithms/HepMC/CMakeLists.txt index 74cb5e3e4e9..aeaab151c77 100644 --- a/Examples/Algorithms/HepMC/CMakeLists.txt +++ b/Examples/Algorithms/HepMC/CMakeLists.txt @@ -1,16 +1,16 @@ -add_library( - ActsExamplesHepMC3 SHARED - src/HepMCProcessExtractor.cpp) +add_library(ActsExamplesHepMC3 SHARED src/HepMCProcessExtractor.cpp) target_include_directories( - ActsExamplesHepMC3 - SYSTEM PUBLIC ${HEPMC3_INCLUDE_DIR}) + ActsExamplesHepMC3 + SYSTEM + PUBLIC ${HEPMC3_INCLUDE_DIR} +) target_include_directories( - ActsExamplesHepMC3 - PUBLIC $) + ActsExamplesHepMC3 + PUBLIC $ +) target_link_libraries( - ActsExamplesHepMC3 - PUBLIC ActsCore ActsExamplesFramework ActsExamplesIoHepMC3) + ActsExamplesHepMC3 + PUBLIC ActsCore ActsExamplesFramework ActsExamplesIoHepMC3 +) -install( - TARGETS ActsExamplesHepMC3 - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS ActsExamplesHepMC3 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/Examples/Algorithms/MaterialMapping/CMakeLists.txt b/Examples/Algorithms/MaterialMapping/CMakeLists.txt index 11d65602e4d..ac2bd9c5d0e 100644 --- a/Examples/Algorithms/MaterialMapping/CMakeLists.txt +++ b/Examples/Algorithms/MaterialMapping/CMakeLists.txt @@ -1,16 +1,21 @@ add_library( - ActsExamplesMaterialMapping SHARED - src/CoreMaterialMapping.cpp - src/MaterialValidation.cpp - src/MaterialMapping.cpp) + ActsExamplesMaterialMapping + SHARED + src/CoreMaterialMapping.cpp + src/MaterialValidation.cpp + src/MaterialMapping.cpp +) target_include_directories( - ActsExamplesMaterialMapping - PUBLIC $) + ActsExamplesMaterialMapping + PUBLIC $ +) target_link_libraries( - ActsExamplesMaterialMapping - PUBLIC ActsCore ActsExamplesFramework) + ActsExamplesMaterialMapping + PUBLIC ActsCore ActsExamplesFramework +) install( - TARGETS ActsExamplesMaterialMapping - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesMaterialMapping + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Algorithms/Printers/CMakeLists.txt b/Examples/Algorithms/Printers/CMakeLists.txt index 5d8a50b444e..4131c04bb84 100644 --- a/Examples/Algorithms/Printers/CMakeLists.txt +++ b/Examples/Algorithms/Printers/CMakeLists.txt @@ -1,14 +1,19 @@ add_library( - ActsExamplesPrinters SHARED - ActsExamples/Printers/ParticlesPrinter.cpp - ActsExamples/Printers/TrackParametersPrinter.cpp) + ActsExamplesPrinters + SHARED + ActsExamples/Printers/ParticlesPrinter.cpp + ActsExamples/Printers/TrackParametersPrinter.cpp +) target_include_directories( - ActsExamplesPrinters - PUBLIC $) + ActsExamplesPrinters + PUBLIC $ +) target_link_libraries( - ActsExamplesPrinters - PUBLIC ActsCore ActsFatras ActsExamplesFramework) + ActsExamplesPrinters + PUBLIC ActsCore ActsFatras ActsExamplesFramework +) install( - TARGETS ActsExamplesPrinters - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesPrinters + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Algorithms/Propagation/CMakeLists.txt b/Examples/Algorithms/Propagation/CMakeLists.txt index 18dcaf30963..c9b2b68ca36 100644 --- a/Examples/Algorithms/Propagation/CMakeLists.txt +++ b/Examples/Algorithms/Propagation/CMakeLists.txt @@ -1,14 +1,16 @@ -add_library(ActsExamplesPropagation SHARED - src/PropagationAlgorithm.cpp) +add_library(ActsExamplesPropagation SHARED src/PropagationAlgorithm.cpp) target_include_directories( - ActsExamplesPropagation - PUBLIC $) + ActsExamplesPropagation + PUBLIC $ +) target_link_libraries( - ActsExamplesPropagation - PUBLIC ActsCore ActsExamplesFramework) + ActsExamplesPropagation + PUBLIC ActsCore ActsExamplesFramework +) install( - TARGETS ActsExamplesPropagation - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesPropagation + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagationAlgorithm.hpp b/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagationAlgorithm.hpp index 1aaaf758160..bbebf9b8625 100644 --- a/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagationAlgorithm.hpp +++ b/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagationAlgorithm.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2017 CERN for the benefit of the Acts project +// Copyright (C) 2017-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -13,6 +13,7 @@ #include "Acts/Propagator/MaterialInteractor.hpp" #include "Acts/Propagator/detail/SteppingLogger.hpp" #include "Acts/Utilities/Logger.hpp" +#include "ActsExamples/EventData/PropagationSummary.hpp" #include "ActsExamples/EventData/Track.hpp" #include "ActsExamples/Framework/DataHandle.hpp" #include "ActsExamples/Framework/IAlgorithm.hpp" @@ -22,24 +23,15 @@ #include #include +namespace Acts { +class Surface; +} + namespace ActsExamples { class PropagatorInterface; struct AlgorithmContext; -/// Using some short hands for Recorded Material -using RecordedMaterial = Acts::MaterialInteractor::result_type; - -/// And recorded material track -/// - this is start: position, start momentum -/// and the Recorded material -using RecordedMaterialTrack = - std::pair, Acts::RecordedMaterial>; - -/// Finally the output of the propagation test -using PropagationOutput = - std::pair, Acts::RecordedMaterial>; - /// @brief this test algorithm performs test propagation /// within the Acts::Propagator /// @@ -48,6 +40,13 @@ using PropagationOutput = class PropagationAlgorithm : public IAlgorithm { public: struct Config { + /// Input track parameters + std::string inputTrackParameters = "InputTrackParameters"; + /// The step collection to be stored + std::string outputSummaryCollection = "PropagationSummary"; + /// The material collection to be stored + std::string outputMaterialCollection = "RecordedMaterialTracks"; + /// Instance of a propagator wrapper that performs the actual propagation std::shared_ptr propagatorImpl = nullptr; /// Switch the logger to sterile - for timing measurements @@ -66,12 +65,6 @@ class PropagationAlgorithm : public IAlgorithm { double maxStepSize = 5 * Acts::UnitConstants::m; /// Switch covariance transport on bool covarianceTransport = false; - /// Input track parameters - std::string inputTrackParameters = "InputTrackParameters"; - /// The step collection to be stored - std::string outputPropagationSteps = "PropagationSteps"; - /// The material collection to be stored - std::string outputMaterialTracks = "RecordedMaterialTracks"; }; /// Constructor @@ -94,8 +87,7 @@ class PropagationAlgorithm : public IAlgorithm { ReadDataHandle m_inputTrackParameters{ this, "InputTrackParameters"}; - WriteDataHandle>> - m_outputPropagationSteps{this, "OutputPropagationSteps"}; + WriteDataHandle m_outputSummary{this, "OutputSummary"}; WriteDataHandle> m_outputMaterialTracks{this, "RecordedMaterial"}; diff --git a/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagatorInterface.hpp b/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagatorInterface.hpp index b9d0b31ea5b..cc13142616f 100644 --- a/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagatorInterface.hpp +++ b/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagatorInterface.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2021 CERN for the benefit of the Acts project +// Copyright (C) 2021-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -30,7 +30,7 @@ class PropagatorInterface { ///@param logger A logger wrapper instance ///@param startParameters The start parameters ///@return PropagationOutput - virtual PropagationOutput execute( + virtual Acts::Result execute( const AlgorithmContext& context, const PropagationAlgorithm::Config& cfg, const Acts::Logger& logger, const Acts::BoundTrackParameters& startParameters) const = 0; @@ -53,27 +53,14 @@ class ConcretePropagator : public PropagatorInterface { ConcretePropagator(propagator_t propagator) : m_propagator{std::move(propagator)} {} - PropagationOutput execute( + Acts::Result execute( const AlgorithmContext& context, const PropagationAlgorithm::Config& cfg, const Acts::Logger& logger, const Acts::BoundTrackParameters& startParameters) const override { - return executeTest(context, cfg, logger, startParameters); - } - - private: - /// Templated execute test method for - /// charged and neutral particles - /// @param [in] context is the contextual data of this event - /// @param [in] startParameters the start parameters - /// @param [in] pathLength the maximal path length to go - template - PropagationOutput executeTest( - const AlgorithmContext& context, const PropagationAlgorithm::Config& cfg, - const Acts::Logger& logger, const parameters_t& startParameters, - double pathLength = std::numeric_limits::max()) const { ACTS_DEBUG("Test propagation/extrapolation starts"); - PropagationOutput pOutput; + PropagationSummary summary(startParameters); + RecordedMaterial recordedMaterial; // The step length logger for testing & end of world aborter using MaterialInteractor = Acts::MaterialInteractor; @@ -87,8 +74,6 @@ class ConcretePropagator : public PropagatorInterface { typename propagator_t::template Options; PropagatorOptions options(context.geoContext, context.magFieldContext); - options.pathLimit = pathLength; - // Activate loop protection at some pt value options.loopProtection = startParameters.transverseMomentum() < cfg.ptLoopers; @@ -105,23 +90,41 @@ class ConcretePropagator : public PropagatorInterface { // Set a maximum step size options.stepping.maxStepSize = cfg.maxStepSize; + auto state = m_propagator.makeState(startParameters, options); + // Propagate using the propagator - auto result = m_propagator.propagate(startParameters, options); - if (result.ok()) { - const auto& resultValue = result.value(); - auto steppingResults = - resultValue.template get(); - - // Set the stepping result - pOutput.first = std::move(steppingResults.steps); - // Also set the material recording result - if configured - if (cfg.recordMaterialInteractions) { - auto materialResult = - resultValue.template get(); - pOutput.second = std::move(materialResult); - } + auto resultTmp = m_propagator.propagate(state); + if (!resultTmp.ok()) { + return resultTmp.error(); } - return pOutput; + + // Collect internal stepping information + summary.nStepTrials = state.stepping.nStepTrials; + + auto result = + m_propagator.makeResult(std::move(state), resultTmp, options, true); + if (!result.ok()) { + return result.error(); + } + auto& resultValue = result.value(); + + // Collect general summary information + summary.nSteps = resultValue.steps; + summary.pathLength = resultValue.pathLength; + + // Collect the steps + auto& steppingResults = + resultValue.template get(); + summary.steps = std::move(steppingResults.steps); + + // Also set the material recording result - if configured + if (cfg.recordMaterialInteractions) { + auto materialResult = + resultValue.template get(); + recordedMaterial = std::move(materialResult); + } + + return std::pair{std::move(summary), std::move(recordedMaterial)}; } private: diff --git a/Examples/Algorithms/Propagation/src/PropagationAlgorithm.cpp b/Examples/Algorithms/Propagation/src/PropagationAlgorithm.cpp index abd591331a0..7c426557b56 100644 --- a/Examples/Algorithms/Propagation/src/PropagationAlgorithm.cpp +++ b/Examples/Algorithms/Propagation/src/PropagationAlgorithm.cpp @@ -13,9 +13,21 @@ #include "ActsExamples/Propagation/PropagatorInterface.hpp" #include +#include namespace ActsExamples { +PropagationAlgorithm::PropagationAlgorithm( + const PropagationAlgorithm::Config& config, Acts::Logging::Level level) + : IAlgorithm("PropagationAlgorithm", level), m_cfg(config) { + if (!m_cfg.propagatorImpl) { + throw std::invalid_argument("Config needs to contain a propagator"); + } + m_inputTrackParameters.initialize(m_cfg.inputTrackParameters); + m_outputSummary.initialize(m_cfg.outputSummaryCollection); + m_outputMaterialTracks.initialize(m_cfg.outputMaterialCollection); +} + ProcessCode PropagationAlgorithm::execute( const AlgorithmContext& context) const { // Input : the track parameters @@ -25,8 +37,8 @@ ProcessCode PropagationAlgorithm::execute( << " input trackparameters"); // Output : the propagation steps - std::vector> propagationSteps; - propagationSteps.reserve(inputTrackParameters.size()); + PropagationSummaries propagationSummaries; + propagationSummaries.reserve(inputTrackParameters.size()); // Output (optional): the recorded material std::unordered_map @@ -38,7 +50,7 @@ ProcessCode PropagationAlgorithm::execute( for (const auto [it, parameters] : Acts::enumerate(inputTrackParameters)) { // In case covariance transport is not desired, it has to be stripped // off the input parameters - PropagationOutput pOutput = + auto propagationResult = m_cfg.covarianceTransport ? m_cfg.propagatorImpl->execute(context, m_cfg, logger(), parameters) @@ -47,22 +59,29 @@ ProcessCode PropagationAlgorithm::execute( TrackParameters(parameters.referenceSurface().getSharedPtr(), parameters.parameters(), std::nullopt, parameters.particleHypothesis())); + if (!propagationResult.ok()) { + ACTS_ERROR("Propagation failed with " << propagationResult.error()); + continue; + } + + PropagationOutput& propagationOutput = propagationResult.value(); // Position / momentum for the output writing Acts::Vector3 position = parameters.position(context.geoContext); Acts::Vector3 direction = parameters.direction(); // Record the propagator steps - propagationSteps.push_back(std::move(pOutput.first)); + propagationSummaries.push_back(std::move(propagationOutput.first)); + if (m_cfg.recordMaterialInteractions) { // Record the material information recordedMaterialTracks.emplace( it, std::make_pair(std::make_pair(position, direction), - std::move(pOutput.second))); + std::move(propagationOutput.second))); } } // Write the propagation step data to the event store - m_outputPropagationSteps(context, std::move(propagationSteps)); + m_outputSummary(context, std::move(propagationSummaries)); // Write the recorded material to the event store if (m_cfg.recordMaterialInteractions) { @@ -71,15 +90,4 @@ ProcessCode PropagationAlgorithm::execute( return ProcessCode::SUCCESS; } -PropagationAlgorithm::PropagationAlgorithm( - const PropagationAlgorithm::Config& config, Acts::Logging::Level level) - : IAlgorithm("PropagationAlgorithm", level), m_cfg(config) { - if (!m_cfg.propagatorImpl) { - throw std::invalid_argument("Config needs to contain a propagator"); - } - m_inputTrackParameters.initialize(m_cfg.inputTrackParameters); - m_outputPropagationSteps.initialize(m_cfg.outputPropagationSteps); - m_outputMaterialTracks.initialize(m_cfg.outputMaterialTracks); -} - } // namespace ActsExamples diff --git a/Examples/Algorithms/TrackFinding/CMakeLists.txt b/Examples/Algorithms/TrackFinding/CMakeLists.txt index be962b242cf..d030529d18c 100644 --- a/Examples/Algorithms/TrackFinding/CMakeLists.txt +++ b/Examples/Algorithms/TrackFinding/CMakeLists.txt @@ -1,33 +1,33 @@ add_library( - ActsExamplesTrackFinding SHARED - src/SeedingAlgorithm.cpp - src/SeedingOrthogonalAlgorithm.cpp - src/SpacePointMaker.cpp - src/TrackFindingAlgorithm.cpp - src/TrackFindingAlgorithmFunction.cpp - src/HoughTransformSeeder.cpp - src/TrackParamsEstimationAlgorithm.cpp - src/MuonHoughSeeder.cpp - src/GbtsSeedingAlgorithm.cpp + ActsExamplesTrackFinding + SHARED + src/SeedingAlgorithm.cpp + src/SeedingOrthogonalAlgorithm.cpp + src/SpacePointMaker.cpp + src/TrackFindingAlgorithm.cpp + src/TrackFindingAlgorithmFunction.cpp + src/HoughTransformSeeder.cpp + src/TrackParamsEstimationAlgorithm.cpp + src/MuonHoughSeeder.cpp + src/GbtsSeedingAlgorithm.cpp ) target_include_directories( - ActsExamplesTrackFinding - PUBLIC $ + ActsExamplesTrackFinding + PUBLIC $ ) target_link_libraries( - ActsExamplesTrackFinding - PUBLIC - ActsCore - ActsExamplesFramework - ActsExamplesIoJson - ActsExamplesMagneticField - - PRIVATE ROOT::Core ROOT::Geom ROOT::Graf ROOT::Hist ROOT::Gpad + ActsExamplesTrackFinding + PUBLIC + ActsCore + ActsExamplesFramework + ActsExamplesIoJson + ActsExamplesMagneticField + PRIVATE ROOT::Core ROOT::Geom ROOT::Graf ROOT::Hist ROOT::Gpad ) install( - TARGETS ActsExamplesTrackFinding - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + TARGETS ActsExamplesTrackFinding + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) diff --git a/Examples/Algorithms/TrackFindingExaTrkX/CMakeLists.txt b/Examples/Algorithms/TrackFindingExaTrkX/CMakeLists.txt index 5b7ea5e820e..85866466ec6 100644 --- a/Examples/Algorithms/TrackFindingExaTrkX/CMakeLists.txt +++ b/Examples/Algorithms/TrackFindingExaTrkX/CMakeLists.txt @@ -1,25 +1,23 @@ add_library( - ActsExamplesTrackFindingExaTrkX SHARED - src/TrackFindingAlgorithmExaTrkX.cpp - src/PrototracksToParameters.cpp - src/TrackFindingFromPrototrackAlgorithm.cpp - src/TruthGraphBuilder.cpp + ActsExamplesTrackFindingExaTrkX + SHARED + src/TrackFindingAlgorithmExaTrkX.cpp + src/PrototracksToParameters.cpp + src/TrackFindingFromPrototrackAlgorithm.cpp + src/TruthGraphBuilder.cpp ) target_include_directories( - ActsExamplesTrackFindingExaTrkX - PUBLIC $ + ActsExamplesTrackFindingExaTrkX + PUBLIC $ ) target_link_libraries( - ActsExamplesTrackFindingExaTrkX - PUBLIC - ActsPluginExaTrkX - ActsExamplesFramework - ActsExamplesTrackFinding + ActsExamplesTrackFindingExaTrkX + PUBLIC ActsPluginExaTrkX ActsExamplesFramework ActsExamplesTrackFinding ) install( - TARGETS ActsExamplesTrackFindingExaTrkX - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + TARGETS ActsExamplesTrackFindingExaTrkX + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) diff --git a/Examples/Algorithms/TrackFindingML/CMakeLists.txt b/Examples/Algorithms/TrackFindingML/CMakeLists.txt index 90b9913efee..d826b224f2c 100644 --- a/Examples/Algorithms/TrackFindingML/CMakeLists.txt +++ b/Examples/Algorithms/TrackFindingML/CMakeLists.txt @@ -1,29 +1,23 @@ set(SOURCES - src/AmbiguityResolutionML.cpp - src/AmbiguityResolutionMLAlgorithm.cpp - src/AmbiguityResolutionMLDBScanAlgorithm.cpp - src/SeedFilterMLAlgorithm.cpp + src/AmbiguityResolutionML.cpp + src/AmbiguityResolutionMLAlgorithm.cpp + src/AmbiguityResolutionMLDBScanAlgorithm.cpp + src/SeedFilterMLAlgorithm.cpp ) -add_library( - ActsExamplesTrackFindingML SHARED - ${SOURCES} -) +add_library(ActsExamplesTrackFindingML SHARED ${SOURCES}) target_include_directories( - ActsExamplesTrackFindingML - PUBLIC $ + ActsExamplesTrackFindingML + PUBLIC $ ) target_link_libraries( - ActsExamplesTrackFindingML - PUBLIC - ActsCore - ActsPluginOnnx - ActsExamplesFramework + ActsExamplesTrackFindingML + PUBLIC ActsCore ActsPluginOnnx ActsExamplesFramework ) install( - TARGETS ActsExamplesTrackFindingML - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + TARGETS ActsExamplesTrackFindingML + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) diff --git a/Examples/Algorithms/TrackFitting/CMakeLists.txt b/Examples/Algorithms/TrackFitting/CMakeLists.txt index ca049947e51..07e26091384 100644 --- a/Examples/Algorithms/TrackFitting/CMakeLists.txt +++ b/Examples/Algorithms/TrackFitting/CMakeLists.txt @@ -1,21 +1,24 @@ add_library( - ActsExamplesTrackFitting SHARED - src/RefittingCalibrator.cpp - src/SurfaceSortingAlgorithm.cpp - src/TrackFittingAlgorithm.cpp - src/KalmanFitterFunction.cpp - src/RefittingAlgorithm.cpp - src/GsfFitterFunction.cpp - src/GlobalChiSquareFitterFunction.cpp) + ActsExamplesTrackFitting + SHARED + src/RefittingCalibrator.cpp + src/SurfaceSortingAlgorithm.cpp + src/TrackFittingAlgorithm.cpp + src/KalmanFitterFunction.cpp + src/RefittingAlgorithm.cpp + src/GsfFitterFunction.cpp + src/GlobalChiSquareFitterFunction.cpp +) target_include_directories( - ActsExamplesTrackFitting - PUBLIC $) + ActsExamplesTrackFitting + PUBLIC $ +) target_link_libraries( - ActsExamplesTrackFitting - PUBLIC - ActsCore - ActsExamplesFramework ActsExamplesMagneticField) + ActsExamplesTrackFitting + PUBLIC ActsCore ActsExamplesFramework ActsExamplesMagneticField +) install( - TARGETS ActsExamplesTrackFitting - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesTrackFitting + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Algorithms/TrackFitting/src/GsfFitterFunction.cpp b/Examples/Algorithms/TrackFitting/src/GsfFitterFunction.cpp index ca0af32d204..bfadb103a25 100644 --- a/Examples/Algorithms/TrackFitting/src/GsfFitterFunction.cpp +++ b/Examples/Algorithms/TrackFitting/src/GsfFitterFunction.cpp @@ -19,6 +19,7 @@ #include "Acts/Propagator/MultiEigenStepperLoop.hpp" #include "Acts/Propagator/Navigator.hpp" #include "Acts/Propagator/Propagator.hpp" +#include "Acts/Propagator/StepperExtensionList.hpp" #include "Acts/TrackFitting/GainMatrixUpdater.hpp" #include "Acts/TrackFitting/GaussianSumFitter.hpp" #include "Acts/TrackFitting/GsfMixtureReduction.hpp" @@ -57,7 +58,9 @@ using namespace ActsExamples; namespace { -using MultiStepper = Acts::MultiEigenStepperLoop<>; +using MultiStepper = Acts::MultiEigenStepperLoop< + Acts::StepperExtensionList, + Acts::MaxWeightReducerLoop>; using Propagator = Acts::Propagator; using DirectPropagator = Acts::Propagator; diff --git a/Examples/Algorithms/TruthTracking/CMakeLists.txt b/Examples/Algorithms/TruthTracking/CMakeLists.txt index df9a5d6c36b..7c1eff1ed51 100644 --- a/Examples/Algorithms/TruthTracking/CMakeLists.txt +++ b/Examples/Algorithms/TruthTracking/CMakeLists.txt @@ -1,22 +1,26 @@ add_library( - ActsExamplesTruthTracking SHARED - ActsExamples/TruthTracking/ParticleSelector.cpp - ActsExamples/TruthTracking/ParticleSmearing.cpp - ActsExamples/TruthTracking/TrackParameterSelector.cpp - ActsExamples/TruthTracking/TrackModifier.cpp - ActsExamples/TruthTracking/TrackTruthMatcher.cpp - ActsExamples/TruthTracking/TruthSeedSelector.cpp - ActsExamples/TruthTracking/TruthTrackFinder.cpp - ActsExamples/TruthTracking/TruthVertexFinder.cpp - ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp + ActsExamplesTruthTracking + SHARED + ActsExamples/TruthTracking/ParticleSelector.cpp + ActsExamples/TruthTracking/ParticleSmearing.cpp + ActsExamples/TruthTracking/TrackParameterSelector.cpp + ActsExamples/TruthTracking/TrackModifier.cpp + ActsExamples/TruthTracking/TrackTruthMatcher.cpp + ActsExamples/TruthTracking/TruthSeedSelector.cpp + ActsExamples/TruthTracking/TruthTrackFinder.cpp + ActsExamples/TruthTracking/TruthVertexFinder.cpp + ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp ) target_include_directories( - ActsExamplesTruthTracking - PUBLIC $) + ActsExamplesTruthTracking + PUBLIC $ +) target_link_libraries( - ActsExamplesTruthTracking - PUBLIC ActsCore ActsExamplesFramework) + ActsExamplesTruthTracking + PUBLIC ActsCore ActsExamplesFramework +) install( - TARGETS ActsExamplesTruthTracking - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesTruthTracking + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Algorithms/Utilities/CMakeLists.txt b/Examples/Algorithms/Utilities/CMakeLists.txt index 82a314a699d..ba9419c1914 100644 --- a/Examples/Algorithms/Utilities/CMakeLists.txt +++ b/Examples/Algorithms/Utilities/CMakeLists.txt @@ -1,22 +1,25 @@ add_library( - ActsExamplesUtilities SHARED - src/PrototracksToSeeds.cpp - src/SeedsToPrototracks.cpp - src/TrajectoriesToPrototracks.cpp - src/TrackSelectorAlgorithm.cpp - src/TracksToTrajectories.cpp - src/PrototracksToTracks.cpp - src/HitSelector.cpp - src/TracksToParameters.cpp) + ActsExamplesUtilities + SHARED + src/PrototracksToSeeds.cpp + src/SeedsToPrototracks.cpp + src/TrajectoriesToPrototracks.cpp + src/TrackSelectorAlgorithm.cpp + src/TracksToTrajectories.cpp + src/PrototracksToTracks.cpp + src/HitSelector.cpp + src/TracksToParameters.cpp +) target_include_directories( - ActsExamplesUtilities - PUBLIC $) + ActsExamplesUtilities + PUBLIC $ +) target_link_libraries( - ActsExamplesUtilities - PUBLIC - ActsCore - ActsExamplesFramework) + ActsExamplesUtilities + PUBLIC ActsCore ActsExamplesFramework +) install( - TARGETS ActsExamplesUtilities - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesUtilities + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Algorithms/Vertexing/CMakeLists.txt b/Examples/Algorithms/Vertexing/CMakeLists.txt index b982e10bc26..131135543c5 100644 --- a/Examples/Algorithms/Vertexing/CMakeLists.txt +++ b/Examples/Algorithms/Vertexing/CMakeLists.txt @@ -1,19 +1,23 @@ add_library( - ActsExamplesVertexing SHARED - src/AdaptiveMultiVertexFinderAlgorithm.cpp - src/IterativeVertexFinderAlgorithm.cpp - src/VertexFitterAlgorithm.cpp - src/SingleSeedVertexFinderAlgorithm.cpp - src/TruthVertexSeeder.cpp + ActsExamplesVertexing + SHARED + src/AdaptiveMultiVertexFinderAlgorithm.cpp + src/IterativeVertexFinderAlgorithm.cpp + src/VertexFitterAlgorithm.cpp + src/SingleSeedVertexFinderAlgorithm.cpp + src/TruthVertexSeeder.cpp ) target_include_directories( - ActsExamplesVertexing - PUBLIC $) + ActsExamplesVertexing + PUBLIC $ +) target_link_libraries( - ActsExamplesVertexing - PUBLIC ActsCore ActsExamplesFramework - PRIVATE ActsExamplesTruthTracking) + ActsExamplesVertexing + PUBLIC ActsCore ActsExamplesFramework + PRIVATE ActsExamplesTruthTracking +) install( - TARGETS ActsExamplesVertexing - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesVertexing + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Detectors/ContextualDetector/CMakeLists.txt b/Examples/Detectors/ContextualDetector/CMakeLists.txt index 7ffc1394e8e..2cb61207c53 100644 --- a/Examples/Detectors/ContextualDetector/CMakeLists.txt +++ b/Examples/Detectors/ContextualDetector/CMakeLists.txt @@ -1,17 +1,20 @@ add_library( - ActsExamplesDetectorContextual SHARED - src/AlignedDetector.cpp - src/InternalAlignmentDecorator.cpp - src/ExternalAlignmentDecorator.cpp) + ActsExamplesDetectorContextual + SHARED + src/AlignedDetector.cpp + src/InternalAlignmentDecorator.cpp + src/ExternalAlignmentDecorator.cpp +) target_include_directories( - ActsExamplesDetectorContextual - PUBLIC $) + ActsExamplesDetectorContextual + PUBLIC $ +) target_link_libraries( - ActsExamplesDetectorContextual - PUBLIC - ActsCore - ActsExamplesFramework ActsExamplesDetectorGeneric) + ActsExamplesDetectorContextual + PUBLIC ActsCore ActsExamplesFramework ActsExamplesDetectorGeneric +) install( - TARGETS ActsExamplesDetectorContextual - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesDetectorContextual + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Detectors/ContextualDetector/src/ExternalAlignmentDecorator.cpp b/Examples/Detectors/ContextualDetector/src/ExternalAlignmentDecorator.cpp index 30f5a6072ce..065ef4c6e2f 100644 --- a/Examples/Detectors/ContextualDetector/src/ExternalAlignmentDecorator.cpp +++ b/Examples/Detectors/ContextualDetector/src/ExternalAlignmentDecorator.cpp @@ -110,9 +110,15 @@ void ActsExamples::Contextual::ExternalAlignmentDecorator::parseGeometry( Acts::Transform3::Identity()); auto fillTransforms = [&aStore, &nominalCtx](const auto* surface) -> void { + if (surface == nullptr) { + throw std::invalid_argument("Surface is nullptr."); + } auto alignableElement = dynamic_cast( surface->associatedDetectorElement()); + if (alignableElement == nullptr) { + throw std::invalid_argument("Surface is not alignable"); + } aStore[alignableElement->identifier()] = surface->transform(nominalCtx); }; diff --git a/Examples/Detectors/DD4hepDetector/CMakeLists.txt b/Examples/Detectors/DD4hepDetector/CMakeLists.txt index 1a335363871..244b4f20a6d 100644 --- a/Examples/Detectors/DD4hepDetector/CMakeLists.txt +++ b/Examples/Detectors/DD4hepDetector/CMakeLists.txt @@ -1,31 +1,42 @@ add_library( - ActsExamplesDetectorDD4hep SHARED - src/DD4hepDetector.cpp - src/DD4hepGeometryService.cpp) + ActsExamplesDetectorDD4hep + SHARED + src/DD4hepDetector.cpp + src/DD4hepGeometryService.cpp +) target_include_directories( - ActsExamplesDetectorDD4hep - PUBLIC $) + ActsExamplesDetectorDD4hep + PUBLIC $ +) target_link_libraries( - ActsExamplesDetectorDD4hep - PUBLIC - ActsCore - ActsPluginDD4hep - ActsExamplesFramework) + ActsExamplesDetectorDD4hep + PUBLIC ActsCore ActsPluginDD4hep ActsExamplesFramework +) if(${DD4hep_VERSION} VERSION_LESS 1.11) - target_include_directories(ActsExamplesDetectorDD4hep PUBLIC ${DD4hep_INCLUDE_DIRS}) - target_link_libraries(ActsExamplesDetectorDD4hep PUBLIC ${DD4hep_DDCORE_LIBRARY}) + target_include_directories( + ActsExamplesDetectorDD4hep + PUBLIC ${DD4hep_INCLUDE_DIRS} + ) + target_link_libraries( + ActsExamplesDetectorDD4hep + PUBLIC ${DD4hep_DDCORE_LIBRARY} + ) else() - target_link_libraries(ActsExamplesDetectorDD4hep PUBLIC DD4hep::DDCore) + target_link_libraries(ActsExamplesDetectorDD4hep PUBLIC DD4hep::DDCore) endif() # not sure why this needs to be set, but dd4hep fails to compile otherwise set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) -set_target_properties(ActsExamplesDetectorDD4hep PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +set_target_properties( + ActsExamplesDetectorDD4hep + PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) dd4hep_set_version(ActsExamplesDetectorDD4hep MAJOR 1 MINOR 0 PATCH 0) dd4hep_generate_rootmap(ActsExamplesDetectorDD4hep) install( - TARGETS ActsExamplesDetectorDD4hep - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesDetectorDD4hep + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Detectors/Geant4Detector/CMakeLists.txt b/Examples/Detectors/Geant4Detector/CMakeLists.txt index 56b3b872930..8a83657de5a 100644 --- a/Examples/Detectors/Geant4Detector/CMakeLists.txt +++ b/Examples/Detectors/Geant4Detector/CMakeLists.txt @@ -1,14 +1,14 @@ -add_library( - ActsExamplesDetectorGeant4 SHARED - src/Geant4Detector.cpp - ) +add_library(ActsExamplesDetectorGeant4 SHARED src/Geant4Detector.cpp) target_include_directories( ActsExamplesDetectorGeant4 - PUBLIC $) + PUBLIC $ +) target_link_libraries( ActsExamplesDetectorGeant4 - PUBLIC ActsCore ActsExamplesFramework ActsExamplesGeant4 ActsPluginGeant4) + PUBLIC ActsCore ActsExamplesFramework ActsExamplesGeant4 ActsPluginGeant4 +) install( - TARGETS ActsExamplesDetectorGeant4 - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesDetectorGeant4 + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Detectors/GenericDetector/CMakeLists.txt b/Examples/Detectors/GenericDetector/CMakeLists.txt index 28614c7ae7b..242e710df42 100644 --- a/Examples/Detectors/GenericDetector/CMakeLists.txt +++ b/Examples/Detectors/GenericDetector/CMakeLists.txt @@ -1,18 +1,18 @@ add_library( - ActsExamplesDetectorGeneric SHARED - src/BuildGenericDetector.cpp - src/GenericDetector.cpp - src/GenericDetectorElement.cpp) + ActsExamplesDetectorGeneric + SHARED + src/BuildGenericDetector.cpp + src/GenericDetector.cpp + src/GenericDetectorElement.cpp +) target_include_directories( - ActsExamplesDetectorGeneric - PUBLIC $) -target_link_libraries( - ActsExamplesDetectorGeneric - PUBLIC ActsCore) -target_link_libraries( - ActsExamplesDetectorGeneric - PUBLIC ActsExamplesFramework) + ActsExamplesDetectorGeneric + PUBLIC $ +) +target_link_libraries(ActsExamplesDetectorGeneric PUBLIC ActsCore) +target_link_libraries(ActsExamplesDetectorGeneric PUBLIC ActsExamplesFramework) install( - TARGETS ActsExamplesDetectorGeneric - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesDetectorGeneric + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Detectors/MagneticField/CMakeLists.txt b/Examples/Detectors/MagneticField/CMakeLists.txt index 7e13b135650..b8eb5f9c326 100644 --- a/Examples/Detectors/MagneticField/CMakeLists.txt +++ b/Examples/Detectors/MagneticField/CMakeLists.txt @@ -1,18 +1,23 @@ add_library( - ActsExamplesMagneticField SHARED - src/FieldMapRootIo.cpp - src/FieldMapTextIo.cpp - src/ScalableBFieldService.cpp) + ActsExamplesMagneticField + SHARED + src/FieldMapRootIo.cpp + src/FieldMapTextIo.cpp + src/ScalableBFieldService.cpp +) target_include_directories( - ActsExamplesMagneticField - PUBLIC $) + ActsExamplesMagneticField + PUBLIC $ +) target_link_libraries( - ActsExamplesMagneticField - # the ROOT libraries should be private, but if we do that then the linker - # fails with some missing ROOT symbols. - PUBLIC ActsCore ActsExamplesFramework ROOT::Core ROOT::Tree - PRIVATE std::filesystem) + ActsExamplesMagneticField + # the ROOT libraries should be private, but if we do that then the linker + # fails with some missing ROOT symbols. + PUBLIC ActsCore ActsExamplesFramework ROOT::Core ROOT::Tree + PRIVATE std::filesystem +) install( - TARGETS ActsExamplesMagneticField - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesMagneticField + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Detectors/MuonSpectrometerMockupDetector/CMakeLists.txt b/Examples/Detectors/MuonSpectrometerMockupDetector/CMakeLists.txt index 9a5c02082ed..4e0850cc21f 100644 --- a/Examples/Detectors/MuonSpectrometerMockupDetector/CMakeLists.txt +++ b/Examples/Detectors/MuonSpectrometerMockupDetector/CMakeLists.txt @@ -1,13 +1,23 @@ add_library( - ActsExamplesMuonSpectrometerMockupDetector SHARED - src/MockupSectorBuilder.cpp) + ActsExamplesMuonSpectrometerMockupDetector + SHARED + src/MockupSectorBuilder.cpp +) target_include_directories( ActsExamplesMuonSpectrometerMockupDetector - PUBLIC $) + PUBLIC $ +) target_link_libraries( ActsExamplesMuonSpectrometerMockupDetector - PUBLIC ActsCore ActsExamplesFramework ActsExamplesGeant4 ActsExamplesDetectorGeant4 ActsPluginGeant4) + PUBLIC + ActsCore + ActsExamplesFramework + ActsExamplesGeant4 + ActsExamplesDetectorGeant4 + ActsPluginGeant4 +) install( - TARGETS ActsExamplesMuonSpectrometerMockupDetector - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesMuonSpectrometerMockupDetector + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Detectors/TGeoDetector/CMakeLists.txt b/Examples/Detectors/TGeoDetector/CMakeLists.txt index 6bb8967f0b7..04d065adaa5 100644 --- a/Examples/Detectors/TGeoDetector/CMakeLists.txt +++ b/Examples/Detectors/TGeoDetector/CMakeLists.txt @@ -1,21 +1,27 @@ add_library( - ActsExamplesDetectorTGeo SHARED - src/TGeoDetector.cpp - src/TGeoITkModuleSplitter.cpp) + ActsExamplesDetectorTGeo + SHARED + src/TGeoDetector.cpp + src/TGeoITkModuleSplitter.cpp +) target_include_directories( - ActsExamplesDetectorTGeo - PUBLIC $) + ActsExamplesDetectorTGeo + PUBLIC $ +) target_link_libraries( - ActsExamplesDetectorTGeo - PUBLIC - ActsCore ActsPluginTGeo ActsPluginJson - ActsExamplesFramework ActsExamplesDetectorGeneric) + ActsExamplesDetectorTGeo + PUBLIC + ActsCore + ActsPluginTGeo + ActsPluginJson + ActsExamplesFramework + ActsExamplesDetectorGeneric +) install( - TARGETS ActsExamplesDetectorTGeo - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesDetectorTGeo + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) -install( - DIRECTORY include/ActsExamples - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(DIRECTORY include/ActsExamples DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Examples/Detectors/TelescopeDetector/CMakeLists.txt b/Examples/Detectors/TelescopeDetector/CMakeLists.txt index 08acae480b6..9b41a082c42 100644 --- a/Examples/Detectors/TelescopeDetector/CMakeLists.txt +++ b/Examples/Detectors/TelescopeDetector/CMakeLists.txt @@ -1,15 +1,20 @@ add_library( - ActsExamplesDetectorTelescope SHARED - src/TelescopeDetector.cpp - src/TelescopeDetectorElement.cpp - src/BuildTelescopeDetector.cpp) + ActsExamplesDetectorTelescope + SHARED + src/TelescopeDetector.cpp + src/TelescopeDetectorElement.cpp + src/BuildTelescopeDetector.cpp +) target_include_directories( - ActsExamplesDetectorTelescope - PUBLIC $) + ActsExamplesDetectorTelescope + PUBLIC $ +) target_link_libraries( - ActsExamplesDetectorTelescope - PUBLIC ActsCore ActsExamplesFramework) + ActsExamplesDetectorTelescope + PUBLIC ActsCore ActsExamplesFramework +) install( - TARGETS ActsExamplesDetectorTelescope - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesDetectorTelescope + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Framework/CMakeLists.txt b/Examples/Framework/CMakeLists.txt index 49fa92a53cb..bfe33f2e8e6 100644 --- a/Examples/Framework/CMakeLists.txt +++ b/Examples/Framework/CMakeLists.txt @@ -2,69 +2,78 @@ include(ActsTargetLinkLibrariesSystem) set(ActsExamplesFramework_SOURCES) - add_library( - ActsExamplesFramework SHARED - src/EventData/MeasurementCalibration.cpp - src/EventData/ScalingCalibrator.cpp - src/Framework/IAlgorithm.cpp - src/Framework/SequenceElement.cpp - src/Framework/WhiteBoard.cpp - src/Framework/RandomNumbers.cpp - src/Framework/Sequencer.cpp - src/Utilities/EventDataTransforms.cpp - src/Utilities/Paths.cpp - src/Utilities/Options.cpp - src/Utilities/Helpers.cpp - src/Validation/DuplicationPlotTool.cpp - src/Validation/EffPlotTool.cpp - src/Validation/FakeRatePlotTool.cpp - src/Validation/ResPlotTool.cpp - src/Validation/TrackClassification.cpp - src/Validation/TrackSummaryPlotTool.cpp - ) + ActsExamplesFramework + SHARED + src/EventData/MeasurementCalibration.cpp + src/EventData/ScalingCalibrator.cpp + src/Framework/IAlgorithm.cpp + src/Framework/SequenceElement.cpp + src/Framework/WhiteBoard.cpp + src/Framework/RandomNumbers.cpp + src/Framework/Sequencer.cpp + src/Utilities/EventDataTransforms.cpp + src/Utilities/Paths.cpp + src/Utilities/Options.cpp + src/Utilities/Helpers.cpp + src/Validation/DuplicationPlotTool.cpp + src/Validation/EffPlotTool.cpp + src/Validation/FakeRatePlotTool.cpp + src/Validation/ResPlotTool.cpp + src/Validation/TrackClassification.cpp + src/Validation/TrackSummaryPlotTool.cpp +) target_include_directories( - ActsExamplesFramework - PUBLIC $) + ActsExamplesFramework + PUBLIC $ +) target_link_libraries( - ActsExamplesFramework - PUBLIC ActsCore ActsFatras ActsPluginFpeMonitoring Boost::boost ROOT::Core ROOT::Hist - PRIVATE std::filesystem) + ActsExamplesFramework + PUBLIC + ActsCore + ActsFatras + ActsPluginFpeMonitoring + Boost::boost + ROOT::Core + ROOT::Hist + PRIVATE std::filesystem +) target_compile_definitions( - ActsExamplesFramework - PRIVATE BOOST_FILESYSTEM_NO_DEPRECATED) + ActsExamplesFramework + PRIVATE BOOST_FILESYSTEM_NO_DEPRECATED +) if(ACTS_USE_EXAMPLES_TBB) - # newer DD4hep version require TBB and search internally for TBB in - # config-only mode. to avoid mismatches we explicitly search using - # config-only mode first to be sure that we find the same version. - find_package(TBB ${_acts_tbb_version} CONFIG) - if(NOT TBB_FOUND) - # no version check possible when using the find module - find_package(TBB ${_acts_tbb_version} MODULE) - endif() + # newer DD4hep version require TBB and search internally for TBB in + # config-only mode. to avoid mismatches we explicitly search using + # config-only mode first to be sure that we find the same version. + find_package(TBB ${_acts_tbb_version} CONFIG) + if(NOT TBB_FOUND) + # no version check possible when using the find module + find_package(TBB ${_acts_tbb_version} MODULE) + endif() else() - set(TBB_FOUND FALSE) + set(TBB_FOUND FALSE) endif() if(TBB_FOUND) - target_link_libraries( - ActsExamplesFramework - PUBLIC TBB::tbb) + target_link_libraries(ActsExamplesFramework PUBLIC TBB::tbb) else() - message(STATUS "disable TBB for Examples/Framework - only single-threaded running will be supported") - target_compile_definitions( - ActsExamplesFramework - PUBLIC - -DACTS_EXAMPLES_NO_TBB) + message( + STATUS + "disable TBB for Examples/Framework - only single-threaded running will be supported" + ) + target_compile_definitions( + ActsExamplesFramework + PUBLIC -DACTS_EXAMPLES_NO_TBB + ) endif() install( - TARGETS ActsExamplesFramework - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesFramework + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) -install( - DIRECTORY include/ActsExamples - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(DIRECTORY include/ActsExamples DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) add_subdirectory_if(ML ACTS_BUILD_PLUGIN_ONNX) diff --git a/Examples/Framework/ML/CMakeLists.txt b/Examples/Framework/ML/CMakeLists.txt index bd574de9fa6..ab50cbb6f4a 100644 --- a/Examples/Framework/ML/CMakeLists.txt +++ b/Examples/Framework/ML/CMakeLists.txt @@ -1,21 +1,18 @@ -add_library( - ActsExamplesFrameworkML SHARED - src/NeuralCalibrator.cpp - ) +add_library(ActsExamplesFrameworkML SHARED src/NeuralCalibrator.cpp) target_include_directories( - ActsExamplesFrameworkML - PUBLIC $) + ActsExamplesFrameworkML + PUBLIC $ +) target_link_libraries( - ActsExamplesFrameworkML - PUBLIC ActsExamplesFramework ActsPluginOnnx - ) + ActsExamplesFrameworkML + PUBLIC ActsExamplesFramework ActsPluginOnnx +) install( - TARGETS ActsExamplesFrameworkML - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesFrameworkML + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) -install( - DIRECTORY include/ActsExamples - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(DIRECTORY include/ActsExamples DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Examples/Framework/include/ActsExamples/EventData/Index.hpp b/Examples/Framework/include/ActsExamples/EventData/Index.hpp index c1c88c9fb8e..74e7153b78f 100644 --- a/Examples/Framework/include/ActsExamples/EventData/Index.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/Index.hpp @@ -8,9 +8,11 @@ #pragma once +#include #include #include +#include namespace ActsExamples { @@ -53,8 +55,11 @@ inline boost::container::flat_multimap invertIndexMultimap( inverse.insert(i); } #else - inverse.insert(unordered.begin(), unordered.end()); + std::sort(unordered.begin(), unordered.end()); + inverse.insert(boost::container::ordered_range_t{}, unordered.begin(), + unordered.end()); #endif + return inverse; } diff --git a/Examples/Framework/include/ActsExamples/EventData/PropagationSummary.hpp b/Examples/Framework/include/ActsExamples/EventData/PropagationSummary.hpp new file mode 100644 index 00000000000..e628d757cf9 --- /dev/null +++ b/Examples/Framework/include/ActsExamples/EventData/PropagationSummary.hpp @@ -0,0 +1,53 @@ +// This file is part of the Acts project. +// +// Copyright (C) 2024 CERN for the benefit of the Acts project +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#pragma once + +#include "Acts/EventData/TrackParameters.hpp" +#include "Acts/Propagator/MaterialInteractor.hpp" +#include "Acts/Propagator/detail/SteppingLogger.hpp" + +#include + +namespace ActsExamples { + +struct PropagationSummary { + explicit PropagationSummary(Acts::BoundTrackParameters startParameters_) + : startParameters(std::move(startParameters_)) {} + + /// The start parameters + Acts::BoundTrackParameters startParameters; + + /// Totoal number of successful steps + std::size_t nSteps = 0; + + /// Totoal number of attempted steps + std::size_t nStepTrials = 0; + + /// Path length + double pathLength = 0; + + /// Steps + std::vector steps; +}; + +using PropagationSummaries = std::vector; + +/// Using some short hands for Recorded Material +using RecordedMaterial = Acts::MaterialInteractor::result_type; + +/// And recorded material track +/// - this is start: position, start momentum +/// and the Recorded material +using RecordedMaterialTrack = + std::pair, RecordedMaterial>; + +/// Finally the output of the propagation test +using PropagationOutput = std::pair; + +} // namespace ActsExamples diff --git a/Examples/Framework/src/EventData/ScalingCalibrator.cpp b/Examples/Framework/src/EventData/ScalingCalibrator.cpp index bac4f1d8cae..fd93c584c51 100644 --- a/Examples/Framework/src/EventData/ScalingCalibrator.cpp +++ b/Examples/Framework/src/EventData/ScalingCalibrator.cpp @@ -85,7 +85,7 @@ readMaps(const std::filesystem::path& path) { for (auto it = lst->begin(); it != lst->end(); ++it) { TKey* key = static_cast(*it); - if (std::strcmp(key->GetClassName(), "TH2D") == 0) { + if (key != nullptr && std::strcmp(key->GetClassName(), "TH2D") == 0) { auto [geoId, var] = parseMapKey(key->GetName()); TH2D hist; diff --git a/Examples/HelloWorld/CMakeLists.txt b/Examples/HelloWorld/CMakeLists.txt index ab8a087463c..738ded22a99 100644 --- a/Examples/HelloWorld/CMakeLists.txt +++ b/Examples/HelloWorld/CMakeLists.txt @@ -1,15 +1,16 @@ add_executable( - ActsExampleHelloWorld - HelloWorld.cpp - HelloLoggerAlgorithm.cpp - HelloRandomAlgorithm.cpp - HelloWhiteBoardAlgorithm.cpp) + ActsExampleHelloWorld + HelloWorld.cpp + HelloLoggerAlgorithm.cpp + HelloRandomAlgorithm.cpp + HelloWhiteBoardAlgorithm.cpp +) target_link_libraries( - ActsExampleHelloWorld - PRIVATE - ActsCore - ActsExamplesFramework) + ActsExampleHelloWorld + PRIVATE ActsCore ActsExamplesFramework +) install( - TARGETS ActsExampleHelloWorld - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + TARGETS ActsExampleHelloWorld + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/Examples/Io/Csv/CMakeLists.txt b/Examples/Io/Csv/CMakeLists.txt index 3cb9919f405..e252bd95fe7 100644 --- a/Examples/Io/Csv/CMakeLists.txt +++ b/Examples/Io/Csv/CMakeLists.txt @@ -1,36 +1,39 @@ include(ActsTargetLinkLibrariesSystem) add_library( - ActsExamplesIoCsv SHARED - src/CsvMeasurementReader.cpp - src/CsvMeasurementWriter.cpp - src/CsvParticleReader.cpp - src/CsvParticleWriter.cpp - src/CsvSimHitReader.cpp - src/CsvSimHitWriter.cpp - src/CsvSpacePointReader.cpp - src/CsvTrackingGeometryWriter.cpp - src/CsvTrackParameterReader.cpp - src/CsvTrackParameterWriter.cpp - src/CsvSeedWriter.cpp - src/CsvTrackWriter.cpp - src/CsvDriftCircleReader.cpp - src/CsvMuonSimHitReader.cpp - src/CsvProtoTrackWriter.cpp - src/CsvSpacePointWriter.cpp - src/CsvExaTrkXGraphWriter.cpp - src/CsvExaTrkXGraphReader.cpp - src/CsvBFieldWriter.cpp) + ActsExamplesIoCsv + SHARED + src/CsvMeasurementReader.cpp + src/CsvMeasurementWriter.cpp + src/CsvParticleReader.cpp + src/CsvParticleWriter.cpp + src/CsvSimHitReader.cpp + src/CsvSimHitWriter.cpp + src/CsvSpacePointReader.cpp + src/CsvTrackingGeometryWriter.cpp + src/CsvTrackParameterReader.cpp + src/CsvTrackParameterWriter.cpp + src/CsvSeedWriter.cpp + src/CsvTrackWriter.cpp + src/CsvDriftCircleReader.cpp + src/CsvMuonSimHitReader.cpp + src/CsvProtoTrackWriter.cpp + src/CsvSpacePointWriter.cpp + src/CsvExaTrkXGraphWriter.cpp + src/CsvExaTrkXGraphReader.cpp + src/CsvBFieldWriter.cpp +) target_include_directories( - ActsExamplesIoCsv - PUBLIC $) + ActsExamplesIoCsv + PUBLIC $ +) target_link_libraries( - ActsExamplesIoCsv - PRIVATE - ActsCore - ActsExamplesFramework ActsExamplesDigitization - Threads::Threads) + ActsExamplesIoCsv + PRIVATE + ActsCore + ActsExamplesFramework + ActsExamplesDigitization + Threads::Threads +) -install( - TARGETS ActsExamplesIoCsv - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS ActsExamplesIoCsv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/Examples/Io/EDM4hep/CMakeLists.txt b/Examples/Io/EDM4hep/CMakeLists.txt index 9f7ddf37057..2d48bae21bd 100644 --- a/Examples/Io/EDM4hep/CMakeLists.txt +++ b/Examples/Io/EDM4hep/CMakeLists.txt @@ -1,29 +1,34 @@ add_library( - ActsExamplesIoEDM4hep SHARED - src/EDM4hepMeasurementReader.cpp - src/EDM4hepMeasurementWriter.cpp - src/EDM4hepMultiTrajectoryWriter.cpp - src/EDM4hepReader.cpp - src/EDM4hepTrackWriter.cpp - src/EDM4hepTrackReader.cpp - src/EDM4hepParticleWriter.cpp - src/EDM4hepSimHitWriter.cpp - src/EDM4hepUtil.cpp) + ActsExamplesIoEDM4hep + SHARED + src/EDM4hepMeasurementReader.cpp + src/EDM4hepMeasurementWriter.cpp + src/EDM4hepMultiTrajectoryWriter.cpp + src/EDM4hepReader.cpp + src/EDM4hepTrackWriter.cpp + src/EDM4hepTrackReader.cpp + src/EDM4hepParticleWriter.cpp + src/EDM4hepSimHitWriter.cpp + src/EDM4hepUtil.cpp +) target_include_directories( - ActsExamplesIoEDM4hep - PUBLIC $) + ActsExamplesIoEDM4hep + PUBLIC $ +) target_link_libraries( - ActsExamplesIoEDM4hep - PUBLIC - EDM4HEP::edm4hep - ActsPluginEDM4hep - podio::podioRootIO - ActsCore - ActsFatras - ActsExamplesFramework - ActsExamplesDigitization - ActsExamplesDetectorDD4hep) + ActsExamplesIoEDM4hep + PUBLIC + EDM4HEP::edm4hep + ActsPluginEDM4hep + podio::podioRootIO + ActsCore + ActsFatras + ActsExamplesFramework + ActsExamplesDigitization + ActsExamplesDetectorDD4hep +) install( - TARGETS ActsExamplesIoEDM4hep - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesIoEDM4hep + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Io/EDM4hep/src/EDM4hepReader.cpp b/Examples/Io/EDM4hep/src/EDM4hepReader.cpp index 34cbf1e345a..7e61ba2a561 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepReader.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepReader.cpp @@ -250,8 +250,13 @@ ProcessCode EDM4hepReader::read(const AlgorithmContext& ctx) { SimParticleContainer particlesFinal; SimParticleContainer particlesGenerator; for (const auto& inParticle : mcParticleCollection) { - const std::size_t index = - edm4hepParticleMap.find(inParticle.getObjectID().index)->second; + auto particleIt = edm4hepParticleMap.find(inParticle.getObjectID().index); + if (particleIt == edm4hepParticleMap.end()) { + ACTS_ERROR("Particle " << inParticle.getObjectID().index + << " not found in particle map"); + continue; + } + const std::size_t index = particleIt->second; const auto& particleInitial = unordered.at(index); if (!inParticle.isCreatedInSimulation()) { particlesGenerator.insert(particleInitial); @@ -348,8 +353,14 @@ ProcessCode EDM4hepReader::read(const AlgorithmContext& ctx) { if (it == m_surfaceMap.end()) { ACTS_ERROR("Unable to find surface for detElement " << detElement.name() << " with cellId " << cellId); + throw std::runtime_error("Unable to find surface for detElement"); } const auto* surface = it->second; + if (surface == nullptr) { + ACTS_ERROR("Unable to find surface for detElement " + << detElement.name() << " with cellId " << cellId); + throw std::runtime_error("Unable to find surface for detElement"); + } ACTS_VERBOSE(" -> surface: " << surface->geometryId()); return surface->geometryId(); }); diff --git a/Examples/Io/HepMC3/CMakeLists.txt b/Examples/Io/HepMC3/CMakeLists.txt index 4eb850a326b..44d0f9d96ae 100644 --- a/Examples/Io/HepMC3/CMakeLists.txt +++ b/Examples/Io/HepMC3/CMakeLists.txt @@ -1,21 +1,28 @@ add_library( - ActsExamplesIoHepMC3 SHARED - src/HepMC3Event.cpp - src/HepMC3Particle.cpp - src/HepMC3Reader.cpp - src/HepMC3Vertex.cpp - src/HepMC3Writer.cpp) + ActsExamplesIoHepMC3 + SHARED + src/HepMC3Event.cpp + src/HepMC3Particle.cpp + src/HepMC3Reader.cpp + src/HepMC3Vertex.cpp + src/HepMC3Writer.cpp +) target_include_directories( - ActsExamplesIoHepMC3 - SYSTEM PUBLIC ${HEPMC3_INCLUDE_DIR}) + ActsExamplesIoHepMC3 + SYSTEM + PUBLIC ${HEPMC3_INCLUDE_DIR} +) target_include_directories( - ActsExamplesIoHepMC3 - PUBLIC $) + ActsExamplesIoHepMC3 + PUBLIC $ +) target_link_libraries( - ActsExamplesIoHepMC3 - PUBLIC ActsCore ActsExamplesFramework ${HEPMC3_LIBRARIES} - PRIVATE ActsFatras) + ActsExamplesIoHepMC3 + PUBLIC ActsCore ActsExamplesFramework ${HEPMC3_LIBRARIES} + PRIVATE ActsFatras +) install( - TARGETS ActsExamplesIoHepMC3 - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesIoHepMC3 + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Io/Json/CMakeLists.txt b/Examples/Io/Json/CMakeLists.txt index aaedc77ce54..255d862881f 100644 --- a/Examples/Io/Json/CMakeLists.txt +++ b/Examples/Io/Json/CMakeLists.txt @@ -1,17 +1,24 @@ add_library( - ActsExamplesIoJson SHARED - src/JsonGeometryList.cpp - src/JsonMaterialWriter.cpp - src/JsonSurfacesWriter.cpp - src/JsonSurfacesReader.cpp - src/JsonDigitizationConfig.cpp) + ActsExamplesIoJson + SHARED + src/JsonGeometryList.cpp + src/JsonMaterialWriter.cpp + src/JsonSurfacesWriter.cpp + src/JsonSurfacesReader.cpp + src/JsonDigitizationConfig.cpp +) target_include_directories( - ActsExamplesIoJson - PUBLIC $) + ActsExamplesIoJson + PUBLIC $ +) target_link_libraries( - ActsExamplesIoJson - PUBLIC ActsCore ActsPluginJson ActsExamplesDigitization ActsExamplesFramework ActsExamplesMaterialMapping) + ActsExamplesIoJson + PUBLIC + ActsCore + ActsPluginJson + ActsExamplesDigitization + ActsExamplesFramework + ActsExamplesMaterialMapping +) -install( - TARGETS ActsExamplesIoJson - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS ActsExamplesIoJson LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/Examples/Io/NuclearInteractions/CMakeLists.txt b/Examples/Io/NuclearInteractions/CMakeLists.txt index 8de6d3ff77c..3f7ad2b9b9b 100644 --- a/Examples/Io/NuclearInteractions/CMakeLists.txt +++ b/Examples/Io/NuclearInteractions/CMakeLists.txt @@ -1,18 +1,20 @@ add_library( - ActsExamplesIoNuclearInteractions SHARED - src/RootNuclearInteractionParametersWriter.cpp - src/detail/NuclearInteractionParametrisation.cpp + ActsExamplesIoNuclearInteractions + SHARED + src/RootNuclearInteractionParametersWriter.cpp + src/detail/NuclearInteractionParametrisation.cpp ) target_include_directories( - ActsExamplesIoNuclearInteractions - PUBLIC $) + ActsExamplesIoNuclearInteractions + PUBLIC $ +) target_link_libraries( - ActsExamplesIoNuclearInteractions - PUBLIC - ActsCore ActsExamplesFramework - Threads::Threads - PRIVATE ROOT::Core ROOT::Hist ROOT::Tree) + ActsExamplesIoNuclearInteractions + PUBLIC ActsCore ActsExamplesFramework Threads::Threads + PRIVATE ROOT::Core ROOT::Hist ROOT::Tree +) install( - TARGETS ActsExamplesIoNuclearInteractions - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesIoNuclearInteractions + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Io/Obj/CMakeLists.txt b/Examples/Io/Obj/CMakeLists.txt index e8fc75a6d80..9ca888f726a 100644 --- a/Examples/Io/Obj/CMakeLists.txt +++ b/Examples/Io/Obj/CMakeLists.txt @@ -1,13 +1,17 @@ add_library( - ActsExamplesIoObj SHARED - src/ObjTrackingGeometryWriter.cpp) + ActsExamplesIoObj + SHARED + src/ObjTrackingGeometryWriter.cpp + src/ObjPropagationStepsWriter.cpp +) + target_include_directories( - ActsExamplesIoObj - PUBLIC $) + ActsExamplesIoObj + PUBLIC $ +) target_link_libraries( - ActsExamplesIoObj - PUBLIC ActsCore ActsExamplesFramework Threads::Threads) + ActsExamplesIoObj + PUBLIC ActsCore ActsExamplesFramework Threads::Threads +) -install( - TARGETS ActsExamplesIoObj - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS ActsExamplesIoObj LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/Examples/Io/Obj/include/ActsExamples/Plugins/Obj/ObjPropagationStepsWriter.hpp b/Examples/Io/Obj/include/ActsExamples/Plugins/Obj/ObjPropagationStepsWriter.hpp index 0b236eade55..8741c21fe93 100644 --- a/Examples/Io/Obj/include/ActsExamples/Plugins/Obj/ObjPropagationStepsWriter.hpp +++ b/Examples/Io/Obj/include/ActsExamples/Plugins/Obj/ObjPropagationStepsWriter.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2017 CERN for the benefit of the Acts project +// Copyright (C) 2017-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -9,6 +9,7 @@ #pragma once #include "Acts/Propagator/detail/SteppingLogger.hpp" +#include "ActsExamples/EventData/PropagationSummary.hpp" #include "ActsExamples/Framework/WriterT.hpp" #include "ActsExamples/Utilities/Paths.hpp" @@ -25,15 +26,17 @@ namespace ActsExamples { /// event000000002-propagation-steps.obj /// /// One Thread per write call and hence thread safe -template -class ObjPropagationStepsWriter - : public WriterT>> { +class ObjPropagationStepsWriter : public WriterT { public: struct Config { - std::string collection; ///< which collection to write - std::string outputDir; ///< where to place output files - double outputScalor = 1.0; ///< scale output values - std::size_t outputPrecision = 6; ///< floating point precision + /// which collection to write + std::string collection; + /// where to place output files + std::string outputDir; + /// scale output values + double outputScalor = 1.0; + /// floating point precision + std::size_t outputPrecision = 6; }; /// Constructor with arguments @@ -41,14 +44,7 @@ class ObjPropagationStepsWriter /// @param cfg configuration struct /// @param level Output logging level ObjPropagationStepsWriter(const Config& cfg, - Acts::Logging::Level level = Acts::Logging::INFO) - : WriterT>>( - cfg.collection, "ObjPropagationStepsWriter", level), - m_cfg(cfg) { - if (m_cfg.collection.empty()) { - throw std::invalid_argument("Missing input collection"); - } - } + Acts::Logging::Level level = Acts::Logging::INFO); /// Virtual destructor ~ObjPropagationStepsWriter() override = default; @@ -60,45 +56,14 @@ class ObjPropagationStepsWriter const Config& config() const { return m_cfg; } private: - Config m_cfg; ///!< Internal configuration representation + /// Internal configuration representation + Config m_cfg; protected: /// This implementation holds the actual writing method /// and is called by the WriterT<>::write interface - ProcessCode writeT( - const AlgorithmContext& context, - const std::vector>& stepCollection) override { - // open per-event file - std::string path = ActsExamples::perEventFilepath( - m_cfg.outputDir, "propagation-steps.obj", context.eventNumber); - std::ofstream os(path, std::ofstream::out | std::ofstream::trunc); - if (!os) { - throw std::ios_base::failure("Could not open '" + path + "' to write"); - } - - // Initialize the vertex counter - unsigned int vCounter = 0; - - for (auto& steps : stepCollection) { - // At least three points to draw - if (steps.size() > 2) { - // We start from one - ++vCounter; - for (auto& step : steps) { - // Write the space point - os << "v " << m_cfg.outputScalor * step.position.x() << " " - << m_cfg.outputScalor * step.position.y() << " " - << m_cfg.outputScalor * step.position.z() << '\n'; - } - // Write out the line - only if we have at least two points created - std::size_t vBreak = vCounter + steps.size() - 1; - for (; vCounter < vBreak; ++vCounter) { - os << "l " << vCounter << " " << vCounter + 1 << '\n'; - } - } - } - return ActsExamples::ProcessCode::SUCCESS; - } + ProcessCode writeT(const AlgorithmContext& context, + const PropagationSummaries& summaries) final; }; } // namespace ActsExamples diff --git a/Examples/Io/Obj/src/ObjPropagationStepsWriter.cpp b/Examples/Io/Obj/src/ObjPropagationStepsWriter.cpp new file mode 100644 index 00000000000..50007b1070b --- /dev/null +++ b/Examples/Io/Obj/src/ObjPropagationStepsWriter.cpp @@ -0,0 +1,60 @@ +// This file is part of the Acts project. +// +// Copyright (C) 2024 CERN for the benefit of the Acts project +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "ActsExamples/Plugins/Obj/ObjPropagationStepsWriter.hpp" + +namespace ActsExamples { + +ObjPropagationStepsWriter::ObjPropagationStepsWriter(const Config& cfg, + Acts::Logging::Level level) + : WriterT(cfg.collection, "ObjPropagationStepsWriter", + level), + m_cfg(cfg) { + if (m_cfg.collection.empty()) { + throw std::invalid_argument("Missing input collection"); + } +} + +/// This implementation holds the actual writing method +/// and is called by the WriterT<>::write interface +ProcessCode ObjPropagationStepsWriter::writeT( + const AlgorithmContext& context, const PropagationSummaries& summaries) { + // open per-event file + std::string path = ActsExamples::perEventFilepath( + m_cfg.outputDir, "propagation-steps.obj", context.eventNumber); + std::ofstream os(path, std::ofstream::out | std::ofstream::trunc); + if (!os) { + throw std::ios_base::failure("Could not open '" + path + "' to write"); + } + + // Initialize the vertex counter + unsigned int vCounter = 0; + + for (const auto& summary : summaries) { + const auto& steps = summary.steps; + // At least three points to draw + if (steps.size() > 2) { + // We start from one + ++vCounter; + for (auto& step : steps) { + // Write the space point + os << "v " << m_cfg.outputScalor * step.position.x() << " " + << m_cfg.outputScalor * step.position.y() << " " + << m_cfg.outputScalor * step.position.z() << '\n'; + } + // Write out the line - only if we have at least two points created + std::size_t vBreak = vCounter + steps.size() - 1; + for (; vCounter < vBreak; ++vCounter) { + os << "l " << vCounter << " " << vCounter + 1 << '\n'; + } + } + } + return ActsExamples::ProcessCode::SUCCESS; +} + +} // namespace ActsExamples diff --git a/Examples/Io/Performance/ActsExamples/Io/Performance/CKFPerformanceWriter.cpp b/Examples/Io/Performance/ActsExamples/Io/Performance/CKFPerformanceWriter.cpp index 107a331f2e6..3caad01b002 100644 --- a/Examples/Io/Performance/ActsExamples/Io/Performance/CKFPerformanceWriter.cpp +++ b/Examples/Io/Performance/ActsExamples/Io/Performance/CKFPerformanceWriter.cpp @@ -150,7 +150,6 @@ ProcessCode CKFPerformanceWriter::finalize() { ProcessCode CKFPerformanceWriter::writeT(const AlgorithmContext& ctx, const ConstTrackContainer& tracks) { // The number of majority particle hits and fitted track parameters - using RecoTrackInfo = std::pair; using Acts::VectorHelpers::perp; // Read truth input collections diff --git a/Examples/Io/Performance/CMakeLists.txt b/Examples/Io/Performance/CMakeLists.txt index 7f9f6d130b7..b41bf76ea07 100644 --- a/Examples/Io/Performance/CMakeLists.txt +++ b/Examples/Io/Performance/CMakeLists.txt @@ -1,19 +1,23 @@ add_library( - ActsExamplesIoPerformance SHARED - ActsExamples/Io/Performance/CKFPerformanceWriter.cpp - ActsExamples/Io/Performance/SeedingPerformanceWriter.cpp - ActsExamples/Io/Performance/TrackFinderPerformanceWriter.cpp - ActsExamples/Io/Performance/TrackFitterPerformanceWriter.cpp - ActsExamples/Io/Performance/VertexPerformanceWriter.cpp + ActsExamplesIoPerformance + SHARED + ActsExamples/Io/Performance/CKFPerformanceWriter.cpp + ActsExamples/Io/Performance/SeedingPerformanceWriter.cpp + ActsExamples/Io/Performance/TrackFinderPerformanceWriter.cpp + ActsExamples/Io/Performance/TrackFitterPerformanceWriter.cpp + ActsExamples/Io/Performance/VertexPerformanceWriter.cpp ) target_include_directories( - ActsExamplesIoPerformance - PUBLIC $) + ActsExamplesIoPerformance + PUBLIC $ +) target_link_libraries( - ActsExamplesIoPerformance - PUBLIC ActsExamplesFramework - PRIVATE ActsCore ROOT::Core ROOT::Tree) + ActsExamplesIoPerformance + PUBLIC ActsExamplesFramework + PRIVATE ActsCore ROOT::Core ROOT::Tree +) install( - TARGETS ActsExamplesIoPerformance - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsExamplesIoPerformance + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/Examples/Io/Root/CMakeLists.txt b/Examples/Io/Root/CMakeLists.txt index f43087361fd..3ac12286395 100644 --- a/Examples/Io/Root/CMakeLists.txt +++ b/Examples/Io/Root/CMakeLists.txt @@ -1,45 +1,50 @@ add_library( - ActsExamplesIoRoot SHARED - src/RootMeasurementWriter.cpp - src/RootMaterialDecorator.cpp - src/RootMaterialWriter.cpp - src/RootMaterialTrackReader.cpp - src/RootMaterialTrackWriter.cpp - src/RootParticleWriter.cpp - src/RootParticleReader.cpp - src/RootPropagationStepsWriter.cpp - src/RootSeedWriter.cpp - src/RootSimHitWriter.cpp - src/RootSimHitReader.cpp - src/RootSpacepointWriter.cpp - src/RootTrackParameterWriter.cpp - src/RootTrackStatesWriter.cpp - src/RootTrackSummaryReader.cpp - src/RootTrackSummaryWriter.cpp - src/RootBFieldWriter.cpp - src/RootAthenaNTupleReader.cpp - src/RootVertexReader.cpp - src/RootVertexWriter.cpp - src/RootAthenaDumpReader.cpp + ActsExamplesIoRoot + SHARED + src/RootMeasurementWriter.cpp + src/RootMaterialDecorator.cpp + src/RootMaterialWriter.cpp + src/RootMaterialTrackReader.cpp + src/RootMaterialTrackWriter.cpp + src/RootParticleWriter.cpp + src/RootParticleReader.cpp + src/RootPropagationStepsWriter.cpp + src/RootPropagationSummaryWriter.cpp + src/RootSeedWriter.cpp + src/RootSimHitWriter.cpp + src/RootSimHitReader.cpp + src/RootSpacepointWriter.cpp + src/RootTrackParameterWriter.cpp + src/RootTrackStatesWriter.cpp + src/RootTrackSummaryReader.cpp + src/RootTrackSummaryWriter.cpp + src/RootBFieldWriter.cpp + src/RootAthenaNTupleReader.cpp + src/RootVertexReader.cpp + src/RootVertexWriter.cpp + src/RootAthenaDumpReader.cpp ) target_include_directories( - ActsExamplesIoRoot - PUBLIC $) + ActsExamplesIoRoot + PUBLIC $ +) target_link_libraries( - ActsExamplesIoRoot - PUBLIC - ActsCore ActsExamplesDigitization - ActsExamplesFramework ActsExamplesPropagation - ActsExamplesTruthTracking ActsExamplesMaterialMapping - Threads::Threads - PRIVATE - ROOT::Core ROOT::Hist ROOT::Tree) + ActsExamplesIoRoot + PUBLIC + ActsCore + ActsExamplesDigitization + ActsExamplesFramework + ActsExamplesPropagation + ActsExamplesTruthTracking + ActsExamplesMaterialMapping + Threads::Threads + PRIVATE ROOT::Core ROOT::Hist ROOT::Tree +) -ROOT_GENERATE_DICTIONARY( - ActsExamplesIoRootDict MODULE ActsExamplesIoRoot LINKDEF LinkDef.hpp) -set_target_properties( - ActsExamplesIoRootDict PROPERTIES CXX_CLANG_TIDY "") +root_generate_dictionary( + ActsExamplesIoRootDict MODULE ActsExamplesIoRoot LINKDEF LinkDef.hpp +) +set_target_properties(ActsExamplesIoRootDict PROPERTIES CXX_CLANG_TIDY "") +target_compile_options(ActsExamplesIoRootDict PRIVATE "-Wno-old-style-cast") -install( - TARGETS ActsExamplesIoRoot - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS ActsExamplesIoRoot LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/RootPropagationStepsWriter.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/RootPropagationStepsWriter.hpp index 75aa7e616a2..6f1026806ab 100644 --- a/Examples/Io/Root/include/ActsExamples/Io/Root/RootPropagationStepsWriter.hpp +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/RootPropagationStepsWriter.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2018-2022 CERN for the benefit of the Acts project +// Copyright (C) 2018-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -10,6 +10,7 @@ #include "Acts/Propagator/detail/SteppingLogger.hpp" #include "Acts/Utilities/Logger.hpp" +#include "ActsExamples/EventData/PropagationSummary.hpp" #include "ActsExamples/Framework/ProcessCode.hpp" #include "ActsExamples/Framework/WriterT.hpp" @@ -24,8 +25,6 @@ class TTree; namespace ActsExamples { struct AlgorithmContext; -using PropagationSteps = std::vector; - /// @class RootPropagationStepsWriter /// /// Write out the steps of test propgations for stepping validation, @@ -37,16 +36,19 @@ using PropagationSteps = std::vector; /// this is done by setting the Config::rootFile pointer to an existing file /// /// Safe to use from multiple writer threads - uses a std::mutex lock. -class RootPropagationStepsWriter - : public WriterT> { +class RootPropagationStepsWriter : public WriterT { public: struct Config { - std::string collection = - "propagation_steps"; ///< particle collection to write - std::string filePath = ""; ///< path of the output file - std::string fileMode = "RECREATE"; ///< file access mode - std::string treeName = "propagation_steps"; ///< name of the output tree - TFile* rootFile = nullptr; ///< common root file + /// particle collection to write + std::string collection = "propagation_steps"; + /// path of the output file + std::string filePath = ""; + /// file access mode + std::string fileMode = "RECREATE"; + /// name of the output tree + std::string treeName = "propagation_steps"; + /// common root file + TFile* rootFile = nullptr; }; /// Constructor with @@ -69,37 +71,80 @@ class RootPropagationStepsWriter /// and is called by the WriterT<>::write interface /// /// @param context The Algorithm context with per event information - /// @param stepCollection is the data to be written out - ProcessCode writeT( - const AlgorithmContext& context, - const std::vector& stepCollection) override; + /// @param summaries is the data to be written out + ProcessCode writeT(const AlgorithmContext& context, + const PropagationSummaries& summaries) override; private: - Config m_cfg; ///< the configuration object - std::mutex m_writeMutex; ///< protect multi-threaded writes - TFile* m_outputFile = nullptr; ///< the output file name - TTree* m_outputTree = nullptr; ///< the output tree - int m_eventNr = 0; ///< the event number of - std::vector m_volumeID; ///< volume identifier - std::vector m_boundaryID; ///< boundary identifier - std::vector m_layerID; ///< layer identifier if - std::vector m_approachID; ///< surface identifier - std::vector m_sensitiveID; ///< surface identifier - std::vector m_material; ///< flag material if present - std::vector m_x; ///< global x - std::vector m_y; ///< global y - std::vector m_z; ///< global z - std::vector m_dx; ///< global direction x - std::vector m_dy; ///< global direction y - std::vector m_dz; ///< global direction z - std::vector m_step_type; ///< step type - std::vector m_step_acc; ///< accuracy - std::vector m_step_act; ///< actor check - std::vector m_step_abt; ///< aborter - std::vector m_step_usr; ///< user - std::vector - m_nStepTrials; ///< Number of iterations needed by the stepsize - /// finder (e.g. Runge-Kutta) of the stepper. + /// the configuration object + Config m_cfg; + + /// protect multi-threaded writes + std::mutex m_writeMutex; + /// the output file name + TFile* m_outputFile = nullptr; + /// the output tree + TTree* m_outputTree = nullptr; + + /// event number + int m_eventNr = 0; + /// track number + int m_trackNr = 0; + + // initial trajectory parameters + float m_d0 = 0; + float m_z0 = 0; + float m_phi = 0; + float m_theta = 0; + float m_qOverP = 0; + float m_t = 0; + + // derived initial trajectory parameters + float m_eta = 0; + float m_pt = 0; + float m_p = 0; + + /// volume identifier + std::vector m_volumeID; + /// boundary identifier + std::vector m_boundaryID; + /// layer identifier if + std::vector m_layerID; + /// surface identifier + std::vector m_approachID; + /// surface identifier + std::vector m_sensitiveID; + /// surface identifier + std::vector m_extraID; + /// flag material if present + std::vector m_material; + /// global x + std::vector m_x; + /// global y + std::vector m_y; + /// global z + std::vector m_z; + /// global r + std::vector m_r; + /// global direction x + std::vector m_dx; + /// global direction y + std::vector m_dy; + /// global direction z + std::vector m_dz; + /// step type + std::vector m_step_type; + /// accuracy + std::vector m_step_acc; + /// actor check + std::vector m_step_act; + /// aborter + std::vector m_step_abt; + /// user + std::vector m_step_usr; + /// Number of iterations needed by the stepsize finder (e.g. Runge-Kutta) of + /// the stepper. + std::vector m_nStepTrials; }; } // namespace ActsExamples diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/RootPropagationSummaryWriter.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/RootPropagationSummaryWriter.hpp new file mode 100644 index 00000000000..b55db747128 --- /dev/null +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/RootPropagationSummaryWriter.hpp @@ -0,0 +1,114 @@ +// This file is part of the Acts project. +// +// Copyright (C) 2024 CERN for the benefit of the Acts project +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#pragma once + +#include "Acts/Propagator/detail/SteppingLogger.hpp" +#include "Acts/Utilities/Logger.hpp" +#include "ActsExamples/Framework/ProcessCode.hpp" +#include "ActsExamples/Framework/WriterT.hpp" +#include "ActsExamples/Propagation/PropagationAlgorithm.hpp" + +#include +#include +#include +#include + +class TFile; +class TTree; + +namespace ActsExamples { +struct AlgorithmContext; + +/// @class RootPropagationSummaryWriter +/// +/// Write out the steps of test propgations for stepping validation, +/// each step sequence is one entry in the root file for optimised +/// data writing speed. +/// The event number is part of the written data. +/// +/// A common file can be provided for the writer to attach his TTree, +/// this is done by setting the Config::rootFile pointer to an existing file +/// +/// Safe to use from multiple writer threads - uses a std::mutex lock. +class RootPropagationSummaryWriter : public WriterT { + public: + struct Config { + /// particle collection to write + std::string inputSummaryCollection = "propagation_summary"; + + /// path of the output file + std::string filePath = ""; + /// file access mode + std::string fileMode = "RECREATE"; + /// name of the output tree + std::string treeName = "propagation_summary"; + /// common root file + TFile* rootFile = nullptr; + }; + + /// Constructor with + /// @param cfg configuration struct + /// @param output logging level + RootPropagationSummaryWriter( + const Config& cfg, Acts::Logging::Level level = Acts::Logging::INFO); + + /// Virtual destructor + ~RootPropagationSummaryWriter() override; + + /// End-of-run hook + ProcessCode finalize() override; + + /// Get readonly access to the config parameters + const Config& config() const { return m_cfg; } + + protected: + /// This implementation holds the actual writing method + /// and is called by the WriterT<>::write interface + /// + /// @param context The Algorithm context with per event information + /// @param summaries is the data to be written out + ProcessCode writeT(const AlgorithmContext& context, + const PropagationSummaries& summaries) override; + + private: + /// the configuration object + Config m_cfg; + + /// protect multi-threaded writes + std::mutex m_writeMutex; + /// the output file name + TFile* m_outputFile = nullptr; + /// the output tree + TTree* m_outputTree = nullptr; + + /// event number + int m_eventNr = 0; + /// track number + int m_trackNr = 0; + + // initial trajectory parameters + float m_d0 = 0; + float m_z0 = 0; + float m_phi = 0; + float m_theta = 0; + float m_qOverP = 0; + float m_t = 0; + + // derived initial trajectory parameters + float m_eta = 0; + float m_pt = 0; + float m_p = 0; + + // steper statistics + int m_nSteps = 0; + int m_nStepTrials = 0; + int m_pathLength = 0; +}; + +} // namespace ActsExamples diff --git a/Examples/Io/Root/src/RootPropagationStepsWriter.cpp b/Examples/Io/Root/src/RootPropagationStepsWriter.cpp index 201fcdae032..5f157d519d6 100644 --- a/Examples/Io/Root/src/RootPropagationStepsWriter.cpp +++ b/Examples/Io/Root/src/RootPropagationStepsWriter.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2017-2022 CERN for the benefit of the Acts project +// Copyright (C) 2017-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -10,6 +10,8 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Utilities/Helpers.hpp" +#include "Acts/Utilities/VectorHelpers.hpp" +#include "ActsExamples/EventData/PropagationSummary.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" #include #include @@ -55,15 +57,27 @@ ActsExamples::RootPropagationStepsWriter::RootPropagationStepsWriter( // Set the branches m_outputTree->Branch("event_nr", &m_eventNr); + m_outputTree->Branch("track_nr", &m_trackNr); + m_outputTree->Branch("d0", &m_d0); + m_outputTree->Branch("z0", &m_z0); + m_outputTree->Branch("phi", &m_phi); + m_outputTree->Branch("theta", &m_theta); + m_outputTree->Branch("qOverP", &m_qOverP); + m_outputTree->Branch("t", &m_t); + m_outputTree->Branch("eta", &m_eta); + m_outputTree->Branch("pt", &m_pt); + m_outputTree->Branch("p", &m_p); m_outputTree->Branch("volume_id", &m_volumeID); m_outputTree->Branch("boundary_id", &m_boundaryID); m_outputTree->Branch("layer_id", &m_layerID); m_outputTree->Branch("approach_id", &m_approachID); m_outputTree->Branch("sensitive_id", &m_sensitiveID); + m_outputTree->Branch("extra_id", &m_extraID); m_outputTree->Branch("material", &m_material); m_outputTree->Branch("g_x", &m_x); m_outputTree->Branch("g_y", &m_y); m_outputTree->Branch("g_z", &m_z); + m_outputTree->Branch("g_r", &m_r); m_outputTree->Branch("d_x", &m_dx); m_outputTree->Branch("d_y", &m_dy); m_outputTree->Branch("d_z", &m_dz); @@ -97,8 +111,7 @@ ActsExamples::ProcessCode ActsExamples::RootPropagationStepsWriter::finalize() { } ActsExamples::ProcessCode ActsExamples::RootPropagationStepsWriter::writeT( - const AlgorithmContext& context, - const std::vector& stepCollection) { + const AlgorithmContext& context, const PropagationSummaries& summaries) { // Exclusive access to the tree while writing std::lock_guard lock(m_writeMutex); @@ -110,13 +123,14 @@ ActsExamples::ProcessCode ActsExamples::RootPropagationStepsWriter::writeT( std::size_t lastTotalTrials = 0; // Loop over the step vector of each test propagation in this - for (auto& steps : stepCollection) { + for (const auto& [trackNr, summary] : Acts::enumerate(summaries)) { // Clear the vectors for each collection m_volumeID.clear(); m_boundaryID.clear(); m_layerID.clear(); m_approachID.clear(); m_sensitiveID.clear(); + m_extraID.clear(); m_material.clear(); m_x.clear(); m_y.clear(); @@ -131,20 +145,40 @@ ActsExamples::ProcessCode ActsExamples::RootPropagationStepsWriter::writeT( m_step_usr.clear(); m_nStepTrials.clear(); + // Set the track number + m_trackNr = static_cast(trackNr); + + // Set the initial trajectory parameters + const auto& startParameters = summary.startParameters; + m_d0 = static_cast(startParameters.parameters()[Acts::eBoundLoc0]); + m_z0 = static_cast(startParameters.parameters()[Acts::eBoundLoc1]); + m_phi = static_cast(startParameters.parameters()[Acts::eBoundPhi]); + m_theta = + static_cast(startParameters.parameters()[Acts::eBoundTheta]); + m_qOverP = + static_cast(startParameters.parameters()[Acts::eBoundQOverP]); + m_t = static_cast(startParameters.parameters()[Acts::eBoundTime]); + + // Derived initial trajectory parameters + m_eta = static_cast( + Acts::VectorHelpers::eta(startParameters.direction())); + m_pt = static_cast(startParameters.transverseMomentum()); + m_p = static_cast(startParameters.absoluteMomentum()); + // Loop over single steps - for (auto& step : steps) { + for (auto& step : summary.steps) { const auto& geoID = step.geoID; m_sensitiveID.push_back(geoID.sensitive()); m_approachID.push_back(geoID.approach()); m_layerID.push_back(geoID.layer()); m_boundaryID.push_back(geoID.boundary()); m_volumeID.push_back(geoID.volume()); + m_extraID.push_back(geoID.extra()); int material = 0; - if (step.surface) { - if (step.surface->surfaceMaterial() != nullptr) { - material = 1; - } + if (step.surface != nullptr && + step.surface->surfaceMaterial() != nullptr) { + material = 1; } m_material.push_back(material); @@ -152,6 +186,7 @@ ActsExamples::ProcessCode ActsExamples::RootPropagationStepsWriter::writeT( m_x.push_back(step.position.x()); m_y.push_back(step.position.y()); m_z.push_back(step.position.z()); + m_r.push_back(Acts::VectorHelpers::perp(step.position)); auto direction = step.momentum.normalized(); m_dx.push_back(direction.x()); m_dy.push_back(direction.y()); @@ -166,7 +201,6 @@ ActsExamples::ProcessCode ActsExamples::RootPropagationStepsWriter::writeT( double aboAbs = std::abs(aborter); double usrAbs = std::abs(user); - // todo - fold with direction if (actAbs < accAbs && actAbs < aboAbs && actAbs < usrAbs) { m_step_type.push_back(0); } else if (accAbs < aboAbs && accAbs < usrAbs) { @@ -189,5 +223,6 @@ ActsExamples::ProcessCode ActsExamples::RootPropagationStepsWriter::writeT( } m_outputTree->Fill(); } + return ActsExamples::ProcessCode::SUCCESS; } diff --git a/Examples/Io/Root/src/RootPropagationSummaryWriter.cpp b/Examples/Io/Root/src/RootPropagationSummaryWriter.cpp new file mode 100644 index 00000000000..561d1bdc9e8 --- /dev/null +++ b/Examples/Io/Root/src/RootPropagationSummaryWriter.cpp @@ -0,0 +1,143 @@ +// This file is part of the Acts project. +// +// Copyright (C) 2024 CERN for the benefit of the Acts project +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "ActsExamples/Io/Root/RootPropagationSummaryWriter.hpp" + +#include "Acts/Definitions/Algebra.hpp" +#include "Acts/Utilities/Helpers.hpp" +#include "Acts/Utilities/VectorHelpers.hpp" +#include "ActsExamples/Framework/AlgorithmContext.hpp" +#include "ActsExamples/Propagation/PropagationAlgorithm.hpp" +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +namespace ActsExamples { + +RootPropagationSummaryWriter::RootPropagationSummaryWriter( + const RootPropagationSummaryWriter::Config& cfg, Acts::Logging::Level level) + : WriterT(cfg.inputSummaryCollection, "RootPropagationSummaryWriter", + level), + m_cfg(cfg), + m_outputFile(cfg.rootFile) { + // An input collection name and tree name must be specified + if (m_cfg.inputSummaryCollection.empty()) { + throw std::invalid_argument("Missing input collection"); + } + if (m_cfg.treeName.empty()) { + throw std::invalid_argument("Missing tree name"); + } + + // Setup ROOT I/O + if (m_outputFile == nullptr) { + m_outputFile = TFile::Open(m_cfg.filePath.c_str(), m_cfg.fileMode.c_str()); + if (m_outputFile == nullptr) { + throw std::ios_base::failure("Could not open '" + m_cfg.filePath + "'"); + } + } + m_outputFile->cd(); + + m_outputTree = new TTree(m_cfg.treeName.c_str(), + "TTree from RootPropagationSummaryWriter"); + if (m_outputTree == nullptr) { + throw std::bad_alloc(); + } + + // Set the branches + m_outputTree->Branch("event_nr", &m_eventNr); + m_outputTree->Branch("track_nr", &m_trackNr); + + m_outputTree->Branch("d0", &m_d0); + m_outputTree->Branch("z0", &m_z0); + m_outputTree->Branch("phi", &m_phi); + m_outputTree->Branch("theta", &m_theta); + m_outputTree->Branch("qOverP", &m_qOverP); + m_outputTree->Branch("t", &m_t); + + m_outputTree->Branch("eta", &m_eta); + m_outputTree->Branch("pt", &m_pt); + m_outputTree->Branch("p", &m_p); + + m_outputTree->Branch("nSteps", &m_nSteps); + m_outputTree->Branch("nStepTrials", &m_nStepTrials); + m_outputTree->Branch("pathLength", &m_pathLength); +} + +RootPropagationSummaryWriter::~RootPropagationSummaryWriter() { + if (m_outputFile != nullptr) { + m_outputFile->Close(); + } +} + +ProcessCode RootPropagationSummaryWriter::finalize() { + // Write the tree + m_outputFile->cd(); + m_outputTree->Write(); + /// Close the file if it's yours + if (m_cfg.rootFile == nullptr) { + m_outputFile->Close(); + } + + ACTS_VERBOSE("Wrote particles to tree '" << m_cfg.treeName << "' in '" + << m_cfg.filePath << "'"); + + return ProcessCode::SUCCESS; +} + +ProcessCode RootPropagationSummaryWriter::writeT( + const AlgorithmContext& context, const PropagationSummaries& summaries) { + // Exclusive access to the tree while writing + std::scoped_lock lock(m_writeMutex); + + // Get the event number + m_eventNr = static_cast(context.eventNumber); + + // Loop over the step vector of each test propagation in this + for (const auto& [trackNr, summary] : Acts::enumerate(summaries)) { + // Set the track number + m_trackNr = static_cast(trackNr); + + // Set the initial trajectory parameters + const auto& startParameters = summary.startParameters; + m_d0 = static_cast(startParameters.parameters()[Acts::eBoundLoc0]); + m_z0 = static_cast(startParameters.parameters()[Acts::eBoundLoc1]); + m_phi = static_cast(startParameters.parameters()[Acts::eBoundPhi]); + m_theta = + static_cast(startParameters.parameters()[Acts::eBoundTheta]); + m_qOverP = + static_cast(startParameters.parameters()[Acts::eBoundQOverP]); + m_t = static_cast(startParameters.parameters()[Acts::eBoundTime]); + + // Derived initial trajectory parameters + m_eta = static_cast( + Acts::VectorHelpers::eta(startParameters.direction())); + m_pt = static_cast(startParameters.transverseMomentum()); + m_p = static_cast(startParameters.absoluteMomentum()); + + // Stepper statistics + m_nSteps = static_cast(summary.steps.size()); + m_nStepTrials = static_cast(summary.nStepTrials); + m_pathLength = static_cast(summary.pathLength); + + m_outputTree->Fill(); + } + + return ProcessCode::SUCCESS; +} + +} // namespace ActsExamples diff --git a/Examples/Io/Svg/CMakeLists.txt b/Examples/Io/Svg/CMakeLists.txt index 1eb1a321111..7614ed97442 100644 --- a/Examples/Io/Svg/CMakeLists.txt +++ b/Examples/Io/Svg/CMakeLists.txt @@ -1,13 +1,11 @@ -add_library( - ActsExamplesIoSvg SHARED - src/SvgTrackingGeometryWriter.cpp) +add_library(ActsExamplesIoSvg SHARED src/SvgTrackingGeometryWriter.cpp) target_include_directories( ActsExamplesIoSvg - PUBLIC $) + PUBLIC $ +) target_link_libraries( - ActsExamplesIoSvg - PUBLIC ActsCore ActsExamplesFramework ActsPluginActSVG Threads::Threads) + ActsExamplesIoSvg + PUBLIC ActsCore ActsExamplesFramework ActsPluginActSVG Threads::Threads +) -install( - TARGETS ActsExamplesIoSvg - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS ActsExamplesIoSvg LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/Examples/Python/CMakeLists.txt b/Examples/Python/CMakeLists.txt index f991ea59dcc..56721a3eb7c 100644 --- a/Examples/Python/CMakeLists.txt +++ b/Examples/Python/CMakeLists.txt @@ -32,188 +32,266 @@ pybind11_add_module(ActsPythonBindings ) install(TARGETS ActsPythonBindings DESTINATION ${_python_install_dir}) -set_target_properties(ActsPythonBindings PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}") -set_target_properties(ActsPythonBindings PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts) - -target_link_libraries(ActsPythonBindings PUBLIC - ActsCore - ActsPythonUtilities - ActsExamplesFramework - ActsExamplesGeometry - ActsExamplesDetectorGeneric - ActsExamplesDetectorContextual - ActsExamplesDetectorTGeo - ActsExamplesMagneticField - ActsExamplesIoRoot - ActsExamplesIoNuclearInteractions - ActsExamplesIoCsv - ActsExamplesIoObj - ActsExamplesIoJson - ActsExamplesIoPerformance - ActsExamplesGenerators - ActsExamplesPrinters - ActsExamplesTrackFinding - ActsExamplesTrackFitting - ActsExamplesVertexing - ActsExamplesFatras - ActsExamplesDetectorTelescope - ActsExamplesUtilities - ActsExamplesAmbiguityResolution +set_target_properties( + ActsPythonBindings + PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}" +) +set_target_properties( + ActsPythonBindings + PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts +) + +target_link_libraries( + ActsPythonBindings + PUBLIC + ActsCore + ActsPythonUtilities + ActsExamplesFramework + ActsExamplesGeometry + ActsExamplesDetectorGeneric + ActsExamplesDetectorContextual + ActsExamplesDetectorTGeo + ActsExamplesMagneticField + ActsExamplesIoRoot + ActsExamplesIoNuclearInteractions + ActsExamplesIoCsv + ActsExamplesIoObj + ActsExamplesIoJson + ActsExamplesIoPerformance + ActsExamplesGenerators + ActsExamplesPrinters + ActsExamplesTrackFinding + ActsExamplesTrackFitting + ActsExamplesVertexing + ActsExamplesFatras + ActsExamplesDetectorTelescope + ActsExamplesUtilities + ActsExamplesAmbiguityResolution ) set(py_files - __init__.py - examples/__init__.py - examples/simulation.py - examples/reconstruction.py - examples/itk.py - examples/odd.py - _adapter.py + __init__.py + examples/__init__.py + examples/simulation.py + examples/reconstruction.py + examples/itk.py + examples/odd.py + _adapter.py ) if(ACTS_BUILD_PLUGIN_JSON) - target_link_libraries(ActsPythonBindings PUBLIC ActsPluginJson) - target_sources(ActsPythonBindings PRIVATE src/Json.cpp) + target_link_libraries(ActsPythonBindings PUBLIC ActsPluginJson) + target_sources(ActsPythonBindings PRIVATE src/Json.cpp) else() - target_sources(ActsPythonBindings PRIVATE src/JsonStub.cpp) + target_sources(ActsPythonBindings PRIVATE src/JsonStub.cpp) endif() if(ACTS_BUILD_PLUGIN_GEOMODEL) - target_link_libraries(ActsPythonBindings PUBLIC ActsPluginGeoModel) - target_sources(ActsPythonBindings PRIVATE src/GeoModel.cpp) + target_link_libraries(ActsPythonBindings PUBLIC ActsPluginGeoModel) + target_sources(ActsPythonBindings PRIVATE src/GeoModel.cpp) else() - target_sources(ActsPythonBindings PRIVATE src/GeoModelStub.cpp) + target_sources(ActsPythonBindings PRIVATE src/GeoModelStub.cpp) endif() if(ACTS_BUILD_PLUGIN_TRACCC) - target_link_libraries(ActsPythonBindings PUBLIC ActsPluginDetray) - target_sources(ActsPythonBindings PRIVATE src/Detray.cpp) + target_link_libraries(ActsPythonBindings PUBLIC ActsPluginDetray) + target_sources(ActsPythonBindings PRIVATE src/Detray.cpp) else() - target_sources(ActsPythonBindings PRIVATE src/DetrayStub.cpp) + target_sources(ActsPythonBindings PRIVATE src/DetrayStub.cpp) endif() if(ACTS_BUILD_PLUGIN_ACTSVG) - target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesIoSvg) - target_sources(ActsPythonBindings PRIVATE src/Svg.cpp) + target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesIoSvg) + target_sources(ActsPythonBindings PRIVATE src/Svg.cpp) else() - target_sources(ActsPythonBindings PRIVATE src/SvgStub.cpp) + target_sources(ActsPythonBindings PRIVATE src/SvgStub.cpp) endif() if(ACTS_BUILD_PLUGIN_DD4HEP AND ACTS_BUILD_EXAMPLES_DD4HEP) - pybind11_add_module(ActsPythonBindingsDD4hep src/DD4hepComponent.cpp) - target_link_libraries(ActsPythonBindingsDD4hep PUBLIC - ActsPythonUtilities - ActsExamplesDetectorDD4hep) - add_dependencies(ActsPythonBindings ActsPythonBindingsDD4hep) - - install(TARGETS ActsPythonBindingsDD4hep DESTINATION ${_python_install_dir}) - set_target_properties(ActsPythonBindingsDD4hep PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}") - set_target_properties(ActsPythonBindingsDD4hep PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts) - list(APPEND py_files examples/dd4hep.py) + pybind11_add_module(ActsPythonBindingsDD4hep src/DD4hepComponent.cpp) + target_link_libraries( + ActsPythonBindingsDD4hep + PUBLIC ActsPythonUtilities ActsExamplesDetectorDD4hep + ) + add_dependencies(ActsPythonBindings ActsPythonBindingsDD4hep) + + install(TARGETS ActsPythonBindingsDD4hep DESTINATION ${_python_install_dir}) + set_target_properties( + ActsPythonBindingsDD4hep + PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}" + ) + set_target_properties( + ActsPythonBindingsDD4hep + PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts + ) + list(APPEND py_files examples/dd4hep.py) endif() if(ACTS_BUILD_EXAMPLES_PYTHIA8) - target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesGeneratorsPythia8) - target_sources(ActsPythonBindings PRIVATE src/Pythia8.cpp) + target_link_libraries( + ActsPythonBindings + PUBLIC ActsExamplesGeneratorsPythia8 + ) + target_sources(ActsPythonBindings PRIVATE src/Pythia8.cpp) else() - target_sources(ActsPythonBindings PRIVATE src/Pythia8Stub.cpp) + target_sources(ActsPythonBindings PRIVATE src/Pythia8Stub.cpp) endif() if(ACTS_BUILD_EXAMPLES_GEANT4) - pybind11_add_module(ActsPythonBindingsGeant4 src/Geant4Component.cpp) - target_link_libraries(ActsPythonBindingsGeant4 PUBLIC - ActsExamplesGeant4 ActsExamplesDetectorGeant4 - ActsPythonUtilities ActsExamplesMuonSpectrometerMockupDetector) - add_dependencies(ActsPythonBindings ActsPythonBindingsGeant4) - - install(TARGETS ActsPythonBindingsGeant4 DESTINATION ${_python_install_dir}) - set_target_properties(ActsPythonBindingsGeant4 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}") - set_target_properties(ActsPythonBindingsGeant4 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts) - list(APPEND py_files examples/geant4/__init__.py) - - if(ACTS_BUILD_PLUGIN_DD4HEP AND ACTS_BUILD_EXAMPLES_DD4HEP) - pybind11_add_module(ActsPythonBindingsDDG4 src/Geant4DD4hepComponent.cpp) - target_link_libraries(ActsPythonBindingsDDG4 PUBLIC - ActsPythonUtilities - ActsExamplesGeant4 - ActsExamplesDetectorDD4hep) - add_dependencies(ActsPythonBindings ActsPythonBindingsDDG4) - - install(TARGETS ActsPythonBindingsDDG4 DESTINATION ${_python_install_dir}) - set_target_properties(ActsPythonBindingsDDG4 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}") - set_target_properties(ActsPythonBindingsDDG4 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts) - list(APPEND py_files examples/geant4/dd4hep.py) - endif() - - if(ACTS_BUILD_PLUGIN_GEOMODEL) - pybind11_add_module(ActsPythonBindingsGeoModelG4 src/Geant4GeoModelComponent.cpp) - target_link_libraries(ActsPythonBindingsGeoModelG4 PUBLIC - ActsPythonUtilities - ActsExamplesGeant4) - add_dependencies(ActsPythonBindings ActsPythonBindingsGeoModelG4) - install(TARGETS ActsPythonBindingsGeoModelG4 DESTINATION ${_python_install_dir}) - set_target_properties(ActsPythonBindingsGeoModelG4 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}") - set_target_properties(ActsPythonBindingsGeoModelG4 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts) - - list(APPEND py_files examples/geant4/geomodel.py) - endif() - - if(ACTS_BUILD_EXAMPLES_HEPMC3) - target_link_libraries(ActsPythonBindingsGeant4 PUBLIC ActsExamplesEventRecording) - target_sources(ActsPythonBindingsGeant4 PRIVATE src/Geant4HepMC3.cpp) - list(APPEND py_files examples/geant4/hepmc3.py) - else() - target_sources(ActsPythonBindingsGeant4 PRIVATE src/Geant4HepMC3Stub.cpp) - endif() + pybind11_add_module(ActsPythonBindingsGeant4 src/Geant4Component.cpp) + target_link_libraries( + ActsPythonBindingsGeant4 + PUBLIC + ActsExamplesGeant4 + ActsExamplesDetectorGeant4 + ActsPythonUtilities + ActsExamplesMuonSpectrometerMockupDetector + ) + add_dependencies(ActsPythonBindings ActsPythonBindingsGeant4) + + install(TARGETS ActsPythonBindingsGeant4 DESTINATION ${_python_install_dir}) + set_target_properties( + ActsPythonBindingsGeant4 + PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}" + ) + set_target_properties( + ActsPythonBindingsGeant4 + PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts + ) + list(APPEND py_files examples/geant4/__init__.py) + + if(ACTS_BUILD_PLUGIN_DD4HEP AND ACTS_BUILD_EXAMPLES_DD4HEP) + pybind11_add_module(ActsPythonBindingsDDG4 src/Geant4DD4hepComponent.cpp) + target_link_libraries( + ActsPythonBindingsDDG4 + PUBLIC + ActsPythonUtilities + ActsExamplesGeant4 + ActsExamplesDetectorDD4hep + ) + add_dependencies(ActsPythonBindings ActsPythonBindingsDDG4) + install( + TARGETS ActsPythonBindingsDDG4 DESTINATION ${_python_install_dir} + ) + set_target_properties( + ActsPythonBindingsDDG4 + PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}" + ) + set_target_properties( + ActsPythonBindingsDDG4 + PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts + ) + list(APPEND py_files examples/geant4/dd4hep.py) + endif() + + if(ACTS_BUILD_PLUGIN_GEOMODEL) + pybind11_add_module(ActsPythonBindingsGeoModelG4 src/Geant4GeoModelComponent.cpp) + target_link_libraries( + ActsPythonBindingsGeoModelG4 + PUBLIC ActsPythonUtilities ActsExamplesGeant4 + ) + add_dependencies(ActsPythonBindings ActsPythonBindingsGeoModelG4) + install( + TARGETS + ActsPythonBindingsGeoModelG4 + DESTINATION + ${_python_install_dir} + ) + set_target_properties( + ActsPythonBindingsGeoModelG4 + PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}" + ) + set_target_properties( + ActsPythonBindingsGeoModelG4 + PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts + ) + + list(APPEND py_files examples/geant4/geomodel.py) + endif() + + if(ACTS_BUILD_EXAMPLES_HEPMC3) + target_link_libraries( + ActsPythonBindingsGeant4 + PUBLIC ActsExamplesEventRecording + ) + target_sources(ActsPythonBindingsGeant4 PRIVATE src/Geant4HepMC3.cpp) + list(APPEND py_files examples/geant4/hepmc3.py) + else() + target_sources( + ActsPythonBindingsGeant4 + PRIVATE src/Geant4HepMC3Stub.cpp + ) + endif() endif() if(ACTS_BUILD_EXAMPLES_HEPMC3) - target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesHepMC3) - target_sources(ActsPythonBindings PRIVATE src/HepMC3.cpp) - list(APPEND py_files examples/hepmc3.py) + target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesHepMC3) + target_sources(ActsPythonBindings PRIVATE src/HepMC3.cpp) + list(APPEND py_files examples/hepmc3.py) else() - target_sources(ActsPythonBindings PRIVATE src/HepMC3Stub.cpp) + target_sources(ActsPythonBindings PRIVATE src/HepMC3Stub.cpp) endif() if(ACTS_BUILD_EXAMPLES_EXATRKX) - target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesTrackFindingExaTrkX) - target_sources(ActsPythonBindings PRIVATE src/ExaTrkXTrackFinding.cpp) + target_link_libraries( + ActsPythonBindings + PUBLIC ActsExamplesTrackFindingExaTrkX + ) + target_sources(ActsPythonBindings PRIVATE src/ExaTrkXTrackFinding.cpp) else() - target_sources(ActsPythonBindings PRIVATE src/ExaTrkXTrackFindingStub.cpp) + target_sources(ActsPythonBindings PRIVATE src/ExaTrkXTrackFindingStub.cpp) endif() if(ACTS_BUILD_EXAMPLES_EDM4HEP) - pybind11_add_module(ActsPythonBindingsEDM4hep src/EDM4hepComponent.cpp) - target_link_libraries(ActsPythonBindingsEDM4hep PUBLIC - ActsPythonUtilities ActsExamplesIoEDM4hep) - add_dependencies(ActsPythonBindings ActsPythonBindingsEDM4hep) - install(TARGETS ActsPythonBindingsEDM4hep DESTINATION ${_python_install_dir}) - set_target_properties(ActsPythonBindingsEDM4hep PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}") - set_target_properties(ActsPythonBindingsEDM4hep PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts) - list(APPEND py_files examples/edm4hep.py) + pybind11_add_module(ActsPythonBindingsEDM4hep src/EDM4hepComponent.cpp) + target_link_libraries( + ActsPythonBindingsEDM4hep + PUBLIC ActsPythonUtilities ActsExamplesIoEDM4hep + ) + add_dependencies(ActsPythonBindings ActsPythonBindingsEDM4hep) + install( + TARGETS ActsPythonBindingsEDM4hep DESTINATION ${_python_install_dir} + ) + set_target_properties( + ActsPythonBindingsEDM4hep + PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}" + ) + set_target_properties( + ActsPythonBindingsEDM4hep + PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts + ) + list(APPEND py_files examples/edm4hep.py) endif() if(ACTS_BUILD_PLUGIN_ONNX) - target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesFrameworkML ActsExamplesTrackFindingML) - target_sources(ActsPythonBindings PRIVATE src/Onnx.cpp) - target_sources(ActsPythonBindings PRIVATE src/OnnxNeuralCalibrator.cpp) - list(APPEND py_files examples/onnx/__init__.py) - + target_link_libraries( + ActsPythonBindings + PUBLIC ActsExamplesFrameworkML ActsExamplesTrackFindingML + ) + target_sources(ActsPythonBindings PRIVATE src/Onnx.cpp) + target_sources(ActsPythonBindings PRIVATE src/OnnxNeuralCalibrator.cpp) + list(APPEND py_files examples/onnx/__init__.py) else() - target_sources(ActsPythonBindings PRIVATE src/OnnxStub.cpp) - target_sources(ActsPythonBindings PRIVATE src/OnnxNeuralCalibratorStub.cpp) + target_sources(ActsPythonBindings PRIVATE src/OnnxStub.cpp) + target_sources(ActsPythonBindings PRIVATE src/OnnxNeuralCalibratorStub.cpp) endif() configure_file(setup.sh.in ${_python_dir}/setup.sh @ONLY) install(FILES ${_python_dir}/setup.sh DESTINATION "python") foreach(f ${py_files}) -set(_target ${_python_dir}/acts/${f}) -get_filename_component(_dir ${_target} DIRECTORY) -file(MAKE_DIRECTORY ${_dir}) + set(_target ${_python_dir}/acts/${f}) + get_filename_component(_dir ${_target} DIRECTORY) + file(MAKE_DIRECTORY ${_dir}) -file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/python/acts/${f} ${_target} SYMBOLIC) + file( + CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/python/acts/${f} ${_target} + SYMBOLIC + ) endforeach() -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python/acts/ DESTINATION ${_python_install_dir}) +install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python/acts/ + DESTINATION ${_python_install_dir} +) diff --git a/Examples/Python/src/Output.cpp b/Examples/Python/src/Output.cpp index 4dc3902141f..5e405c5fa23 100644 --- a/Examples/Python/src/Output.cpp +++ b/Examples/Python/src/Output.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2021-2023 CERN for the benefit of the Acts project +// Copyright (C) 2021-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -36,6 +36,7 @@ #include "ActsExamples/Io/Root/RootMeasurementWriter.hpp" #include "ActsExamples/Io/Root/RootParticleWriter.hpp" #include "ActsExamples/Io/Root/RootPropagationStepsWriter.hpp" +#include "ActsExamples/Io/Root/RootPropagationSummaryWriter.hpp" #include "ActsExamples/Io/Root/RootSeedWriter.hpp" #include "ActsExamples/Io/Root/RootSimHitWriter.hpp" #include "ActsExamples/Io/Root/RootSpacepointWriter.hpp" @@ -104,10 +105,9 @@ namespace Acts::Python { void addOutput(Context& ctx) { auto [m, mex] = ctx.get("main", "examples"); - ACTS_PYTHON_DECLARE_WRITER( - ActsExamples::ObjPropagationStepsWriter, mex, - "ObjPropagationStepsWriter", collection, outputDir, outputScalor, - outputPrecision); + ACTS_PYTHON_DECLARE_WRITER(ActsExamples::ObjPropagationStepsWriter, mex, + "ObjPropagationStepsWriter", collection, outputDir, + outputScalor, outputPrecision); { auto c = py::class_(m, "ViewConfig").def(py::init<>()); @@ -174,6 +174,10 @@ void addOutput(Context& ctx) { "RootPropagationStepsWriter", collection, filePath, fileMode); + ACTS_PYTHON_DECLARE_WRITER(ActsExamples::RootPropagationSummaryWriter, mex, + "RootPropagationSummaryWriter", + inputSummaryCollection, filePath, fileMode); + ACTS_PYTHON_DECLARE_WRITER(ActsExamples::RootParticleWriter, mex, "RootParticleWriter", inputParticles, inputFinalParticles, filePath, fileMode, treeName); diff --git a/Examples/Python/src/Propagation.cpp b/Examples/Python/src/Propagation.cpp index 1ccb31819c6..6e872e29558 100644 --- a/Examples/Python/src/Propagation.cpp +++ b/Examples/Python/src/Propagation.cpp @@ -116,8 +116,8 @@ void addPropagation(Context& ctx) { ActsExamples::PropagationAlgorithm, mex, "PropagationAlgorithm", propagatorImpl, sterileLogger, debugOutput, energyLoss, multipleScattering, recordMaterialInteractions, ptLoopers, maxStepSize, - covarianceTransport, inputTrackParameters, outputPropagationSteps, - outputMaterialTracks); + covarianceTransport, inputTrackParameters, outputSummaryCollection, + outputMaterialCollection); py::class_>( diff --git a/Examples/Python/tests/conftest.py b/Examples/Python/tests/conftest.py index 352155fb6a3..f4e0abbcadd 100644 --- a/Examples/Python/tests/conftest.py +++ b/Examples/Python/tests/conftest.py @@ -232,10 +232,8 @@ def _basic_prop_seq_factory(geo, s=None): level=acts.logging.WARNING, propagatorImpl=prop, sterileLogger=False, - recordMaterialInteractions=True, inputTrackParameters="start_parameters", - outputPropagationSteps="propagation-steps", - outputMaterialTracks="material-tracks", + outputSummaryCollection="propagation_summary", ) s.addAlgorithm(alg) diff --git a/Examples/Python/tests/root_file_hashes.txt b/Examples/Python/tests/root_file_hashes.txt index 3ee27a30f02..d70a12efb5d 100644 --- a/Examples/Python/tests/root_file_hashes.txt +++ b/Examples/Python/tests/root_file_hashes.txt @@ -15,12 +15,12 @@ test_itk_seeding__estimatedparams.root: 7e3acb54fcaabae19fe5b8601bd5bd3e5f65d6a1 test_itk_seeding__performance_seeding.root: 78ebda54cd0f026ba4b7f316724ffd946de56a932735914baf1b7bba9505c29d test_itk_seeding__particles.root: 0b6f4ad438010ac48803d48ed98e80b5e87d310bae6c2c02b16cd94d7a4d7d07 test_itk_seeding__particles_simulation.root: ef0246069aa697019f28a8b270a68de95312cae5f2f2c74848566c3ce4f70363 -test_propagation__propagation_steps.root: 665901379c73b468590ed49f00679708d9ace1952972be72022b15f5301e8a02 +test_propagation__propagation_summary.root: 85d877c3a48a6235d3d5a398b47130d5d17d4d3724128ccb339d8174e71a5bb0 test_material_recording__geant4_material_tracks.root: c022b9362249b29f57a07926b20644e3ab4ab8ebcf03f773fbf46c446fc1a0a1 test_truth_tracking_gsf[generic]__trackstates_gsf.root: 1466671bee7b7cfffe90459d9aef316dcee104e6c32a2df4f2f11ea9f12ddc14 test_truth_tracking_gsf[generic]__tracksummary_gsf.root: b698e3d21eacc34fc8b0ce1d3fbe07405a4b8b549e07f0160573e64c3b401f04 -test_truth_tracking_gsf[odd]__trackstates_gsf.root: 194198c9c9657b02192e573ba9969230663f179104e32e180101ffcd677b4745 -test_truth_tracking_gsf[odd]__tracksummary_gsf.root: 80e60784d4d6eabe734f6fc1ffe04aefa0276cf8798430c590a06f40a07a484f +test_truth_tracking_gsf[odd]__trackstates_gsf.root: b0d05586724ad2b08e40f81535929375ae55a687d5d3436e9ab2ac4661876e9a +test_truth_tracking_gsf[odd]__tracksummary_gsf.root: df8da514590ed5ff7236adbcd47030132e1b34873cf3ab264dc5c5f1319bdf98 test_particle_gun__particles.root: 5fe7dda2933ee6b9615b064d192322fe07831133cd998e5ed99a3b992b713a10 test_material_mapping__material-map_tracks.root: 938b1a855369e9304401cb10d2751df3fd7acf32a2573f2057eb1691cd94edf3 test_material_mapping__propagation-material.root: 5eacd0cb804d381171c8fb65d7b2d36e1d57db9f4cb2b58c0f24703479218cbf @@ -55,9 +55,9 @@ test_vertex_fitting_reading[AMVF-False-100]__performance_vertexing.root: 009e4b1 test_vertex_fitting_reading[AMVF-True-100]__performance_vertexing.root: 2d0dc1e02bfd1f7eaae26ef8ac657ce0291f70c7e4efddd35d171d31988a631e test_bfield_writing__solenoid.root: 7be51f0ed9cb99f59ae0271ba79cdb84635e6ee3d2109ea8a4b521875029c21d test_bfield_writing__solenoid2.root: 2db149336c9cd749dc50025076b49f9bc0586d53792b87a0fdd7f21a649a01a5 -test_root_prop_step_writer[configPosConstructor]__prop_steps.root: 7cfe1c38a345c1c233aaaf1af740409d379d4cf475507c9cea05ee8b432ce93a -test_root_prop_step_writer[configKwConstructor]__prop_steps.root: 7cfe1c38a345c1c233aaaf1af740409d379d4cf475507c9cea05ee8b432ce93a -test_root_prop_step_writer[kwargsConstructor]__prop_steps.root: 7cfe1c38a345c1c233aaaf1af740409d379d4cf475507c9cea05ee8b432ce93a +test_root_prop_step_writer[configPosConstructor]__prop_steps.root: c0a4898c1f2539d9e3e72587d5a377fc700fed6deb156952daeff670ab7a6f55 +test_root_prop_step_writer[configKwConstructor]__prop_steps.root: c0a4898c1f2539d9e3e72587d5a377fc700fed6deb156952daeff670ab7a6f55 +test_root_prop_step_writer[kwargsConstructor]__prop_steps.root: c0a4898c1f2539d9e3e72587d5a377fc700fed6deb156952daeff670ab7a6f55 test_root_particle_writer[configPosConstructor]__particles.root: 759f7c0225a30afc28c3dda6010295207254ebb0194b88f692d538b8c65d4326 test_root_particle_writer[configKwConstructor]__particles.root: 759f7c0225a30afc28c3dda6010295207254ebb0194b88f692d538b8c65d4326 test_root_particle_writer[kwargsConstructor]__particles.root: 759f7c0225a30afc28c3dda6010295207254ebb0194b88f692d538b8c65d4326 diff --git a/Examples/Python/tests/test_examples.py b/Examples/Python/tests/test_examples.py index 291dca8ac85..1772f7c0dba 100644 --- a/Examples/Python/tests/test_examples.py +++ b/Examples/Python/tests/test_examples.py @@ -412,8 +412,8 @@ def test_propagation(tmp_path, trk_geo, field, seq, assert_root_hash): root_files = [ ( - "propagation_steps.root", - "propagation_steps", + "propagation_summary.root", + "propagation_summary", 10000, ) ] diff --git a/Examples/Python/tests/test_propagation.py b/Examples/Python/tests/test_propagation.py index 84dbd77c3e9..6583098f427 100644 --- a/Examples/Python/tests/test_propagation.py +++ b/Examples/Python/tests/test_propagation.py @@ -78,16 +78,14 @@ def test_steppers(conf_const, trk_geo): acts.examples.PropagationAlgorithm, level=acts.logging.WARNING, propagatorImpl=prop, - sterileLogger=False, - recordMaterialInteractions=True, inputTrackParameters="start_parameters", - outputPropagationSteps="propagation_steps", - outputMaterialTracks="material-tracks", + outputSummaryCollection="propagation_summary", + sterileLogger=False, ) seq.addAlgorithm(alg) chkAlg = AssertCollectionExistsAlg( - "propagation_steps", "chk_alg", level=acts.logging.WARNING + "propagation_summary", "chk_alg", level=acts.logging.WARNING ) seq.addAlgorithm(chkAlg) diff --git a/Examples/Python/tests/test_writer.py b/Examples/Python/tests/test_writer.py index ce85a374174..a3098c743c9 100644 --- a/Examples/Python/tests/test_writer.py +++ b/Examples/Python/tests/test_writer.py @@ -58,7 +58,7 @@ def test_obj_propagation_step_writer(tmp_path, trk_geo, conf_const, basic_prop_s w = conf_const( ObjPropagationStepsWriter, acts.logging.INFO, - collection=alg.config.outputPropagationSteps, + collection=alg.config.outputSummaryCollection, outputDir=str(obj), ) @@ -110,7 +110,7 @@ def test_root_prop_step_writer( w = conf_const( RootPropagationStepsWriter, acts.logging.INFO, - collection=alg.config.outputPropagationSteps, + collection=alg.config.outputSummaryCollection, filePath=str(file), ) diff --git a/Examples/Scripts/MaterialMapping/CMakeLists.txt b/Examples/Scripts/MaterialMapping/CMakeLists.txt index f1a5dae6d1d..ee1d03873b0 100644 --- a/Examples/Scripts/MaterialMapping/CMakeLists.txt +++ b/Examples/Scripts/MaterialMapping/CMakeLists.txt @@ -1,7 +1,16 @@ add_executable(ActsAnalysisMaterialComposition MaterialComposition.cpp) -target_link_libraries(ActsAnalysisMaterialComposition ActsExamplesFramework ROOT::Core ROOT::Hist ROOT::Tree ROOT::TreePlayer Boost::program_options nlohmann_json::nlohmann_json) +target_link_libraries( + ActsAnalysisMaterialComposition + ActsExamplesFramework + ROOT::Core + ROOT::Hist + ROOT::Tree + ROOT::TreePlayer + Boost::program_options + nlohmann_json::nlohmann_json +) install( - TARGETS - ActsAnalysisMaterialComposition - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + TARGETS ActsAnalysisMaterialComposition + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/Examples/Scripts/MaterialMapping/GeometryVisualisationAndMaterialHandling.py b/Examples/Scripts/MaterialMapping/GeometryVisualisationAndMaterialHandling.py index c6271054d44..ebd90169878 100644 --- a/Examples/Scripts/MaterialMapping/GeometryVisualisationAndMaterialHandling.py +++ b/Examples/Scripts/MaterialMapping/GeometryVisualisationAndMaterialHandling.py @@ -141,7 +141,7 @@ def dump_geo(filename, plot, output_folder, dump_steering, steering_file): index_to_extends_layers_discs[vol - 1].append(extends) else: print( - "WARNING: Processing surface with unknown type. Only CylinderSurface and DiscSurface are considered." + f"WARNING: Processing surface with unknown type '{entry["value"]["type"]}'. Only CylinderSurface and DiscSurface are considered." ) if "boundary" in entry: @@ -176,7 +176,7 @@ def dump_geo(filename, plot, output_folder, dump_steering, steering_file): index_to_extends_layers_bounds_discs[vol - 1].append(extends) else: print( - "WARNING: Processing surface with unknown type. Only CylinderSurface and DiscSurface are considered." + f"WARNING: Processing surface with unknown type '{entry["value"]["type"]}'. Only CylinderSurface and DiscSurface are considered." ) # Steering the information and collect it into an output file if needed @@ -436,10 +436,12 @@ def dump_geo(filename, plot, output_folder, dump_steering, steering_file): def read_and_modify(filename, plot, output_folder, steering_file, output_file): - f = open(filename) - layers = open(steering_file) - data = json.load(f) - full_data = json.load(layers) + with open(filename) as f: + data = json.load(f) + + with open(steering_file) as f: + full_data = json.load(f) + layer_data = full_data["SteeringField"] index_to_names = [] @@ -548,7 +550,7 @@ def read_and_modify(filename, plot, output_folder, steering_file, output_file): ] else: print( - "WARNING: Processing surface with unknown type. Only CylinderSurface and DiscSurface are considered." + f"WARNING: Processing surface with unknown type '{entry["value"]["type"]}. Only CylinderSurface and DiscSurface are considered." ) if val["bins"] == 0: print( @@ -624,7 +626,7 @@ def read_and_modify(filename, plot, output_folder, steering_file, output_file): material_layer_discs[vol - 1].append(extends) else: print( - "WARNING: Processing surface with unknown type. Only CylinderSurface and DiscSurface are considered." + f"WARNING: Processing surface with unknown type '{entry["value"]["type"]}'. Only CylinderSurface and DiscSurface are considered." ) if "boundary" in entry: diff --git a/Examples/Scripts/MaterialMapping/MaterialComposition.cpp b/Examples/Scripts/MaterialMapping/MaterialComposition.cpp index 76fed740cf6..bc9f7936f67 100644 --- a/Examples/Scripts/MaterialMapping/MaterialComposition.cpp +++ b/Examples/Scripts/MaterialMapping/MaterialComposition.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #define BOOST_AVAILABLE 1 diff --git a/Examples/Scripts/MaterialMapping/materialComposition.C b/Examples/Scripts/MaterialMapping/materialComposition.C index 40bfd2b8a57..ecd3863f19d 100644 --- a/Examples/Scripts/MaterialMapping/materialComposition.C +++ b/Examples/Scripts/MaterialMapping/materialComposition.C @@ -43,10 +43,10 @@ struct MaterialHistograms { (iA == 0) ? name + std::string("_l0_vs_eta_all") : name + std::string("_l0_vs_eta_A") + std::to_string(iA); - x0_vs_eta = new TProfile(x0NameEta.c_str(), "X_{0} vs. #eta", bins, -eta, - eta); - l0_vs_eta = new TProfile(l0NameEta.c_str(), "L_{0} vs. #eta", bins, -eta, - eta); + x0_vs_eta = + new TProfile(x0NameEta.c_str(), "X_{0} vs. #eta", bins, -eta, eta); + l0_vs_eta = + new TProfile(l0NameEta.c_str(), "L_{0} vs. #eta", bins, -eta, eta); std::string x0NamePhi = (iA == 0) ? name + std::string("_x0_vs_phi_all") @@ -55,10 +55,10 @@ struct MaterialHistograms { (iA == 0) ? name + std::string("_l0_vs_phi_all") : name + std::string("_l0_vs_phi_A") + std::to_string(iA); - x0_vs_phi = new TProfile(x0NamePhi.c_str(), "X_{0} vs. #phi", bins, -M_PI, - M_PI); - l0_vs_phi = new TProfile(l0NamePhi.c_str(), "L_{0} vs. #phi", bins, -M_PI, - M_PI); + x0_vs_phi = + new TProfile(x0NamePhi.c_str(), "X_{0} vs. #phi", bins, -M_PI, M_PI); + l0_vs_phi = + new TProfile(l0NamePhi.c_str(), "L_{0} vs. #phi", bins, -M_PI, M_PI); } /// This fills the event into the histograms @@ -132,6 +132,10 @@ void materialComposition(const std::string& inFile, const std::string& treeName, // Draw all the atomic elements & get the histogram inputTree->Draw("mat_A>>hA(200,0.5,200.5)"); TH1F* histA = dynamic_cast(gDirectory->Get("hA")); + if (histA == nullptr) { + throw std::runtime_error{"Could not get the histogram"}; + } + histA->Draw(); auto outputFile = TFile::Open(outFile.c_str(), "recreate"); diff --git a/Examples/Scripts/MaterialMapping/material_comparison.py b/Examples/Scripts/MaterialMapping/material_comparison.py index 0c980af3287..b4555988b27 100644 --- a/Examples/Scripts/MaterialMapping/material_comparison.py +++ b/Examples/Scripts/MaterialMapping/material_comparison.py @@ -121,5 +121,7 @@ # Set the range of x-axis plt.xlabel(pr.x_label) - plt.show() fig.savefig(pr.saveAs) + + +plt.show() diff --git a/Examples/Scripts/Python/material_mapping_core.py b/Examples/Scripts/Python/material_mapping_core.py index 837d42c6047..9a9801b50af 100644 --- a/Examples/Scripts/Python/material_mapping_core.py +++ b/Examples/Scripts/Python/material_mapping_core.py @@ -26,13 +26,6 @@ JsonFormat, ) -from acts.examples.dd4hep import ( - DD4hepDetector, - DD4hepDetectorOptions, - DD4hepGeometryService, -) - -from acts import geomodel as gm from acts.examples.odd import getOpenDataDetector, getOpenDataDetectorDirectory @@ -191,6 +184,8 @@ def runMaterialMapping(surfaces, inputFile, outputFile, outputMap, loglevel): if args.experimental: if len(args.geomodel_input) > 0: + from acts import geomodel as gm + # Read the geometry model from the database gmTree = acts.geomodel.readFromDb(args.geomodel_input) @@ -251,6 +246,12 @@ def runMaterialMapping(surfaces, inputFile, outputFile, outputMap, loglevel): materialSurfaces = detector.extractMaterialSurfaces() else: + from acts.examples.dd4hep import ( + DD4hepDetector, + DD4hepDetectorOptions, + DD4hepGeometryService, + ) + odd_xml = getOpenDataDetectorDirectory() / "xml" / "OpenDataDetector.xml" # Create the dd4hep geometry service and detector diff --git a/Examples/Scripts/Python/material_validation.py b/Examples/Scripts/Python/material_validation.py index 984e61303af..ebc26041cd2 100755 --- a/Examples/Scripts/Python/material_validation.py +++ b/Examples/Scripts/Python/material_validation.py @@ -57,21 +57,19 @@ def runMaterialValidation( alg = acts.examples.PropagationAlgorithm( propagatorImpl=prop, level=acts.logging.INFO, - sterileLogger=False, + sterileLogger=True, recordMaterialInteractions=True, inputTrackParameters="start_parameters", - outputPropagationSteps="propagation_steps", - outputMaterialTracks="material-tracks", + outputSummaryCollection="propagation_summary", + outputMaterialCollection="material_tracks", ) s.addAlgorithm(alg) - print(os.path.join(outputDir, (outputName + ".root"))) - s.addWriter( RootMaterialTrackWriter( level=acts.logging.INFO, - inputMaterialTracks=alg.config.outputMaterialTracks, + inputMaterialTracks=alg.config.outputMaterialCollection, filePath=os.path.join(outputDir, (outputName + ".root")), storeSurface=True, storeVolume=True, diff --git a/Examples/Scripts/Python/material_validation_core.py b/Examples/Scripts/Python/material_validation_core.py index a0f3a19d9e5..e696f704a5f 100644 --- a/Examples/Scripts/Python/material_validation_core.py +++ b/Examples/Scripts/Python/material_validation_core.py @@ -22,15 +22,6 @@ MaterialValidation, ) -from acts.examples.dd4hep import ( - DD4hepDetector, - DD4hepDetectorOptions, - DD4hepGeometryService, -) - -from acts import geomodel as gm -from acts.examples.odd import getOpenDataDetector, getOpenDataDetectorDirectory - def runMaterialValidation(s, ntracks, surfaces, outputFile, seed, loglevel): # IO for material tracks reading @@ -133,6 +124,8 @@ def runMaterialValidation(s, ntracks, surfaces, outputFile, seed, loglevel): if args.experimental: if len(args.geomodel_input) > 0: + from acts import geomodel as gm + # Read the geometry model from the database gmTree = acts.geomodel.readFromDb(args.geomodel_input) @@ -194,6 +187,17 @@ def runMaterialValidation(s, ntracks, surfaces, outputFile, seed, loglevel): materialSurfaces = detector.extractMaterialSurfaces() else: + from acts.examples.dd4hep import ( + DD4hepDetector, + DD4hepDetectorOptions, + DD4hepGeometryService, + ) + + from acts.examples.odd import ( + getOpenDataDetector, + getOpenDataDetectorDirectory, + ) + odd_xml = getOpenDataDetectorDirectory() / "xml" / "OpenDataDetector.xml" # Create the dd4hep geometry service and detector diff --git a/Examples/Scripts/Python/material_validation_itk.py b/Examples/Scripts/Python/material_validation_itk.py index 84b6406aed6..759f75a5ea2 100755 --- a/Examples/Scripts/Python/material_validation_itk.py +++ b/Examples/Scripts/Python/material_validation_itk.py @@ -74,7 +74,7 @@ def runMaterialValidation( s.addWriter( RootMaterialTrackWriter( level=acts.logging.INFO, - inputMaterialTracks=alg.config.propagationMaterialCollection, + inputMaterialTracks=alg.config.outputMaterialCollection, filePath=os.path.join(outputDir, (outputName + ".root")), storeSurface=True, storeVolume=True, @@ -85,7 +85,7 @@ def runMaterialValidation( s.addWriter( acts.examples.RootPropagationStepsWriter( level=acts.logging.INFO, - collection=alg.config.propagationStepCollection, + collection=alg.config.outputSummaryCollection, filePath=outputDir + "/propagation_steps.root", ) ) diff --git a/Examples/Scripts/Python/propagation.py b/Examples/Scripts/Python/propagation.py index 770b79681d2..ea54919a89f 100755 --- a/Examples/Scripts/Python/propagation.py +++ b/Examples/Scripts/Python/propagation.py @@ -56,32 +56,19 @@ def runPropagation(trackingGeometry, field, outputDir, s=None, decorators=[]): propagationAlgorithm = acts.examples.PropagationAlgorithm( propagatorImpl=propagator, level=acts.logging.INFO, - sterileLogger=False, - covarianceTransport=False, + sterileLogger=True, inputTrackParameters="start_parameters", - outputPropagationSteps="propagation_steps", + outputSummaryCollection="propagation_summary", ) s.addAlgorithm(propagationAlgorithm) - # if not os.path.exists(outputDir + "/obj"): - # os.makedirs(outputDir + "/obj") - - # s.addWriter( - # acts.examples.ObjPropagationStepsWriter( - # level=acts.logging.INFO, - # collection="propagation_steps", - # outputDir=outputDir + "/obj", - # ) - # ) - - if not propagationAlgorithm.config.sterileLogger: - s.addWriter( - acts.examples.RootPropagationStepsWriter( - level=acts.logging.INFO, - collection="propagation_steps", - filePath=outputDir + "/propagation_steps.root", - ) + s.addWriter( + acts.examples.RootPropagationSummaryWriter( + level=acts.logging.INFO, + inputSummaryCollection="propagation_summary", + filePath=outputDir + "/propagation_summary.root", ) + ) return s @@ -137,6 +124,11 @@ def runPropagation(trackingGeometry, field, outputDir, s=None, decorators=[]): # field=solenoid # ) + os.makedirs(os.getcwd() + "/propagation", exist_ok=True) + runPropagation( - trackingGeometry, field, os.getcwd(), decorators=contextDecorators + trackingGeometry, + field, + os.getcwd() + "/propagation", + decorators=contextDecorators, ).run() diff --git a/Examples/Scripts/TrackingPerformance/CMakeLists.txt b/Examples/Scripts/TrackingPerformance/CMakeLists.txt index 31492084b0c..7e6fb6df7b6 100644 --- a/Examples/Scripts/TrackingPerformance/CMakeLists.txt +++ b/Examples/Scripts/TrackingPerformance/CMakeLists.txt @@ -1,23 +1,26 @@ add_executable(ActsAnalysisResidualsAndPulls ResidualsAndPulls.cpp) -target_link_libraries(ActsAnalysisResidualsAndPulls - ROOT::Core - ROOT::Hist - ROOT::Tree - ROOT::TreePlayer - Boost::program_options) +target_link_libraries( + ActsAnalysisResidualsAndPulls + ROOT::Core + ROOT::Hist + ROOT::Tree + ROOT::TreePlayer + Boost::program_options +) add_executable(ActsAnalysisTrackSummary TrackSummary.cpp) -target_link_libraries(ActsAnalysisTrackSummary - ActsExamplesFramework - ROOT::Core - ROOT::Hist - ROOT::Tree - ROOT::TreePlayer - Boost::program_options - nlohmann_json::nlohmann_json) +target_link_libraries( + ActsAnalysisTrackSummary + ActsExamplesFramework + ROOT::Core + ROOT::Hist + ROOT::Tree + ROOT::TreePlayer + Boost::program_options + nlohmann_json::nlohmann_json +) install( - TARGETS - ActsAnalysisResidualsAndPulls - ActsAnalysisTrackSummary - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + TARGETS ActsAnalysisResidualsAndPulls ActsAnalysisTrackSummary + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/Examples/Scripts/TrackingPerformance/TrackSummary.cpp b/Examples/Scripts/TrackingPerformance/TrackSummary.cpp index 515f1000981..06d547bd357 100644 --- a/Examples/Scripts/TrackingPerformance/TrackSummary.cpp +++ b/Examples/Scripts/TrackingPerformance/TrackSummary.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #define BOOST_AVAILABLE 1 diff --git a/Fatras/CMakeLists.txt b/Fatras/CMakeLists.txt index 1fdfe72e961..4e998b1ea17 100644 --- a/Fatras/CMakeLists.txt +++ b/Fatras/CMakeLists.txt @@ -1,34 +1,34 @@ add_library( - ActsFatras SHARED - src/Digitization/Segmentizer.cpp - src/Digitization/DigitizationError.cpp - src/Digitization/PlanarSurfaceMask.cpp - src/Digitization/PlanarSurfaceDrift.cpp - src/EventData/Particle.cpp - src/EventData/ParticleOutcome.cpp - src/EventData/ProcessType.cpp - src/Kernel/SimulationError.cpp - src/Physics/BetheHeitler.cpp - src/Physics/NuclearInteraction/NuclearInteraction.cpp - src/Physics/PhotonConversion.cpp - src/Physics/StandardInteractions.cpp - src/Utilities/LandauDistribution.cpp) + ActsFatras + SHARED + src/Digitization/Segmentizer.cpp + src/Digitization/DigitizationError.cpp + src/Digitization/PlanarSurfaceMask.cpp + src/Digitization/PlanarSurfaceDrift.cpp + src/EventData/Particle.cpp + src/EventData/ParticleOutcome.cpp + src/EventData/ProcessType.cpp + src/Kernel/SimulationError.cpp + src/Physics/BetheHeitler.cpp + src/Physics/NuclearInteraction/NuclearInteraction.cpp + src/Physics/PhotonConversion.cpp + src/Physics/StandardInteractions.cpp + src/Utilities/LandauDistribution.cpp +) target_include_directories( - ActsFatras - PUBLIC - $ - $) -target_link_libraries( - ActsFatras - PUBLIC ActsCore) + ActsFatras + PUBLIC + $ + $ +) +target_link_libraries(ActsFatras PUBLIC ActsCore) install( - TARGETS ActsFatras - EXPORT ActsFatrasTargets + TARGETS ActsFatras + EXPORT ActsFatrasTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -install( - DIRECTORY include/ActsFatras - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) +install(DIRECTORY include/ActsFatras DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) add_component_if(Geant4 FatrasGeant4 ACTS_BUILD_FATRAS_GEANT4) diff --git a/Fatras/Geant4/CMakeLists.txt b/Fatras/Geant4/CMakeLists.txt index 074f558b78f..a0645174913 100644 --- a/Fatras/Geant4/CMakeLists.txt +++ b/Fatras/Geant4/CMakeLists.txt @@ -1,28 +1,31 @@ add_library( - ActsFatrasGeant4 SHARED - src/Geant4Decay.cpp - src/PDGtoG4Converter.cpp - src/DummyDetectorConstruction.cpp) -target_compile_definitions( - ActsFatrasGeant4 - PUBLIC ${Geant4_DEFINITIONS}) + ActsFatrasGeant4 + SHARED + src/Geant4Decay.cpp + src/PDGtoG4Converter.cpp + src/DummyDetectorConstruction.cpp +) +target_compile_definitions(ActsFatrasGeant4 PUBLIC ${Geant4_DEFINITIONS}) target_include_directories( - ActsFatrasGeant4 - SYSTEM PUBLIC ${Geant4_INCLUDE_DIRS}) + ActsFatrasGeant4 + SYSTEM + PUBLIC ${Geant4_INCLUDE_DIRS} +) target_include_directories( - ActsFatrasGeant4 - PUBLIC - $ - $) + ActsFatrasGeant4 + PUBLIC + $ + $ +) target_link_libraries( - ActsFatrasGeant4 - PUBLIC ActsCore ActsFatras ${Geant4_LIBRARIES}) + ActsFatrasGeant4 + PUBLIC ActsCore ActsFatras ${Geant4_LIBRARIES} +) install( - TARGETS ActsFatrasGeant4 - EXPORT ActsFatrasGeant4Targets + TARGETS ActsFatrasGeant4 + EXPORT ActsFatrasGeant4Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -install( - DIRECTORY include/ActsFatras - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) +install(DIRECTORY include/ActsFatras DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Fatras/include/ActsFatras/Physics/ElectroMagnetic/PhotonConversion.hpp b/Fatras/include/ActsFatras/Physics/ElectroMagnetic/PhotonConversion.hpp index 4e976f69882..6a01b08e19e 100644 --- a/Fatras/include/ActsFatras/Physics/ElectroMagnetic/PhotonConversion.hpp +++ b/Fatras/include/ActsFatras/Physics/ElectroMagnetic/PhotonConversion.hpp @@ -255,7 +255,7 @@ Particle::Vector3 PhotonConversion::generateChildDirection( return direction; } -std::array PhotonConversion::generateChildren( +inline std::array PhotonConversion::generateChildren( const Particle& photon, Scalar childEnergy, const Particle::Vector3& childDirection) const { using namespace Acts::UnitLiterals; diff --git a/Plugins/ActSVG/CMakeLists.txt b/Plugins/ActSVG/CMakeLists.txt index b156e5a5edd..917d56062e4 100644 --- a/Plugins/ActSVG/CMakeLists.txt +++ b/Plugins/ActSVG/CMakeLists.txt @@ -1,30 +1,30 @@ add_library( - ActsPluginActSVG SHARED - src/DetectorVolumeSvgConverter.cpp - src/DetectorSvgConverter.cpp - src/EventDataSvgConverter.cpp - src/LayerSvgConverter.cpp - src/PortalSvgConverter.cpp - src/SurfaceArraySvgConverter.cpp - src/SurfaceSvgConverter.cpp - src/TrackingGeometrySvgConverter.cpp) + ActsPluginActSVG + SHARED + src/DetectorVolumeSvgConverter.cpp + src/DetectorSvgConverter.cpp + src/EventDataSvgConverter.cpp + src/LayerSvgConverter.cpp + src/PortalSvgConverter.cpp + src/SurfaceArraySvgConverter.cpp + src/SurfaceSvgConverter.cpp + src/TrackingGeometrySvgConverter.cpp +) target_include_directories( - ActsPluginActSVG - PUBLIC - $ - $) + ActsPluginActSVG + PUBLIC + $ + $ +) target_link_libraries( - ActsPluginActSVG - PUBLIC - ActsCore - actsvg::core - actsvg::meta) + ActsPluginActSVG + PUBLIC ActsCore actsvg::core actsvg::meta +) install( - TARGETS ActsPluginActSVG - EXPORT ActsPluginActSVGTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install( - DIRECTORY include/Acts - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + TARGETS ActsPluginActSVG + EXPORT ActsPluginActSVGTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Plugins/Cuda/CMakeLists.txt b/Plugins/Cuda/CMakeLists.txt index bcbe9a808e1..21adefee36a 100644 --- a/Plugins/Cuda/CMakeLists.txt +++ b/Plugins/Cuda/CMakeLists.txt @@ -1,62 +1,59 @@ # Set up the "CUDA 1" plugin. find_library(CUDART_LIBRARY cudart ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) -add_library( - ActsPluginCuda SHARED - src/Seeding/Kernels.cu -) +add_library(ActsPluginCuda SHARED src/Seeding/Kernels.cu) target_include_directories( - ActsPluginCuda - PUBLIC - $ - $ ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) -target_link_libraries( - ActsPluginCuda - PUBLIC ActsCore ${CUDART_LIBRARY}) + ActsPluginCuda + PUBLIC + $ + $ + ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} +) +target_link_libraries(ActsPluginCuda PUBLIC ActsCore ${CUDART_LIBRARY}) # Set up the "CUDA 2" plugin. add_library( - ActsPluginCuda2 STATIC - include/Acts/Plugins/Cuda/Seeding2/Details/CountDublets.hpp - include/Acts/Plugins/Cuda/Seeding2/Details/FindDublets.hpp - include/Acts/Plugins/Cuda/Seeding2/Details/FindTriplets.hpp - include/Acts/Plugins/Cuda/Seeding2/Details/Types.hpp - include/Acts/Plugins/Cuda/Seeding2/SeedFinder.hpp - include/Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp - include/Acts/Plugins/Cuda/Seeding2/TripletFilterConfig.hpp - include/Acts/Plugins/Cuda/Utilities/Arrays.hpp - include/Acts/Plugins/Cuda/Utilities/Info.hpp - include/Acts/Plugins/Cuda/Utilities/MemoryManager.hpp - include/Acts/Plugins/Cuda/Utilities/StreamWrapper.hpp - src/Seeding2/CountDublets.cu - src/Seeding2/FindDublets.cu - src/Seeding2/FindTriplets.cu - src/Utilities/Arrays.cu - src/Utilities/ErrorCheck.cuh - src/Utilities/ErrorCheck.cu - src/Utilities/Info.cu - src/Utilities/MatrixMacros.hpp - src/Utilities/MemoryManager.cu - src/Utilities/StreamHandlers.cuh - src/Utilities/StreamWrapper.cu + ActsPluginCuda2 + STATIC + include/Acts/Plugins/Cuda/Seeding2/Details/CountDublets.hpp + include/Acts/Plugins/Cuda/Seeding2/Details/FindDublets.hpp + include/Acts/Plugins/Cuda/Seeding2/Details/FindTriplets.hpp + include/Acts/Plugins/Cuda/Seeding2/Details/Types.hpp + include/Acts/Plugins/Cuda/Seeding2/SeedFinder.hpp + include/Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp + include/Acts/Plugins/Cuda/Seeding2/TripletFilterConfig.hpp + include/Acts/Plugins/Cuda/Utilities/Arrays.hpp + include/Acts/Plugins/Cuda/Utilities/Info.hpp + include/Acts/Plugins/Cuda/Utilities/MemoryManager.hpp + include/Acts/Plugins/Cuda/Utilities/StreamWrapper.hpp + src/Seeding2/CountDublets.cu + src/Seeding2/FindDublets.cu + src/Seeding2/FindTriplets.cu + src/Utilities/Arrays.cu + src/Utilities/ErrorCheck.cuh + src/Utilities/ErrorCheck.cu + src/Utilities/Info.cu + src/Utilities/MatrixMacros.hpp + src/Utilities/MemoryManager.cu + src/Utilities/StreamHandlers.cuh + src/Utilities/StreamWrapper.cu ) target_include_directories( - ActsPluginCuda2 - PUBLIC - $ - $) -target_link_libraries( - ActsPluginCuda2 - PUBLIC ActsCore) -set_target_properties(ActsPluginCuda2 PROPERTIES - CUDA_SEPARABLE_COMPILATION ON - POSITION_INDEPENDENT_CODE ON) + ActsPluginCuda2 + PUBLIC + $ + $ +) +target_link_libraries(ActsPluginCuda2 PUBLIC ActsCore) +set_target_properties( + ActsPluginCuda2 + PROPERTIES CUDA_SEPARABLE_COMPILATION ON POSITION_INDEPENDENT_CODE ON +) # Install all CUDA plugins. install( - TARGETS ActsPluginCuda ActsPluginCuda2 - EXPORT ActsPluginCudaTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install( - DIRECTORY include/Acts - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + TARGETS ActsPluginCuda ActsPluginCuda2 + EXPORT ActsPluginCudaTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Plugins/Cuda/src/Seeding/CMakeLists.txt b/Plugins/Cuda/src/Seeding/CMakeLists.txt index b5e9bf68367..b8ef76f9a50 100644 --- a/Plugins/Cuda/src/Seeding/CMakeLists.txt +++ b/Plugins/Cuda/src/Seeding/CMakeLists.txt @@ -1,5 +1 @@ -target_sources( - ActsCore - PRIVATE - Kernels.cu -) +target_sources(ActsCore PRIVATE Kernels.cu) diff --git a/Plugins/DD4hep/CMakeLists.txt b/Plugins/DD4hep/CMakeLists.txt index 9af2f9fc7d1..bbaa90c77d0 100644 --- a/Plugins/DD4hep/CMakeLists.txt +++ b/Plugins/DD4hep/CMakeLists.txt @@ -1,39 +1,39 @@ include(FetchContent) add_library( - ActsPluginDD4hep SHARED - src/ConvertDD4hepDetector.cpp - src/DD4hepBlueprintFactory.cpp - src/DD4hepBinningHelpers.cpp - src/DD4hepDetectorStructure.cpp - src/DD4hepMaterialHelpers.cpp - src/DD4hepDetectorElement.cpp - src/DD4hepDetectorSurfaceFactory.cpp - src/DD4hepLayerBuilder.cpp - src/DD4hepLayerStructure.cpp - src/DD4hepVolumeBuilder.cpp - src/DD4hepFieldAdapter.cpp) + ActsPluginDD4hep + SHARED + src/ConvertDD4hepDetector.cpp + src/DD4hepBlueprintFactory.cpp + src/DD4hepBinningHelpers.cpp + src/DD4hepDetectorStructure.cpp + src/DD4hepMaterialHelpers.cpp + src/DD4hepDetectorElement.cpp + src/DD4hepDetectorSurfaceFactory.cpp + src/DD4hepLayerBuilder.cpp + src/DD4hepLayerStructure.cpp + src/DD4hepVolumeBuilder.cpp + src/DD4hepFieldAdapter.cpp +) target_include_directories( - ActsPluginDD4hep - PUBLIC - $ - $) -target_link_libraries( - ActsPluginDD4hep - PUBLIC ActsCore ActsPluginTGeo) + ActsPluginDD4hep + PUBLIC + $ + $ +) +target_link_libraries(ActsPluginDD4hep PUBLIC ActsCore ActsPluginTGeo) if(${DD4hep_VERSION} VERSION_LESS 1.11) - target_include_directories(ActsPluginDD4hep PUBLIC ${DD4hep_INCLUDE_DIRS}) - target_link_libraries(ActsPluginDD4hep PUBLIC ${DD4hep_DDCORE_LIBRARY}) + target_include_directories(ActsPluginDD4hep PUBLIC ${DD4hep_INCLUDE_DIRS}) + target_link_libraries(ActsPluginDD4hep PUBLIC ${DD4hep_DDCORE_LIBRARY}) else() - target_link_libraries(ActsPluginDD4hep PUBLIC DD4hep::DDCore DD4hep::DDRec) + target_link_libraries(ActsPluginDD4hep PUBLIC DD4hep::DDCore DD4hep::DDRec) endif() install( - TARGETS ActsPluginDD4hep - EXPORT ActsPluginDD4hepTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install( - DIRECTORY include/Acts - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + TARGETS ActsPluginDD4hep + EXPORT ActsPluginDD4hepTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp index 2fb52291a04..4d604fbeb42 100644 --- a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp +++ b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp @@ -128,6 +128,8 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::endcapLayers( TGeoTubeSeg* tube = dynamic_cast(geoShape); if (tube == nullptr) { ACTS_ERROR(" Disc layer has wrong shape - needs to be TGeoTubeSeg!"); + throw std::logic_error{ + "Disc layer has wrong shape - needs to be TGeoTubeSeg!"}; } // extract the boundaries double rMin = tube->GetRmin() * UnitConstants::cm; @@ -299,6 +301,8 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers( if (tube == nullptr) { ACTS_ERROR( " Cylinder layer has wrong shape - needs to be TGeoTubeSeg!"); + throw std::logic_error{ + " Cylinder layer has wrong shape - needs to be TGeoTubeSeg!"}; } // extract the boundaries diff --git a/Plugins/DD4hep/src/DD4hepVolumeBuilder.cpp b/Plugins/DD4hep/src/DD4hepVolumeBuilder.cpp index 4b426d4c2b4..0913c3d31e1 100644 --- a/Plugins/DD4hep/src/DD4hepVolumeBuilder.cpp +++ b/Plugins/DD4hep/src/DD4hepVolumeBuilder.cpp @@ -64,6 +64,8 @@ Acts::DD4hepVolumeBuilder::centralVolumes() const { if (tube == nullptr) { ACTS_ERROR( "[L] Cylinder layer has wrong shape - needs to be TGeoTubeSeg!"); + throw std::logic_error{ + "[L] Cylinder layer has wrong shape - needs to be TGeoTubeSeg!"}; } // Extract the boundaries diff --git a/Plugins/Detray/CMakeLists.txt b/Plugins/Detray/CMakeLists.txt index 3af182b7b7f..4dba2bf7c5d 100644 --- a/Plugins/Detray/CMakeLists.txt +++ b/Plugins/Detray/CMakeLists.txt @@ -1,34 +1,30 @@ -add_library( - ActsPluginDetray SHARED - src/DetrayConverter.cpp) +add_library(ActsPluginDetray SHARED src/DetrayConverter.cpp) -add_dependencies(ActsPluginDetray - detray::core - covfie::core - vecmem::core) +add_dependencies(ActsPluginDetray detray::core covfie::core vecmem::core) target_include_directories( - ActsPluginDetray - PUBLIC - $ - $) + ActsPluginDetray + PUBLIC + $ + $ +) target_link_libraries( - ActsPluginDetray - PUBLIC - ActsCore - ActsPluginJson - detray::core - detray::core_array - detray::io - detray::utils - vecmem::core) + ActsPluginDetray + PUBLIC + ActsCore + ActsPluginJson + detray::core + detray::core_array + detray::io + detray::utils + vecmem::core +) install( - TARGETS ActsPluginDetray - EXPORT ActsPluginDetrayTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsPluginDetray + EXPORT ActsPluginDetrayTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) -install( - DIRECTORY include/Acts - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Plugins/Detray/src/DetrayConverter.cpp b/Plugins/Detray/src/DetrayConverter.cpp index b4f19fcbaea..4f2ac983ad0 100644 --- a/Plugins/Detray/src/DetrayConverter.cpp +++ b/Plugins/Detray/src/DetrayConverter.cpp @@ -79,9 +79,6 @@ detray::io::mask_payload Acts::DetrayConverter::convertMask( detray::io::surface_payload Acts::DetrayConverter::convertSurface( const Acts::GeometryContext& gctx, const Surface& surface, bool portal) { - using material_link_payload = - detray::io::typed_link_payload; - detray::io::surface_payload surfacePayload; surfacePayload.transform = convertTransform(surface.transform(gctx)); @@ -176,13 +173,13 @@ std::vector Acts::DetrayConverter::convertPortal( std::array clipRange = {0., 0.}; std::vector boundValues = surfaceAdjusted->bounds().values(); if (surfaceType == Surface::SurfaceType::Cylinder && - cast == Acts::BinningValue::binZ) { + cast == BinningValue::binZ) { ActsScalar zPosition = surfaceAdjusted->center(gctx).z(); clipRange = { zPosition - boundValues[CylinderBounds::BoundValues::eHalfLengthZ], zPosition + boundValues[CylinderBounds::BoundValues::eHalfLengthZ]}; } else if (surfaceType == Surface::SurfaceType::Disc && - cast == Acts::BinningValue::binR) { + cast == BinningValue::binR) { clipRange = {boundValues[RadialBounds::BoundValues::eMinR], boundValues[RadialBounds::BoundValues::eMaxR]}; } else { diff --git a/Plugins/EDM4hep/CMakeLists.txt b/Plugins/EDM4hep/CMakeLists.txt index 090e1531097..bad8460d880 100644 --- a/Plugins/EDM4hep/CMakeLists.txt +++ b/Plugins/EDM4hep/CMakeLists.txt @@ -1,23 +1,19 @@ -add_library( - ActsPluginEDM4hep SHARED - src/EDM4hepUtil.cpp) +add_library(ActsPluginEDM4hep SHARED src/EDM4hepUtil.cpp) target_include_directories( - ActsPluginEDM4hep - PUBLIC - $ - $) + ActsPluginEDM4hep + PUBLIC + $ + $ +) target_link_libraries( - ActsPluginEDM4hep - PUBLIC - ActsCore - ActsPluginPodio - EDM4HEP::edm4hep) + ActsPluginEDM4hep + PUBLIC ActsCore ActsPluginPodio EDM4HEP::edm4hep +) install( - TARGETS ActsPluginEDM4hep - EXPORT ActsPluginEDM4hepTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install( - DIRECTORY include/Acts - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + TARGETS ActsPluginEDM4hep + EXPORT ActsPluginEDM4hepTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Plugins/ExaTrkX/CMakeLists.txt b/Plugins/ExaTrkX/CMakeLists.txt index d2481f585c8..802941e7367 100644 --- a/Plugins/ExaTrkX/CMakeLists.txt +++ b/Plugins/ExaTrkX/CMakeLists.txt @@ -1,99 +1,91 @@ -set(SOURCES - src/buildEdges.cpp - src/ExaTrkXPipeline.cpp -) +set(SOURCES src/buildEdges.cpp src/ExaTrkXPipeline.cpp) if(ACTS_EXATRKX_ENABLE_ONNX) - list(APPEND SOURCES - src/OnnxEdgeClassifier.cpp - src/OnnxMetricLearning.cpp - src/CugraphTrackBuilding.cpp - ) + list( + APPEND + SOURCES + src/OnnxEdgeClassifier.cpp + src/OnnxMetricLearning.cpp + src/CugraphTrackBuilding.cpp + ) endif() if(ACTS_EXATRKX_ENABLE_TORCH) - list(APPEND SOURCES - src/TorchEdgeClassifier.cpp - src/TorchMetricLearning.cpp - src/BoostTrackBuilding.cpp - src/TorchTruthGraphMetricsHook.cpp - src/TorchGraphStoreHook.cpp - ) + list( + APPEND + SOURCES + src/TorchEdgeClassifier.cpp + src/TorchMetricLearning.cpp + src/BoostTrackBuilding.cpp + src/TorchTruthGraphMetricsHook.cpp + src/TorchGraphStoreHook.cpp + ) endif() -add_library( - ActsPluginExaTrkX SHARED - ${SOURCES} -) +add_library(ActsPluginExaTrkX SHARED ${SOURCES}) target_include_directories( - ActsPluginExaTrkX - PUBLIC - $ - $ + ActsPluginExaTrkX + PUBLIC + $ + $ ) target_link_libraries( - ActsPluginExaTrkX - PUBLIC - ActsCore - Boost::boost - ${TORCH_LIBRARIES} # TODO try to make this private again (torch::Device is leaking) - std::filesystem + ActsPluginExaTrkX + PUBLIC + ActsCore + Boost::boost + ${TORCH_LIBRARIES} # TODO try to make this private again (torch::Device is leaking) + std::filesystem ) if(ACTS_EXATRKX_ENABLE_CUDA) - target_link_libraries( - ActsPluginExaTrkX - PRIVATE - frnn - ) - set_target_properties(ActsPluginExaTrkX - PROPERTIES - CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED ON - CUDA_SEPARABLE_COMPILATION ON - ) - target_compile_definitions(ActsPluginExaTrkX PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM) - target_compile_definitions(ActsPluginExaTrkX PUBLIC NO_CUGRAPH_OPS) + target_link_libraries(ActsPluginExaTrkX PRIVATE frnn) + set_target_properties( + ActsPluginExaTrkX + PROPERTIES + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON + CUDA_SEPARABLE_COMPILATION ON + ) + target_compile_definitions( + ActsPluginExaTrkX + PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM + ) + target_compile_definitions(ActsPluginExaTrkX PUBLIC NO_CUGRAPH_OPS) else() - target_compile_definitions(ActsPluginExaTrkX PUBLIC ACTS_EXATRKX_CPUONLY) + target_compile_definitions(ActsPluginExaTrkX PUBLIC ACTS_EXATRKX_CPUONLY) endif() if(ACTS_EXATRKX_ENABLE_ONNX) - target_compile_definitions(ActsPluginExaTrkX PUBLIC ACTS_EXATRKX_ONNX_BACKEND) + target_compile_definitions( + ActsPluginExaTrkX + PUBLIC ACTS_EXATRKX_ONNX_BACKEND + ) - target_link_libraries( - ActsPluginExaTrkX - PRIVATE - OnnxRuntime - cugraph::cugraph - ) + target_link_libraries( + ActsPluginExaTrkX + PRIVATE OnnxRuntime cugraph::cugraph + ) endif() if(ACTS_EXATRKX_ENABLE_TORCH) - target_compile_definitions(ActsPluginExaTrkX PUBLIC ACTS_EXATRKX_TORCH_BACKEND) + target_compile_definitions( + ActsPluginExaTrkX + PUBLIC ACTS_EXATRKX_TORCH_BACKEND + ) - target_link_libraries( - ActsPluginExaTrkX - PRIVATE - TorchScatter::TorchScatter - ) + target_link_libraries(ActsPluginExaTrkX PRIVATE TorchScatter::TorchScatter) - # Should not discard TorchScatter even if its not needed at this point - # since we need the scatter_max operation in the torch script later - target_link_options( - ActsPluginExaTrkX - PUBLIC - "-Wl,-no-as-needed" - ) + # Should not discard TorchScatter even if its not needed at this point + # since we need the scatter_max operation in the torch script later + target_link_options(ActsPluginExaTrkX PUBLIC "-Wl,-no-as-needed") endif() - -install( - TARGETS ActsPluginExaTrkX - EXPORT ActsPluginExaTrkXTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) install( - DIRECTORY include/Acts - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + TARGETS ActsPluginExaTrkX + EXPORT ActsPluginExaTrkXTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Plugins/FpeMonitoring/CMakeLists.txt b/Plugins/FpeMonitoring/CMakeLists.txt index 6486027fd2e..05a6126e2f3 100644 --- a/Plugins/FpeMonitoring/CMakeLists.txt +++ b/Plugins/FpeMonitoring/CMakeLists.txt @@ -1,14 +1,12 @@ -add_library( - ActsPluginFpeMonitoring SHARED - src/FpeMonitor.cpp) +add_library(ActsPluginFpeMonitoring SHARED src/FpeMonitor.cpp) target_include_directories( - ActsPluginFpeMonitoring - PUBLIC - $ - $) + ActsPluginFpeMonitoring + PUBLIC + $ + $ +) -target_link_libraries( - ActsPluginFpeMonitoring PUBLIC ActsCore) +target_link_libraries(ActsPluginFpeMonitoring PUBLIC ActsCore) # Fpe flags set(_fpe_options "") @@ -19,151 +17,176 @@ find_library(dl_LIBRARY dl) find_package(Backtrace) find_program(addr2line_EXECUTABLE addr2line) if(APPLE) - list(APPEND _fpe_options -D_GNU_SOURCE) + list(APPEND _fpe_options -D_GNU_SOURCE) else() + if(dl_LIBRARY) + target_link_libraries(ActsPluginFpeMonitoring PUBLIC ${dl_LIBRARY}) - if(dl_LIBRARY) - target_link_libraries(ActsPluginFpeMonitoring PUBLIC ${dl_LIBRARY}) + set(_backtrace_setup_complete FALSE) - set(_backtrace_setup_complete FALSE) + if(Backtrace_FOUND) + # check if we need to link against bracktrace or not + set(backtrace_include "") - if(Backtrace_FOUND) - - # check if we need to link against bracktrace or not - set(backtrace_include "") - - - file(WRITE - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" - " + file( + WRITE + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" + " #include int main() {} - " ) - - - message(CHECK_START "Does backtrace work with the default include") - - try_compile(_backtrace_default_header "${CMAKE_BINARY_DIR}" - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" - LINK_LIBRARIES ${dl_LIBRARY} - COMPILE_DEFINITIONS -DBOOST_STACKTRACE_USE_BACKTRACE - OUTPUT_VARIABLE __OUTPUT) - - - if(_backtrace_default_header) - message(CHECK_PASS "yes") - else() - message(CHECK_FAIL "no") - - file(GLOB hints "/usr/lib/gcc/*/*/include") - find_file(backtrace_header "backtrace.h" - HINTS ${hints}) - - if(${backtrace_header} STREQUAL "backtrcae_header-NOTFOUND") - message(STATUS "Could not find backtrace header file") - else() - set(backtrace_include "-DBOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE=\"${backtrace_header}\"") - - - file(WRITE - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" - " + " + ) + + message(CHECK_START "Does backtrace work with the default include") + + try_compile( + _backtrace_default_header + "${CMAKE_BINARY_DIR}" + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" + LINK_LIBRARIES ${dl_LIBRARY} + COMPILE_DEFINITIONS -DBOOST_STACKTRACE_USE_BACKTRACE + OUTPUT_VARIABLE __OUTPUT + ) + + if(_backtrace_default_header) + message(CHECK_PASS "yes") + else() + message(CHECK_FAIL "no") + + file(GLOB hints "/usr/lib/gcc/*/*/include") + find_file(backtrace_header "backtrace.h" HINTS ${hints}) + + if(${backtrace_header} STREQUAL "backtrcae_header-NOTFOUND") + message(STATUS "Could not find backtrace header file") + else() + set(backtrace_include + "-DBOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE=\"${backtrace_header}\"" + ) + + file( + WRITE + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" + " #include int main() {} - " ) - - - message(CHECK_START "Does backtrace work with explicit include") - - try_compile(_backtrace_explicit_header "${CMAKE_BINARY_DIR}" - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" - LINK_LIBRARIES ${dl_LIBRARY} - COMPILE_DEFINITIONS -DBOOST_STACKTRACE_USE_BACKTRACE ${backtrace_include} - OUTPUT_VARIABLE __OUTPUT) - - if(_backtrace_explicit_header) - message(CHECK_PASS "yes") - list(APPEND _fpe_options "${backtrace_include}") - else() - message(CHECK_FAIL "no") - endif() + " + ) + + message( + CHECK_START + "Does backtrace work with explicit include" + ) + + try_compile( + _backtrace_explicit_header + "${CMAKE_BINARY_DIR}" + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" + LINK_LIBRARIES ${dl_LIBRARY} + COMPILE_DEFINITIONS + -DBOOST_STACKTRACE_USE_BACKTRACE + ${backtrace_include} + OUTPUT_VARIABLE __OUTPUT + ) + + if(_backtrace_explicit_header) + message(CHECK_PASS "yes") + list(APPEND _fpe_options "${backtrace_include}") + else() + message(CHECK_FAIL "no") + endif() + endif() + endif() + + file( + WRITE + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" + "#include \n" + "#include \n" + "int main() { std::cout << boost::stacktrace::stacktrace(); }\n" + ) + + message(CHECK_START "Does backtrace work without linker flag") + try_compile( + _backtrace_nolink + "${CMAKE_BINARY_DIR}" + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" + LINK_LIBRARIES ${dl_LIBRARY} + COMPILE_DEFINITIONS + -DBOOST_STACKTRACE_USE_BACKTRACE + ${backtrace_include} + OUTPUT_VARIABLE __OUTPUT + ) + + if(_backtrace_nolink) + message(CHECK_PASS "yes") + set(_backtrace_setup_complete TRUE) + else() + message(CHECK_FAIL "no") + + file( + WRITE + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" + "#include \n" + "#include \n" + "int main() { std::cout << boost::stacktrace::stacktrace(); }\n" + ) + + message(CHECK_START "Does backtrace work with linker flag") + try_compile( + _backtrace_link + "${CMAKE_BINARY_DIR}" + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" + LINK_LIBRARIES backtrace ${dl_LIBRARY} + COMPILE_DEFINITIONS + -DBOOST_STACKTRACE_USE_BACKTRACE + ${backtrace_include} + OUTPUT_VARIABLE __OUTPUT + ) + + if(_backtrace_link) + message(CHECK_PASS "yes") + list(APPEND _fpe_options -DBOOST_STACKTRACE_USE_BACKTRACE) + target_link_libraries( + ActsPluginFpeMonitoring + PUBLIC backtrace + ) + + set(_backtrace_setup_complete TRUE) + else() + message(CHECK_FAIL "no") + endif() + endif() endif() - endif() - - - file(WRITE - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" - "#include \n" - "#include \n" - "int main() { std::cout << boost::stacktrace::stacktrace(); }\n" ) - - message(CHECK_START "Does backtrace work without linker flag") - try_compile(_backtrace_nolink "${CMAKE_BINARY_DIR}" - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" - LINK_LIBRARIES ${dl_LIBRARY} - COMPILE_DEFINITIONS -DBOOST_STACKTRACE_USE_BACKTRACE ${backtrace_include} - OUTPUT_VARIABLE __OUTPUT) - - if(_backtrace_nolink) - message(CHECK_PASS "yes") - set(_backtrace_setup_complete TRUE) - else() - message(CHECK_FAIL "no") - - file(WRITE - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" - "#include \n" - "#include \n" - "int main() { std::cout << boost::stacktrace::stacktrace(); }\n" ) - - message(CHECK_START "Does backtrace work with linker flag") - try_compile(_backtrace_link "${CMAKE_BINARY_DIR}" - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp" - LINK_LIBRARIES backtrace ${dl_LIBRARY} - COMPILE_DEFINITIONS -DBOOST_STACKTRACE_USE_BACKTRACE ${backtrace_include} - OUTPUT_VARIABLE __OUTPUT) - - if(_backtrace_link) - message(CHECK_PASS "yes") - list(APPEND _fpe_options -DBOOST_STACKTRACE_USE_BACKTRACE) - target_link_libraries(ActsPluginFpeMonitoring PUBLIC backtrace) - - set(_backtrace_setup_complete TRUE) - else() - message(CHECK_FAIL "no") + if(NOT _backtrace_setup_complete) + message(CHECK_START "Is addr2line available") + if(addr2line_EXECUTABLE) + list(APPEND _fpe_options -DBOOST_STACKTRACE_USE_ADDR2LINE) + list( + APPEND + _fpe_options + -DBOOST_STACKTRACE_ADDR2LINE_LOCATION=${addr2line_EXECUTABLE} + ) + message(CHECK_PASS "yes") + + set(_backtrace_setup_complete TRUE) + else() + message(CHECK_FAIL "no") + endif() endif() - endif() - endif() - - if(NOT _backtrace_setup_complete) - message(CHECK_START "Is addr2line available") - if(addr2line_EXECUTABLE) - list(APPEND _fpe_options -DBOOST_STACKTRACE_USE_ADDR2LINE) - list(APPEND _fpe_options -DBOOST_STACKTRACE_ADDR2LINE_LOCATION=${addr2line_EXECUTABLE}) - message(CHECK_PASS "yes") - - set(_backtrace_setup_complete TRUE) - else() - message(CHECK_FAIL "no") - endif() - endif() - - if(NOT _backtrace_setup_complete) - message(STATUS "Unable to set up stacktrace setup: use noop") - list(APPEND _fpe_options -BOOST_STACKTRACE_USE_NOOP) + if(NOT _backtrace_setup_complete) + message(STATUS "Unable to set up stacktrace setup: use noop") + list(APPEND _fpe_options -BOOST_STACKTRACE_USE_NOOP) + endif() endif() - endif() endif() target_compile_options(ActsPluginFpeMonitoring PUBLIC "${_fpe_options}") - -install( - TARGETS ActsPluginFpeMonitoring - EXPORT ActsPluginFpeMonitoringTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) install( - DIRECTORY include/Acts - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + TARGETS ActsPluginFpeMonitoring + EXPORT ActsPluginFpeMonitoringTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Plugins/Geant4/CMakeLists.txt b/Plugins/Geant4/CMakeLists.txt index dc4e35c9fa2..c92adbdb525 100644 --- a/Plugins/Geant4/CMakeLists.txt +++ b/Plugins/Geant4/CMakeLists.txt @@ -1,27 +1,29 @@ include(FetchContent) add_library( - ActsPluginGeant4 SHARED - src/Geant4Converters.cpp - src/Geant4DetectorElement.cpp - src/Geant4DetectorSurfaceFactory.cpp - src/Geant4PhysicalVolumeSelectors.cpp) + ActsPluginGeant4 + SHARED + src/Geant4Converters.cpp + src/Geant4DetectorElement.cpp + src/Geant4DetectorSurfaceFactory.cpp + src/Geant4PhysicalVolumeSelectors.cpp +) target_include_directories( ActsPluginGeant4 - PUBLIC - $ - $) + PUBLIC + $ + $ +) target_include_directories( - ActsPluginGeant4 - SYSTEM PRIVATE ${Geant4_INCLUDE_DIRS}) -target_link_libraries( ActsPluginGeant4 - PUBLIC ActsCore ${Geant4_LIBRARIES}) + SYSTEM + PRIVATE ${Geant4_INCLUDE_DIRS} +) +target_link_libraries(ActsPluginGeant4 PUBLIC ActsCore ${Geant4_LIBRARIES}) install( - TARGETS ActsPluginGeant4 - EXPORT ActsPluginGeant4Targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install( - DIRECTORY include/Acts - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + TARGETS ActsPluginGeant4 + EXPORT ActsPluginGeant4Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Plugins/GeoModel/CMakeLists.txt b/Plugins/GeoModel/CMakeLists.txt index eda838bac65..5e40ade3230 100644 --- a/Plugins/GeoModel/CMakeLists.txt +++ b/Plugins/GeoModel/CMakeLists.txt @@ -1,33 +1,40 @@ include(FetchContent) add_library( - ActsPluginGeoModel SHARED - src/GeoModelBlueprintCreater.cpp - src/GeoModelConversionError.cpp - src/GeoModelReader.cpp - src/GeoModelDetectorElement.cpp - src/GeoModelDetectorSurfaceFactory.cpp - src/detail/GeoBoxConverter.cpp - src/detail/GeoTrdConverter.cpp - src/detail/GeoTubeConverter.cpp - src/detail/GeoShiftConverter.cpp - src/detail/GeoIntersectionAnnulusConverter.cpp - src/detail/GeoModelBinningHelper.cpp - src/detail/GeoModelExtentHelper.cpp - src/detail/GeoUnionDoubleTrdConverter.cpp) + ActsPluginGeoModel + SHARED + src/GeoModelBlueprintCreater.cpp + src/GeoModelConversionError.cpp + src/GeoModelReader.cpp + src/GeoModelDetectorElement.cpp + src/GeoModelDetectorSurfaceFactory.cpp + src/detail/GeoBoxConverter.cpp + src/detail/GeoTrdConverter.cpp + src/detail/GeoTubeConverter.cpp + src/detail/GeoShiftConverter.cpp + src/detail/GeoIntersectionAnnulusConverter.cpp + src/detail/GeoModelBinningHelper.cpp + src/detail/GeoModelExtentHelper.cpp + src/detail/GeoUnionDoubleTrdConverter.cpp +) target_include_directories( ActsPluginGeoModel - PUBLIC - $ - $) + PUBLIC + $ + $ +) target_link_libraries( ActsPluginGeoModel - PUBLIC ActsCore GeoModelCore::GeoModelKernel GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelRead) + PUBLIC + ActsCore + GeoModelCore::GeoModelKernel + GeoModelIO::GeoModelDBManager + GeoModelIO::GeoModelRead +) install( - TARGETS ActsPluginGeoModel - EXPORT ActsPluginGeoModelTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install( - DIRECTORY include/Acts - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + TARGETS ActsPluginGeoModel + EXPORT ActsPluginGeoModelTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Plugins/Json/CMakeLists.txt b/Plugins/Json/CMakeLists.txt index 3b7f495b1c5..0d3ff9875ee 100644 --- a/Plugins/Json/CMakeLists.txt +++ b/Plugins/Json/CMakeLists.txt @@ -1,41 +1,46 @@ include(ActsTargetLinkLibrariesSystem) add_library( - ActsPluginJson SHARED - src/AlgebraJsonConverter.cpp - src/DetectorJsonConverter.cpp - src/DetectorVolumeJsonConverter.cpp - src/ExtentJsonConverter.cpp - src/GridJsonConverter.cpp - src/DetectorVolumeFinderJsonConverter.cpp - src/IndexedSurfacesJsonConverter.cpp - src/JsonMaterialDecorator.cpp - src/MaterialMapJsonConverter.cpp - src/MaterialJsonConverter.cpp - src/PortalJsonConverter.cpp - src/ProtoDetectorJsonConverter.cpp - src/SurfaceBoundsJsonConverter.cpp - src/SurfaceJsonConverter.cpp - src/UtilitiesJsonConverter.cpp - src/VolumeBoundsJsonConverter.cpp - src/VolumeJsonConverter.cpp - src/AmbiguityConfigJsonConverter.cpp - src/DetrayJsonHelper.cpp) + ActsPluginJson + SHARED + src/AlgebraJsonConverter.cpp + src/DetectorJsonConverter.cpp + src/DetectorVolumeJsonConverter.cpp + src/ExtentJsonConverter.cpp + src/GridJsonConverter.cpp + src/DetectorVolumeFinderJsonConverter.cpp + src/IndexedSurfacesJsonConverter.cpp + src/JsonMaterialDecorator.cpp + src/MaterialMapJsonConverter.cpp + src/MaterialJsonConverter.cpp + src/PortalJsonConverter.cpp + src/ProtoDetectorJsonConverter.cpp + src/SurfaceBoundsJsonConverter.cpp + src/SurfaceJsonConverter.cpp + src/UtilitiesJsonConverter.cpp + src/VolumeBoundsJsonConverter.cpp + src/VolumeJsonConverter.cpp + src/AmbiguityConfigJsonConverter.cpp + src/DetrayJsonHelper.cpp +) target_include_directories( - ActsPluginJson - PUBLIC - $ - $) + ActsPluginJson + PUBLIC + $ + $ +) target_link_libraries( - ActsPluginJson PUBLIC ActsCore nlohmann_json::nlohmann_json) + ActsPluginJson + PUBLIC ActsCore nlohmann_json::nlohmann_json +) target_compile_definitions( - ActsPluginJson - PRIVATE JSON_DISABLE_ENUM_SERIALIZATION=1) + ActsPluginJson + PRIVATE JSON_DISABLE_ENUM_SERIALIZATION=1 +) install( - TARGETS ActsPluginJson - EXPORT ActsPluginJsonTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install( - DIRECTORY include/Acts - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + TARGETS ActsPluginJson + EXPORT ActsPluginJsonTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Plugins/Legacy/CMakeLists.txt b/Plugins/Legacy/CMakeLists.txt index c280b0d0c8d..430c1ad4fad 100644 --- a/Plugins/Legacy/CMakeLists.txt +++ b/Plugins/Legacy/CMakeLists.txt @@ -1,21 +1,16 @@ -add_library( - ActsPluginLegacy INTERFACE) -target_compile_features( - ActsPluginLegacy - INTERFACE cxx_std_17) +add_library(ActsPluginLegacy INTERFACE) +target_compile_features(ActsPluginLegacy INTERFACE cxx_std_17) target_include_directories( - ActsPluginLegacy - INTERFACE - $ - $) -target_link_libraries( - ActsPluginLegacy - INTERFACE Boost::boost Eigen3::Eigen) + ActsPluginLegacy + INTERFACE + $ + $ +) +target_link_libraries(ActsPluginLegacy INTERFACE Boost::boost Eigen3::Eigen) install( - TARGETS ActsPluginLegacy - EXPORT ActsPluginLegacyTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install( - DIRECTORY include/Acts - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + TARGETS ActsPluginLegacy + EXPORT ActsPluginLegacyTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Plugins/Onnx/CMakeLists.txt b/Plugins/Onnx/CMakeLists.txt index f4b756fb38a..3a07262ac71 100644 --- a/Plugins/Onnx/CMakeLists.txt +++ b/Plugins/Onnx/CMakeLists.txt @@ -1,29 +1,29 @@ add_library( - ActsPluginOnnx SHARED - # header files - include/Acts/Plugins/Onnx/OnnxRuntimeBase.hpp - include/Acts/Plugins/Onnx/MLTrackClassifier.hpp - include/Acts/Plugins/Onnx/AmbiguityTrackClassifier.hpp - include/Acts/Plugins/Onnx/SeedClassifier.hpp - # source files - src/OnnxRuntimeBase.cpp - src/MLTrackClassifier.cpp) + ActsPluginOnnx + SHARED + # header files + include/Acts/Plugins/Onnx/OnnxRuntimeBase.hpp + include/Acts/Plugins/Onnx/MLTrackClassifier.hpp + include/Acts/Plugins/Onnx/AmbiguityTrackClassifier.hpp + include/Acts/Plugins/Onnx/SeedClassifier.hpp + # source files + src/OnnxRuntimeBase.cpp + src/MLTrackClassifier.cpp +) target_include_directories( - ActsPluginOnnx - PUBLIC - $ - $) + ActsPluginOnnx + PUBLIC + $ + $ +) -target_link_libraries( - ActsPluginOnnx - PUBLIC ActsCore OnnxRuntime) +target_link_libraries(ActsPluginOnnx PUBLIC ActsCore OnnxRuntime) install( - TARGETS ActsPluginOnnx - EXPORT ActsPluginOnnxTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsPluginOnnx + EXPORT ActsPluginOnnxTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) -install( - DIRECTORY include/Acts - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Plugins/Podio/CMakeLists.txt b/Plugins/Podio/CMakeLists.txt index 606f488f1f3..39cca792df3 100644 --- a/Plugins/Podio/CMakeLists.txt +++ b/Plugins/Podio/CMakeLists.txt @@ -1,23 +1,18 @@ -add_library( - ActsPluginPodio SHARED - src/PodioUtil.cpp -) +add_library(ActsPluginPodio SHARED src/PodioUtil.cpp) target_include_directories( - ActsPluginPodio - PUBLIC - $ - $) -target_link_libraries( - ActsPluginPodio - PUBLIC ActsCore) + ActsPluginPodio + PUBLIC + $ + $ +) +target_link_libraries(ActsPluginPodio PUBLIC ActsCore) # target_link_libraries(ActsPluginEDM4hep PUBLIC EDM4HEP::edm4hep) - # message(STATUS "IO HANDLERS: ${PODIO_IO_HANDLERS}") -PODIO_GENERATE_DATAMODEL( +podio_generate_datamodel( ActsPodioEdm ${CMAKE_CURRENT_LIST_DIR}/edm.yml headers @@ -25,54 +20,62 @@ PODIO_GENERATE_DATAMODEL( IO_BACKEND_HANDLERS ${PODIO_IO_HANDLERS} ) -PODIO_ADD_DATAMODEL_CORE_LIB(ActsPodioEdm "${headers}" "${sources}") +podio_add_datamodel_core_lib(ActsPodioEdm "${headers}" "${sources}") -target_link_libraries(ActsPluginPodio PUBLIC - ActsPodioEdm - ROOT::Core - podio::podio - podio::podioRootIO +target_link_libraries( + ActsPluginPodio + PUBLIC ActsPodioEdm ROOT::Core podio::podio podio::podioRootIO ) -PODIO_ADD_ROOT_IO_DICT(ActsPodioEdmDict ActsPodioEdm "${headers}" src/selection.xml) +target_compile_options(ActsPodioEdm PRIVATE "-Wno-old-style-cast") + +podio_add_root_io_dict(ActsPodioEdmDict ActsPodioEdm "${headers}" src/selection.xml) add_library(Acts::ActsPodioEdmDict ALIAS ActsPodioEdmDict) +target_compile_options(ActsPodioEdmDict PRIVATE "-Wno-old-style-cast") + install( - TARGETS ActsPodioEdm - EXPORT ActsPodioEdmTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ActsPodioEdm) + TARGETS ActsPodioEdm + EXPORT ActsPodioEdmTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ActsPodioEdm +) install( - DIRECTORY ActsPodioEdm - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ActsPodioEdm) + DIRECTORY ActsPodioEdm + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ActsPodioEdm +) set(install_package_config_dir "${CMAKE_INSTALL_LIBDIR}/cmake/Acts") +install(EXPORT ActsPodioEdmTargets DESTINATION ${install_package_config_dir}) + install( - EXPORT ActsPodioEdmTargets - DESTINATION ${install_package_config_dir}) + TARGETS ActsPluginPodio + EXPORT ActsPluginPodioTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install( - TARGETS ActsPluginPodio - EXPORT ActsPluginPodioTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + TARGETS ActsPodioEdmDict + EXPORT ActsPodioEdmTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + PUBLIC_HEADER + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ActsPodioEdm" + COMPONENT dev +) + install( - DIRECTORY include/Acts - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) - -install(TARGETS ActsPodioEdmDict - EXPORT ActsPodioEdmTargets - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib - PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ActsPodioEdm" - COMPONENT dev) - -install(FILES - "${CMAKE_CURRENT_BINARY_DIR}/ActsPodioEdmDictDict.rootmap" - DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT dev) - -if (${ROOT_VERSION} GREATER 6) - install(FILES - "${CMAKE_CURRENT_BINARY_DIR}/libActsPodioEdmDict_rdict.pcm" - DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT dev) + FILES "${CMAKE_CURRENT_BINARY_DIR}/ActsPodioEdmDictDict.rootmap" + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + COMPONENT dev +) + +if(${ROOT_VERSION} GREATER 6) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/libActsPodioEdmDict_rdict.pcm" + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + COMPONENT dev + ) endif() diff --git a/Plugins/Podio/include/Acts/Plugins/Podio/PodioTrackContainer.hpp b/Plugins/Podio/include/Acts/Plugins/Podio/PodioTrackContainer.hpp index 0079c606bc5..8ef787b32c4 100644 --- a/Plugins/Podio/include/Acts/Plugins/Podio/PodioTrackContainer.hpp +++ b/Plugins/Podio/include/Acts/Plugins/Podio/PodioTrackContainer.hpp @@ -15,10 +15,14 @@ #include "Acts/EventData/detail/DynamicColumn.hpp" #include "Acts/Plugins/Podio/PodioDynamicColumns.hpp" #include "Acts/Plugins/Podio/PodioUtil.hpp" + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wold-style-cast" #include "ActsPodioEdm/ParticleHypothesis.h" #include "ActsPodioEdm/Track.h" #include "ActsPodioEdm/TrackCollection.h" #include "ActsPodioEdm/TrackInfo.h" +#pragma GCC diagnostic pop #include #include diff --git a/Plugins/Podio/include/Acts/Plugins/Podio/PodioTrackStateContainer.hpp b/Plugins/Podio/include/Acts/Plugins/Podio/PodioTrackStateContainer.hpp index 5f47f62eaf8..60951942618 100644 --- a/Plugins/Podio/include/Acts/Plugins/Podio/PodioTrackStateContainer.hpp +++ b/Plugins/Podio/include/Acts/Plugins/Podio/PodioTrackStateContainer.hpp @@ -19,10 +19,14 @@ #include "Acts/Plugins/Podio/PodioUtil.hpp" #include "Acts/Utilities/HashedString.hpp" #include "Acts/Utilities/Helpers.hpp" + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wold-style-cast" #include "ActsPodioEdm/BoundParametersCollection.h" #include "ActsPodioEdm/JacobianCollection.h" #include "ActsPodioEdm/TrackStateCollection.h" #include "ActsPodioEdm/TrackStateInfo.h" +#pragma GCC diagnostic pop #include #include @@ -33,8 +37,6 @@ #include #include -#include "podio/UserDataCollection.h" - namespace Acts { class MutablePodioTrackStateContainer; diff --git a/Plugins/Podio/include/Acts/Plugins/Podio/PodioUtil.hpp b/Plugins/Podio/include/Acts/Plugins/Podio/PodioUtil.hpp index 8dbf1175a95..50a61059bba 100644 --- a/Plugins/Podio/include/Acts/Plugins/Podio/PodioUtil.hpp +++ b/Plugins/Podio/include/Acts/Plugins/Podio/PodioUtil.hpp @@ -19,7 +19,8 @@ #include -#if podio_VERSION_MAJOR >= 1 +#if podio_VERSION_MAJOR >= 1 || \ + (podio_VERSION_MAJOR == 0 && podio_VERSION_MINOR == 99) #include #include #else @@ -41,7 +42,8 @@ namespace PodioUtil { // We want to support podio 0.16 and 1.x for now // See https://github.com/AIDASoft/podio/pull/549 -#if podio_VERSION_MAJOR >= 1 +#if podio_VERSION_MAJOR >= 1 || \ + (podio_VERSION_MAJOR == 0 && podio_VERSION_MINOR == 99) using ROOTWriter = podio::ROOTWriter; using ROOTReader = podio::ROOTReader; #else diff --git a/Plugins/Podio/src/PodioUtil.cpp b/Plugins/Podio/src/PodioUtil.cpp index 8e16e6ae3f4..2fd73c0db3a 100644 --- a/Plugins/Podio/src/PodioUtil.cpp +++ b/Plugins/Podio/src/PodioUtil.cpp @@ -217,9 +217,6 @@ void recoverDynamicColumns( std::unordered_map>& dynamic) { - using load_type = std::unique_ptr (*)( - const podio::CollectionBase*); - // See // https://github.com/AIDASoft/podio/blob/858c0ff0b841705d1b18aafd57569fcbd1beda91/include/podio/UserDataCollection.h#L30-L31 using types = TypeList - $) -target_link_libraries( - ActsPluginTGeo - PUBLIC ActsCore ROOT::Geom) + ActsPluginTGeo + PUBLIC + $ + $ +) +target_link_libraries(ActsPluginTGeo PUBLIC ActsCore ROOT::Geom) install( - TARGETS ActsPluginTGeo - EXPORT ActsPluginTGeoTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install( - DIRECTORY include/Acts - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + TARGETS ActsPluginTGeo + EXPORT ActsPluginTGeoTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/Plugins/TGeo/src/TGeoParser.cpp b/Plugins/TGeo/src/TGeoParser.cpp index abc2d570344..3e757fa75ae 100644 --- a/Plugins/TGeo/src/TGeoParser.cpp +++ b/Plugins/TGeo/src/TGeoParser.cpp @@ -68,23 +68,26 @@ void Acts::TGeoParser::select(Acts::TGeoParser::State& state, bool accept = true; if (!options.parseRanges.empty()) { - auto shape = - dynamic_cast(state.node->GetVolume()->GetShape()); // It uses the bounding box of TGeoBBox - // @TODO this should be replace by a proper TGeo to Acts::VolumeBounds - // and vertices converision which would make a more appropriate parsomg - double dx = options.unit * shape->GetDX(); - double dy = options.unit * shape->GetDY(); - double dz = options.unit * shape->GetDZ(); - for (auto x : std::vector{-dx, dx}) { - for (auto y : std::vector{-dy, dy}) { - for (auto z : std::vector{-dz, dz}) { - Vector3 edge = etrf * Vector3(x, y, z); - for (auto& check : options.parseRanges) { - double val = VectorHelpers::cast(edge, check.first); - if (val < check.second.first || val > check.second.second) { - accept = false; - break; + if (auto* shape = + dynamic_cast(state.node->GetVolume()->GetShape()); + shape != nullptr) { + // @TODO this should be replace by a proper TGeo to Acts::VolumeBounds + // and vertices converision which would make a more appropriate + // parsomg + double dx = options.unit * shape->GetDX(); + double dy = options.unit * shape->GetDY(); + double dz = options.unit * shape->GetDZ(); + for (auto x : std::vector{-dx, dx}) { + for (auto y : std::vector{-dy, dy}) { + for (auto z : std::vector{-dz, dz}) { + Vector3 edge = etrf * Vector3(x, y, z); + for (auto& check : options.parseRanges) { + double val = VectorHelpers::cast(edge, check.first); + if (val < check.second.first || val > check.second.second) { + accept = false; + break; + } } } } diff --git a/Tests/Benchmarks/CMakeLists.txt b/Tests/Benchmarks/CMakeLists.txt index 4955febba09..8906375caea 100644 --- a/Tests/Benchmarks/CMakeLists.txt +++ b/Tests/Benchmarks/CMakeLists.txt @@ -1,23 +1,23 @@ # benchmarks tests are not registered with a common target # add an benchmark executable w/ default dependencies macro(add_benchmark _name) - # automatically prefix the target name - set(_target "ActsBenchmark${_name}") - add_executable(${_target} ${ARGN}) - # define required BOOST_TEST_... macros here to ensure consistent names - target_compile_definitions( - ${_target} - PRIVATE "-DBOOST_TEST_DYN_LINK" "-DBOOST_TEST_MODULE=${_target}") - target_include_directories( - ${_target} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries( - ${_target} - PRIVATE - ActsCore - ActsTestsCommonHelpers - Boost::program_options - Boost::unit_test_framework) + # automatically prefix the target name + set(_target "ActsBenchmark${_name}") + add_executable(${_target} ${ARGN}) + # define required BOOST_TEST_... macros here to ensure consistent names + target_compile_definitions( + ${_target} + PRIVATE "-DBOOST_TEST_DYN_LINK" "-DBOOST_TEST_MODULE=${_target}" + ) + target_include_directories(${_target} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + target_link_libraries( + ${_target} + PRIVATE + ActsCore + ActsTestsCommonHelpers + Boost::program_options + Boost::unit_test_framework + ) endmacro() add_benchmark(AtlasStepper AtlasStepperBenchmark.cpp) diff --git a/Tests/CommonHelpers/CMakeLists.txt b/Tests/CommonHelpers/CMakeLists.txt index fc09c3e5ffa..12d42d851ab 100644 --- a/Tests/CommonHelpers/CMakeLists.txt +++ b/Tests/CommonHelpers/CMakeLists.txt @@ -2,18 +2,22 @@ file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../Data" acts_test_data_dir) add_library( - ActsTestsCommonHelpers SHARED - Acts/Tests/CommonHelpers/DataDirectory.cpp + ActsTestsCommonHelpers + SHARED + Acts/Tests/CommonHelpers/DataDirectory.cpp ) target_compile_definitions( - ActsTestsCommonHelpers - PRIVATE - "ACTS_TEST_DATA_DIR=\"${acts_test_data_dir}\"" - BOOST_FILESYSTEM_NO_DEPRECATED) + ActsTestsCommonHelpers + PRIVATE + "ACTS_TEST_DATA_DIR=\"${acts_test_data_dir}\"" + BOOST_FILESYSTEM_NO_DEPRECATED +) target_include_directories( - ActsTestsCommonHelpers - PUBLIC $) + ActsTestsCommonHelpers + PUBLIC $ +) target_link_libraries( - ActsTestsCommonHelpers - PUBLIC ActsCore - PRIVATE std::filesystem) + ActsTestsCommonHelpers + PUBLIC ActsCore + PRIVATE std::filesystem +) diff --git a/Tests/DownstreamProject/CMakeLists.txt b/Tests/DownstreamProject/CMakeLists.txt index 53b805e674b..27f2f10583b 100644 --- a/Tests/DownstreamProject/CMakeLists.txt +++ b/Tests/DownstreamProject/CMakeLists.txt @@ -4,48 +4,46 @@ project(ActsDownstreamProject) # find all optional components that are build find_package( - Acts CONFIG REQUIRED - COMPONENTS - Core - Fatras - PluginJson - PluginLegacy - PluginTGeo) + Acts + CONFIG + REQUIRED + COMPONENTS Core Fatras PluginJson PluginLegacy PluginTGeo +) # place artifacts in GNU-like paths, e.g. binaries in `/bin` include(GNUInstallDirs) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY + "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}" +) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY + "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}" +) # link with all optional components even when they are not really used # to check e.g. for possible linker issues add_executable(ShowActsVersion ShowActsVersion.cpp) target_link_libraries( - ShowActsVersion - PRIVATE - ActsCore - ActsFatras - ActsPluginJson - ActsPluginLegacy - ActsPluginTGeo) + ShowActsVersion + PRIVATE ActsCore ActsFatras ActsPluginJson ActsPluginLegacy ActsPluginTGeo +) option(DD4HEP "Build with DD4hep" ON) if(DD4HEP) - message(STATUS "Adding DD4hep plugin") - find_package(Acts CONFIG REQUIRED COMPONENTS PluginDD4hep) - target_link_libraries( ShowActsVersion PRIVATE ActsPluginDD4hep) + message(STATUS "Adding DD4hep plugin") + find_package(Acts CONFIG REQUIRED COMPONENTS PluginDD4hep) + target_link_libraries(ShowActsVersion PRIVATE ActsPluginDD4hep) endif() option(PODIO "Build with podio" ON) if(PODIO) - message(STATUS "Adding podio plugin") - find_package(Acts CONFIG REQUIRED COMPONENTS PluginPodio) - target_link_libraries( ShowActsVersion PRIVATE ActsPluginPodio) + message(STATUS "Adding podio plugin") + find_package(Acts CONFIG REQUIRED COMPONENTS PluginPodio) + target_link_libraries(ShowActsVersion PRIVATE ActsPluginPodio) endif() option(EDM4HEP "Build with EDM4hep" ON) if(EDM4HEP) - message(STATUS "Adding EDM4hep plugin") - find_package(Acts CONFIG REQUIRED COMPONENTS PluginEDM4hep) - target_link_libraries( ShowActsVersion PRIVATE ActsPluginEDM4hep) + message(STATUS "Adding EDM4hep plugin") + find_package(Acts CONFIG REQUIRED COMPONENTS PluginEDM4hep) + target_link_libraries(ShowActsVersion PRIVATE ActsPluginEDM4hep) endif() diff --git a/Tests/DownstreamProjectNodeps/CMakeLists.txt b/Tests/DownstreamProjectNodeps/CMakeLists.txt index 4ac08153d63..909fdbd5d2d 100644 --- a/Tests/DownstreamProjectNodeps/CMakeLists.txt +++ b/Tests/DownstreamProjectNodeps/CMakeLists.txt @@ -6,8 +6,15 @@ find_package(Acts CONFIG REQUIRED COMPONENTS Core) # place artifacts in GNU-like paths, e.g. binaries in `/bin` include(GNUInstallDirs) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY + "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}" +) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY + "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}" +) add_executable(ShowActsVersion ShowActsVersion.cpp) -target_link_libraries(ShowActsVersion PRIVATE ActsCore Boost::boost Eigen3::Eigen) +target_link_libraries( + ShowActsVersion + PRIVATE ActsCore Boost::boost Eigen3::Eigen +) diff --git a/Tests/IntegrationTests/CMakeLists.txt b/Tests/IntegrationTests/CMakeLists.txt index d62f027fa95..fb5c84492d2 100644 --- a/Tests/IntegrationTests/CMakeLists.txt +++ b/Tests/IntegrationTests/CMakeLists.txt @@ -7,27 +7,27 @@ add_custom_target(integrationtests) # extended by setting the `integrationtest_extra_libraries` variables before # calling the macro. macro(add_integrationtest _name) - # automatically prefix the target name - set(_target "ActsIntegrationTest${_name}") - add_executable(${_target} ${ARGN}) - # define required BOOST_TEST_... macros here to ensure consistent names - target_compile_definitions( - ${_target} - PRIVATE "-DBOOST_TEST_DYN_LINK" "-DBOOST_TEST_MODULE=${_target}") - target_include_directories( - ${_target} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries( - ${_target} - PRIVATE - ActsCore - ActsTestsCommonHelpers - Boost::unit_test_framework - ${integrationtest_extra_libraries}) - # register as integration test executable - set(_run "RunIntegrationTest${_name}") - add_custom_target(${_run} COMMAND ${_target}) - add_dependencies(integrationtests ${_run}) + # automatically prefix the target name + set(_target "ActsIntegrationTest${_name}") + add_executable(${_target} ${ARGN}) + # define required BOOST_TEST_... macros here to ensure consistent names + target_compile_definitions( + ${_target} + PRIVATE "-DBOOST_TEST_DYN_LINK" "-DBOOST_TEST_MODULE=${_target}" + ) + target_include_directories(${_target} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + target_link_libraries( + ${_target} + PRIVATE + ActsCore + ActsTestsCommonHelpers + Boost::unit_test_framework + ${integrationtest_extra_libraries} + ) + # register as integration test executable + set(_run "RunIntegrationTest${_name}") + add_custom_target(${_run} COMMAND ${_target}) + add_dependencies(integrationtests ${_run}) endmacro() add_integrationtest(InterpolatedSolenoidBField InterpolatedSolenoidBFieldTest.cpp) diff --git a/Tests/UnitTests/CMakeLists.txt b/Tests/UnitTests/CMakeLists.txt index f986c6f5418..daff8b028e9 100644 --- a/Tests/UnitTests/CMakeLists.txt +++ b/Tests/UnitTests/CMakeLists.txt @@ -7,28 +7,27 @@ add_custom_target(unit_tests) macro(add_unittest _name _source) - # automatically prefix the target name - set(_target "ActsUnitTest${_name}") - add_executable(${_target} ${_source}) - # define required BOOST_TEST_... macros here to ensure consistent names - target_compile_definitions( - ${_target} - PRIVATE "-DBOOST_TEST_DYN_LINK") - set_source_files_properties(${_source} PROPERTIES - COMPILE_DEFINITIONS "BOOST_TEST_MODULE=${_target}") - target_include_directories( - ${_target} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries( - ${_target} - PRIVATE - ActsCore - ActsTestsCommonHelpers - Boost::unit_test_framework - ${unittest_extra_libraries}) - # register as unittest executable - add_test(NAME ${_name} COMMAND ${_target}) - add_dependencies(unit_tests ${_target}) + # automatically prefix the target name + set(_target "ActsUnitTest${_name}") + add_executable(${_target} ${_source}) + # define required BOOST_TEST_... macros here to ensure consistent names + target_compile_definitions(${_target} PRIVATE "-DBOOST_TEST_DYN_LINK") + set_source_files_properties( + ${_source} + PROPERTIES COMPILE_DEFINITIONS "BOOST_TEST_MODULE=${_target}" + ) + target_include_directories(${_target} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + target_link_libraries( + ${_target} + PRIVATE + ActsCore + ActsTestsCommonHelpers + Boost::unit_test_framework + ${unittest_extra_libraries} + ) + # register as unittest executable + add_test(NAME ${_name} COMMAND ${_target}) + add_dependencies(unit_tests ${_target}) endmacro() # This function adds a non compile test. To this end it @@ -41,74 +40,90 @@ endmacro() # - Adds a closure test where it's supposed to actually compile if all of the # critical sections are removed function(add_non_compile_test name src) - - # Don't add anything if the corresponding flag is not set - if(NOT ACTS_BUILD_NONCOMPILE_TESTS) - return() - endif() - - # Figure out where to put the output file - cmake_path(ABSOLUTE_PATH src) - get_filename_component(_filename ${src} NAME) - set(_processed_source "${CMAKE_CURRENT_BINARY_DIR}/${_filename}") - - # Add a build step to generate the source file by invoking a CMake script - add_custom_command( - OUTPUT ${_processed_source} - DEPENDS ${src} - COMMAND "${CMAKE_COMMAND}" - -DINPUT_FILE=${src} - -DOUTPUT_FILE=${_processed_source} - -P ${CMAKE_SOURCE_DIR}/cmake/ActsGenerateNonCompileTest.cmake - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) - add_custom_target( - "${name}_generated_source" - DEPENDS ${_processed_source} - ) - - # Create the executable target, add the generated source code as a - # dependencies, so that it's generated when required. - set(test "ActsNonCompileTest${name}Closure") - set(target "${test}_Executable") - add_executable(${target} ${_processed_source}) - target_link_libraries(${target} PUBLIC ActsCore ActsTestsCommonHelpers) - add_dependencies(${target} "${name}_generated_source") - - # Don't build this target by default - set_target_properties(${target} PROPERTIES - EXCLUDE_FROM_ALL ON - EXCLUDE_FROM_DEFAULT_BUILD ON) - - # Add the test that calls into CMake to build the target. This one we expect to succeed - add_test(NAME ${test} - COMMAND ${CMAKE_COMMAND} --build . --target ${target} --config $ - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) - - # Loop over critical section markers and add one pair of executable targets and - # and test jobs. The test jobs are flipped, so success is failure. - file(READ ${src} content) - string(REGEX MATCHALL "ACTS_DOES_NOT_COMPILE_BEGIN\\(([A-Za-z0-9]+)\\)" matches ${content}) - foreach(match ${matches}) - string(REGEX REPLACE "ACTS_DOES_NOT_COMPILE_BEGIN\\(([A-Za-z0-9]+)\\)" "\\1" match ${match}) - - set(test "ActsNonCompileTest${name}${match}") + # Don't add anything if the corresponding flag is not set + if(NOT ACTS_BUILD_NONCOMPILE_TESTS) + return() + endif() + + # Figure out where to put the output file + cmake_path(ABSOLUTE_PATH src) + get_filename_component(_filename ${src} NAME) + set(_processed_source "${CMAKE_CURRENT_BINARY_DIR}/${_filename}") + + # Add a build step to generate the source file by invoking a CMake script + add_custom_command( + OUTPUT ${_processed_source} + DEPENDS ${src} + COMMAND + "${CMAKE_COMMAND}" -DINPUT_FILE=${src} + -DOUTPUT_FILE=${_processed_source} -P + ${CMAKE_SOURCE_DIR}/cmake/ActsGenerateNonCompileTest.cmake + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) + add_custom_target("${name}_generated_source" DEPENDS ${_processed_source}) + + # Create the executable target, add the generated source code as a + # dependencies, so that it's generated when required. + set(test "ActsNonCompileTest${name}Closure") set(target "${test}_Executable") add_executable(${target} ${_processed_source}) target_link_libraries(${target} PUBLIC ActsCore ActsTestsCommonHelpers) - target_compile_definitions(${target} PRIVATE "-D${match}") add_dependencies(${target} "${name}_generated_source") - set_target_properties(${target} PROPERTIES - EXCLUDE_FROM_ALL ON - EXCLUDE_FROM_DEFAULT_BUILD ON) - - add_test(NAME ${test} - COMMAND ${CMAKE_COMMAND} --build . --target ${target} --config $ - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) - set_tests_properties(${test} PROPERTIES WILL_FAIL ON) - endforeach() - + # Don't build this target by default + set_target_properties( + ${target} + PROPERTIES EXCLUDE_FROM_ALL ON EXCLUDE_FROM_DEFAULT_BUILD ON + ) + + # Add the test that calls into CMake to build the target. This one we expect to succeed + add_test( + NAME ${test} + COMMAND + ${CMAKE_COMMAND} --build . --target ${target} --config + $ + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) + + # Loop over critical section markers and add one pair of executable targets and + # and test jobs. The test jobs are flipped, so success is failure. + file(READ ${src} content) + string( + REGEX MATCHALL + "ACTS_DOES_NOT_COMPILE_BEGIN\\(([A-Za-z0-9]+)\\)" + matches + ${content} + ) + foreach(match ${matches}) + string( + REGEX REPLACE + "ACTS_DOES_NOT_COMPILE_BEGIN\\(([A-Za-z0-9]+)\\)" + "\\1" + match + ${match} + ) + + set(test "ActsNonCompileTest${name}${match}") + set(target "${test}_Executable") + add_executable(${target} ${_processed_source}) + target_link_libraries(${target} PUBLIC ActsCore ActsTestsCommonHelpers) + target_compile_definitions(${target} PRIVATE "-D${match}") + add_dependencies(${target} "${name}_generated_source") + + set_target_properties( + ${target} + PROPERTIES EXCLUDE_FROM_ALL ON EXCLUDE_FROM_DEFAULT_BUILD ON + ) + + add_test( + NAME ${test} + COMMAND + ${CMAKE_COMMAND} --build . --target ${target} --config + $ + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) + set_tests_properties(${test} PROPERTIES WILL_FAIL ON) + endforeach() endfunction() add_subdirectory(Core) diff --git a/Tests/UnitTests/Core/Geometry/CylinderVolumeStackTests.cpp b/Tests/UnitTests/Core/Geometry/CylinderVolumeStackTests.cpp index 93141684032..fcdd21b931c 100644 --- a/Tests/UnitTests/Core/Geometry/CylinderVolumeStackTests.cpp +++ b/Tests/UnitTests/Core/Geometry/CylinderVolumeStackTests.cpp @@ -868,7 +868,7 @@ BOOST_DATA_TEST_CASE(Baseline, std::transform( volumes.begin(), volumes.end(), std::back_inserter(originalBounds), [](const auto& vol) { - return *dynamic_cast(&vol->volumeBounds()); + return dynamic_cast(vol->volumeBounds()); }); if (f < 0.0) { diff --git a/Tests/UnitTests/Core/MagneticField/CMakeLists.txt b/Tests/UnitTests/Core/MagneticField/CMakeLists.txt index f207d5d6228..60a829bf548 100644 --- a/Tests/UnitTests/Core/MagneticField/CMakeLists.txt +++ b/Tests/UnitTests/Core/MagneticField/CMakeLists.txt @@ -1,5 +1,4 @@ add_unittest(ConstantBField ConstantBFieldTests.cpp) add_unittest(InterpolatedBFieldMap InterpolatedBFieldMapTests.cpp) -#add_unittest(MagneticFieldInterfaceConsistency MagneticFieldInterfaceConsistencyTests.cpp) add_unittest(SolenoidBField SolenoidBFieldTests.cpp) add_unittest(MagneticFieldProvider MagneticFieldProviderTests.cpp) diff --git a/Tests/UnitTests/Core/MagneticField/MagneticFieldInterfaceConsistencyTests.cpp b/Tests/UnitTests/Core/MagneticField/MagneticFieldInterfaceConsistencyTests.cpp deleted file mode 100644 index f6d2a153c5b..00000000000 --- a/Tests/UnitTests/Core/MagneticField/MagneticFieldInterfaceConsistencyTests.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// This file is part of the Acts project. -// -// Copyright (C) 2018 CERN for the benefit of the Acts project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#include - -#include "Acts/Definitions/Algebra.hpp" -#include "Acts/Definitions/Units.hpp" -#include "Acts/MagneticField/ConstantBField.hpp" -#include "Acts/MagneticField/InterpolatedBFieldMap.hpp" -#include "Acts/MagneticField/MagneticFieldContext.hpp" -#include "Acts/MagneticField/MagneticFieldProvider.hpp" -#include "Acts/MagneticField/SolenoidBField.hpp" - -namespace Acts::Test { - -// Create a test context -MagneticFieldContext mfContext = MagneticFieldContext(); - -/// This is the canonical interface that all field implementations -/// need to comply with. -/// This test group is should include ALL field implementations, -/// to make sure they conform to the interface, even if they are -/// not implicitly tested by some of the other tests (e.g. Propagation) -/// The function does not assert any functionality, it just ensures -/// the interface compiles -template -void testInterfaceConsistency(const BField_t& field) { - using Cache_t = typename BField_t::Cache; - Vector3 pos(0, 0, 0); - Vector3 B; - ActsMatrix<3, 3> gradient; - - // test interface method without cache - field.getField(pos); - field.getFieldGradient(pos, gradient); - - // test interface method with cache - Cache_t cache(mfContext); - field.getField(pos, cache); - field.getFieldGradient(pos, gradient, cache); -} - -BOOST_AUTO_TEST_CASE(TestConstantBFieldInterfaceConsistency) { - ConstantBField field(1, 1, 1); - testInterfaceConsistency(field); -} - -BOOST_AUTO_TEST_CASE(TestSolenoidBFieldInterfaceConsistency) { - SolenoidBField field({100, 1000, 20, 5}); - testInterfaceConsistency(field); -} - -BOOST_AUTO_TEST_CASE(TestInterpolatedBFieldMapInterfaceConsistency) { - // define dummy mapper and field cell, we don't need them to do anything - struct DummyFieldCell { - Vector3 getField(const Vector3&) const { return {0, 0, 0}; } - bool isInside(const Vector3&) const { return true; } - }; - - struct DummyMapper : DummyFieldCell { - using FieldCell = DummyFieldCell; - - DummyFieldCell getFieldCell(const Vector3&) const { - return DummyFieldCell(); - } - std::vector getNBins() const { return {42}; } - std::vector getMin() const { return {5}; } - std::vector getMax() const { return {15}; } - }; - - DummyMapper m; - InterpolatedBFieldMap::Config config(std::move(m)); - config.scale = 1.; - - // create BField service - InterpolatedBFieldMap b(std::move(config)); - - testInterfaceConsistency(b); -} - -} // namespace Acts::Test diff --git a/Tests/UnitTests/Core/Material/GridSurfaceMaterialTests.cpp b/Tests/UnitTests/Core/Material/GridSurfaceMaterialTests.cpp index 999f89ea85b..910f6c9960f 100644 --- a/Tests/UnitTests/Core/Material/GridSurfaceMaterialTests.cpp +++ b/Tests/UnitTests/Core/Material/GridSurfaceMaterialTests.cpp @@ -62,7 +62,6 @@ BOOST_AUTO_TEST_CASE(GridIndexedMaterial_invalid_bound2Grid_Unconnected) { using EqBound = Acts::GridAxisGenerators::EqBound; using EqGrid = EqBound::grid_type; - using Point = EqGrid::point_t; EqBound eqBound{{0., 5.}, 5}; EqGrid eqGrid{eqBound()}; @@ -86,7 +85,6 @@ BOOST_AUTO_TEST_CASE(GridIndexedMaterial_invalid_global2Grid_Unconnected) { using EqBound = Acts::GridAxisGenerators::EqBound; using EqGrid = EqBound::grid_type; - using Point = EqGrid::point_t; EqBound eqBound{{0., 5.}, 5}; EqGrid eqGrid{eqBound()}; diff --git a/Tests/UnitTests/Core/Material/MaterialInteractionAssignmentTests.cpp b/Tests/UnitTests/Core/Material/MaterialInteractionAssignmentTests.cpp index 1cf35a058af..5d6101cd3be 100644 --- a/Tests/UnitTests/Core/Material/MaterialInteractionAssignmentTests.cpp +++ b/Tests/UnitTests/Core/Material/MaterialInteractionAssignmentTests.cpp @@ -277,8 +277,6 @@ BOOST_AUTO_TEST_CASE(AssignWithPathLength) { Surface::makeShared(Transform3::Identity(), 20.0, 100.0); surface->assignGeometryId(GeometryIdentifier().setSensitive(1)); - using SurfaceHit = std::tuple; - Vector3 position = {20., 10., 0.}; Vector3 direction = position.normalized(); diff --git a/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp b/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp index be4b0d81661..9ff22be2697 100644 --- a/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp @@ -59,7 +59,8 @@ const MagneticFieldContext magCtx; const GeometryContext geoCtx; using MultiStepperLoop = - MultiEigenStepperLoop>; + MultiEigenStepperLoop, + MaxWeightReducerLoop>; using SingleStepper = EigenStepper>; const double defaultStepSize = 123.; @@ -134,6 +135,86 @@ auto makeDefaultBoundPars(bool cov = true, std::size_t n = 4, return MultiComponentBoundTrackParameters(surface, cmps, particleHypothesis); } +////////////////////// +/// Test the reducers +////////////////////// +BOOST_AUTO_TEST_CASE(test_weighted_reducer) { + // Can use this multistepper since we only care about the state which is + // invariant + using MultiState = typename MultiStepperLoop::State; + + constexpr std::size_t N = 4; + const auto multi_pars = makeDefaultBoundPars(false, N); + + MultiState state(geoCtx, magCtx, defaultBField, multi_pars, defaultStepSize); + SingleStepper singleStepper(defaultBField); + + WeightedComponentReducerLoop reducer{}; + + Acts::Vector3 pos = Acts::Vector3::Zero(); + Acts::Vector3 dir = Acts::Vector3::Zero(); + for (const auto &[sstate, weight, _] : state.components) { + pos += weight * singleStepper.position(sstate); + dir += weight * singleStepper.direction(sstate); + } + dir.normalize(); + + BOOST_CHECK_EQUAL(reducer.position(state), pos); + BOOST_CHECK_EQUAL(reducer.direction(state), dir); +} + +BOOST_AUTO_TEST_CASE(test_max_weight_reducer) { + // Can use this multistepper since we only care about the state which is + // invariant + using MultiState = typename MultiStepperLoop::State; + + constexpr std::size_t N = 4; + const auto multi_pars = makeDefaultBoundPars(false, N); + MultiState state(geoCtx, magCtx, defaultBField, multi_pars, defaultStepSize); + SingleStepper singleStepper(defaultBField); + + double w = 0.1; + double wSum = 0.0; + for (auto &[sstate, weight, _] : state.components) { + weight = w; + wSum += w; + w += 0.1; + } + BOOST_CHECK_EQUAL(wSum, 1.0); + BOOST_CHECK_EQUAL(state.components.back().weight, 0.4); + + MaxWeightReducerLoop reducer{}; + BOOST_CHECK_EQUAL(reducer.position(state), + singleStepper.position(state.components.back().state)); + BOOST_CHECK_EQUAL(reducer.direction(state), + singleStepper.direction(state.components.back().state)); +} + +BOOST_AUTO_TEST_CASE(test_max_momentum_reducer) { + // Can use this multistepper since we only care about the state which is + // invariant + using MultiState = typename MultiStepperLoop::State; + + constexpr std::size_t N = 4; + const auto multi_pars = makeDefaultBoundPars(false, N); + MultiState state(geoCtx, magCtx, defaultBField, multi_pars, defaultStepSize); + SingleStepper singleStepper(defaultBField); + + double p = 1.0; + double q = 1.0; + for (auto &[sstate, weight, _] : state.components) { + sstate.pars[eFreeQOverP] = q / p; + p *= 2.0; + } + BOOST_CHECK_EQUAL(state.components.back().state.pars[eFreeQOverP], q / 8.0); + + MaxMomentumReducerLoop reducer{}; + BOOST_CHECK_EQUAL(reducer.position(state), + singleStepper.position(state.components.back().state)); + BOOST_CHECK_EQUAL(reducer.direction(state), + singleStepper.direction(state.components.back().state)); +} + ////////////////////////////////////////////////////// /// Test the construction of the MultiStepper::State ////////////////////////////////////////////////////// @@ -751,9 +832,11 @@ void propagator_instatiation_test_function() { decltype(propagator.template propagate( pars, *surface, options)); + static_assert(!std::is_same_v); // Instantiate without target - using tybe_b = decltype(propagator.propagate(pars, options)); + using type_b = decltype(propagator.propagate(pars, options)); + static_assert(!std::is_same_v); } BOOST_AUTO_TEST_CASE(propagator_instatiation_test) { diff --git a/Tests/UnitTests/Core/Utilities/CMakeLists.txt b/Tests/UnitTests/Core/Utilities/CMakeLists.txt index af362d6d564..30bfda33fc3 100644 --- a/Tests/UnitTests/Core/Utilities/CMakeLists.txt +++ b/Tests/UnitTests/Core/Utilities/CMakeLists.txt @@ -39,14 +39,20 @@ add_unittest(TypeTraits TypeTraitsTest.cpp) add_unittest(UnitVectors UnitVectorsTests.cpp) add_unittest(Delegate DelegateTests.cpp) add_unittest(HashedString HashedStringTests.cpp) -if (ACTS_BUILD_CUDA_FEATURES) - add_unittest(Cuda CudaTests.cu) - add_unittest(CudaMostSimplified CudaMostSimplifiedTests.cu) +if(ACTS_BUILD_CUDA_FEATURES) + add_unittest(Cuda CudaTests.cu) + add_unittest(CudaMostSimplified CudaMostSimplifiedTests.cu) endif() add_unittest(Any AnyTests.cpp) add_unittest(AnyDebug AnyTests.cpp) -target_compile_definitions(ActsUnitTestAnyDebug PRIVATE _ACTS_ANY_ENABLE_VERBOSE _ACTS_ANY_ENABLE_DEBUG _ACTS_ANY_ENABLE_TRACK_ALLOCATIONS) +target_compile_definitions( + ActsUnitTestAnyDebug + PRIVATE + _ACTS_ANY_ENABLE_VERBOSE + _ACTS_ANY_ENABLE_DEBUG + _ACTS_ANY_ENABLE_TRACK_ALLOCATIONS +) add_unittest(ParticleData ParticleDataTests.cpp) add_unittest(Zip ZipTests.cpp) diff --git a/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp b/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp index 5b4ba624346..411ddda7cf2 100644 --- a/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp @@ -101,8 +101,6 @@ BOOST_AUTO_TEST_CASE(zscan_finder_test) { // Set up propagator with void navigator auto propagator = std::make_shared(stepper); - using BilloirFitter = FullBilloirVertexFitter; - // Create perigee surface std::shared_ptr perigeeSurface = Surface::makeShared(Vector3(0., 0., 0.)); @@ -220,8 +218,6 @@ BOOST_AUTO_TEST_CASE(zscan_finder_usertrack_test) { // Set up propagator with void navigator auto propagator = std::make_shared(stepper); - using BilloirFitter = FullBilloirVertexFitter; - // Create perigee surface std::shared_ptr perigeeSurface = Surface::makeShared(Vector3(0., 0., 0.)); diff --git a/Tests/UnitTests/Plugins/Cuda/Seeding/CMakeLists.txt b/Tests/UnitTests/Plugins/Cuda/Seeding/CMakeLists.txt index 8cc71759a99..20148fcae23 100644 --- a/Tests/UnitTests/Plugins/Cuda/Seeding/CMakeLists.txt +++ b/Tests/UnitTests/Plugins/Cuda/Seeding/CMakeLists.txt @@ -1,2 +1,5 @@ add_executable(ActsUnitTestSeedFinderCuda SeedFinderCudaTest.cpp) -target_link_libraries(ActsUnitTestSeedFinderCuda PRIVATE ${unittest_extra_libraries} Boost::boost) +target_link_libraries( + ActsUnitTestSeedFinderCuda + PRIVATE ${unittest_extra_libraries} Boost::boost +) diff --git a/Tests/UnitTests/Plugins/Cuda/Seeding2/CMakeLists.txt b/Tests/UnitTests/Plugins/Cuda/Seeding2/CMakeLists.txt index 6cecfc515e4..94709ec6bf3 100644 --- a/Tests/UnitTests/Plugins/Cuda/Seeding2/CMakeLists.txt +++ b/Tests/UnitTests/Plugins/Cuda/Seeding2/CMakeLists.txt @@ -1,12 +1,22 @@ - -add_executable(ActsUnitTestSeedFinderCuda2 - main.cpp - CommandLineArguments.hpp CommandLineArguments.cpp - ReadSeedFile.hpp ReadSeedFile.cpp - TestSpacePoint.hpp TestSpacePoint.cpp - TestDeviceCuts.hpp TestDeviceCuts.cu - TestHostCuts.hpp TestHostCuts.cpp) -target_link_libraries(ActsUnitTestSeedFinderCuda2 - PRIVATE Boost::program_options ActsCore ActsPluginCuda2) -set_target_properties(ActsUnitTestSeedFinderCuda2 - PROPERTIES CUDA_SEPARABLE_COMPILATION ON) +add_executable( + ActsUnitTestSeedFinderCuda2 + main.cpp + CommandLineArguments.hpp + CommandLineArguments.cpp + ReadSeedFile.hpp + ReadSeedFile.cpp + TestSpacePoint.hpp + TestSpacePoint.cpp + TestDeviceCuts.hpp + TestDeviceCuts.cu + TestHostCuts.hpp + TestHostCuts.cpp +) +target_link_libraries( + ActsUnitTestSeedFinderCuda2 + PRIVATE Boost::program_options ActsCore ActsPluginCuda2 +) +set_target_properties( + ActsUnitTestSeedFinderCuda2 + PROPERTIES CUDA_SEPARABLE_COMPILATION ON +) diff --git a/Tests/UnitTests/Plugins/DD4hep/CMakeLists.txt b/Tests/UnitTests/Plugins/DD4hep/CMakeLists.txt index 0dfe2a66901..912aab59887 100644 --- a/Tests/UnitTests/Plugins/DD4hep/CMakeLists.txt +++ b/Tests/UnitTests/Plugins/DD4hep/CMakeLists.txt @@ -1,46 +1,74 @@ add_library( - ActsTestsDD4hepFactories SHARED + ActsTestsDD4hepFactories + SHARED DD4hepTestsHelper.cpp LayerFactory.cpp - PrimitivesFactory.cpp) + PrimitivesFactory.cpp +) target_include_directories( ActsTestsDD4hepFactories - PUBLIC $) + PUBLIC $ +) target_link_libraries( - ActsTestsDD4hepFactories PUBLIC ActsPluginDD4hep DD4hep::DDCore) + ActsTestsDD4hepFactories + PUBLIC ActsPluginDD4hep DD4hep::DDCore +) # Not sure why this needs to be set, but dd4hep fails to compile otherwise set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) -set_target_properties(ActsTestsDD4hepFactories PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +set_target_properties( + ActsTestsDD4hepFactories + PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) dd4hep_set_version(ActsTestsDD4hepFactories MAJOR 1 MINOR 0 PATCH 0) dd4hep_generate_rootmap(ActsTestsDD4hepFactories) find_library(dd4hep_core_library DDCore) if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24.0") - set(factory_path "$>") + set(factory_path + "$>" + ) else() - set(factory_path "${CMAKE_CURRENT_BINARY_DIR}") + set(factory_path "${CMAKE_CURRENT_BINARY_DIR}") endif() - -if (NOT "${dd4hep_core_library}" STREQUAL "dd4hep_core_library-NOTFOUND") - cmake_path(GET dd4hep_core_library PARENT_PATH DD4HEP_LIBRARY_PATH) - # set test library dependencies - set(unittest_extra_libraries ActsTestsDD4hepFactories ActsPluginDD4hep) - set(dd4hep_tests DD4hepDetectorElement DD4hepCylinderLayerStructure DD4hepDiscLayerStructure DD4hepCylindricalDetector) - foreach(_test ${dd4hep_tests}) - add_unittest(${_test} ${_test}Tests.cpp) - add_dependencies(ActsUnitTest${_test} Components_ActsTestsDD4hepFactories) - if(APPLE) - set_property(TEST ${_test} PROPERTY ENVIRONMENT - "DYLD_LIBRARY_PATH=${DD4HEP_LIBRARY_PATH}:${factory_path}:$ENV{DYLD_LIBRARY_PATH}") - else() - set_property(TEST ${_test} PROPERTY ENVIRONMENT - "LD_LIBRARY_PATH=${DD4HEP_LIBRARY_PATH}:${factory_path}:$ENV{LD_LIBRARY_PATH}") - endif() - endforeach() +if(NOT "${dd4hep_core_library}" STREQUAL "dd4hep_core_library-NOTFOUND") + cmake_path(GET dd4hep_core_library PARENT_PATH DD4HEP_LIBRARY_PATH) + # set test library dependencies + set(unittest_extra_libraries ActsTestsDD4hepFactories ActsPluginDD4hep) + set(dd4hep_tests + DD4hepDetectorElement + DD4hepCylinderLayerStructure + DD4hepDiscLayerStructure + DD4hepCylindricalDetector + ) + foreach(_test ${dd4hep_tests}) + add_unittest(${_test} ${_test}Tests.cpp) + add_dependencies( + ActsUnitTest${_test} + Components_ActsTestsDD4hepFactories + ) + if(APPLE) + set_property( + TEST ${_test} + PROPERTY + ENVIRONMENT + "DYLD_LIBRARY_PATH=${DD4HEP_LIBRARY_PATH}:${factory_path}:$ENV{DYLD_LIBRARY_PATH}" + ) + else() + set_property( + TEST ${_test} + PROPERTY + ENVIRONMENT + "LD_LIBRARY_PATH=${DD4HEP_LIBRARY_PATH}:${factory_path}:$ENV{LD_LIBRARY_PATH}" + ) + endif() + endforeach() else() - message(WARNING "DD4hep libraries not found, DD4hep tests will not be built.") + message( + WARNING + "DD4hep libraries not found, DD4hep tests will not be built." + ) endif() diff --git a/Tests/UnitTests/Plugins/EDM4hep/ConvertTrackEDM4hepTest.cpp b/Tests/UnitTests/Plugins/EDM4hep/ConvertTrackEDM4hepTest.cpp index d3636eef0e2..ffd2ef2e7d4 100644 --- a/Tests/UnitTests/Plugins/EDM4hep/ConvertTrackEDM4hepTest.cpp +++ b/Tests/UnitTests/Plugins/EDM4hep/ConvertTrackEDM4hepTest.cpp @@ -263,7 +263,6 @@ BOOST_AUTO_TEST_CASE(RoundTripTests) { auto trackStateContainer = std::make_shared(); TrackContainer tracks(trackContainer, trackStateContainer); - using mutable_proxy_t = decltype(tracks)::TrackProxy; using const_proxy_t = decltype(tracks)::ConstTrackProxy; std::mt19937 rng{42}; diff --git a/Tests/UnitTests/Plugins/FpeMonitoring/CMakeLists.txt b/Tests/UnitTests/Plugins/FpeMonitoring/CMakeLists.txt index bef6d56adfb..9c0957c49f7 100644 --- a/Tests/UnitTests/Plugins/FpeMonitoring/CMakeLists.txt +++ b/Tests/UnitTests/Plugins/FpeMonitoring/CMakeLists.txt @@ -1,7 +1,10 @@ set(unittest_extra_libraries ActsPluginFpeMonitoring) if(NOT APPLE) - # This test doesn't make sense on macOS at this time - add_unittest(FpeMonitor FpeMonitorTests.cpp) - set_tests_properties(FpeMonitor PROPERTIES ENVIRONMENT BOOST_TEST_CATCH_SYSTEM_ERRORS=no) + # This test doesn't make sense on macOS at this time + add_unittest(FpeMonitor FpeMonitorTests.cpp) + set_tests_properties( + FpeMonitor + PROPERTIES ENVIRONMENT BOOST_TEST_CATCH_SYSTEM_ERRORS=no + ) endif() diff --git a/Tests/UnitTests/Plugins/TGeo/CMakeLists.txt b/Tests/UnitTests/Plugins/TGeo/CMakeLists.txt index dff88398c8a..5592d6b4849 100644 --- a/Tests/UnitTests/Plugins/TGeo/CMakeLists.txt +++ b/Tests/UnitTests/Plugins/TGeo/CMakeLists.txt @@ -6,7 +6,7 @@ add_unittest(TGeoTrd1Conversion TGeoTrd1ConversionTests.cpp) add_unittest(TGeoTrd2Conversion TGeoTrd2ConversionTests.cpp) add_unittest(TGeoTubeConversion TGeoTubeConversionTests.cpp) add_unittest(TGeoLayerBuilder TGeoLayerBuilderTests.cpp) -if (${ROOT_VERSION} VERSION_GREATER "6.25.01") +if(${ROOT_VERSION} VERSION_GREATER "6.25.01") add_unittest(TGeoMaterialConverter TGeoMaterialConverterTests.cpp) endif() add_unittest(TGeoParser TGeoParserTests.cpp) diff --git a/cmake/ActsCompilerOptions.cmake b/cmake/ActsCompilerOptions.cmake index ea1b505c3d5..64467c64665 100644 --- a/cmake/ActsCompilerOptions.cmake +++ b/cmake/ActsCompilerOptions.cmake @@ -1,34 +1,54 @@ # Acts compiler flags -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build type configuration" FORCE) - message(STATUS "Setting default build type: ${CMAKE_BUILD_TYPE}") +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE + RelWithDebInfo + CACHE STRING + "Build type configuration" + FORCE + ) + message(STATUS "Setting default build type: ${CMAKE_BUILD_TYPE}") endif() -set(cxx_flags "-Wall -Wextra -Wpedantic -Wshadow -Wno-unused-local-typedefs") +set(cxx_flags + "-Wall -Wextra -Wpedantic -Wshadow -Wzero-as-null-pointer-constant -Wold-style-cast" +) # This adds some useful conversion checks like float-to-bool, float-to-int, etc. # However, at the moment this is only added to clang builds, since GCC's -Wfloat-conversion # is much more aggressive and also triggers on e.g., double-to-float if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(cxx_flags "${cxx_flags} -Wfloat-conversion") + set(cxx_flags "${cxx_flags} -Wfloat-conversion") endif() +# -Wnull-dereference gets applied to -isystem includes in GCC13, +# which causes lots of warnings in code we have no control over +if( + CMAKE_CXX_COMPILER_ID MATCHES "Clang" + OR ( + CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 12 + ) +) + set(cxx_flags "${cxx_flags} -Wnull-dereference") +endif() set(ACTS_CXX_STANDARD 20) set(ACTS_CXX_STANDARD_FEATURE cxx_std_20) if(DEFINED CMAKE_CXX_STANDARD) - if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) - set(ACTS_CXX_STANDARD ${CMAKE_CXX_STANDARD}) - set(ACTS_CXX_STANDARD_FEATURE "cxx_std_${CMAKE_CXX_STANDARD}") - else() - message(SEND_ERROR "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}, but ACTS requires C++ >=20") - endif() + if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20) + set(ACTS_CXX_STANDARD ${CMAKE_CXX_STANDARD}) + set(ACTS_CXX_STANDARD_FEATURE "cxx_std_${CMAKE_CXX_STANDARD}") + else() + message( + SEND_ERROR + "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}, but ACTS requires C++ >=20" + ) + endif() endif() - if(ACTS_ENABLE_CPU_PROFILING OR ACTS_ENABLE_MEMORY_PROFILING) - message(STATUS "Added debug symbol compile flag") - set(cxx_flags "${cxx_flags} ${CMAKE_CXX_FLAGS_DEBUG_INIT}") + message(STATUS "Added debug symbol compile flag") + set(cxx_flags "${cxx_flags} ${CMAKE_CXX_FLAGS_DEBUG_INIT}") endif() # assign to global CXX flags diff --git a/cmake/ActsComponentsHelpers.cmake b/cmake/ActsComponentsHelpers.cmake index 80e421ffe93..e0720e08595 100644 --- a/cmake/ActsComponentsHelpers.cmake +++ b/cmake/ActsComponentsHelpers.cmake @@ -29,16 +29,21 @@ set(_components) # add an optional directory and register its name as a component function(add_component_if path name) - file(RELATIVE_PATH _rel ${PROJECT_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/${path}") - if(${ARGN}) - list(APPEND _components "${name}") - # propagate variable outside function scope - set(_components "${_components}" PARENT_SCOPE) - message(STATUS "Enable component '${name}' in '${_rel}'") - add_subdirectory(${path}) - else() - message(STATUS "Ignore component '${name}' in '${_rel}'") - endif() + file( + RELATIVE_PATH + _rel + ${PROJECT_SOURCE_DIR} + "${CMAKE_CURRENT_SOURCE_DIR}/${path}" + ) + if(${ARGN}) + list(APPEND _components "${name}") + # propagate variable outside function scope + set(_components "${_components}" PARENT_SCOPE) + message(STATUS "Enable component '${name}' in '${_rel}'") + add_subdirectory(${path}) + else() + message(STATUS "Ignore component '${name}' in '${_rel}'") + endif() endfunction() # add a directory and register its name as a component @@ -48,16 +53,21 @@ endmacro() # propagate the list of components to the parent scope macro(propagate_components_to_parent) - set(_components "${_components}" PARENT_SCOPE) + set(_components "${_components}" PARENT_SCOPE) endmacro() # add an optional subdirectory that is **not** registered as a component function(add_subdirectory_if path) - file(RELATIVE_PATH _rel ${PROJECT_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/${path}") - if(${ARGN}) - message(STATUS "Enable subdirectory '${_rel}'") - add_subdirectory(${path}) - else() - message(STATUS "Ignore subdirectory '${_rel}'") - endif() + file( + RELATIVE_PATH + _rel + ${PROJECT_SOURCE_DIR} + "${CMAKE_CURRENT_SOURCE_DIR}/${path}" + ) + if(${ARGN}) + message(STATUS "Enable subdirectory '${_rel}'") + add_subdirectory(${path}) + else() + message(STATUS "Ignore subdirectory '${_rel}'") + endif() endfunction() diff --git a/cmake/ActsCreatePackageConfig.cmake b/cmake/ActsCreatePackageConfig.cmake index dd73597d2ff..f2aa6d0edfb 100644 --- a/cmake/ActsCreatePackageConfig.cmake +++ b/cmake/ActsCreatePackageConfig.cmake @@ -8,30 +8,34 @@ set(install_package_config_dir "${CMAKE_INSTALL_LIBDIR}/cmake/Acts") # version is taken automatically from PROJECT_VERSION; no need to specify write_basic_package_version_file( - ${PROJECT_BINARY_DIR}/ActsConfigVersion.cmake - COMPATIBILITY SameMajorVersion) + ${PROJECT_BINARY_DIR}/ActsConfigVersion.cmake + COMPATIBILITY SameMajorVersion +) configure_package_config_file( - ${CMAKE_CURRENT_LIST_DIR}/ActsConfig.cmake.in - ${PROJECT_BINARY_DIR}/ActsConfig.cmake - INSTALL_DESTINATION ${install_package_config_dir} - PATH_VARS CMAKE_INSTALL_BINDIR CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR) + ${CMAKE_CURRENT_LIST_DIR}/ActsConfig.cmake.in + ${PROJECT_BINARY_DIR}/ActsConfig.cmake + INSTALL_DESTINATION ${install_package_config_dir} + PATH_VARS CMAKE_INSTALL_BINDIR CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR +) # install cmake package configs install( - FILES - ${PROJECT_BINARY_DIR}/ActsConfigVersion.cmake - ${PROJECT_BINARY_DIR}/ActsConfig.cmake - DESTINATION ${install_package_config_dir}) + FILES + ${PROJECT_BINARY_DIR}/ActsConfigVersion.cmake + ${PROJECT_BINARY_DIR}/ActsConfig.cmake + DESTINATION ${install_package_config_dir} +) # install third party FindXXX.cmake files install( - FILES - ${CMAKE_CURRENT_LIST_DIR}/FindOnnxRuntime.cmake - DESTINATION ${install_package_config_dir}/Modules) + FILES ${CMAKE_CURRENT_LIST_DIR}/FindOnnxRuntime.cmake + DESTINATION ${install_package_config_dir}/Modules +) # install target configs for all available components foreach(_component ${_components}) - install( - EXPORT Acts${_component}Targets - DESTINATION ${install_package_config_dir}) + install( + EXPORT Acts${_component}Targets + DESTINATION ${install_package_config_dir} + ) endforeach() diff --git a/cmake/ActsCreateSetup.cmake b/cmake/ActsCreateSetup.cmake index ef37ea1db3b..bc69a2babed 100644 --- a/cmake/ActsCreateSetup.cmake +++ b/cmake/ActsCreateSetup.cmake @@ -1,16 +1,20 @@ # Create a setup.sh file at the install prefix to setup the shell environment configure_file( - ${CMAKE_CURRENT_LIST_DIR}/setup.sh.in - ${PROJECT_BINARY_DIR}/this_acts.sh - @ONLY) + ${CMAKE_CURRENT_LIST_DIR}/setup.sh.in + ${PROJECT_BINARY_DIR}/this_acts.sh + @ONLY +) install( - FILES ${PROJECT_BINARY_DIR}/this_acts.sh - DESTINATION ${CMAKE_INSTALL_BINDIR}) + FILES ${PROJECT_BINARY_DIR}/this_acts.sh + DESTINATION ${CMAKE_INSTALL_BINDIR} +) configure_file( - ${CMAKE_CURRENT_LIST_DIR}/setup_withdeps.sh.in - ${PROJECT_BINARY_DIR}/this_acts_withdeps.sh - @ONLY) + ${CMAKE_CURRENT_LIST_DIR}/setup_withdeps.sh.in + ${PROJECT_BINARY_DIR}/this_acts_withdeps.sh + @ONLY +) install( - FILES ${PROJECT_BINARY_DIR}/this_acts_withdeps.sh - DESTINATION ${CMAKE_INSTALL_BINDIR}) + FILES ${PROJECT_BINARY_DIR}/this_acts_withdeps.sh + DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/cmake/ActsExternSources.cmake b/cmake/ActsExternSources.cmake index 70920a42663..f2e2ea146b5 100644 --- a/cmake/ActsExternSources.cmake +++ b/cmake/ActsExternSources.cmake @@ -1,39 +1,69 @@ -set( ACTS_ACTSVG_SOURCE - "URL;https://github.com/acts-project/actsvg/archive/refs/tags/v0.4.47.tar.gz;URL_HASH;SHA256=aeb3927f8db1c7c9b8afa76adaa720013aa03a01032c8d5f457f623e2b04a172" CACHE STRING "Source to take ACTSVG from") -mark_as_advanced( ACTS_ACTSVG_SOURCE ) +set(ACTS_ACTSVG_SOURCE + "URL;https://github.com/acts-project/actsvg/archive/refs/tags/v0.4.47.tar.gz;URL_HASH;SHA256=aeb3927f8db1c7c9b8afa76adaa720013aa03a01032c8d5f457f623e2b04a172" + CACHE STRING + "Source to take ACTSVG from" +) +mark_as_advanced(ACTS_ACTSVG_SOURCE) -set( ACTS_VECMEM_SOURCE - "URL;https://github.com/acts-project/vecmem/archive/refs/tags/v1.4.0.tar.gz;URL_HASH;SHA256=545dfb4de4f9f3d773eef6a0e3297ebf981bb81950930d0991ad739e31ab16af" CACHE STRING "Source to take VECMEM from") -mark_as_advanced( ACTS_VECMEM_SOURCE ) +set(ACTS_VECMEM_SOURCE + "URL;https://github.com/acts-project/vecmem/archive/refs/tags/v1.4.0.tar.gz;URL_HASH;SHA256=545dfb4de4f9f3d773eef6a0e3297ebf981bb81950930d0991ad739e31ab16af" + CACHE STRING + "Source to take VECMEM from" +) +mark_as_advanced(ACTS_VECMEM_SOURCE) -set( ACTS_ALGEBRAPLUGINS_SOURCE - "URL;https://github.com/acts-project/algebra-plugins/archive/refs/tags/v0.22.0.tar.gz;URL_HASH;SHA256=6fde02181c1b856c0a17a1925f0969798eecd5e3d6f2a87ea2eb365b6c948cc1" CACHE STRING "Source to take ALGEBRAPLUGINS from") -mark_as_advanced( ACTS_ALGEBRAPLUGINS_SOURCE ) +set(ACTS_ALGEBRAPLUGINS_SOURCE + "URL;https://github.com/acts-project/algebra-plugins/archive/refs/tags/v0.22.0.tar.gz;URL_HASH;SHA256=6fde02181c1b856c0a17a1925f0969798eecd5e3d6f2a87ea2eb365b6c948cc1" + CACHE STRING + "Source to take ALGEBRAPLUGINS from" +) +mark_as_advanced(ACTS_ALGEBRAPLUGINS_SOURCE) -set( ACTS_COVFIE_SOURCE - "URL;https://github.com/acts-project/covfie/archive/refs/tags/v0.10.0.tar.gz;URL_HASH;SHA256=d44142b302ffc193ad2229f1d2cc6d8d720dd9da8c37989ada4f23018f86c964" CACHE STRING "Source to take COVFIE from") -mark_as_advanced( ACTS_COVFIE_SOURCE ) +set(ACTS_COVFIE_SOURCE + "URL;https://github.com/acts-project/covfie/archive/refs/tags/v0.10.0.tar.gz;URL_HASH;SHA256=d44142b302ffc193ad2229f1d2cc6d8d720dd9da8c37989ada4f23018f86c964" + CACHE STRING + "Source to take COVFIE from" +) +mark_as_advanced(ACTS_COVFIE_SOURCE) -set( ACTS_DETRAY_SOURCE - "URL;https://github.com/acts-project/detray/archive/refs/tags/v0.72.1.tar.gz;URL_HASH;SHA256=6cc8d34bc0d801338e9ab142c4a9884d19d9c02555dbb56972fab86b98d0f75b" CACHE STRING "Source to take DETRAY from") -mark_as_advanced( ACTS_DETRAY_SOURCE ) +set(ACTS_DETRAY_SOURCE + "URL;https://github.com/acts-project/detray/archive/refs/tags/v0.72.1.tar.gz;URL_HASH;SHA256=6cc8d34bc0d801338e9ab142c4a9884d19d9c02555dbb56972fab86b98d0f75b" + CACHE STRING + "Source to take DETRAY from" +) +mark_as_advanced(ACTS_DETRAY_SOURCE) -set( ACTS_TRACCC_SOURCE - "URL;https://github.com/acts-project/traccc/archive/refs/tags/v0.15.0.tar.gz;URL_HASH;SHA256=1a9a1d0d2f6c4a7773eae3119b1e044fb52031ca49dfc88e6dc4ab8a11df167e" CACHE STRING "Source to take TRACCC from") -mark_as_advanced( ACTS_TRACCC_SOURCE ) +set(ACTS_TRACCC_SOURCE + "URL;https://github.com/acts-project/traccc/archive/refs/tags/v0.15.0.tar.gz;URL_HASH;SHA256=1a9a1d0d2f6c4a7773eae3119b1e044fb52031ca49dfc88e6dc4ab8a11df167e" + CACHE STRING + "Source to take TRACCC from" +) +mark_as_advanced(ACTS_TRACCC_SOURCE) -set( ACTS_FRNN_SOURCE - "GIT_REPOSITORY;https://github.com/hrzhao76/FRNN/;GIT_TAG;5f8a48b0022300cd2863119f5646a5f31373e0c8" CACHE STRING "Source to take FRNN from") -mark_as_advanced( ACTS_FRNN_SOURCE ) +set(ACTS_FRNN_SOURCE + "GIT_REPOSITORY;https://github.com/hrzhao76/FRNN/;GIT_TAG;5f8a48b0022300cd2863119f5646a5f31373e0c8" + CACHE STRING + "Source to take FRNN from" +) +mark_as_advanced(ACTS_FRNN_SOURCE) -set( ACTS_NLOHMANNJSON_SOURCE - "URL;https://github.com/nlohmann/json/archive/refs/tags/v3.10.5.tar.gz;URL_HASH;SHA256=5daca6ca216495edf89d167f808d1d03c4a4d929cef7da5e10f135ae1540c7e4" CACHE STRING "Source to take nlohmann_json from") -mark_as_advanced( ACTS_NLOHMANN_JSON_SOURCE ) +set(ACTS_NLOHMANNJSON_SOURCE + "URL;https://github.com/nlohmann/json/archive/refs/tags/v3.10.5.tar.gz;URL_HASH;SHA256=5daca6ca216495edf89d167f808d1d03c4a4d929cef7da5e10f135ae1540c7e4" + CACHE STRING + "Source to take nlohmann_json from" +) +mark_as_advanced(ACTS_NLOHMANN_JSON_SOURCE) -set( ACTS_EIGEN3_SOURCE - "URL;https://gitlab.com/libeigen/eigen/-/archive/${_acts_eigen3_version}/${_acts_eigen3_version}.tar.gz;URL_HASH;SHA256=ba6ef66ba2d319e0a871a267889411c550d4bdf5bc7c62f86c60276913f3f4ba" CACHE STRING "Source to take eigen3 from") -mark_as_advanced( ACTS_EIGEN3_SOURCE ) +set(ACTS_EIGEN3_SOURCE + "URL;https://gitlab.com/libeigen/eigen/-/archive/${_acts_eigen3_version}/${_acts_eigen3_version}.tar.gz;URL_HASH;SHA256=ba6ef66ba2d319e0a871a267889411c550d4bdf5bc7c62f86c60276913f3f4ba" + CACHE STRING + "Source to take eigen3 from" +) +mark_as_advanced(ACTS_EIGEN3_SOURCE) -set( ACTS_PYBIND11_SOURCE - "GIT_REPOSITORY;https://github.com/pybind/pybind11.git;GIT_TAG;v2.13.1" CACHE STRING "Source to take pybind11 from") -mark_as_advanced( ACTS_PYBIND11_SOURCE ) +set(ACTS_PYBIND11_SOURCE + "GIT_REPOSITORY;https://github.com/pybind/pybind11.git;GIT_TAG;v2.13.1" + CACHE STRING + "Source to take pybind11 from" +) +mark_as_advanced(ACTS_PYBIND11_SOURCE) diff --git a/cmake/ActsGenerateNonCompileTest.cmake b/cmake/ActsGenerateNonCompileTest.cmake index 3ec2f3ee07c..a1561d03af7 100644 --- a/cmake/ActsGenerateNonCompileTest.cmake +++ b/cmake/ActsGenerateNonCompileTest.cmake @@ -2,8 +2,13 @@ file(READ ${INPUT_FILE} content) -string(REGEX REPLACE "ACTS_DOES_NOT_COMPILE_BEGIN\\(([A-Za-z0-9]+)\\)" "#if defined(\\1)" processed "${content}") +string( + REGEX REPLACE + "ACTS_DOES_NOT_COMPILE_BEGIN\\(([A-Za-z0-9]+)\\)" + "#if defined(\\1)" + processed + "${content}" +) string(REPLACE "ACTS_DOES_NOT_COMPILE_END()" "#endif" processed "${processed}") - file(WRITE ${OUTPUT_FILE} "${processed}") diff --git a/cmake/ActsOptionHelpers.cmake b/cmake/ActsOptionHelpers.cmake index c3f5b7c5f00..a1b6d283e66 100644 --- a/cmake/ActsOptionHelpers.cmake +++ b/cmake/ActsOptionHelpers.cmake @@ -12,10 +12,10 @@ # macro(set_option_if option) - if(${ARGN}) - # create a regular (directory-scope) variable that should take precedence - # over a cache entry of the same name. that means that automatically - # activated options are not stored in the cache. - set(${option} ON) - endif() + if(${ARGN}) + # create a regular (directory-scope) variable that should take precedence + # over a cache entry of the same name. that means that automatically + # activated options are not stored in the cache. + set(${option} ON) + endif() endmacro() diff --git a/cmake/ActsRetrieveVersion.cmake b/cmake/ActsRetrieveVersion.cmake index 95d575f9e04..a21c34aad51 100644 --- a/cmake/ActsRetrieveVersion.cmake +++ b/cmake/ActsRetrieveVersion.cmake @@ -16,11 +16,11 @@ get_git_head_revision(_git_refspec _git_hash) string(SUBSTRING "${_git_hash}" 0 9 _git_hash_short) git_local_changes(_git_local_changes) if(_git_local_changes STREQUAL "CLEAN") - set(_acts_commit_hash "${_git_hash}") - set(_acts_commit_hash_short "${_git_hash_short}") + set(_acts_commit_hash "${_git_hash}") + set(_acts_commit_hash_short "${_git_hash_short}") else() - set(_acts_commit_hash "${_git_hash}-dirty") - set(_acts_commit_hash_short "${_git_hash_short}-dirty") + set(_acts_commit_hash "${_git_hash}-dirty") + set(_acts_commit_hash_short "${_git_hash_short}-dirty") endif() # remove temporary variables diff --git a/cmake/ActsStaticAnalysis.cmake b/cmake/ActsStaticAnalysis.cmake index 5b1541035ff..1e563a1846b 100644 --- a/cmake/ActsStaticAnalysis.cmake +++ b/cmake/ActsStaticAnalysis.cmake @@ -1,50 +1,55 @@ if(ACTS_RUN_CLANG_TIDY) - find_program(CLANG_TIDY_COMMAND NAMES clang-tidy) - if(NOT CLANG_TIDY_COMMAND) - message(WARNING "ACTS_RUN_CLANG_TIDY is ON but clang-tidy is not found!") - set(CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE) - else() - message(STATUS "Setting up clang-tidy run") + find_program(CLANG_TIDY_COMMAND NAMES clang-tidy) + if(NOT CLANG_TIDY_COMMAND) + message( + WARNING + "ACTS_RUN_CLANG_TIDY is ON but clang-tidy is not found!" + ) + set(CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE) + else() + message(STATUS "Setting up clang-tidy run") - set(_chks "") - list(APPEND _chks "-*") - list(APPEND _chks "clang-analyzer-optin.cplusplus.UninitializedObject") - list(APPEND _chks "cppcoreguidelines-init-variables") - list(APPEND _chks "cppcoreguidelines-pro-type-member-init") - list(APPEND _chks "google-readability-casting") - list(APPEND _chks "modernize-concat-nested-namespaces") - list(APPEND _chks "modernize-use-equals-default") - list(APPEND _chks "modernize-use-default-member-init") - list(APPEND _chks "modernize-use-nullptr") - list(APPEND _chks "modernize-use-override") - list(APPEND _chks "modernize-use-using") - list(APPEND _chks "performance-for-range-copy") - list(APPEND _chks "performance-move-const-arg") - list(APPEND _chks "performance-unnecessary-value-param") - list(APPEND _chks "readability-braces-around-statements") - list(APPEND _chks "readability-container-size-empty") - list(APPEND _chks "readability-implicit-bool-cast") - list(APPEND _chks "readability-implicit-bool-conversion") - list(APPEND _chks "readability-inconsistent-declaration-parameter-name") - list(APPEND _chks "readability-named-parameter") - list(APPEND _chks "readability-operators-representation") - list(JOIN _chks "," CLANG_TIDY_CHECKS) + set(_chks "") + list(APPEND _chks "-*") + list(APPEND _chks "clang-analyzer-optin.cplusplus.UninitializedObject") + list(APPEND _chks "cppcoreguidelines-init-variables") + list(APPEND _chks "cppcoreguidelines-pro-type-member-init") + list(APPEND _chks "google-readability-casting") + list(APPEND _chks "modernize-concat-nested-namespaces") + list(APPEND _chks "modernize-use-equals-default") + list(APPEND _chks "modernize-use-default-member-init") + list(APPEND _chks "modernize-use-nullptr") + list(APPEND _chks "modernize-use-override") + list(APPEND _chks "modernize-use-using") + list(APPEND _chks "performance-for-range-copy") + list(APPEND _chks "performance-move-const-arg") + list(APPEND _chks "performance-unnecessary-value-param") + list(APPEND _chks "readability-braces-around-statements") + list(APPEND _chks "readability-container-size-empty") + list(APPEND _chks "readability-implicit-bool-cast") + list(APPEND _chks "readability-implicit-bool-conversion") + list(APPEND _chks "readability-inconsistent-declaration-parameter-name") + list(APPEND _chks "readability-named-parameter") + list(APPEND _chks "readability-operators-representation") + list(JOIN _chks "," CLANG_TIDY_CHECKS) - message(STATUS "Configured checks") - foreach(_chk ${_chks}) - message(STATUS "|-> ${_chk}") - endforeach() + message(STATUS "Configured checks") + foreach(_chk ${_chks}) + message(STATUS "|-> ${_chk}") + endforeach() - set(_errs "") - list(JOIN _errs "," CLANG_TIDY_ERRORS) + set(_errs "") + list(JOIN _errs "," CLANG_TIDY_ERRORS) - message(STATUS "Enabled errors:") - foreach(_err ${_errs}) - message(STATUS "|-> ${_err}") - endforeach() + message(STATUS "Enabled errors:") + foreach(_err ${_errs}) + message(STATUS "|-> ${_err}") + endforeach() - set(CLANG_TIDY_HEADER_FILTER ".*") + set(CLANG_TIDY_HEADER_FILTER ".*") - set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND};-checks=${CLANG_TIDY_CHECKS};-header-filter=${CLANG_TIDY_HEADER_FILTER};-warnings-as-errors=${CLANG_TIDY_ERRORS}") - endif() + set(CMAKE_CXX_CLANG_TIDY + "${CLANG_TIDY_COMMAND};-checks=${CLANG_TIDY_CHECKS};-header-filter=${CLANG_TIDY_HEADER_FILTER};-warnings-as-errors=${CLANG_TIDY_ERRORS}" + ) + endif() endif() diff --git a/cmake/ActsTargetLinkLibrariesSystem.cmake b/cmake/ActsTargetLinkLibrariesSystem.cmake index dfddd04a297..e3ad7b2c367 100644 --- a/cmake/ActsTargetLinkLibrariesSystem.cmake +++ b/cmake/ActsTargetLinkLibrariesSystem.cmake @@ -2,30 +2,45 @@ # necessary until cmake 3.25 https://cmake.org/cmake/help/latest/prop_tgt/SYSTEM.html#prop_tgt:SYSTEM function(acts_target_link_libraries_system target) - set(options PRIVATE PUBLIC INTERFACE) - cmake_parse_arguments(TLLS "${options}" "" "" ${ARGN}) - foreach(op ${options}) - if(TLLS_${op}) - set(scope ${op}) - endif() - endforeach(op) - set(libs ${TLLS_UNPARSED_ARGUMENTS}) + set(options PRIVATE PUBLIC INTERFACE) + cmake_parse_arguments(TLLS "${options}" "" "" ${ARGN}) + foreach(op ${options}) + if(TLLS_${op}) + set(scope ${op}) + endif() + endforeach(op) + set(libs ${TLLS_UNPARSED_ARGUMENTS}) - foreach(lib ${libs}) - get_target_property(lib_include_dirs ${lib} INTERFACE_INCLUDE_DIRECTORIES) - if(lib_include_dirs) - if(scope) - target_include_directories(${target} SYSTEM ${scope} ${lib_include_dirs}) - else() - target_include_directories(${target} SYSTEM PRIVATE ${lib_include_dirs}) - endif() - else() - message("Warning: ${lib} doesn't set INTERFACE_INCLUDE_DIRECTORIES. No include_directories set.") - endif() - if(scope) - target_link_libraries(${target} ${scope} ${lib}) - else() - target_link_libraries(${target} ${lib}) - endif() - endforeach() + foreach(lib ${libs}) + get_target_property( + lib_include_dirs + ${lib} + INTERFACE_INCLUDE_DIRECTORIES + ) + if(lib_include_dirs) + if(scope) + target_include_directories( + ${target} + SYSTEM + ${scope} + ${lib_include_dirs} + ) + else() + target_include_directories( + ${target} + SYSTEM + PRIVATE ${lib_include_dirs} + ) + endif() + else() + message( + "Warning: ${lib} doesn't set INTERFACE_INCLUDE_DIRECTORIES. No include_directories set." + ) + endif() + if(scope) + target_link_libraries(${target} ${scope} ${lib}) + else() + target_link_libraries(${target} ${lib}) + endif() + endforeach() endfunction(acts_target_link_libraries_system) diff --git a/cmake/FindFilesystem.cmake b/cmake/FindFilesystem.cmake index de3f25cb567..93cc9b9c8a3 100644 --- a/cmake/FindFilesystem.cmake +++ b/cmake/FindFilesystem.cmake @@ -98,13 +98,11 @@ Using `find_package(Filesystem)` with no component arguments: #]=======================================================================] - if(TARGET std::filesystem) # This module has already been processed. Don't do it again. return() endif() - include(CMakePushCheckState) include(CheckIncludeFileCXX) @@ -136,7 +134,10 @@ endif() set(extra_components ${want_components}) list(REMOVE_ITEM extra_components Final Experimental) foreach(component IN LISTS extra_components) - message(WARNING "Extraneous find_package component for Filesystem: ${component}") + message( + WARNING + "Extraneous find_package component for Filesystem: ${component}" + ) endforeach() # Detect which of Experimental and Final we should look for @@ -162,7 +163,10 @@ else() endif() if(find_experimental) - check_include_file_cxx("experimental/filesystem" _CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER) + check_include_file_cxx( + "experimental/filesystem" + _CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER + ) mark_as_advanced(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER) else() set(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER FALSE) @@ -182,16 +186,34 @@ else() set(_have_fs FALSE) endif() -set(CXX_FILESYSTEM_HAVE_FS ${_have_fs} CACHE BOOL "TRUE if we have the C++ filesystem headers") -set(CXX_FILESYSTEM_HEADER ${_fs_header} CACHE STRING "The header that should be included to obtain the filesystem APIs") -set(CXX_FILESYSTEM_NAMESPACE ${_fs_namespace} CACHE STRING "The C++ namespace that contains the filesystem APIs") -set(CXX_FILESYSTEM_IS_EXPERIMENTAL ${_is_experimental} CACHE BOOL "TRUE if the C++ filesystem library is the experimental version") +set(CXX_FILESYSTEM_HAVE_FS + ${_have_fs} + CACHE BOOL + "TRUE if we have the C++ filesystem headers" +) +set(CXX_FILESYSTEM_HEADER + ${_fs_header} + CACHE STRING + "The header that should be included to obtain the filesystem APIs" +) +set(CXX_FILESYSTEM_NAMESPACE + ${_fs_namespace} + CACHE STRING + "The C++ namespace that contains the filesystem APIs" +) +set(CXX_FILESYSTEM_IS_EXPERIMENTAL + ${_is_experimental} + CACHE BOOL + "TRUE if the C++ filesystem library is the experimental version" +) set(_found FALSE) if(CXX_FILESYSTEM_HAVE_FS) # We have some filesystem library available. Do link checks - string(CONFIGURE [[ + string( + CONFIGURE + [[ #include #include <@CXX_FILESYSTEM_HEADER@> @@ -200,7 +222,10 @@ if(CXX_FILESYSTEM_HAVE_FS) printf("%s", cwd.c_str()); return EXIT_SUCCESS; } - ]] code @ONLY) + ]] + code + @ONLY + ) # Check a simple filesystem program without any linker flags _cmcm_check_cxx_source("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED) @@ -223,22 +248,39 @@ if(CXX_FILESYSTEM_HAVE_FS) if(can_link) add_library(std::filesystem INTERFACE IMPORTED) - set_property(TARGET std::filesystem APPEND PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_17) + set_property( + TARGET std::filesystem + APPEND + PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_17 + ) set(_found TRUE) if(CXX_FILESYSTEM_NO_LINK_NEEDED) # Nothing to add... elseif(CXX_FILESYSTEM_STDCPPFS_NEEDED) - set_property(TARGET std::filesystem APPEND PROPERTY INTERFACE_LINK_LIBRARIES -lstdc++fs) + set_property( + TARGET std::filesystem + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES -lstdc++fs + ) elseif(CXX_FILESYSTEM_CPPFS_NEEDED) - set_property(TARGET std::filesystem APPEND PROPERTY INTERFACE_LINK_LIBRARIES -lc++fs) + set_property( + TARGET std::filesystem + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES -lc++fs + ) endif() endif() endif() cmake_pop_check_state() -set(Filesystem_FOUND ${_found} CACHE BOOL "TRUE if we can run a program using std::filesystem" FORCE) +set(Filesystem_FOUND + ${_found} + CACHE BOOL + "TRUE if we can run a program using std::filesystem" + FORCE +) if(Filesystem_FIND_REQUIRED AND NOT Filesystem_FOUND) message(FATAL_ERROR "Cannot run simple program using std::filesystem") diff --git a/cmake/FindOnnxRuntime.cmake b/cmake/FindOnnxRuntime.cmake index ed6f3e79c40..512d0e443c0 100644 --- a/cmake/FindOnnxRuntime.cmake +++ b/cmake/FindOnnxRuntime.cmake @@ -4,49 +4,72 @@ # necessary information in its target properties. find_library( - OnnxRuntime_LIBRARY - NAMES onnxruntime - PATHS ${onnxruntime_DIR} - PATH_SUFFIXES lib lib32 lib64 - DOC "The ONNXRuntime library") + OnnxRuntime_LIBRARY + NAMES onnxruntime + PATHS ${onnxruntime_DIR} + PATH_SUFFIXES lib lib32 lib64 + DOC "The ONNXRuntime library" +) if(NOT OnnxRuntime_LIBRARY) - message(FATAL_ERROR "onnxruntime library not found") + message(FATAL_ERROR "onnxruntime library not found") else() - message(STATUS "Found OnnxRuntime library at ${OnnxRuntime_LIBRARY}") + message(STATUS "Found OnnxRuntime library at ${OnnxRuntime_LIBRARY}") endif() find_path( - OnnxRuntime_INCLUDE_DIR - NAMES onnxruntime_cxx_api.h - PATHS ${onnxruntime_DIR} - PATH_SUFFIXES include include/onnxruntime include/onnxruntime/core/session - DOC "The ONNXRuntime include directory") + OnnxRuntime_INCLUDE_DIR + NAMES onnxruntime_cxx_api.h + PATHS ${onnxruntime_DIR} + PATH_SUFFIXES include include/onnxruntime include/onnxruntime/core/session + DOC "The ONNXRuntime include directory" +) if(NOT OnnxRuntime_INCLUDE_DIR) - message(FATAL_ERROR "onnxruntime includes not found") + message(FATAL_ERROR "onnxruntime includes not found") else() - file(READ ${OnnxRuntime_INCLUDE_DIR}/onnxruntime_c_api.h ver) - string(REGEX MATCH "ORT_API_VERSION ([0-9]*)" _ ${ver}) - set(OnnxRuntime_API_VERSION ${CMAKE_MATCH_1}) - message(STATUS "Found OnnxRuntime includes at ${OnnxRuntime_INCLUDE_DIR} (API version: ${OnnxRuntime_API_VERSION})") + file(READ ${OnnxRuntime_INCLUDE_DIR}/onnxruntime_c_api.h ver) + string(REGEX MATCH "ORT_API_VERSION ([0-9]*)" _ ${ver}) + set(OnnxRuntime_API_VERSION ${CMAKE_MATCH_1}) + message( + STATUS + "Found OnnxRuntime includes at ${OnnxRuntime_INCLUDE_DIR} (API version: ${OnnxRuntime_API_VERSION})" + ) endif() - -string(REPLACE "." ";" OnnxRuntime_MIN_VERSION_LIST ${_acts_onnxruntime_version}) +string( + REPLACE + "." + ";" + OnnxRuntime_MIN_VERSION_LIST + ${_acts_onnxruntime_version} +) list(GET OnnxRuntime_MIN_VERSION_LIST 1 OnnxRuntime_MIN_API_VERSION) if("${OnnxRuntime_API_VERSION}" LESS ${OnnxRuntime_MIN_API_VERSION}) - message(FATAL_ERROR "OnnxRuntime API version ${OnnxRuntime_MIN_API_VERSION} or greater required") + message( + FATAL_ERROR + "OnnxRuntime API version ${OnnxRuntime_MIN_API_VERSION} or greater required" + ) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args( - OnnxRuntime - REQUIRED_VARS OnnxRuntime_LIBRARY OnnxRuntime_INCLUDE_DIR) + OnnxRuntime + REQUIRED_VARS OnnxRuntime_LIBRARY OnnxRuntime_INCLUDE_DIR +) add_library(OnnxRuntime SHARED IMPORTED) -set_property(TARGET OnnxRuntime PROPERTY IMPORTED_LOCATION ${OnnxRuntime_LIBRARY}) -set_property(TARGET OnnxRuntime PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${OnnxRuntime_INCLUDE_DIR}) -set_property(TARGET OnnxRuntime PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${OnnxRuntime_INCLUDE_DIR}) +set_property( + TARGET OnnxRuntime + PROPERTY IMPORTED_LOCATION ${OnnxRuntime_LIBRARY} +) +set_property( + TARGET OnnxRuntime + PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${OnnxRuntime_INCLUDE_DIR} +) +set_property( + TARGET OnnxRuntime + PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${OnnxRuntime_INCLUDE_DIR} +) mark_as_advanced(OnnxRuntime_FOUND OnnxRuntime_INCLUDE_DIR OnnxRuntime_LIBRARY) diff --git a/cmake/FindPythia8.cmake b/cmake/FindPythia8.cmake index 81486164ebc..e6f02ecad1c 100644 --- a/cmake/FindPythia8.cmake +++ b/cmake/FindPythia8.cmake @@ -3,27 +3,45 @@ # This module defines the `Pythia8` imported target that encodes all # necessary information in its target properties. -find_library(Pythia8_LIBRARY - NAMES Pythia8 pythia8 - HINTS ENV PYTHIA8_DIR PYTHIA8 - PATHS /opt/pythia8 /usr/local - DOC "The Pythia8 library") -find_path(Pythia8_INCLUDE_DIR - NAMES Pythia8/Pythia.h - HINTS ENV PYTHIA8_DIR PYTHIA8 - PATHS /opt/pythia8 /usr/local - DOC "The Pythia8 include directory") +find_library( + Pythia8_LIBRARY + NAMES Pythia8 pythia8 + HINTS + ENV PYTHIA8_DIR + PYTHIA8 + PATHS /opt/pythia8 /usr/local + DOC "The Pythia8 library" +) +find_path( + Pythia8_INCLUDE_DIR + NAMES Pythia8/Pythia.h + HINTS + ENV PYTHIA8_DIR + PYTHIA8 + PATHS /opt/pythia8 /usr/local + DOC "The Pythia8 include directory" +) file(READ "${Pythia8_INCLUDE_DIR}/Pythia8/Pythia.h" Pythia8_VERSION_FILE) -string(REGEX MATCH "#define PYTHIA_VERSION (8\.[0-9]+)" _ ${Pythia8_VERSION_FILE}) +string( + REGEX MATCH + "#define PYTHIA_VERSION (8\.[0-9]+)" + _ + ${Pythia8_VERSION_FILE} +) set(Pythia8_VERSION ${CMAKE_MATCH_1}) -find_package_handle_standard_args(Pythia8 - REQUIRED_VARS Pythia8_LIBRARY Pythia8_INCLUDE_DIR - VERSION_VAR Pythia8_VERSION) +find_package_handle_standard_args( + Pythia8 + REQUIRED_VARS Pythia8_LIBRARY Pythia8_INCLUDE_DIR + VERSION_VAR Pythia8_VERSION +) add_library(Pythia8 SHARED IMPORTED) set_property(TARGET Pythia8 PROPERTY IMPORTED_LOCATION ${Pythia8_LIBRARY}) -set_property(TARGET Pythia8 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Pythia8_INCLUDE_DIR}) +set_property( + TARGET Pythia8 + PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Pythia8_INCLUDE_DIR} +) mark_as_advanced(Pythia8_FOUND Pythia8_INCLUDE_DIR Pythia8_LIBRARY) diff --git a/cmake/FindSphinx.cmake b/cmake/FindSphinx.cmake index e230a3e58b5..cdfafee3850 100644 --- a/cmake/FindSphinx.cmake +++ b/cmake/FindSphinx.cmake @@ -10,35 +10,36 @@ set(_hints) # use python installation to find potential install locations for sphinx find_package(Python3 QUIET) if(Python3_EXECUTABLE) - execute_process( - COMMAND ${Python3_EXECUTABLE} -m site --user-base - OUTPUT_VARIABLE Python3_USER_BASE) - execute_process( - COMMAND ${Python3_EXECUTABLE} -c "import sys; print(sys.exec_prefix)" - OUTPUT_VARIABLE Python3_EXEC_PREFIX) - # strip newlines - string(REPLACE "\n" "" Python3_USER_BASE ${Python3_USER_BASE}) - string(REPLACE "\n" "" Python3_EXEC_PREFIX ${Python3_EXEC_PREFIX}) - # add derived binary dirs as hints - list(APPEND _hints "${Python3_USER_BASE}/bin" "${Python3_EXEC_PREFIX}/bin") + execute_process( + COMMAND ${Python3_EXECUTABLE} -m site --user-base + OUTPUT_VARIABLE Python3_USER_BASE + ) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c "import sys; print(sys.exec_prefix)" + OUTPUT_VARIABLE Python3_EXEC_PREFIX + ) + # strip newlines + string(REPLACE "\n" "" Python3_USER_BASE ${Python3_USER_BASE}) + string(REPLACE "\n" "" Python3_EXEC_PREFIX ${Python3_EXEC_PREFIX}) + # add derived binary dirs as hints + list(APPEND _hints "${Python3_USER_BASE}/bin" "${Python3_EXEC_PREFIX}/bin") endif() # find sphinx executable if(_hints) - message(STATUS "Using additional Sphinx search hints:") - foreach(_hint IN LISTS _hints) - message(STATUS " ${_hint}") - endforeach() + message(STATUS "Using additional Sphinx search hints:") + foreach(_hint IN LISTS _hints) + message(STATUS " ${_hint}") + endforeach() endif() find_program( - Sphinx_EXECUTABLE - NAMES sphinx-build sphinx-build-3 - HINTS ${_hints} - DOC "Sphinx documentation generator") + Sphinx_EXECUTABLE + NAMES sphinx-build sphinx-build-3 + HINTS ${_hints} + DOC "Sphinx documentation generator" +) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - Sphinx - REQUIRED_VARS Sphinx_EXECUTABLE) +find_package_handle_standard_args(Sphinx REQUIRED_VARS Sphinx_EXECUTABLE) unset(_hints) diff --git a/cmake/FindTBB.cmake b/cmake/FindTBB.cmake index bd756313176..1ac26fb4a28 100644 --- a/cmake/FindTBB.cmake +++ b/cmake/FindTBB.cmake @@ -63,7 +63,6 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) - #============================================================================= # FindTBB helper functions and macros # @@ -71,143 +70,165 @@ # Use TBBConfig.cmake if possible. set(_tbb_find_quiet) -if (TBB_FIND_QUIETLY) - set(_tbb_find_quiet QUIET) -endif () +if(TBB_FIND_QUIETLY) + set(_tbb_find_quiet QUIET) +endif() set(_tbb_find_components) set(_tbb_find_optional_components) -foreach (_tbb_find_component IN LISTS TBB_FIND_COMPONENTS) - if (TBB_FIND_REQUIRED_${_tbb_find_component}) - list(APPEND _tbb_find_components "${_tbb_find_component}") - else () - list(APPEND _tbb_find_optional_components "${_tbb_find_component}") - endif () -endforeach () +foreach(_tbb_find_component IN LISTS TBB_FIND_COMPONENTS) + if(TBB_FIND_REQUIRED_${_tbb_find_component}) + list(APPEND _tbb_find_components "${_tbb_find_component}") + else() + list(APPEND _tbb_find_optional_components "${_tbb_find_component}") + endif() +endforeach() unset(_tbb_find_component) -find_package(TBB CONFIG ${_tbb_find_quiet} - COMPONENTS ${_tbb_find_components} - OPTIONAL_COMPONENTS ${_tbb_find_optional_components}) +find_package( + TBB + CONFIG + ${_tbb_find_quiet} + COMPONENTS ${_tbb_find_components} + OPTIONAL_COMPONENTS ${_tbb_find_optional_components} +) unset(_tbb_find_quiet) unset(_tbb_find_components) unset(_tbb_find_optional_components) -if (TBB_FOUND) - return () -endif () +if(TBB_FOUND) + return() +endif() #==================================================== # Fix the library path in case it is a linker script #==================================================== function(tbb_extract_real_library library real_library) - if(NOT UNIX OR NOT EXISTS ${library}) - set(${real_library} "${library}" PARENT_SCOPE) - return() - endif() - - #Read in the first 4 bytes and see if they are the ELF magic number - set(_elf_magic "7f454c46") - file(READ ${library} _hex_data OFFSET 0 LIMIT 4 HEX) - if(_hex_data STREQUAL _elf_magic) - #we have opened a elf binary so this is what - #we should link to - set(${real_library} "${library}" PARENT_SCOPE) - return() - endif() - - file(READ ${library} _data OFFSET 0 LIMIT 1024) - if("${_data}" MATCHES "INPUT \\(([^(]+)\\)") - #extract out the .so name from REGEX MATCH command - set(_proper_so_name "${CMAKE_MATCH_1}") - - #construct path to the real .so which is presumed to be in the same directory - #as the input file - get_filename_component(_so_dir "${library}" DIRECTORY) - set(${real_library} "${_so_dir}/${_proper_so_name}" PARENT_SCOPE) - else() - #unable to determine what this library is so just hope everything works - #and pass it unmodified. - set(${real_library} "${library}" PARENT_SCOPE) - endif() + if(NOT UNIX OR NOT EXISTS ${library}) + set(${real_library} "${library}" PARENT_SCOPE) + return() + endif() + + #Read in the first 4 bytes and see if they are the ELF magic number + set(_elf_magic "7f454c46") + file(READ ${library} _hex_data OFFSET 0 LIMIT 4 HEX) + if(_hex_data STREQUAL _elf_magic) + #we have opened a elf binary so this is what + #we should link to + set(${real_library} "${library}" PARENT_SCOPE) + return() + endif() + + file(READ ${library} _data OFFSET 0 LIMIT 1024) + if("${_data}" MATCHES "INPUT \\(([^(]+)\\)") + #extract out the .so name from REGEX MATCH command + set(_proper_so_name "${CMAKE_MATCH_1}") + + #construct path to the real .so which is presumed to be in the same directory + #as the input file + get_filename_component(_so_dir "${library}" DIRECTORY) + set(${real_library} "${_so_dir}/${_proper_so_name}" PARENT_SCOPE) + else() + #unable to determine what this library is so just hope everything works + #and pass it unmodified. + set(${real_library} "${library}" PARENT_SCOPE) + endif() endfunction() #=============================================== # Do the final processing for the package find. #=============================================== macro(findpkg_finish PREFIX TARGET_NAME) - if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY) - set(${PREFIX}_FOUND TRUE) - set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR}) - set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY}) - else () - if (${PREFIX}_FIND_REQUIRED AND NOT ${PREFIX}_FIND_QUIETLY) - message(FATAL_ERROR "Required library ${PREFIX} not found.") - endif () - endif () - - if (NOT TARGET "TBB::${TARGET_NAME}") - if (${PREFIX}_LIBRARY_RELEASE) - tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release) - endif () - if (${PREFIX}_LIBRARY_DEBUG) - tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug) - endif () - add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}") - if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - IMPORTED_LOCATION "${real_release}" - IMPORTED_LOCATION_DEBUG "${real_debug}" - IMPORTED_LOCATION_RELEASE "${real_release}") - elseif (${PREFIX}_LIBRARY_RELEASE) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - IMPORTED_LOCATION "${real_release}") - elseif (${PREFIX}_LIBRARY_DEBUG) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - IMPORTED_LOCATION "${real_debug}") - endif () - endif () - - #mark the following variables as internal variables - mark_as_advanced(${PREFIX}_INCLUDE_DIR - ${PREFIX}_LIBRARY - ${PREFIX}_LIBRARY_DEBUG - ${PREFIX}_LIBRARY_RELEASE) + if(${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY) + set(${PREFIX}_FOUND TRUE) + set(${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR}) + set(${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY}) + else() + if(${PREFIX}_FIND_REQUIRED AND NOT ${PREFIX}_FIND_QUIETLY) + message(FATAL_ERROR "Required library ${PREFIX} not found.") + endif() + endif() + + if(NOT TARGET "TBB::${TARGET_NAME}") + if(${PREFIX}_LIBRARY_RELEASE) + tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release) + endif() + if(${PREFIX}_LIBRARY_DEBUG) + tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug) + endif() + add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED) + set_target_properties( + TBB::${TARGET_NAME} + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}" + ) + if(${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE) + set_target_properties( + TBB::${TARGET_NAME} + PROPERTIES + IMPORTED_LOCATION "${real_release}" + IMPORTED_LOCATION_DEBUG "${real_debug}" + IMPORTED_LOCATION_RELEASE "${real_release}" + ) + elseif(${PREFIX}_LIBRARY_RELEASE) + set_target_properties( + TBB::${TARGET_NAME} + PROPERTIES IMPORTED_LOCATION "${real_release}" + ) + elseif(${PREFIX}_LIBRARY_DEBUG) + set_target_properties( + TBB::${TARGET_NAME} + PROPERTIES IMPORTED_LOCATION "${real_debug}" + ) + endif() + endif() + + #mark the following variables as internal variables + mark_as_advanced( + ${PREFIX}_INCLUDE_DIR + ${PREFIX}_LIBRARY + ${PREFIX}_LIBRARY_DEBUG + ${PREFIX}_LIBRARY_RELEASE + ) endmacro() #=============================================== # Generate debug names from given release names #=============================================== macro(get_debug_names PREFIX) - foreach(i ${${PREFIX}}) - set(${PREFIX}_DEBUG ${${PREFIX}_DEBUG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i}) - endforeach() + foreach(i ${${PREFIX}}) + set(${PREFIX}_DEBUG + ${${PREFIX}_DEBUG} + ${i}d + ${i}D + ${i}_d + ${i}_D + ${i}_debug + ${i} + ) + endforeach() endmacro() #=============================================== # See if we have env vars to help us find tbb #=============================================== macro(getenv_path VAR) - set(ENV_${VAR} $ENV{${VAR}}) - # replace won't work if var is blank - if (ENV_${VAR}) - string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} ) - endif () + set(ENV_${VAR} $ENV{${VAR}}) + # replace won't work if var is blank + if(ENV_${VAR}) + string(REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}}) + endif() endmacro() #=============================================== # Couple a set of release AND debug libraries #=============================================== macro(make_library_set PREFIX) - if (${PREFIX}_RELEASE AND ${PREFIX}_DEBUG) - set(${PREFIX} optimized ${${PREFIX}_RELEASE} debug ${${PREFIX}_DEBUG}) - elseif (${PREFIX}_RELEASE) - set(${PREFIX} ${${PREFIX}_RELEASE}) - elseif (${PREFIX}_DEBUG) - set(${PREFIX} ${${PREFIX}_DEBUG}) - endif () + if(${PREFIX}_RELEASE AND ${PREFIX}_DEBUG) + set(${PREFIX} optimized ${${PREFIX}_RELEASE} debug ${${PREFIX}_DEBUG}) + elseif(${PREFIX}_RELEASE) + set(${PREFIX} ${${PREFIX}_RELEASE}) + elseif(${PREFIX}_DEBUG) + set(${PREFIX} ${${PREFIX}_DEBUG}) + endif() endmacro() - #============================================================================= # Now to actually find TBB # @@ -220,21 +241,22 @@ set(TBB_PREFIX_PATH ${TBB_ROOT} ${ENV_TBB_ROOT}) set(TBB_INC_SEARCH_PATH "") set(TBB_LIB_SEARCH_PATH "") - # If user built from sources set(TBB_BUILD_PREFIX $ENV{TBB_BUILD_PREFIX}) -if (TBB_BUILD_PREFIX AND ENV_TBB_ROOT) - getenv_path(TBB_BUILD_DIR) - if (NOT ENV_TBB_BUILD_DIR) - set(ENV_TBB_BUILD_DIR ${ENV_TBB_ROOT}/build) - endif () - - # include directory under ${ENV_TBB_ROOT}/include - list(APPEND TBB_LIB_SEARCH_PATH - ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_release - ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_debug) -endif () - +if(TBB_BUILD_PREFIX AND ENV_TBB_ROOT) + getenv_path(TBB_BUILD_DIR) + if(NOT ENV_TBB_BUILD_DIR) + set(ENV_TBB_BUILD_DIR ${ENV_TBB_ROOT}/build) + endif() + + # include directory under ${ENV_TBB_ROOT}/include + list( + APPEND + TBB_LIB_SEARCH_PATH + ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_release + ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_debug + ) +endif() # For Windows, let's assume that the user might be using the precompiled # TBB packages from the main website. These use a rather awkward directory @@ -246,157 +268,181 @@ endif () # to detect the "best" version to use. The user will have to manually # select the right files. (Chances are the distributions are shipping their # custom version of tbb, anyway, so the problem is probably nonexistent.) -if (WIN32 AND MSVC) - set(COMPILER_PREFIX "vc7.1") - if (MSVC_VERSION EQUAL 1400) - set(COMPILER_PREFIX "vc8") - elseif(MSVC_VERSION EQUAL 1500) - set(COMPILER_PREFIX "vc9") - elseif(MSVC_VERSION EQUAL 1600) - set(COMPILER_PREFIX "vc10") - elseif(MSVC_VERSION EQUAL 1700) - set(COMPILER_PREFIX "vc11") - elseif(MSVC_VERSION EQUAL 1800) - set(COMPILER_PREFIX "vc12") - elseif(MSVC_VERSION GREATER_EQUAL 1900) - set(COMPILER_PREFIX "vc14") - endif () - - # for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path - foreach (dir IN LISTS TBB_PREFIX_PATH) - if (CMAKE_CL_64) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia64/${COMPILER_PREFIX}/lib) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia64/${COMPILER_PREFIX}) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${COMPILER_PREFIX}/lib) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${COMPILER_PREFIX}) - else () - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${COMPILER_PREFIX}/lib) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${COMPILER_PREFIX}) - endif () - endforeach () -endif () +if(WIN32 AND MSVC) + set(COMPILER_PREFIX "vc7.1") + if(MSVC_VERSION EQUAL 1400) + set(COMPILER_PREFIX "vc8") + elseif(MSVC_VERSION EQUAL 1500) + set(COMPILER_PREFIX "vc9") + elseif(MSVC_VERSION EQUAL 1600) + set(COMPILER_PREFIX "vc10") + elseif(MSVC_VERSION EQUAL 1700) + set(COMPILER_PREFIX "vc11") + elseif(MSVC_VERSION EQUAL 1800) + set(COMPILER_PREFIX "vc12") + elseif(MSVC_VERSION GREATER_EQUAL 1900) + set(COMPILER_PREFIX "vc14") + endif() + + # for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path + foreach(dir IN LISTS TBB_PREFIX_PATH) + if(CMAKE_CL_64) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia64/${COMPILER_PREFIX}/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia64/${COMPILER_PREFIX}) + list( + APPEND + TBB_LIB_SEARCH_PATH + ${dir}/intel64/${COMPILER_PREFIX}/lib + ) + list( + APPEND + TBB_LIB_SEARCH_PATH + ${dir}/lib/intel64/${COMPILER_PREFIX} + ) + else() + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${COMPILER_PREFIX}/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${COMPILER_PREFIX}) + endif() + endforeach() +endif() # For OS X binary distribution, choose libc++ based libraries for Mavericks (10.9) # and above and AppleClang -if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND - NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0) - set (USE_LIBCXX OFF) - cmake_policy(GET CMP0025 POLICY_VAR) - - if (POLICY_VAR STREQUAL "NEW") - if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - set (USE_LIBCXX ON) - endif () - else () - if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set (USE_LIBCXX ON) - endif () - endif () - - if (USE_LIBCXX) - foreach (dir IN LISTS TBB_PREFIX_PATH) - list (APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/libc++ ${dir}/libc++/lib) - endforeach () - endif () -endif () +if( + CMAKE_SYSTEM_NAME STREQUAL "Darwin" + AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0 +) + set(USE_LIBCXX OFF) + cmake_policy(GET CMP0025 POLICY_VAR) + + if(POLICY_VAR STREQUAL "NEW") + if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + set(USE_LIBCXX ON) + endif() + else() + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(USE_LIBCXX ON) + endif() + endif() + + if(USE_LIBCXX) + foreach(dir IN LISTS TBB_PREFIX_PATH) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/libc++ ${dir}/libc++/lib) + endforeach() + endif() +endif() # check compiler ABI -if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(COMPILER_PREFIX) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) - list(APPEND COMPILER_PREFIX "gcc4.8") - endif() - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) - list(APPEND COMPILER_PREFIX "gcc4.7") - endif() - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) - list(APPEND COMPILER_PREFIX "gcc4.4") - endif() - list(APPEND COMPILER_PREFIX "gcc4.1") +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(COMPILER_PREFIX) + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) + list(APPEND COMPILER_PREFIX "gcc4.8") + endif() + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) + list(APPEND COMPILER_PREFIX "gcc4.7") + endif() + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) + list(APPEND COMPILER_PREFIX "gcc4.4") + endif() + list(APPEND COMPILER_PREFIX "gcc4.1") elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(COMPILER_PREFIX) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) # Complete guess - list(APPEND COMPILER_PREFIX "gcc4.8") - endif() - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6) - list(APPEND COMPILER_PREFIX "gcc4.7") - endif() - list(APPEND COMPILER_PREFIX "gcc4.4") + set(COMPILER_PREFIX) + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) # Complete guess + list(APPEND COMPILER_PREFIX "gcc4.8") + endif() + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6) + list(APPEND COMPILER_PREFIX "gcc4.7") + endif() + list(APPEND COMPILER_PREFIX "gcc4.4") else() # Assume compatibility with 4.4 for other compilers - list(APPEND COMPILER_PREFIX "gcc4.4") -endif () + list(APPEND COMPILER_PREFIX "gcc4.4") +endif() # if platform architecture is explicitly specified set(TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM}) -if (TBB_ARCH_PLATFORM) - foreach (dir IN LISTS TBB_PREFIX_PATH) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${TBB_ARCH_PLATFORM}/lib) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/${TBB_ARCH_PLATFORM}) - endforeach () -endif () - -foreach (dir IN LISTS TBB_PREFIX_PATH) - foreach (prefix IN LISTS COMPILER_PREFIX) - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${prefix}) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/lib) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${prefix}/lib) - else () - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${prefix}) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/lib) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${prefix}/lib) - endif () - endforeach() -endforeach () +if(TBB_ARCH_PLATFORM) + foreach(dir IN LISTS TBB_PREFIX_PATH) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${TBB_ARCH_PLATFORM}/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/${TBB_ARCH_PLATFORM}) + endforeach() +endif() + +foreach(dir IN LISTS TBB_PREFIX_PATH) + foreach(prefix IN LISTS COMPILER_PREFIX) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${prefix}) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${prefix}/lib) + else() + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${prefix}) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${prefix}/lib) + endif() + endforeach() +endforeach() # add general search paths -foreach (dir IN LISTS TBB_PREFIX_PATH) - list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib ${dir}/Lib ${dir}/lib/tbb - ${dir}/Libs) - list(APPEND TBB_INC_SEARCH_PATH ${dir}/include ${dir}/Include - ${dir}/include/tbb) -endforeach () +foreach(dir IN LISTS TBB_PREFIX_PATH) + list( + APPEND + TBB_LIB_SEARCH_PATH + ${dir}/lib + ${dir}/Lib + ${dir}/lib/tbb + ${dir}/Libs + ) + list( + APPEND + TBB_INC_SEARCH_PATH + ${dir}/include + ${dir}/Include + ${dir}/include/tbb + ) +endforeach() set(TBB_LIBRARY_NAMES tbb) get_debug_names(TBB_LIBRARY_NAMES) - -find_path(TBB_INCLUDE_DIR - NAMES tbb/tbb.h - PATHS ${TBB_INC_SEARCH_PATH}) - -find_library(TBB_LIBRARY_RELEASE - NAMES ${TBB_LIBRARY_NAMES} - PATHS ${TBB_LIB_SEARCH_PATH}) -find_library(TBB_LIBRARY_DEBUG - NAMES ${TBB_LIBRARY_NAMES_DEBUG} - PATHS ${TBB_LIB_SEARCH_PATH}) +find_path(TBB_INCLUDE_DIR NAMES tbb/tbb.h PATHS ${TBB_INC_SEARCH_PATH}) + +find_library( + TBB_LIBRARY_RELEASE + NAMES ${TBB_LIBRARY_NAMES} + PATHS ${TBB_LIB_SEARCH_PATH} +) +find_library( + TBB_LIBRARY_DEBUG + NAMES ${TBB_LIBRARY_NAMES_DEBUG} + PATHS ${TBB_LIB_SEARCH_PATH} +) make_library_set(TBB_LIBRARY) findpkg_finish(TBB tbb) #if we haven't found TBB no point on going any further -if (NOT TBB_FOUND) - return() -endif () +if(NOT TBB_FOUND) + return() +endif() #============================================================================= # Look for TBB's malloc package set(TBB_MALLOC_LIBRARY_NAMES tbbmalloc) get_debug_names(TBB_MALLOC_LIBRARY_NAMES) -find_path(TBB_MALLOC_INCLUDE_DIR - NAMES tbb/tbb.h - PATHS ${TBB_INC_SEARCH_PATH}) - -find_library(TBB_MALLOC_LIBRARY_RELEASE - NAMES ${TBB_MALLOC_LIBRARY_NAMES} - PATHS ${TBB_LIB_SEARCH_PATH}) -find_library(TBB_MALLOC_LIBRARY_DEBUG - NAMES ${TBB_MALLOC_LIBRARY_NAMES_DEBUG} - PATHS ${TBB_LIB_SEARCH_PATH}) +find_path(TBB_MALLOC_INCLUDE_DIR NAMES tbb/tbb.h PATHS ${TBB_INC_SEARCH_PATH}) + +find_library( + TBB_MALLOC_LIBRARY_RELEASE + NAMES ${TBB_MALLOC_LIBRARY_NAMES} + PATHS ${TBB_LIB_SEARCH_PATH} +) +find_library( + TBB_MALLOC_LIBRARY_DEBUG + NAMES ${TBB_MALLOC_LIBRARY_NAMES_DEBUG} + PATHS ${TBB_LIB_SEARCH_PATH} +) make_library_set(TBB_MALLOC_LIBRARY) findpkg_finish(TBB_MALLOC tbbmalloc) @@ -406,51 +452,75 @@ findpkg_finish(TBB_MALLOC tbbmalloc) set(TBB_MALLOC_PROXY_LIBRARY_NAMES tbbmalloc_proxy) get_debug_names(TBB_MALLOC_PROXY_LIBRARY_NAMES) -find_path(TBB_MALLOC_PROXY_INCLUDE_DIR - NAMES tbb/tbbmalloc_proxy.h - PATHS ${TBB_INC_SEARCH_PATH}) - -find_library(TBB_MALLOC_PROXY_LIBRARY_RELEASE - NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES} - PATHS ${TBB_LIB_SEARCH_PATH}) -find_library(TBB_MALLOC_PROXY_LIBRARY_DEBUG - NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES_DEBUG} - PATHS ${TBB_LIB_SEARCH_PATH}) +find_path( + TBB_MALLOC_PROXY_INCLUDE_DIR + NAMES tbb/tbbmalloc_proxy.h + PATHS ${TBB_INC_SEARCH_PATH} +) + +find_library( + TBB_MALLOC_PROXY_LIBRARY_RELEASE + NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES} + PATHS ${TBB_LIB_SEARCH_PATH} +) +find_library( + TBB_MALLOC_PROXY_LIBRARY_DEBUG + NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES_DEBUG} + PATHS ${TBB_LIB_SEARCH_PATH} +) make_library_set(TBB_MALLOC_PROXY_LIBRARY) findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_proxy) - #============================================================================= #parse all the version numbers from tbb if(NOT TBB_VERSION) - if (EXISTS "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h") - file(STRINGS - "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h" - TBB_VERSION_CONTENTS - REGEX "VERSION") - else() - #only read the start of the file - file(STRINGS - "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h" - TBB_VERSION_CONTENTS - REGEX "VERSION") - endif() - - string(REGEX REPLACE - ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" - TBB_VERSION_MAJOR "${TBB_VERSION_CONTENTS}") - - string(REGEX REPLACE - ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" - TBB_VERSION_MINOR "${TBB_VERSION_CONTENTS}") - - string(REGEX REPLACE - ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" - TBB_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}") - - string(REGEX REPLACE - ".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" "\\1" - TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}") - + if(EXISTS "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h") + file( + STRINGS + "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h" + TBB_VERSION_CONTENTS + REGEX "VERSION" + ) + else() + #only read the start of the file + file( + STRINGS + "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h" + TBB_VERSION_CONTENTS + REGEX "VERSION" + ) + endif() + + string( + REGEX REPLACE + ".*#define TBB_VERSION_MAJOR ([0-9]+).*" + "\\1" + TBB_VERSION_MAJOR + "${TBB_VERSION_CONTENTS}" + ) + + string( + REGEX REPLACE + ".*#define TBB_VERSION_MINOR ([0-9]+).*" + "\\1" + TBB_VERSION_MINOR + "${TBB_VERSION_CONTENTS}" + ) + + string( + REGEX REPLACE + ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" + "\\1" + TBB_INTERFACE_VERSION + "${TBB_VERSION_CONTENTS}" + ) + + string( + REGEX REPLACE + ".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" + "\\1" + TBB_COMPATIBLE_INTERFACE_VERSION + "${TBB_VERSION_CONTENTS}" + ) endif() diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake index 8ab03bc5f0b..b8bb6caf4a4 100644 --- a/cmake/GetGitRevisionDescription.cmake +++ b/cmake/GetGitRevisionDescription.cmake @@ -37,7 +37,7 @@ # http://www.boost.org/LICENSE_1_0.txt) if(__get_git_revision_description) - return() + return() endif() set(__get_git_revision_description YES) @@ -46,123 +46,127 @@ set(__get_git_revision_description YES) get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) function(get_git_head_revision _refspecvar _hashvar) - set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - set(GIT_DIR "${GIT_PARENT_DIR}/.git") - while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories - set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") - get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) - if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) - # We have reached the root directory, we are not in git - set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) - set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) - return() - endif() - set(GIT_DIR "${GIT_PARENT_DIR}/.git") - endwhile() - # check if this is a submodule - if(NOT IS_DIRECTORY ${GIT_DIR}) - file(READ ${GIT_DIR} submodule) - string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule}) - get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH) - get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE) - endif() - set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") - if(NOT EXISTS "${GIT_DATA}") - file(MAKE_DIRECTORY "${GIT_DATA}") - endif() + set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories + set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") + get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) + if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) + # We have reached the root directory, we are not in git + set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + return() + endif() + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + endwhile() + # check if this is a submodule + if(NOT IS_DIRECTORY ${GIT_DIR}) + file(READ ${GIT_DIR} submodule) + string( + REGEX REPLACE + "gitdir: (.*)\n$" + "\\1" + GIT_DIR_RELATIVE + ${submodule} + ) + get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH) + get_filename_component( + GIT_DIR + ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} + ABSOLUTE + ) + endif() + set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") + if(NOT EXISTS "${GIT_DATA}") + file(MAKE_DIRECTORY "${GIT_DATA}") + endif() - if(NOT EXISTS "${GIT_DIR}/HEAD") - return() - endif() - set(HEAD_FILE "${GIT_DATA}/HEAD") - configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) + if(NOT EXISTS "${GIT_DIR}/HEAD") + return() + endif() + set(HEAD_FILE "${GIT_DATA}/HEAD") + configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) - configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" - "${GIT_DATA}/grabRef.cmake" - @ONLY) - include("${GIT_DATA}/grabRef.cmake") + configure_file( + "${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" + "${GIT_DATA}/grabRef.cmake" + @ONLY + ) + include("${GIT_DATA}/grabRef.cmake") - set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) - set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) + set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) + set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) endfunction() function(git_describe _var) - if(NOT GIT_FOUND) - find_package(Git QUIET) - endif() - get_git_head_revision(refspec hash) - if(NOT GIT_FOUND) - set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) - return() - endif() - if(NOT hash) - set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) - return() - endif() + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(refspec hash) + if(NOT GIT_FOUND) + set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) + return() + endif() + if(NOT hash) + set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) + return() + endif() - # TODO sanitize - #if((${ARGN}" MATCHES "&&") OR - # (ARGN MATCHES "||") OR - # (ARGN MATCHES "\\;")) - # message("Please report the following error to the project!") - # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") - #endif() + # TODO sanitize + #if((${ARGN}" MATCHES "&&") OR + # (ARGN MATCHES "||") OR + # (ARGN MATCHES "\\;")) + # message("Please report the following error to the project!") + # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") + #endif() - #message(STATUS "Arguments to execute_process: ${ARGN}") + #message(STATUS "Arguments to execute_process: ${ARGN}") - execute_process(COMMAND - "${GIT_EXECUTABLE}" - describe - ${hash} - ${ARGN} - WORKING_DIRECTORY - "${CMAKE_CURRENT_SOURCE_DIR}" - RESULT_VARIABLE - res - OUTPUT_VARIABLE - out - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(NOT res EQUAL 0) - set(out "${out}-${res}-NOTFOUND") - endif() + execute_process( + COMMAND "${GIT_EXECUTABLE}" describe ${hash} ${ARGN} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE res + OUTPUT_VARIABLE out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(NOT res EQUAL 0) + set(out "${out}-${res}-NOTFOUND") + endif() - set(${_var} "${out}" PARENT_SCOPE) + set(${_var} "${out}" PARENT_SCOPE) endfunction() function(git_get_exact_tag _var) - git_describe(out --exact-match ${ARGN}) - set(${_var} "${out}" PARENT_SCOPE) + git_describe(out --exact-match ${ARGN}) + set(${_var} "${out}" PARENT_SCOPE) endfunction() function(git_local_changes _var) - if(NOT GIT_FOUND) - find_package(Git QUIET) - endif() - get_git_head_revision(refspec hash) - if(NOT GIT_FOUND) - set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) - return() - endif() - if(NOT hash) - set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) - return() - endif() + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(refspec hash) + if(NOT GIT_FOUND) + set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) + return() + endif() + if(NOT hash) + set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) + return() + endif() - execute_process(COMMAND - "${GIT_EXECUTABLE}" - diff-index --quiet HEAD -- - WORKING_DIRECTORY - "${CMAKE_CURRENT_SOURCE_DIR}" - RESULT_VARIABLE - res - OUTPUT_VARIABLE - out - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(res EQUAL 0) - set(${_var} "CLEAN" PARENT_SCOPE) - else() - set(${_var} "DIRTY" PARENT_SCOPE) - endif() + execute_process( + COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD -- + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE res + OUTPUT_VARIABLE out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(res EQUAL 0) + set(${_var} "CLEAN" PARENT_SCOPE) + else() + set(${_var} "DIRTY" PARENT_SCOPE) + endif() endfunction() diff --git a/codegen/generate_sympy_stepper.py b/codegen/generate_sympy_stepper.py index b28ea2bc758..7602a30c4a8 100644 --- a/codegen/generate_sympy_stepper.py +++ b/codegen/generate_sympy_stepper.py @@ -195,10 +195,14 @@ def my_step_function_print(name_exprs, run_cse=True): lines = [] - head = "template bool rk4(const T* p, const T* d, const T t, const T h, const T lambda, const T m, const T p_abs, GetB getB, T* err, const T errTol, T* new_p, T* new_d, T* new_time, T* path_derivatives, T* J) {" + head = "template Acts::Result rk4(const T* p, const T* d, const T t, const T h, const T lambda, const T m, const T p_abs, GetB getB, T* err, const T errTol, T* new_p, T* new_d, T* new_time, T* path_derivatives, T* J) {" lines.append(head) - lines.append(" const auto B1 = getB(p);") + lines.append(" const auto B1res = getB(p);") + lines.append( + " if (!B1res.ok()) {\n return Acts::Result::failure(B1res.error());\n }" + ) + lines.append(" const auto B1 = *B1res;") def pre_expr_hook(var): if str(var) == "p2": @@ -211,13 +215,15 @@ def pre_expr_hook(var): def post_expr_hook(var): if str(var) == "p2": - return "const auto B2 = getB(p2);" + return "const auto B2res = getB(p2);\n if (!B2res.ok()) {\n return Acts::Result::failure(B2res.error());\n }\n const auto B2 = *B2res;" if str(var) == "p3": - return "const auto B3 = getB(p3);" + return "const auto B3res = getB(p3);\n if (!B3res.ok()) {\n return Acts::Result::failure(B3res.error());\n }\n const auto B3 = *B3res;" if str(var) == "err": - return "if (*err > errTol) {\n return false;\n}" + return ( + "if (*err > errTol) {\n return Acts::Result::success(false);\n}" + ) if str(var) == "new_time": - return "if (J == nullptr) {\n return true;\n}" + return "if (J == nullptr) {\n return Acts::Result::success(true);\n}" if str(var) == "new_J": return printer.doprint(Assignment(MatrixSymbol("J", 8, 8), var)) return None @@ -232,7 +238,7 @@ def post_expr_hook(var): ) lines.extend([f" {l}" for l in code.split("\n")]) - lines.append(" return true;") + lines.append(" return Acts::Result::success(true);") lines.append("}") @@ -279,6 +285,8 @@ def post_expr_hook(var): #pragma once +#include + #include """ ) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index b9f309d4da3..1f5e8a1aa6c 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -17,7 +17,7 @@ list(APPEND sphinx_command "-W;--keep-going") list(APPEND sphinx_command "-t;run_doxygen;-t;lazy_autodoc") if(DEFINED ENV{CI}) - list(APPEND sphinx_command "-b;linkcheck") + list(APPEND sphinx_command "-b;linkcheck") endif() list(APPEND sphinx_command "${CMAKE_CURRENT_SOURCE_DIR}") @@ -27,11 +27,14 @@ message(${sphinx_command}) # standard target to build the documentation without automatic API generation add_custom_target( - docs - COMMAND ${Sphinx_EXECUTABLE} ${sphinx_command} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT "Build documentation") + docs + COMMAND ${Sphinx_EXECUTABLE} ${sphinx_command} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Build documentation" +) install( - DIRECTORY ${sphinx_html}/ - DESTINATION ${CMAKE_INSTALL_DOCDIR}/Acts OPTIONAL) + DIRECTORY ${sphinx_html}/ + DESTINATION ${CMAKE_INSTALL_DOCDIR}/Acts + OPTIONAL +) diff --git a/docs/contribution/run_formatting.md b/docs/contribution/run_formatting.md index 75f915cea88..2f41d8870a3 100644 --- a/docs/contribution/run_formatting.md +++ b/docs/contribution/run_formatting.md @@ -22,11 +22,7 @@ $ CI/check_format $SOURCE_DIR In some cases, different `clang-format` versions will result in slightly different outputs. In many cases, this is accepted by the CI. However, it is recommended to use the same major version of `clang-format` to perform local -formatting. If you are comfortable with Docker, you can use the [docker image -used by the -CI](https://github.com/acts-project/machines/blob/master/format14/Dockerfile). -You can use the script located in `CI/check_format_local` similar to the -description above. Other options to obtain a compatible `clang-format` version +formatting. Options to obtain a compatible `clang-format` version are to use your package manager (e.g. Ubuntu distributions usually offer a set of versions to install), or to use statically linked binaries from [here](https://github.com/muttleyxd/clang-tools-static-binaries)[^1] and use them with: diff --git a/docs/examples/python_bindings.rst b/docs/examples/python_bindings.rst index e5a94c81ad9..fe0cd1dcb9f 100644 --- a/docs/examples/python_bindings.rst +++ b/docs/examples/python_bindings.rst @@ -40,7 +40,7 @@ sets up the particle propagation and runs a few events. randomNumberSvc=rnd, ntests=1000, sterileLogger=False, - propagationStepCollection="propagation-steps", + outputSummaryCollection="propagation_summary", ) s.addAlgorithm(alg) @@ -53,7 +53,7 @@ sets up the particle propagation and runs a few events. s.addWriter( acts.examples.ObjPropagationStepsWriter( level=acts.logging.INFO, - collection="propagation-steps", + collection="propagation_summary", outputDir=objDir, ) ) @@ -61,7 +61,7 @@ sets up the particle propagation and runs a few events. s.addWriter( acts.examples.RootPropagationStepsWriter( level=acts.logging.INFO, - collection="propagation-steps", + collection="propagation_summary", filePath=outputDir + "/propagation_steps.root", ) ) diff --git a/thirdparty/FRNN/CMakeLists.txt b/thirdparty/FRNN/CMakeLists.txt index 3399ab3289b..cd36fc9a330 100644 --- a/thirdparty/FRNN/CMakeLists.txt +++ b/thirdparty/FRNN/CMakeLists.txt @@ -10,13 +10,17 @@ include(FetchContent) message(STATUS "Building FRNN as part of the ACTS project") # Declare where to get frnncontent from -FetchContent_Declare( frnncontent ${ACTS_FRNN_SOURCE} ) +FetchContent_Declare(frnncontent ${ACTS_FRNN_SOURCE}) # FRNN does not provide a CMakeLists.txt, so we use a custom one. Because of this, # we have to implement the populate step manually FetchContent_GetProperties(frnncontent) if(NOT frnncontent_POPULATED) - FetchContent_Populate(frnncontent) - configure_file(CMakeLists.txt.in "${frnncontent_SOURCE_DIR}/CMakeLists.txt" COPYONLY) - add_subdirectory(${frnncontent_SOURCE_DIR} ${frnncontent_BINARY_DIR}) + FetchContent_Populate(frnncontent) + configure_file( + CMakeLists.txt.in + "${frnncontent_SOURCE_DIR}/CMakeLists.txt" + COPYONLY + ) + add_subdirectory(${frnncontent_SOURCE_DIR} ${frnncontent_BINARY_DIR}) endif() diff --git a/thirdparty/OpenDataDetector b/thirdparty/OpenDataDetector index 5d9950adb3e..0bf11ff33bd 160000 --- a/thirdparty/OpenDataDetector +++ b/thirdparty/OpenDataDetector @@ -1 +1 @@ -Subproject commit 5d9950adb3e264e717daef92500eaa304f370b6d +Subproject commit 0bf11ff33bd10d3070e6ecbc4bea0a7c42d86fa0 diff --git a/thirdparty/actsvg/CMakeLists.txt b/thirdparty/actsvg/CMakeLists.txt index 5b1622d3290..1fea9d85b2b 100644 --- a/thirdparty/actsvg/CMakeLists.txt +++ b/thirdparty/actsvg/CMakeLists.txt @@ -7,12 +7,12 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # CMake include(s). -include( FetchContent ) +include(FetchContent) # Tell the user what's happening. -message( STATUS "Building actsvg as part of the ACTS project" ) +message(STATUS "Building actsvg as part of the ACTS project") -FetchContent_Declare( actsvg ${ACTS_ACTSVG_SOURCE} ) +FetchContent_Declare(actsvg ${ACTS_ACTSVG_SOURCE}) # Now set up its build. -FetchContent_MakeAvailable( actsvg ) +FetchContent_MakeAvailable(actsvg) diff --git a/thirdparty/algebra-plugins/CMakeLists.txt b/thirdparty/algebra-plugins/CMakeLists.txt index 75fb0f9ad77..d09880b2615 100644 --- a/thirdparty/algebra-plugins/CMakeLists.txt +++ b/thirdparty/algebra-plugins/CMakeLists.txt @@ -10,37 +10,71 @@ include(FetchContent) # Tell the user what's happening. -message( STATUS "Building algebra-plugins as part of the Acts project" ) +message(STATUS "Building algebra-plugins as part of the Acts project") -FetchContent_Declare( AlgebraPlugins ${ACTS_ALGEBRAPLUGINS_SOURCE} ) +FetchContent_Declare(AlgebraPlugins ${ACTS_ALGEBRAPLUGINS_SOURCE}) # Options used in the build of Algebra Plugins. -set(ALGEBRA_PLUGINS_BUILD_TESTING FALSE CACHE BOOL - "Turn off the build of the Algebra Plugins unit tests") -set(ALGEBRA_PLUGINS_INCLUDE_EIGEN TRUE CACHE BOOL - "Turn on the build of algebra::eigen") -set(ALGEBRA_PLUGINS_INCLUDE_VC FALSE CACHE BOOL - "Turn off the build of algebra::vc_array") -set(ALGEBRA_PLUGINS_INCLUDE_VECMEM TRUE CACHE BOOL - "Turn on the build of algebra::vecmem_array") +set(ALGEBRA_PLUGINS_BUILD_TESTING + FALSE + CACHE BOOL + "Turn off the build of the Algebra Plugins unit tests" +) +set(ALGEBRA_PLUGINS_INCLUDE_EIGEN + TRUE + CACHE BOOL + "Turn on the build of algebra::eigen" +) +set(ALGEBRA_PLUGINS_INCLUDE_VC + FALSE + CACHE BOOL + "Turn off the build of algebra::vc_array" +) +set(ALGEBRA_PLUGINS_INCLUDE_VECMEM + TRUE + CACHE BOOL + "Turn on the build of algebra::vecmem_array" +) # Build smatrix plugin only when it needs to be # ROOT is not provided in native github compilers :/ -set(ALGEBRA_PLUGINS_INCLUDE_SMATRIX ${DETRAY_SMATRIX_PLUGIN} - CACHE BOOL "Turn on/off the build of algebra::smatrix") - -set(ALGEBRA_PLUGINS_SETUP_EIGEN3 OFF CACHE BOOL - "Do not have Algebra Plugins set up Eigen3 for itself") -set(ALGEBRA_PLUGINS_SETUP_VC OFF CACHE BOOL - "Do not have Algebra Plugins set up Vc for itself") -set(ALGEBRA_PLUGINS_USE_SYSTEM_VC OFF CACHE BOOL - "Have Algebra Plugins build Vc itself") -set(ALGEBRA_PLUGINS_SETUP_VECMEM FALSE CACHE BOOL - "Do not set up VecMem in Algebra Plugins") -set(ALGEBRA_PLUGINS_SETUP_GOOGLETEST FALSE CACHE BOOL - "Do not set up GoogleTest in Algebra Plugins") - -set(ALGEBRA_PLUGINS_SETUP_BENCHMARK FALSE CACHE BOOL "Do not setup Algebra Plugins benchmark") +set(ALGEBRA_PLUGINS_INCLUDE_SMATRIX + ${DETRAY_SMATRIX_PLUGIN} + CACHE BOOL + "Turn on/off the build of algebra::smatrix" +) + +set(ALGEBRA_PLUGINS_SETUP_EIGEN3 + OFF + CACHE BOOL + "Do not have Algebra Plugins set up Eigen3 for itself" +) +set(ALGEBRA_PLUGINS_SETUP_VC + OFF + CACHE BOOL + "Do not have Algebra Plugins set up Vc for itself" +) +set(ALGEBRA_PLUGINS_USE_SYSTEM_VC + OFF + CACHE BOOL + "Have Algebra Plugins build Vc itself" +) +set(ALGEBRA_PLUGINS_SETUP_VECMEM + FALSE + CACHE BOOL + "Do not set up VecMem in Algebra Plugins" +) +set(ALGEBRA_PLUGINS_SETUP_GOOGLETEST + FALSE + CACHE BOOL + "Do not set up GoogleTest in Algebra Plugins" +) + +set(ALGEBRA_PLUGINS_SETUP_BENCHMARK + FALSE + CACHE BOOL + "Do not setup Algebra Plugins benchmark" +) # Now set up its build. -FetchContent_MakeAvailable( AlgebraPlugins ) +FetchContent_MakeAvailable(AlgebraPlugins) diff --git a/thirdparty/covfie/CMakeLists.txt b/thirdparty/covfie/CMakeLists.txt index bfd6da88215..0d6d71cf47e 100644 --- a/thirdparty/covfie/CMakeLists.txt +++ b/thirdparty/covfie/CMakeLists.txt @@ -10,23 +10,27 @@ include(FetchContent) # Tell the user what's happening. -message( STATUS "Building Covfie as part of the Acts project" ) +message(STATUS "Building Covfie as part of the Acts project") -set( COVFIE_VERSION "v${_acts_covfie_version}") +set(COVFIE_VERSION "v${_acts_covfie_version}") # Declare where to get covfie from. -FetchContent_Declare( covfie ${ACTS_COVFIE_SOURCE} ) +FetchContent_Declare(covfie ${ACTS_COVFIE_SOURCE}) # Options used for covfie. -set( COVFIE_BUILD_EXAMPLES OFF CACHE BOOL "Build covfie examples") -set( COVFIE_BUILD_TESTS OFF CACHE BOOL "Build covfie tests") -set( COVFIE_BUILD_BENCHMARKS OFF CACHE BOOL "Build covfie benchmarks") +set(COVFIE_BUILD_EXAMPLES OFF CACHE BOOL "Build covfie examples") +set(COVFIE_BUILD_TESTS OFF CACHE BOOL "Build covfie tests") +set(COVFIE_BUILD_BENCHMARKS OFF CACHE BOOL "Build covfie benchmarks") -set( COVFIE_PLATFORM_CPU ON CACHE BOOL "Enable covfie CPU platform") -set( COVFIE_PLATFORM_CUDA ${ACTS_BUILD_PLUGIN_CUDA} CACHE BOOL "Enable covfie CUDA platform") +set(COVFIE_PLATFORM_CPU ON CACHE BOOL "Enable covfie CPU platform") +set(COVFIE_PLATFORM_CUDA + ${ACTS_BUILD_PLUGIN_CUDA} + CACHE BOOL + "Enable covfie CUDA platform" +) -set( COVFIE_REQUIRE_CXX20 OFF CACHE BOOL "Enable covfie C++20 requirement") -set( COVFIE_QUIET ON CACHE BOOL "Quiet covfie feature warnings") +set(COVFIE_REQUIRE_CXX20 OFF CACHE BOOL "Enable covfie C++20 requirement") +set(COVFIE_QUIET ON CACHE BOOL "Quiet covfie feature warnings") # Now set up its build. -FetchContent_MakeAvailable( covfie ) +FetchContent_MakeAvailable(covfie) diff --git a/thirdparty/detray/CMakeLists.txt b/thirdparty/detray/CMakeLists.txt index c93c79cc72e..c24b260b0ff 100644 --- a/thirdparty/detray/CMakeLists.txt +++ b/thirdparty/detray/CMakeLists.txt @@ -7,56 +7,76 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # CMake include(s). -include( FetchContent ) +include(FetchContent) # Tell the user what's happening. -message( STATUS "Building Detray as part of the Acts project" ) +message(STATUS "Building Detray as part of the Acts project") -set( DETRAY_VERSION "v${_acts_detray_version}") +set(DETRAY_VERSION "v${_acts_detray_version}") # Declare where to get Detray from. -FetchContent_Declare( Detray ${ACTS_DETRAY_SOURCE} ) +FetchContent_Declare(Detray ${ACTS_DETRAY_SOURCE}) # Options used in the build of Detray. if(ACTS_CUSTOM_SCALARTYPE) - set(ACTS_DETRAY_SCALARTYPE ${ACTS_CUSTOM_SCALARTYPE}) + set(ACTS_DETRAY_SCALARTYPE ${ACTS_CUSTOM_SCALARTYPE}) else() - set(ACTS_DETRAY_SCALARTYPE "double") + set(ACTS_DETRAY_SCALARTYPE "double") endif() -set( DETRAY_CUSTOM_SCALARTYPE "${ACTS_DETRAY_SCALARTYPE}" CACHE STRING - "Scalar type to use in the Detray code" ) - -set( DETRAY_BUILD_TESTING OFF CACHE BOOL - "Turn off the build of the Detray unit tests" ) -set( DETRAY_BUILD_TUTORIALS OFF CACHE BOOL - "Turn off the build of the Detray tutorials" ) -set( DETRAY_EIGEN_PLUGIN ON CACHE BOOL - "Turn on the build of the Detray Eigen code" ) -set( DETRAY_VC_PLUGIN OFF CACHE BOOL - "Turn off the build of the Detray Vc code" ) - -set( DETRAY_SETUP_VECMEM OFF CACHE BOOL - "Do not set up VecMem as part of Detray" ) -set( DETRAY_SETUP_ALGEBRA_PLUGINS OFF CACHE BOOL - "Do not set up Algebra Plugins as part of Detray" ) -set( DETRAY_SETUP_GOOGLETEST OFF CACHE BOOL - "Do not set up GoogleTest as part of Detray" ) -set( DETRAY_SETUP_BENCHMARK OFF CACHE BOOL - "Do not set up Google Benchmark as part of Detray" ) -set( DETRAY_SETUP_THRUST ON CACHE BOOL - "Set up Thrust as part of Detray" ) -set( DETRAY_SETUP_COVFIE OFF CACHE BOOL - "Do not set up covfie as part of Detray" ) -set( DETRAY_SETUP_NLOHMANN OFF CACHE BOOL - "Do not set up Nlohmann as part of Detray" ) -set( DETRAY_SETUP_ACTSVG OFF CACHE BOOL - "Do not set up Actsvg as part of Detray" ) -set( DETRAY_SETUP_DFELIBS ON CACHE BOOL - "Do not set up Dfelibs as part of Detray" ) -set( DETRAY_SVG_DISPLAY OFF CACHE BOOL - "No not build the ActSVG display module" ) +set(DETRAY_CUSTOM_SCALARTYPE + "${ACTS_DETRAY_SCALARTYPE}" + CACHE STRING + "Scalar type to use in the Detray code" +) +set(DETRAY_BUILD_TESTING + OFF + CACHE BOOL + "Turn off the build of the Detray unit tests" +) +set(DETRAY_BUILD_TUTORIALS + OFF + CACHE BOOL + "Turn off the build of the Detray tutorials" +) +set(DETRAY_EIGEN_PLUGIN + ON + CACHE BOOL + "Turn on the build of the Detray Eigen code" +) +set(DETRAY_VC_PLUGIN OFF CACHE BOOL "Turn off the build of the Detray Vc code") + +set(DETRAY_SETUP_VECMEM OFF CACHE BOOL "Do not set up VecMem as part of Detray") +set(DETRAY_SETUP_ALGEBRA_PLUGINS + OFF + CACHE BOOL + "Do not set up Algebra Plugins as part of Detray" +) +set(DETRAY_SETUP_GOOGLETEST + OFF + CACHE BOOL + "Do not set up GoogleTest as part of Detray" +) +set(DETRAY_SETUP_BENCHMARK + OFF + CACHE BOOL + "Do not set up Google Benchmark as part of Detray" +) +set(DETRAY_SETUP_THRUST ON CACHE BOOL "Set up Thrust as part of Detray") +set(DETRAY_SETUP_COVFIE OFF CACHE BOOL "Do not set up covfie as part of Detray") +set(DETRAY_SETUP_NLOHMANN + OFF + CACHE BOOL + "Do not set up Nlohmann as part of Detray" +) +set(DETRAY_SETUP_ACTSVG OFF CACHE BOOL "Do not set up Actsvg as part of Detray") +set(DETRAY_SETUP_DFELIBS + ON + CACHE BOOL + "Do not set up Dfelibs as part of Detray" +) +set(DETRAY_SVG_DISPLAY OFF CACHE BOOL "No not build the ActSVG display module") #Now set up its build. FetchContent_MakeAvailable(Detray) diff --git a/thirdparty/eigen3/CMakeLists.txt b/thirdparty/eigen3/CMakeLists.txt index 7aefc97f2bf..cd4fe4837c0 100644 --- a/thirdparty/eigen3/CMakeLists.txt +++ b/thirdparty/eigen3/CMakeLists.txt @@ -4,9 +4,15 @@ include(ExternalProject) set(Eigen3_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/eigen3-prefix/src/eigen3) -ExternalProject_Add(eigen3 "${ACTS_EIGEN3_SOURCE};CONFIGURE_COMMAND;;BUILD_COMMAND;;INSTALL_COMMAND;") +ExternalProject_Add( + eigen3 + "${ACTS_EIGEN3_SOURCE};CONFIGURE_COMMAND;;BUILD_COMMAND;;INSTALL_COMMAND;" +) add_library(Eigen3::Eigen INTERFACE IMPORTED GLOBAL) add_dependencies(Eigen3::Eigen eigen3) target_include_directories(Eigen3::Eigen INTERFACE ${Eigen3_INCLUDE_DIR}) -install(DIRECTORY ${Eigen3_INCLUDE_DIR}/Eigen DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install( + DIRECTORY ${Eigen3_INCLUDE_DIR}/Eigen + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) diff --git a/thirdparty/nlohmann_json/CMakeLists.txt b/thirdparty/nlohmann_json/CMakeLists.txt index f54653556b0..2e8be353c21 100644 --- a/thirdparty/nlohmann_json/CMakeLists.txt +++ b/thirdparty/nlohmann_json/CMakeLists.txt @@ -1,12 +1,12 @@ -include( FetchContent ) +include(FetchContent) # Tell the user what's happening. -message( STATUS "Building nlohmann_json as part of the ACTS project" ) +message(STATUS "Building nlohmann_json as part of the ACTS project") # Declare where to get nlohmann json from. -FetchContent_Declare( nlohmann_json ${ACTS_NLOHMANNJSON_SOURCE} ) +FetchContent_Declare(nlohmann_json ${ACTS_NLOHMANNJSON_SOURCE}) # Now set up its build. set(JSON_BuildTests OFF CACHE INTERNAL "") set(JSON_Install ON CACHE INTERNAL "") -FetchContent_MakeAvailable( nlohmann_json ) +FetchContent_MakeAvailable(nlohmann_json) diff --git a/thirdparty/pybind11/CMakeLists.txt b/thirdparty/pybind11/CMakeLists.txt index ac31675e057..525c56d6c80 100644 --- a/thirdparty/pybind11/CMakeLists.txt +++ b/thirdparty/pybind11/CMakeLists.txt @@ -1,12 +1,12 @@ -include( FetchContent ) +include(FetchContent) # Tell the user what's happening. -message( STATUS "Building pybind11 as part of the ACTS project" ) +message(STATUS "Building pybind11 as part of the ACTS project") # Declare where to get pybind from. -FetchContent_Declare( pybind11 ${ACTS_PYBIND11_SOURCE} ) +FetchContent_Declare(pybind11 ${ACTS_PYBIND11_SOURCE}) # Now set up its build. set(PYBIND11_TEST OFF) set(PYBIND11_INSTALL OFF) -FetchContent_MakeAvailable( pybind11 ) +FetchContent_MakeAvailable(pybind11) diff --git a/thirdparty/traccc/CMakeLists.txt b/thirdparty/traccc/CMakeLists.txt index a33636c9c8d..6271b5ef0c3 100644 --- a/thirdparty/traccc/CMakeLists.txt +++ b/thirdparty/traccc/CMakeLists.txt @@ -10,50 +10,68 @@ include(FetchContent) # Tell the user what's happening. -message( STATUS "Building traccc as part of the Acts project" ) +message(STATUS "Building traccc as part of the Acts project") -set( TRACCC_VERSION "${_acts_traccc_version}") +set(TRACCC_VERSION "${_acts_traccc_version}") # Declare where to get traccc from. FetchContent_Declare( traccc ${ACTS_TRACCC_SOURCE} + # Needed until https://github.com/acts-project/traccc/pull/682 and https://github.com/acts-project/traccc/pull/683 are deployed + PATCH_COMMAND patch -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/warnings.diff ) if(ACTS_CUSTOM_SCALARTYPE) - set(ACTS_TRACCC_SCALARTYPE ${ACTS_CUSTOM_SCALARTYPE}) + set(ACTS_TRACCC_SCALARTYPE ${ACTS_CUSTOM_SCALARTYPE}) else() - set(ACTS_TRACCC_SCALARTYPE "double") + set(ACTS_TRACCC_SCALARTYPE "double") endif() -set( TRACCC_CUSTOM_SCALARTYPE "${ACTS_TRACCC_SCALARTYPE}" CACHE STRING - "Scalar type to use in the traccc code" ) - -set( TRACCC_SETUP_VECMEM OFF CACHE BOOL - "Do not set up Actsvg as part of Traccc" ) -set( TRACCC_SETUP_EIGEN3 OFF CACHE BOOL - "Do not set up Eigen3 as part of Traccc" ) -set( TRACCC_SETUP_THRUST ON CACHE BOOL - "Do not set up Thrust as part of Traccc" ) -set( TRACCC_SETUP_ALGEBRA_PLUGINS OFF CACHE BOOL - "Do not set up Algebra Plugins as part of Traccc" ) -set( TRACCC_SETUP_COVFIE OFF CACHE BOOL - "Do not set up Covfie as part of Traccc" ) -set( TRACCC_SETUP_DFELIBS OFF CACHE BOOL - "Do not set up dfelibs as part of Traccc" ) -set( TRACCC_SETUP_DETRAY ON CACHE BOOL - "Set up Detray as part of Traccc" ) -set( TRACCC_SETUP_ACTS OFF CACHE BOOL - "Do not set up ACTS as part of Traccc" ) -set( TRACCC_SETUP_TBB OFF CACHE BOOL - "Do not set up TBB as part of Traccc" ) - -set( TRACCC_BUILD_TESTING OFF CACHE BOOL - "Turn off the build of the Traccc unit tests" ) -set( TRACCC_BUILD_EXAMPLES OFF CACHE BOOL - "Turn off the build of the Traccc examples" ) -set (TRACCC_BUILD_BENCHMARKS OFF CACHE BOOL - "Turn off the build of the Traccc benchmarks") +set(TRACCC_CUSTOM_SCALARTYPE + "${ACTS_TRACCC_SCALARTYPE}" + CACHE STRING + "Scalar type to use in the traccc code" +) + +set(TRACCC_SETUP_VECMEM OFF CACHE BOOL "Do not set up Actsvg as part of Traccc") +set(TRACCC_SETUP_EIGEN3 OFF CACHE BOOL "Do not set up Eigen3 as part of Traccc") +set(TRACCC_SETUP_THRUST ON CACHE BOOL "Do not set up Thrust as part of Traccc") +set(TRACCC_SETUP_ALGEBRA_PLUGINS + OFF + CACHE BOOL + "Do not set up Algebra Plugins as part of Traccc" +) +set(TRACCC_SETUP_COVFIE OFF CACHE BOOL "Do not set up Covfie as part of Traccc") +set(TRACCC_SETUP_DFELIBS + OFF + CACHE BOOL + "Do not set up dfelibs as part of Traccc" +) +set(TRACCC_SETUP_DETRAY ON CACHE BOOL "Set up Detray as part of Traccc") +set(TRACCC_SETUP_ACTS OFF CACHE BOOL "Do not set up ACTS as part of Traccc") +set(TRACCC_SETUP_TBB OFF CACHE BOOL "Do not set up TBB as part of Traccc") +set(TRACCC_SETUP_BENCHMARKS + OFF + CACHE BOOL + "Do not set up google benchmarks as part of Traccc" +) + +set(TRACCC_BUILD_TESTING + OFF + CACHE BOOL + "Turn off the build of the Traccc unit tests" +) +set(TRACCC_BUILD_EXAMPLES + OFF + CACHE BOOL + "Turn off the build of the Traccc examples" +) +set(TRACCC_BUILD_BENCHMARKS + OFF + CACHE BOOL + "Turn off the build of the Traccc benchmarks" +) # Now set up its build. -FetchContent_MakeAvailable( traccc ) +FetchContent_MakeAvailable(traccc) diff --git a/thirdparty/traccc/warnings.diff b/thirdparty/traccc/warnings.diff new file mode 100644 index 00000000000..78fa1f37118 --- /dev/null +++ b/thirdparty/traccc/warnings.diff @@ -0,0 +1,40 @@ +diff --git a/core/include/traccc/seeding/spacepoint_binning_helper.hpp b/core/include/traccc/seeding/spacepoint_binning_helper.hpp +index 56a068d4..5a4f2ff2 100644 +--- a/core/include/traccc/seeding/spacepoint_binning_helper.hpp ++++ b/core/include/traccc/seeding/spacepoint_binning_helper.hpp +@@ -99,7 +99,8 @@ inline std::pair, detray::axis2::regular<>> get_axes( + + scalar zBinSize = grid_config.cotThetaMax * grid_config.deltaRMax; + detray::dindex zBins = std::max( +- 1, (int)std::floor((grid_config.zMax - grid_config.zMin) / zBinSize)); ++ 1, static_cast( ++ std::floor((grid_config.zMax - grid_config.zMin) / zBinSize))); + + detray::axis2::regular m_z_axis{zBins, grid_config.zMin, grid_config.zMax, + mr}; +diff --git a/io/src/csv/read_cells.cpp b/io/src/csv/read_cells.cpp +index a80d8f92..1451202f 100644 +--- a/io/src/csv/read_cells.cpp ++++ b/io/src/csv/read_cells.cpp +@@ -58,7 +58,7 @@ traccc::cell_module get_module(const std::uint64_t geometry_id, + } + + // Set the value on the module description. +- result.placement = (*geom)[result.surface_link.value()]; ++ result.placement = geom->at(result.surface_link.value()); + } + + // Find/set the digitization configuration of the detector module. +diff --git a/io/src/csv/read_spacepoints.cpp b/io/src/csv/read_spacepoints.cpp +index b2a38aba..41922683 100644 +--- a/io/src/csv/read_spacepoints.cpp ++++ b/io/src/csv/read_spacepoints.cpp +@@ -59,7 +59,7 @@ void read_spacepoints(spacepoint_reader_output& out, std::string_view filename, + m[iohit.geometry_id] = link; + cell_module mod; + mod.surface_link = detray::geometry::barcode{iohit.geometry_id}; +- mod.placement = geom[iohit.geometry_id]; ++ mod.placement = geom.at(iohit.geometry_id); + result_modules.push_back(mod); + } + diff --git a/thirdparty/vecmem/CMakeLists.txt b/thirdparty/vecmem/CMakeLists.txt index fca3f49572f..637ea1800b7 100644 --- a/thirdparty/vecmem/CMakeLists.txt +++ b/thirdparty/vecmem/CMakeLists.txt @@ -7,21 +7,27 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # CMake include(s). -include( FetchContent ) +include(FetchContent) # Tell the user what's happening. -message( STATUS "Building VecMem as part of the Acts project" ) +message(STATUS "Building VecMem as part of the Acts project") -set( VECMEM_VERSION "v${_acts_vecmem_version}") +set(VECMEM_VERSION "v${_acts_vecmem_version}") # Declare where to get VecMem from. -FetchContent_Declare( VecMem ${ACTS_VECMEM_SOURCE} ) +FetchContent_Declare(VecMem ${ACTS_VECMEM_SOURCE}) # Options used in the build of VecMem. -set( VECMEM_BUILD_TESTING FALSE CACHE BOOL - "Turn off the build of the VecMem unit tests" ) -set( VECMEM_BUILD_BENCHMARKING FALSE CACHE BOOL - "Turn off the build of VecMem benchmarking" ) +set(VECMEM_BUILD_TESTING + FALSE + CACHE BOOL + "Turn off the build of the VecMem unit tests" +) +set(VECMEM_BUILD_BENCHMARKING + FALSE + CACHE BOOL + "Turn off the build of VecMem benchmarking" +) # Now set up its build. -FetchContent_MakeAvailable( VecMem ) +FetchContent_MakeAvailable(VecMem)