Skip to content

Parallel Geant4 scoring and NIEL clamp - #15812

Open
sawenzel wants to merge 3 commits into
AliceO2Group:devfrom
sawenzel:g4scoring-merge-and-niel-clamp
Open

sawenzel wants to merge 3 commits into
AliceO2Group:devfrom
sawenzel:g4scoring-merge-and-niel-clamp

Conversation

@sawenzel

@sawenzel sawenzel commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

This provides the possibility to run scoring studies (fluence, dose) with Geant4
in parallel simulation mode.

Also adding a numeric stability glamp to weights when they are used beyond the original range.

NIEL weights and parallel scoring

Left: damage weights before (dashed) and after the clamp. Right: 1 MeV n_eq fluence from o2-sim-serial and from o2-sim -j 8 after merging, for the same pp events.

1 MeV n_eq, Geant4 over FLUKA

1 MeV n_eq fluence near the beam pipe, Geant4 over FLUKA, for the same 200 pp events. Applying the damage weights to all hadrons, as FLUKA does, brings Geant4 to 0.98 ± 0.02 of FLUKA in the ITS3 layers (0.85 before). The remaining difference comes from FLUKA's damage tables, which stay flat above 1 GeV. FLUKA references: https://fluka.cern/documentation/references

This fixes unbounded 1 MeV neutron-equivalent weights outside the RD50 tables.

- GetWeight evaluated the spline beyond the last table point, giving a pion weight of 541 at 10 GeV and 5e11 at 1 TeV.
- The energy is now clamped to the table range, so weights beyond it use the value at the table edge.
- Graphs read from CSV are sorted, since the clamp takes the range from the first and last point.
- An empty graph returns 0, as before.
@sawenzel
sawenzel requested a review from a team as a code owner September 17, 2026 09:24
@sawenzel

Copy link
Copy Markdown
Collaborator Author

This follows a discussion with @njacazio about ALICE3 developments.

@sawenzel
sawenzel requested a review from amorsch September 17, 2026 09:26
@njacazio

Copy link
Copy Markdown
Collaborator

Many thanks tagging also @NNicassio99

@amorsch

amorsch commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

@sawenzel @njacazio
Nice to know that somebody is actually using this feature and of course the merging is an excellent extension. Thanks!
Strange that on my Mac the behaviour outside the range is not as "explosive". Of course the cap is needed if root doesn't do it.

This makes Geant4 command-line scoring usable with o2-sim running several workers.

- Each worker writes its scoring meshes to <mesh>.worker<pid>.txt before finishing the Geant4 run.
- The master worker shuts down before waiting for its forked workers, so its dump is not lost to the kill timer.
- o2-sim waits for all workers to exit and sums the worker files into <mesh>.txt.
- The merge fails if the number of dumps differs from the number of workers.
- The tool o2-sim-merge-g4scoring does the same merge for a given directory.
- The total column merges exactly; entries and total^2 count Geant4 events, which o2-sim splits into chunks per worker.
This extends the 1 MeV neutron equivalent fluence weighting to all hadrons and to e±, in line with FLUKA's SI1MEVNE.

- Mesons use the pion weights and (anti)baryons other than the neutron use the proton weights.
- e± use electron weights when the weight file provides pdg 11.
- Near the beam pipe, kaons alone add 15% to the n_eq fluence.
@sawenzel
sawenzel force-pushed the g4scoring-merge-and-niel-clamp branch from 952d5fa to 492f6b1 Compare September 17, 2026 12:53
@amorsch

amorsch commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

@sawenzel
"for all hadrons"
I think you mean for pi, p, n and electrons ?
At larger radius I saw much larger difference because of differences in the particle flux coming from the absorber.

@amorsch

amorsch commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Btw, if electrons make such a difference we have to include QED electrons in the primary event generation. Or is it already includes ?

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants