feat: record Geant4 production process of simulated particles#5605
Open
altsybee wants to merge 3 commits into
Open
feat: record Geant4 production process of simulated particles#5605altsybee wants to merge 3 commits into
altsybee wants to merge 3 commits into
Conversation
Added eIonisation and eOther to GenerationProcess enum, added comments
Added function to map Geant4 processes to ActsFatras GenerationProcess enums, write process for G4 particles via via setProcess()
Contributor
|
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.



Geant4: record the production process of simulated particles
Summary
The standalone Geant4 simulation (
Examples/Algorithms/Geant4) never sets theActsFatras::GenerationProcesson the particles it creates, so every simulated particle was written out withprocess = eUndefined. (Fatras sets it via its physics modules, but the Geant4 backend did not.)This made it impossible to tell, downstream, whether a secondary came from a decay, a conversion, bremsstrahlung, a nuclear interaction, etc.
This PR maps the Geant4 creator process of each track to a
GenerationProcessand stores it on the particle, so it is propagated to the output (e.g. theprocessbranch ofRootParticleWriter).Changes
Examples/Algorithms/Geant4/src/ParticleTrackingAction.cpp: inconvert(), set the process fromtrack.GetCreatorProcess()via a new helperg4CreatorToGenerationProcess(). Mapping:eUndefinedfDecay→eDecayfHadronic/fPhotolepton_hadron→eNuclearInteractionfBremsstrahlung→eBremsstrahlung,fGammaConversion→ePhotonConversion,fIonisation→eIonisationeOtherFatras/include/ActsFatras/EventData/GenerationProcess.hpp: addeIonisation = 5andeOther = 6to carry the finer Geant4 detail (with anote that 4/5/6 are Geant4-fed; Fatras itself only sets 1/2/3).
Fatras/src/EventData/GenerationProcess.cpp: add the matchingoperator<<cases.Notes / compatibility
PreUserTrackingAction, which is whatSimParticle::process()/RootParticleWriterwrite out.switchoverGenerationProcess(GenerationProcess.cpp) has adefault, and all other consumers cast uint↔enum or stream it. Existing files written with codes 0–4 are unaffected.Example usage: origin of particles which produce fake measurements on tracks
(Pythia pp; categories can overlap, so they need not sum to 100%):