Skip to content

Commit

Permalink
fix: Minor fixes to detray and traccc plugins (#3483)
Browse files Browse the repository at this point in the history
This commit makes several minor fixes to the detray and traccc plugins, namely:

1. It establishes a dependency between the detray plugin and the JSON plugin.
2. It uses the Acts scalartype in both detray and traccc.
3. It fixes a few namespace errors in the detray plugin.
4. It fixes a missing import.
5. It disables the SVG tooling in detray, which we don't need.
  • Loading branch information
stephenswat authored Aug 9, 2024
1 parent 3050e22 commit 9d30296
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 14 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ set_option_if(
set_option_if(
ACTS_BUILD_PLUGIN_DETRAY
ACTS_BUILD_PLUGIN_TRACCC)
set_option_if(
ACTS_BUILD_PLUGIN_JSON
ACTS_BUILD_PLUGIN_DETRAY)
set_option_if(
ACTS_BUILD_PLUGIN_COVFIE
ACTS_BUILD_PLUGIN_DETRAY)
Expand Down
1 change: 0 additions & 1 deletion Plugins/Detray/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ target_link_libraries(
detray::core_array
detray::io
detray::utils
detray::svgtools
vecmem::core)

install(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,27 @@ inline static std::size_t accelerationLink(const binning_values_t& casts) {
// Default is `brute_force`
std::size_t accLink = detray::io::accel_id::brute_force;
if (casts.size() == 2u) {
if (casts[0u] == binX && casts[1u] == binY) {
if (casts[0u] == Acts::BinningValue::binX &&
casts[1u] == Acts::BinningValue::binY) {
accLink = detray::io::accel_id::cartesian2_grid;
} else if (casts[0u] == binR && casts[1u] == binPhi) {
} else if (casts[0u] == Acts::BinningValue::binR &&
casts[1u] == Acts::BinningValue::binPhi) {
accLink = detray::io::accel_id::polar2_grid;
} else if (casts[0u] == binZ && casts[1u] == binPhi) {
} else if (casts[0u] == Acts::BinningValue::binZ &&
casts[1u] == Acts::BinningValue::binPhi) {
accLink = detray::io::accel_id::cylinder2_grid;
} else if (casts[0u] == binZ && casts[1u] == binR) {
} else if (casts[0u] == Acts::BinningValue::binZ &&
casts[1u] == Acts::BinningValue::binR) {
accLink = detray::io::accel_id::cylinder3_grid;
}
} else if (casts.size() == 3u) {
if (casts[0u] == binX && casts[1u] == binY && casts[2u] == binZ) {
if (casts[0u] == Acts::BinningValue::binX &&
casts[1u] == Acts::BinningValue::binY &&
casts[2u] == Acts::BinningValue::binZ) {
accLink = detray::io::accel_id::cuboid3_grid;
} else if (casts[0u] == binZ && casts[1u] == binPhi && casts[2u] == binR) {
} else if (casts[0u] == Acts::BinningValue::binZ &&
casts[1u] == Acts::BinningValue::binPhi &&
casts[2u] == Acts::BinningValue::binR) {
accLink = detray::io::accel_id::cylinder3_grid;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#pragma once

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Detector/Detector.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Geometry/VolumeBounds.hpp"

Expand All @@ -28,7 +29,6 @@ class Surface;
class SurfaceBounds;

namespace Experimental {
class Detector;
class DetectorVolume;
class Portal;
} // namespace Experimental
Expand Down
6 changes: 4 additions & 2 deletions Plugins/Detray/src/DetrayConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,14 @@ std::vector<detray::io::surface_payload> Acts::DetrayConverter::convertPortal(
// Pick the surface dimension - via poly
std::array<ActsScalar, 2u> clipRange = {0., 0.};
std::vector<ActsScalar> boundValues = surfaceAdjusted->bounds().values();
if (surfaceType == Surface::SurfaceType::Cylinder && cast == binZ) {
if (surfaceType == Surface::SurfaceType::Cylinder &&
cast == Acts::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 == binR) {
} else if (surfaceType == Surface::SurfaceType::Disc &&
cast == Acts::BinningValue::binR) {
clipRange = {boundValues[RadialBounds::BoundValues::eMinR],
boundValues[RadialBounds::BoundValues::eMaxR]};
} else {
Expand Down
14 changes: 10 additions & 4 deletions thirdparty/detray/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ set( DETRAY_VERSION "v${_acts_detray_version}")
FetchContent_Declare( Detray ${ACTS_DETRAY_SOURCE} )

# Options used in the build of Detray.
set( DETRAY_CUSTOM_SCALARTYPE "float" CACHE STRING
"Scalar type to use in the Detray code" )
if(ACTS_CUSTOM_SCALARTYPE)
set(ACTS_DETRAY_SCALARTYPE ${ACTS_CUSTOM_SCALARTYPE})
else()
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" )
Expand Down Expand Up @@ -48,8 +54,8 @@ set( DETRAY_SETUP_ACTSVG OFF CACHE BOOL
"Do not set up Actsvg as part of Detray" )
set( DETRAY_SETUP_DFELIBS OFF CACHE BOOL
"Do not set up Dfelibs as part of Detray" )
set( DETRAY_SVG_DISPLAY ${ACTS_BUILD_PLUGIN_ACTSVG} CACHE BOOL
"Build the ActSVG display module depending on the ACTS_BUILD_PLUGIN_ACTSVG" )
set( DETRAY_SVG_DISPLAY OFF CACHE BOOL
"No not build the ActSVG display module" )


#Now set up its build.
Expand Down
9 changes: 9 additions & 0 deletions thirdparty/traccc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ set( TRACCC_VERSION "${_acts_traccc_version}")
# Declare where to get traccc from.
FetchContent_Declare( traccc ${ACTS_TRACCC_SOURCE} )

if(ACTS_CUSTOM_SCALARTYPE)
set(ACTS_TRACCC_SCALARTYPE ${ACTS_CUSTOM_SCALARTYPE})
else()
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
Expand Down

0 comments on commit 9d30296

Please sign in to comment.