pre-assign secondary track IDs in ProcessSecondariesFromParticleChange

Add G4EventManager::ReserveNextTrackID() to atomically increment and
return the next track ID counter. Call it from G4SteppingManager::
ProcessSecondariesFromParticleChange() so that each secondary has its
track ID set before UserSteppingAction fires. G4EventManager::StackTracks
is updated to skip re-assignment when GetTrackID() != 0 (pre-assigned).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 10:25:01 +02:00
parent 41f2dd7996
commit e7827c9b07
3 changed files with 21 additions and 2 deletions
+4
View File
@@ -59,6 +59,10 @@ class G4EventManager
static G4EventManager* GetEventManager();
// This method returns the singleton pointer of G4EventManager.
G4int ReserveNextTrackID();
// Pre-assign the next sequential track ID to a secondary being born inside
// G4SteppingManager, so that its ID is available in UserSteppingAction.
G4EventManager();
~G4EventManager();