Skip to content

Add in-situ cartesian field map construction from Geant4#1828

Merged
esseivaju merged 14 commits intoceleritas-project:developfrom
esseivaju:cartmapfield-input-builder
Jun 20, 2025
Merged

Add in-situ cartesian field map construction from Geant4#1828
esseivaju merged 14 commits intoceleritas-project:developfrom
esseivaju:cartmapfield-input-builder

Conversation

@esseivaju
Copy link
Member

@esseivaju esseivaju commented Jun 19, 2025

Implements CartMapMagneticField as a G4MagneticField wrapper around Celeritas CartMapField. Includes:

  • CartMapMagneticField class using pimpl to hide C++20 dependencies
  • MakeCartMapFieldInput function to query and build Celeritas field from an existing G4Field
  • Refactored CylMapMagneticField to use shared field sampling utilities
  • Added covfie dependency to accel

@esseivaju esseivaju requested a review from sethrj June 19, 2025 00:02
@esseivaju esseivaju added field Magnetic field and propagation app Application front ends labels Jun 19, 2025
@github-actions
Copy link

github-actions bot commented Jun 19, 2025

Test summary

 4 456 files   6 838 suites   13m 34s ⏱️
 1 850 tests  1 841 ✅  9 💤 0 ❌
23 540 runs  23 455 ✅ 85 💤 0 ❌

Results for commit 1014963.

♻️ This comment has been updated with latest results.

@esseivaju esseivaju changed the title Add MakeCartMapFieldInput Implement CartMapMagneticField Jun 19, 2025
@sethrj sethrj added enhancement New feature or request external Dependencies and framework-oriented features and removed app Application front ends labels Jun 19, 2025
Copy link
Member

@sethrj sethrj left a comment

Choose a reason for hiding this comment

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

Looks great! This is a nice addition. @rahmans1 @sanmayphy this should be useful in your framework integration.

@sethrj sethrj changed the title Implement CartMapMagneticField Add in-situ cylindrical field map construction from Geant4 Jun 20, 2025
@esseivaju esseivaju changed the title Add in-situ cylindrical field map construction from Geant4 Add in-situ cartesian field map construction from Geant4 Jun 20, 2025
Copy link
Member

@sethrj sethrj left a comment

Choose a reason for hiding this comment

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

Thanks!

@esseivaju esseivaju enabled auto-merge (squash) June 20, 2025 23:04
@esseivaju esseivaju merged commit 6922f1d into celeritas-project:develop Jun 20, 2025
38 checks passed
@esseivaju esseivaju deleted the cartmapfield-input-builder branch June 21, 2025 00:02
@sethrj
Copy link
Member

sethrj commented Jan 28, 2026

I did not do a thorough job with this review. I know we were in a rush to get this in, but this code is virtually untested. I can't edit any of it for fear of breaking something. Our helper functions are using different units internally. ☹️

@esseivaju
Copy link
Member Author

Did you spot a bug where we have a unit mismatch? I can take a look at adding unit test but since we're getting the field from Geant4, some part would require a mock Geant4 run

@sethrj
Copy link
Member

sethrj commented Jan 29, 2026

While working on #2209 I needed to touch convert_to_geant and convert_from_geant. This led me down a rabbit hole into the field code since I couldn't test it at all, and I think I see an order-of-10 magnitude error when we use CGS but not when we use CLHEP...

Never mind, I am an idiot and it was a problem with my test: I had the wrong units for the scale factor (neglecting a 1/length).

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

Labels

enhancement New feature or request external Dependencies and framework-oriented features field Magnetic field and propagation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants