-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: traccc plugin (conversion) #3281
base: main
Are you sure you want to change the base?
Changes from all commits
28943a9
ea9674b
264c1ae
0e110b8
610e9ca
4564029
e262996
3ec8929
22ba911
dc6b20d
7c9f2ba
54c95a2
4fbbd43
0e7cda7
2e012e0
82a43ff
908534d
859b520
f417360
a90be31
443e486
cbf40ec
14da3f4
a262810
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,8 +37,6 @@ option(ACTS_BUILD_PLUGIN_PODIO "Build Podio plugin" OFF) | |
option(ACTS_BUILD_PLUGIN_EDM4HEP "Build EDM4hep plugin" OFF) | ||
option(ACTS_BUILD_PLUGIN_FPEMON "Build FPE monitoring plugin" OFF) | ||
option(ACTS_BUILD_PLUGIN_GEOMODEL "Build GeoModel plugin" OFF) | ||
option(ACTS_BUILD_PLUGIN_COVFIE "Build Covfie plugin" OFF) | ||
option(ACTS_BUILD_PLUGIN_DETRAY "Build Detray plugin" OFF) | ||
option(ACTS_BUILD_PLUGIN_TRACCC "Build Traccc plugin" OFF) | ||
option(ACTS_USE_SYSTEM_GEOMODEL "Use a system-provided GeoModel installation" ${ACTS_USE_SYSTEM_LIBS}) | ||
option(ACTS_BUILD_PLUGIN_GEANT4 "Build Geant4 plugin" OFF) | ||
|
@@ -50,25 +48,25 @@ option(ACTS_BUILD_PLUGIN_JSON "Build json plugin" OFF) | |
option(ACTS_USE_SYSTEM_NLOHMANN_JSON "Use nlohmann::json provided by the system instead of the bundled version" ${ACTS_USE_SYSTEM_LIBS}) | ||
option(ACTS_BUILD_PLUGIN_LEGACY "Build legacy plugin" OFF) | ||
option(ACTS_BUILD_PLUGIN_ONNX "Build ONNX plugin" OFF) | ||
option(ACTS_SETUP_COVFIE "Explicitly set up covfie for the project" OFF) | ||
option(ACTS_SETUP_COVFIE "Explicitly set up covfie for the project" ON) | ||
option(ACTS_USE_SYSTEM_COVFIE "Use a system-provided covfie installation" ${ACTS_USE_SYSTEM_LIBS}) | ||
option(ACTS_SETUP_DETRAY "Explicitly set up detray for the project" OFF) | ||
option(ACTS_SETUP_DETRAY "Explicitly set up detray for the project" ON) | ||
option(ACTS_USE_SYSTEM_DETRAY "Use a system-provided detray installation" ${ACTS_USE_SYSTEM_LIBS}) | ||
option(ACTS_SETUP_TRACCC "Explicitly set up traccc for the project" OFF) | ||
option(ACTS_SETUP_TRACCC "Explicitly set up traccc for the project" ON) | ||
option(ACTS_USE_SYSTEM_TRACCC "Use a system-provided traccc installation" ${ACTS_USE_SYSTEM_LIBS}) | ||
option(ACTS_SETUP_DFELIBS "Explicitly set up dfelibs for the project" ON) | ||
option(ACTS_USE_SYSTEM_DFELIBS "Use a system-provided dfelibs installation" ${ACTS_USE_SYSTEM_LIBS}) | ||
option(ACTS_SETUP_VECMEM "Explicitly set up vecmem for the project" OFF) | ||
option(ACTS_SETUP_VECMEM "Explicitly set up vecmem for the project" ON) | ||
option(ACTS_USE_SYSTEM_VECMEM "Use a system-provided vecmem installation" ${ACTS_USE_SYSTEM_LIBS}) | ||
option(ACTS_SETUP_ALGEBRAPLUGINS "Explicitly set up algebra-plugins for the project" OFF) | ||
option(ACTS_SETUP_ALGEBRAPLUGINS "Explicitly set up algebra-plugins for the project" ON) | ||
Comment on lines
+51
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Wise decision, enabling by default is not, young padawan Proper structure in the Force, I sense. Each component, properly guarded by conditional checks it is, allowing users to choose their path:
Default enabled state, change we must. To
These lines, modify you should: option(ACTS_SETUP_COVFIE "Explicitly set up covfie for the project" OFF)
option(ACTS_SETUP_DETRAY "Explicitly set up detray for the project" OFF)
option(ACTS_SETUP_TRACCC "Explicitly set up traccc for the project" OFF)
option(ACTS_SETUP_DFELIBS "Explicitly set up dfelibs for the project" OFF)
option(ACTS_SETUP_VECMEM "Explicitly set up vecmem for the project" OFF)
option(ACTS_SETUP_ALGEBRAPLUGINS "Explicitly set up algebra-plugins for the project" OFF) 🔗 Analysis chainHmmmm, enabled by default, many options are. Caution, we must exercise. By default enabling these options, impact on build time and dependencies, it may have:
🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Check if these dependencies are commonly enabled in other projects
rg -l 'option.*COVFIE.*ON|option.*DETRAY.*ON|option.*TRACCC.*ON|option.*VECMEM.*ON|option.*ALGEBRAPLUGINS.*ON'
Length of output: 127 Script: #!/bin/bash
# Search for any existing usage or dependencies of these components
rg -l "covfie|detray|traccc|vecmem|algebra-plugins" --type cmake
# Check if these are optional dependencies in the build system
rg "if.*ACTS_(SETUP|USE|BUILD)_(COVFIE|DETRAY|TRACCC|VECMEM|ALGEBRAPLUGINS)" --type cmake -A 2
Length of output: 1279 |
||
option(ACTS_USE_SYSTEM_ALGEBRAPLUGINS "Use a system-provided algebra-plugins installation" ${ACTS_USE_SYSTEM_LIBS}) | ||
option(ACTS_BUILD_PLUGIN_TGEO "Build TGeo plugin" OFF) | ||
# fatras related options | ||
option(ACTS_BUILD_FATRAS "Build FAst TRAcking Simulation package" OFF) | ||
option(ACTS_BUILD_FATRAS_GEANT4 "Build Geant4 Fatras package" OFF) | ||
# alignment related options | ||
option(ACTS_BUILD_ALIGNMENT "Build Alignment package" OFF) | ||
# examples related options | ||
# examples related optionsExplicitly set up vecmem for the project<br> type | ||
option(ACTS_BUILD_EXAMPLES "Build standalone examples" OFF) | ||
option(ACTS_BUILD_EXAMPLES_DD4HEP "Build DD4hep-based code in the examples" OFF) | ||
option(ACTS_BUILD_EXAMPLES_EDM4HEP "Build EDM4hep-based code in the examples" OFF) | ||
|
@@ -154,16 +152,20 @@ set_option_if( | |
set_option_if( | ||
ACTS_BUILD_PLUGIN_TGEO | ||
ACTS_BUILD_PLUGIN_DD4HEP OR ACTS_BUILD_EXAMPLES OR ACTS_BUILD_EVERYTHING) | ||
set_option_if(ACTS_BUILD_PLUGIN_TRACCC | ||
ACTS_BUILD_EVERYTHING) | ||
set_option_if( | ||
ACTS_BUILD_PLUGIN_JSON | ||
ACTS_BUILD_EXAMPLES OR ACTS_BUILD_EVERYTHING) | ||
ACTS_BUILD_EXAMPLES OR ACTS_BUILD_EVERYTHING OR ACTS_BUILD_PLUGIN_TRACCC) | ||
set_option_if( | ||
ACTS_BUILD_FATRAS | ||
ACTS_BUILD_EXAMPLES OR ACTS_BUILD_EVERYTHING) | ||
set_option_if(ACTS_BUILD_PLUGIN_LEGACY ACTS_BUILD_EVERYTHING) | ||
set_option_if(ACTS_BUILD_PLUGIN_EXATRKX ACTS_BUILD_EXAMPLES_EXATRKX) | ||
set_option_if(ACTS_BUILD_PLUGIN_FPEMON | ||
ACTS_BUILD_EXAMPLES OR ACTS_BUILD_EVERYTHING) | ||
set_option_if(ACTS_BUILD_PLUGIN_TRACCC | ||
ACTS_BUILD_EXAMPLES OR ACTS_BUILD_EVERYTHING) | ||
|
||
# feature tests | ||
include(CheckCXXSourceCompiles) | ||
|
@@ -266,24 +268,6 @@ if (ACTS_SETUP_DFELIBS) | |
endif() | ||
endif() | ||
|
||
if (ACTS_SETUP_VECMEM) | ||
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() | ||
endif() | ||
|
||
if (ACTS_SETUP_ALGEBRAPLUGINS) | ||
if (ACTS_USE_SYSTEM_ALGEBRAPLUGINS) | ||
find_package(algebra-plugins ${_acts_algebraplugins_version} REQUIRED) | ||
else() | ||
add_subdirectory(thirdparty/algebra-plugins) | ||
endif() | ||
endif() | ||
|
||
find_package(Filesystem REQUIRED) | ||
|
||
# the `<project_name>_VERSION` variables set by `setup(... VERSION ...)` have | ||
|
@@ -318,27 +302,6 @@ endmacro() | |
# when a particular package is actually needed. | ||
|
||
# plugin dependencies | ||
if(ACTS_SETUP_COVFIE) | ||
if(ACTS_USE_SYSTEM_COVFIE) | ||
find_package(covfie ${_acts_covfie_version} REQUIRED CONFIG) | ||
else() | ||
add_subdirectory(thirdparty/covfie) | ||
endif() | ||
endif() | ||
if(ACTS_SETUP_DETRAY) | ||
if(ACTS_USE_SYSTEM_DETRAY) | ||
find_package(detray ${_acts_detray_version} REQUIRED CONFIG) | ||
else() | ||
add_subdirectory(thirdparty/detray) | ||
endif() | ||
endif() | ||
if(ACTS_SETUP_TRACCC) | ||
if(ACTS_USE_SYSTEM_TRACCC) | ||
find_package(traccc ${_acts_traccc_version} REQUIRED CONFIG) | ||
else() | ||
add_subdirectory(thirdparty/traccc) | ||
endif() | ||
endif() | ||
|
||
if(ACTS_BUILD_PLUGIN_ACTSVG) | ||
if(ACTS_USE_SYSTEM_ACTSVG) | ||
|
@@ -419,6 +382,52 @@ if(ACTS_BUILD_PLUGIN_GEANT4) | |
find_package(Geant4 REQUIRED CONFIG COMPONENTS gdml) | ||
endif() | ||
|
||
if (ACTS_BUILD_PLUGIN_TRACCC) | ||
if (ACTS_SETUP_VECMEM) | ||
if (ACTS_USE_SYSTEM_VECMEM) | ||
find_package(vecmem ${_acts_vecmem_version} REQUIRED) | ||
else() | ||
add_subdirectory(thirdparty/vecmem) | ||
endif() | ||
endif() | ||
|
||
if (ACTS_SETUP_ALGEBRAPLUGINS) | ||
|
||
add_definitions(-DALGEBRA_PLUGINS_INCLUDE_ARRAY) | ||
|
||
if (ACTS_USE_SYSTEM_ALGEBRAPLUGINS) | ||
find_package(algebra-plugins ${_acts_algebraplugins_version} REQUIRED) | ||
else() | ||
add_subdirectory(thirdparty/algebra-plugins) | ||
endif() | ||
endif() | ||
|
||
if(ACTS_SETUP_COVFIE) | ||
if(ACTS_USE_SYSTEM_COVFIE) | ||
find_package(covfie ${_acts_covfie_version} REQUIRED CONFIG) | ||
else() | ||
add_subdirectory(thirdparty/covfie) | ||
endif() | ||
endif() | ||
|
||
if(ACTS_SETUP_DETRAY) | ||
if(ACTS_USE_SYSTEM_DETRAY) | ||
find_package(detray ${_acts_detray_version} REQUIRED CONFIG) | ||
else() | ||
add_subdirectory(thirdparty/detray) | ||
endif() | ||
endif() | ||
|
||
if(ACTS_SETUP_TRACCC) | ||
if(ACTS_USE_SYSTEM_TRACCC) | ||
find_package(traccc ${_acts_traccc_version} REQUIRED CONFIG) | ||
else() | ||
add_subdirectory(thirdparty/traccc) | ||
endif() | ||
endif() | ||
|
||
endif() | ||
|
||
# examples dependencies | ||
if(ACTS_BUILD_EXAMPLES) | ||
set(THREADS_PREFER_PTHREAD_FLAG ON) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2021 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 "Acts/Plugins/Covfie/FieldConversion.hpp" | ||
#include "Acts/Plugins/Python/Utilities.hpp" | ||
|
||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
|
||
namespace py = pybind11; | ||
using namespace pybind11::literals; | ||
|
||
namespace Acts::Python { | ||
|
||
namespace { | ||
|
||
template <typename field_t> | ||
typename field_t::view_t newView(const field_t& field) { | ||
typename field_t::view_t view(field); | ||
return view; | ||
} | ||
|
||
template <typename field_t> | ||
void declareCovfieField(py::module& m, const std::string& fieldName) { | ||
using view_t = typename field_t::view_t; | ||
m.def("newView", static_cast<view_t (*)(const field_t&)>(&newView)); | ||
fredevb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
py::class_<field_t, std::shared_ptr<field_t>>(m, fieldName.c_str()); | ||
py::class_<view_t, std::shared_ptr<view_t>>( | ||
m, (fieldName + std::string("View")).c_str()) | ||
.def("at", &view_t::template at<float, float, float>); | ||
} | ||
|
||
} // namespace | ||
void addCovfie(Context& ctx) { | ||
auto main = ctx.get("main"); | ||
auto m = main.def_submodule("covfie", "Submodule for covfie conversion"); | ||
|
||
declareCovfieField<Acts::CovfiePlugin::ConstantField>(m, | ||
"CovfieConstantField"); | ||
declareCovfieField<Acts::CovfiePlugin::InterpolatedField>( | ||
m, "CovfieAffineLinearStridedField"); | ||
|
||
m.def("covfieField", | ||
py::overload_cast<const Acts::InterpolatedMagneticField&>( | ||
&Acts::CovfiePlugin::covfieField)); | ||
m.def("covfieField", py::overload_cast<const Acts::ConstantBField&>( | ||
&Acts::CovfiePlugin::covfieField)); | ||
m.def( | ||
"covfieField", | ||
py::overload_cast<const Acts::MagneticFieldProvider&, | ||
Acts::MagneticFieldProvider::Cache&, | ||
const std::vector<std::size_t>&, | ||
const std::vector<double>&, const std::vector<double>&>( | ||
&Acts::CovfiePlugin::covfieField)); | ||
} | ||
|
||
} // namespace Acts::Python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Inconsistent, the Force in our build configurations is!
Clear now, the situation becomes:
Recommendations, these are:
.github/workflows/builds.yml
, add-DACTS_USE_SYSTEM_NLOHMANN_JSON=ON
to Linux builds alsoA path to consistency, choose we must. Different configurations between platforms, lead to confusion they do!
🔗 Analysis chain
Hmmmm, system JSON library we use, careful we must be!
Concerns, I have:
Run this script to check system nlohmann_json version we must:
Document minimum version requirements in CMake configuration, you should. Consistent across all platforms, the configuration must be. Consider these paths:
Let me search for more clarity in the Force, I must. Understanding system package usage across platforms and version requirements, essential it is.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 4863
Script:
Length of output: 5425