Skip to content

feat: convert FieldMapB to using covfie#934

Open
wdconinc wants to merge 6 commits intomainfrom
covfie
Open

feat: convert FieldMapB to using covfie#934
wdconinc wants to merge 6 commits intomainfrom
covfie

Conversation

@wdconinc
Copy link
Contributor

@wdconinc wdconinc commented Sep 4, 2025

Briefly, what does this PR introduce?

Needs:

This PR converts the FieldMapB handling to using covfie for all interpolation etc. This will allow us to pass-through covfie to ACTS and others(*), while continuing to use the DD4hep field accessors where necessary.

(*) No demo of this. Not sure all necessary parts are there. You'd need to access the bare cvf file.

After profiling with this change, the cost of fieldComponent calls went from 12% to 7% (and due to the way covfie works with templated code, all calls could be inlined so there is no remaining branching).

What kind of change does this PR introduce?

  • Bug fix (issue #__)
  • New feature (issue #__)
  • Documentation update
  • Other: __

Please check if this PR fulfills the following:

  • Tests for the changes have been added
  • Documentation has been added / updated
  • Changes have been communicated to collaborators

Does this PR introduce breaking changes? What changes might users need to make to their code?

No.

Does this PR change default behavior?

No.

@github-actions github-actions bot added the topic: infrastructure Regarding build system, CI, CD label Sep 4, 2025
Copilot AI review requested due to automatic review settings February 24, 2026 18:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates FieldMapB magnetic field-map sampling/interpolation to use the covfie field infrastructure, with the goal of enabling covfie pass-through to downstream consumers while keeping the DD4hep field interface.

Changes:

  • Added covfie-based field types and loading for BrBz and BxByBz map formats.
  • Replaced manual (bi/tri)-linear interpolation with covfie field_view::at(...) sampling.
  • Added covfie as a CMake dependency.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/FieldMapB.cpp Switches field-map storage/sampling to covfie-backed fields and removes the custom interpolation/indexing logic.
CMakeLists.txt Adds covfie discovery via find_package(covfie REQUIRED).
Comments suppressed due to low confidence (1)

CMakeLists.txt:67

  • find_package(covfie REQUIRED) is added, but the plugin target is not linked against any covfie imported target (nor are covfie include dirs applied). Unless covfie headers are in a global include path, this will break builds; please attach covfie to the ${a_lib_name} target (e.g., via target_link_libraries with the package’s exported target) so include paths/compile options propagate correctly.
# Dependencies
find_package(DD4hep 1.27 REQUIRED COMPONENTS DDCore DDRec)
find_package(fmt REQUIRED)
find_package(covfie REQUIRED)
find_package(IRT2 2.1.1)

#-----------------------------------------------------------------------------------
set(a_lib_name ${PROJECT_NAME})

set(DD4HEP_SET_RPATH TRUE)
dd4hep_configure_output(INSTALL ${CMAKE_INSTALL_PREFIX})
dd4hep_set_compiler_flags()

file(GLOB sources CONFIGURE_DEPENDS src/*.cpp)

dd4hep_add_plugin(${a_lib_name}
  SOURCES ${sources}
  USES ROOT::Core ROOT::Gdml
  )
target_link_libraries(${a_lib_name}
  PUBLIC DD4hep::DDCore DD4hep::DDRec fmt::fmt
  )

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants