Implement check on Celeritas-Geant4 fast simulation particle consistency#2333
Open
drbenmorgan wants to merge 2 commits intoceleritas-project:developfrom
Open
Implement check on Celeritas-Geant4 fast simulation particle consistency#2333drbenmorgan wants to merge 2 commits intoceleritas-project:developfrom
drbenmorgan wants to merge 2 commits intoceleritas-project:developfrom
Conversation
…egration. Offload of particles to Celeritas in FastSimulationIntegration relies on the requested offload particles having G4FastSimulationManagerProcess attached to their process manager. Follow pattern in TrackingManagerIntegration for verifying basic setup before iterating of requested offload particles to check they have the needed geant4 process attached, failing if it is not. Much of the code is copy-pasted for simplicity/to have something. TODO: Add check on offload regions having Celeritas model attched. This require support for regions in SetupOptions.
FastSimulationIntegration should fail at its verify_local_setup stage if Celeritas has been asked to offload particle type "A", and "A" does not have G4FastSimulationManagerProcess attached. Create a concrete test fixture from LarSphere as this already provides exception checking capability needed to determine the wanted exception is thrown. Overload make_physics_list to only add Geant4 fast simulation for e- and gamma. Celeritas default is to offload e-, e+ and gamma and thus should fail due to e+ not having fast simulation attached. Write the test case as simply as possible to trigger the exception and check that this had indeed been thrown.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2333 +/- ##
===========================================
- Coverage 87.12% 85.58% -1.54%
===========================================
Files 1365 1332 -33
Lines 43418 41851 -1567
Branches 13258 10864 -2394
===========================================
- Hits 37827 35820 -2007
- Misses 4366 4405 +39
- Partials 1225 1626 +401
🚀 New features to boost your workflow:
|
Test summary 5 596 files 9 042 suites 7m 38s ⏱️ Results for commit e7360d8. |
sethrj
approved these changes
Mar 30, 2026
Member
sethrj
left a comment
There was a problem hiding this comment.
Thanks @drbenmorgan ! Looks like there's some easy-to-fix build errors in the CI.
Comment on lines
+59
to
+63
| G4ProcessVector* pv = pm->GetProcessList(); | ||
| CELER_ASSERT(pv); | ||
| for (auto j : range(pv->size())) | ||
| { | ||
| if (dynamic_cast<G4FastSimulationManagerProcess*>((*pv)[j])) |
Member
There was a problem hiding this comment.
We need to add Span to geant4 so we can use for (auto* p : pv->view()) 😬 (then we could use a std::algorithm find_if(...) != pv.end())
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Offload of particles from Geant4 to Celeritas via
FastSimulationIntegrationrelies on:SetupOptions.offload_particleshavingG4FastSimulationManagerProcessattached.celeritas::FastSimulationModelattached.The changes here implements a basic check and test on the first item, with placeholder documentation for the second (this requires addition of regions to
SetupOptions, which is a larger task). The implementation ofFastSimulationIntegration::verify_local_setupis extended to check the offload particles in general as is done inTrackingManagerIntegration(so is largely copy-paste), adding the needed loop over particles to check the presence of the needed process andCELER_VALIDATEon the result.I wasn't sure about policy on testing expected failure cases, but implemented an additional fixture/test to check that the expected exception is thrown when a known offload particle does not have
G4FastSimulationManagerProcessattached.