Skip to content

Commit

Permalink
Merge branch 'main' into refactor/truth-graph-metrics-separate-alg
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminhuth committed Jul 9, 2024
2 parents 1e7ea3b + e4f3d90 commit 4edd192
Show file tree
Hide file tree
Showing 155 changed files with 1,905 additions and 1,350 deletions.
41 changes: 26 additions & 15 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,14 @@ jobs:
run: ./build-downstream/bin/ShowActsVersion

macos:
runs-on: macos-13
runs-on: macos-14
env:
INSTALL_DIR: ${{ github.workspace }}/install
INSTALL_DIR: ${{ github.workspace }}/install_acts
DEPENDENCY_DIR: ${{ github.workspace }}/install
ACTS_LOG_FAILURE_THRESHOLD: WARNING
DEPENDENCY_URL: https://acts.web.cern.ch/ACTS/ci/macOS/cmake/deps.8e12bbf.tar.zst
# Works around an issue where root's RPATH is wrong for tbb, thus won't find it
DYLD_LIBRARY_PATH: "${{ github.workspace }}/install/tbb/2021.11.0/lib"
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -338,12 +342,14 @@ jobs:

- name: Install dependencies
run: >
brew install cmake eigen ninja ccache
&& sudo mkdir /usr/local/acts
&& sudo chown $USER /usr/local/acts
&& wget --verbose --progress=dot:giga --continue --retry-connrefused --tries=5 --timeout=2 -O deps.tar.gz https://acts.web.cern.ch/ACTS/ci/macOS/deps.80e4e05.tar.gz
&& tar -xf deps.tar.gz -C /usr/local/acts
&& /usr/local/acts/bin/python3.10 -m pip install pyyaml jinja2
brew install cmake ninja ccache xerces-c
&& wget --verbose --progress=dot:giga --continue --retry-connrefused --tries=5 --timeout=2 -O deps.tar.zst ${{ env.DEPENDENCY_URL }}
&& mkdir ${{ env.DEPENDENCY_DIR }}
&& ls ${{ env.DEPENDENCY_DIR }}
&& tar -xf deps.tar.zst -C ${{ env.DEPENDENCY_DIR }}
&& ls ${{ env.DEPENDENCY_DIR }}
&& ls ${{ env.DEPENDENCY_DIR }}/python
&& ${{ env.DEPENDENCY_DIR }}/python/3.12.2/bin/python3 -m pip install pyyaml jinja2
- name: Restore ccache
uses: actions/cache/restore@v4
Expand All @@ -359,16 +365,17 @@ jobs:
# dd4hep CMake configuration that gets triggered on recent CMake
# versions such as the one installed via homebrew
run: >
ccache -z &&
cmake -B build -S .
ccache -z
&& source ${{ env.DEPENDENCY_DIR }}/setup.sh
&& cmake -B build -S .
-GNinja
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DPython_EXECUTABLE=/usr/local/acts/bin/python3.10
-DPython_EXECUTABLE=${{ env.DEPENDENCY_DIR }}/python/3.12.2/bin/python3
-DDD4HEP_DEBUG_CMAKE=ON
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_CXX_FLAGS=-Werror
-DCMAKE_CXX_STANDARD=17
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
-DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_DIR }}"
-DCMAKE_PREFIX_PATH=/usr/local/acts
-DACTS_BUILD_EVERYTHING=ON
-DACTS_BUILD_ODD=ON
Expand Down Expand Up @@ -398,13 +405,17 @@ jobs:
path: ${{ env.INSTALL_DIR }}
- name: Downstream configure
run: >
cmake -B build-downstream -S Tests/DownstreamProject
source ${{ env.DEPENDENCY_DIR }}/setup.sh
&& cmake -B build-downstream -S Tests/DownstreamProject
-GNinja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_CXX_FLAGS=-Werror
-DCMAKE_CXX_STANDARD=17
-DCMAKE_PREFIX_PATH="${INSTALL_DIR};/usr/local/acts"
-DCMAKE_PREFIX_PATH="${INSTALL_DIR}"
- name: Downstream build
run: cmake --build build-downstream
- name: Downstream run
run: ./build-downstream/bin/ShowActsVersion
run: |
source ${{ env.DEPENDENCY_DIR }}/setup.sh
source ${{ env.DEPENDENCY_DIR}}/dd4hep/*/bin/thisdd4hep.sh
./build-downstream/bin/ShowActsVersion
41 changes: 41 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,46 @@ clang_tidy:
# Generate an html report
- codereport clang-tidy/clang-tidy.json clang-tidy/html

build_exatrkx_cpu:
stage: build
image: ghcr.io/acts-project/ubuntu2004_exatrkx:v43
tags:
- large

cache:
key: ccache-exatrkx-cpu-$CI_COMMIT_REF_SLUG
paths:
- ${CI_PROJECT_DIR}/ccache

script:
- export PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
- export PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:$PATH
- echo $PATH
- git clone $CLONE_URL src
- cd src
- git checkout $HEAD_SHA
- cd ..
- mkdir build
# Here we only do a minimal build without examples to save ressources
- >
cmake -B build -S src
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-GNinja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_CXX_FLAGS=-w
-DACTS_BUILD_PLUGIN_EXATRKX=ON
-DACTS_BUILD_EXAMPLES_EXATRKX=OFF
-DACTS_BUILD_UNITTESTS=OFF
-DACTS_EXATRKX_ENABLE_TORCH=ON
-DACTS_EXATRKX_ENABLE_ONNX=OFF
-DACTS_EXATRKX_ENABLE_CUDA=OFF
-DACTS_BUILD_EXAMPLES_PYTHON_BINDINGS=OFF
-DACTS_ENABLE_LOG_FAILURE_THRESHOLD=ON
- ccache -z
- cmake --build build -- -j2
- ccache -s

build_exatrkx:
stage: build
image: ghcr.io/acts-project/ubuntu2004_exatrkx:v43
Expand Down Expand Up @@ -95,6 +135,7 @@ build_exatrkx:
-DACTS_BUILD_UNITTESTS=ON
-DACTS_EXATRKX_ENABLE_TORCH=ON
-DACTS_EXATRKX_ENABLE_ONNX=ON
-DACTS_EXATRKX_ENABLE_CUDA=ON
-DACTS_BUILD_EXAMPLES_PYTHON_BINDINGS=ON
-DACTS_ENABLE_LOG_FAILURE_THRESHOLD=ON
Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ option(ACTS_BUILD_PLUGIN_GEANT4 "Build Geant4 plugin" OFF)
option(ACTS_BUILD_PLUGIN_EXATRKX "Build the Exa.TrkX plugin" OFF)
option(ACTS_EXATRKX_ENABLE_ONNX "Build the Onnx backend for the exatrkx plugin" OFF)
option(ACTS_EXATRKX_ENABLE_TORCH "Build the torchscript backend for the exatrkx plugin" ON)
option(ACTS_EXATRKX_ENABLE_CUDA "Enable CUDA for the exatrkx plugin" OFF)
option(ACTS_BUILD_PLUGIN_JSON "Build json plugin" OFF)
option(ACTS_USE_SYSTEM_NLOHMANN_JSON "Use nlohmann::json provided by the system instead of the bundled version" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_BUILD_PLUGIN_LEGACY "Build legacy plugin" OFF)
Expand Down Expand Up @@ -369,12 +370,13 @@ if(ACTS_BUILD_ANALYSIS_APPS)
endif()
if(ACTS_BUILD_PLUGIN_EXATRKX)
find_package(Torch REQUIRED)
find_package(CUDAToolkit)
if(CUDAToolkit_FOUND)
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(WARNING "CUDA not found, build Exa.TrkX plugin only for CPU")
message(STATUS "Build Exa.TrkX plugin for CPU only")
endif()
if(NOT (ACTS_EXATRKX_ENABLE_ONNX OR ACTS_EXATRKX_ENABLE_TORCH))
message(FATAL_ERROR
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Detector/DetectorVolume.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "Acts/Material/IVolumeMaterial.hpp"
#include "Acts/Navigation/NavigationDelegates.hpp"
#include "Acts/Navigation/NavigationState.hpp"
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/Surfaces/BoundaryTolerance.hpp"
#include "Acts/Surfaces/SurfaceVisitorConcept.hpp"
#include "Acts/Utilities/BoundingBox.hpp"
#include "Acts/Utilities/Concepts.hpp"
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Detector/Portal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "Acts/Geometry/GeometryIdentifier.hpp"
#include "Acts/Navigation/NavigationDelegates.hpp"
#include "Acts/Navigation/NavigationState.hpp"
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/Surfaces/BoundaryTolerance.hpp"
#include "Acts/Surfaces/RegularSurface.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Surfaces/SurfaceVisitorConcept.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class MultiComponentCurvilinearTrackParameters
// Project the position onto the surface, keep everything else as is
for (const auto& [w, pos4, dir, qop, cov] : curvi) {
Vector3 newPos = s->intersect(gctx, pos4.template segment<3>(eFreePos0),
dir, BoundaryCheck(false))
dir, BoundaryTolerance::Infinite())
.closest()
.position();

Expand Down
13 changes: 5 additions & 8 deletions Core/include/Acts/Geometry/ApproachDescriptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ namespace Acts {

class Surface;
class Layer;
class BoundaryCheck;

/// @class ApproachDescriptor
///
Expand All @@ -42,17 +41,15 @@ class ApproachDescriptor {
/// @param gctx The current geometry context object, e.g. alignment
/// @param position is the position from start of the search
/// @param direction is the direction at the start of the search
/// @param bcheck is the boundary check directive
/// @param boundaryTolerance is the boundary check directive
/// @param nearLimit The minimum distance for an intersection to be considered
/// @param farLimit The maximum distance for an intersection to be considered
///
/// @return is a surface intersection
virtual SurfaceIntersection approachSurface(const GeometryContext& gctx,
const Vector3& position,
const Vector3& direction,
const BoundaryCheck& bcheck,
double nearLimit,
double farLimit) const = 0;
virtual SurfaceIntersection approachSurface(
const GeometryContext& gctx, const Vector3& position,
const Vector3& direction, const BoundaryTolerance& boundaryTolerance,
double nearLimit, double farLimit) const = 0;

/// Get all the contained surfaces
/// @return all contained surfaces of this approach descriptor
Expand Down
14 changes: 6 additions & 8 deletions Core/include/Acts/Geometry/GenericApproachDescriptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Geometry/ApproachDescriptor.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/Surfaces/BoundaryTolerance.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/Helpers.hpp"
#include "Acts/Utilities/Intersection.hpp"
Expand Down Expand Up @@ -56,17 +56,15 @@ class GenericApproachDescriptor : public ApproachDescriptor {
/// @param gctx The current geometry context object, e.g. alignment
/// @param position The global position to start the approach from
/// @param direction The momentum vector
/// @param bcheck The boundary check prescription
/// @param boundaryTolerance The boundary check prescription
/// @param nearLimit The minimum distance for an intersection to be considered
/// @param farLimit The maximum distance for an intersection to be considered
///
/// @return : a @c SurfaceIntersection
SurfaceIntersection approachSurface(const GeometryContext& gctx,
const Vector3& position,
const Vector3& direction,
const BoundaryCheck& bcheck,
double nearLimit,
double farLimit) const override;
SurfaceIntersection approachSurface(
const GeometryContext& gctx, const Vector3& position,
const Vector3& direction, const BoundaryTolerance& boundaryTolerance,
double nearLimit, double farLimit) const override;

/// return all contained surfaces of this approach descriptor
const std::vector<const Surface*>& containedSurfaces() const override;
Expand Down
10 changes: 5 additions & 5 deletions Core/include/Acts/Geometry/Layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "Acts/Geometry/GeometryObject.hpp"
#include "Acts/Geometry/Volume.hpp"
#include "Acts/Material/IMaterialDecorator.hpp"
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/Surfaces/BoundaryTolerance.hpp"
#include "Acts/Surfaces/SurfaceArray.hpp"
#include "Acts/Utilities/BinnedArray.hpp"
#include "Acts/Utilities/Intersection.hpp"
Expand Down Expand Up @@ -127,12 +127,12 @@ class Layer : public virtual GeometryObject {
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param position is the global position to be checked
/// @param bcheck is the boundary check directive
/// @param boundaryTolerance is the boundary check directive
///
/// @return boolean that indicates success of the operation
virtual bool isOnLayer(
const GeometryContext& gctx, const Vector3& position,
const BoundaryCheck& bcheck = BoundaryCheck(true)) const;
virtual bool isOnLayer(const GeometryContext& gctx, const Vector3& position,
const BoundaryTolerance& boundaryTolerance =
BoundaryTolerance::None()) const;

/// Return method for the approach descriptor, can be nullptr
const ApproachDescriptor* approachDescriptor() const;
Expand Down
15 changes: 8 additions & 7 deletions Core/include/Acts/Geometry/NavigationLayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Geometry/Layer.hpp"
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/Surfaces/BoundaryTolerance.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/BinningType.hpp"

Expand Down Expand Up @@ -72,11 +72,12 @@ class NavigationLayer : public Layer {
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param gp is the global position for the check
/// @param bcheck is the boundary check directive
/// @param boundaryTolerance is the boundary check directive
///
/// @return boolean that indicates if the position is on surface
bool isOnLayer(const GeometryContext& gctx, const Vector3& gp,
const BoundaryCheck& bcheck = BoundaryCheck(true)) const final;
const BoundaryTolerance& boundaryTolerance =
BoundaryTolerance::None()) const final;

/// Accept layer according to the following collection directives
///
Expand Down Expand Up @@ -121,11 +122,11 @@ inline Vector3 NavigationLayer::binningPosition(const GeometryContext& gctx,
return m_surfaceRepresentation->binningPosition(gctx, bValue);
}

inline bool NavigationLayer::isOnLayer(const GeometryContext& gctx,
const Vector3& gp,
const BoundaryCheck& bcheck) const {
inline bool NavigationLayer::isOnLayer(
const GeometryContext& gctx, const Vector3& gp,
const BoundaryTolerance& boundaryTolerance) const {
return m_surfaceRepresentation->isOnSurface(gctx, gp, Vector3::Zero(),
bcheck);
boundaryTolerance);
}

inline bool NavigationLayer::resolve(bool /*resolveSensitive*/,
Expand Down
1 change: 1 addition & 0 deletions Core/include/Acts/Geometry/TrackingVolume.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "Acts/Geometry/TrackingVolumeVisitorConcept.hpp"
#include "Acts/Geometry/Volume.hpp"
#include "Acts/Material/IVolumeMaterial.hpp"
#include "Acts/Surfaces/BoundaryTolerance.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Surfaces/SurfaceArray.hpp"
#include "Acts/Surfaces/SurfaceVisitorConcept.hpp"
Expand Down
6 changes: 3 additions & 3 deletions Core/include/Acts/Geometry/detail/Layer.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ inline bool Layer::resolve(bool resolveSensitive, bool resolveMaterial,

inline bool Layer::isOnLayer(const GeometryContext& gctx,
const Vector3& position,
const BoundaryCheck& bcheck) const {
const BoundaryTolerance& boundaryTolerance) const {
if (m_representingVolume != nullptr) {
return m_representingVolume->inside(position);
}
return (surfaceRepresentation())
.isOnSurface(gctx, position, Vector3::Zero(), bcheck);
return surfaceRepresentation().isOnSurface(gctx, position, Vector3::Zero(),
boundaryTolerance);
}

} // namespace Acts
10 changes: 5 additions & 5 deletions Core/include/Acts/Navigation/DetectorNavigator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "Acts/Geometry/Layer.hpp"
#include "Acts/Navigation/NavigationState.hpp"
#include "Acts/Propagator/Propagator.hpp"
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/Surfaces/BoundaryTolerance.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/Logger.hpp"

Expand Down Expand Up @@ -231,10 +231,9 @@ class DetectorNavigator {
<< " (" << surface.center(state.geoContext).transpose()
<< ")");
// Estimate the surface status
bool boundaryCheck = c.boundaryCheck.isEnabled();
auto surfaceStatus = stepper.updateSurfaceStatus(
state.stepping, surface, c.objectIntersection.index(),
state.options.direction, BoundaryCheck(boundaryCheck),
state.options.direction, c.boundaryTolerance,
state.options.surfaceTolerance, logger());

ACTS_VERBOSE(volInfo(state) << posInfo(state, stepper)
Expand Down Expand Up @@ -285,7 +284,8 @@ class DetectorNavigator {
const Portal* nextPortal = nullptr;
const Surface* nextSurface = nullptr;
bool isPortal = false;
bool boundaryCheck = nState.surfaceCandidate().boundaryCheck.isEnabled();
BoundaryTolerance boundaryTolerance =
nState.surfaceCandidate().boundaryTolerance;

if (nState.surfaceCandidate().surface != nullptr) {
nextSurface = nState.surfaceCandidate().surface;
Expand All @@ -304,7 +304,7 @@ class DetectorNavigator {
auto surfaceStatus = stepper.updateSurfaceStatus(
state.stepping, *nextSurface,
nState.surfaceCandidate().objectIntersection.index(),
state.options.direction, BoundaryCheck(boundaryCheck),
state.options.direction, boundaryTolerance,
state.options.surfaceTolerance, logger());

// Check if we are at a surface
Expand Down
Loading

0 comments on commit 4edd192

Please sign in to comment.