-
Notifications
You must be signed in to change notification settings - Fork 221
sPHENIX primary fix: key the vertex using both position and process id #4138
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
sPHENIX primary fix: key the vertex using both position and process id #4138
Conversation
📝 WalkthroughWalkthroughThis change modifies vertex tracking in PHG4TruthTrackingAction to use a composite key combining vertex position and G4 process type, allowing the simulation to distinguish between vertices at identical coordinates produced by different Geant4 processes. Header updated with new data structure and required dependencies. Changes
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Build & test reportReport for commit 9d25f5e0f5fed1f09fa66ac3d5f0b1b0c6c38081:
Automatically generated by sPHENIX Jenkins continuous integration |
|
Note Docstrings generation - SUCCESS |
Docstrings generation was requested by @pinkenburg. * #4138 (comment) The following files were modified: * `simulation/g4simulation/g4main/PHG4TruthTrackingAction.cc` * `simulation/g4simulation/g4main/PHG4TruthTrackingAction.h`



Types of changes
What kind of change does this PR introduce? (Bug fix, feature, ...)
Summary
different physics processes (e.g., K0 → K0_S/K0_L mixing)
Problem
When multiple particles are produced at the same spatial position but by different
processes, they previously shared the same vertex. This caused GEANT4 secondary particles
(like K0_S/K0_L from K0 mixing) to incorrectly inherit the primary particle's vertex
process (kPNoProcess) instead of their actual production process (kPDecay). While the sPHENIX primary require particle produced from decay process if it is secondary.
Solution
Modified PHG4TruthTrackingAction::AddVertex() to use std::pair<G4ThreeVector,
PHG4MCProcess> as the vertex map key, ensuring vertices are unique by both position
AND process.
TODOs (if applicable)
Links to other PRs in macros and calibration repositories (if applicable)
sPHENIX Primary Fix: Key Vertices by Position and Process
Motivation / Context
When multiple particles are produced at the same spatial location by different physics processes (e.g., K0 → K0_S/K0_L mixing), they were previously assigned to a single vertex. This caused GEANT4 secondary particles to incorrectly inherit the primary particle's vertex process (kPNoProcess) instead of their actual production process. The sPHENIX primary particle selection requires secondaries produced by decay to be properly identified as such, making correct process tracking essential.
Key Changes
PHG4MCProcessDefs.hand<utility>includes; changedm_VertexMapfromstd::map<G4ThreeVector, int>tostd::map<std::pair<G4ThreeVector, PHG4MCProcess>, int>track.GetCreatorProcess()and converts to PHG4MCProcess viaPHG4ProcessMapPhysicsPotential Risk Areas
Possible Future Improvements
Note: AI-generated analysis may contain errors. Review actual code changes and impact on your reconstruction workflow, particularly vertex-dependent selections.