Skip to content

Normalize run data once, not once per run streamer#152

Merged
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/105-run-normalize-once
Jun 13, 2026
Merged

Normalize run data once, not once per run streamer#152
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/105-run-normalize-once

Conversation

@zhaozhiwen

Copy link
Copy Markdown
Collaborator

publish_run_data called normalize_run_data inside the per-streamer loop. normalize_run_data mutates the shared run_data_collaction in place (replacing each normalized observable with value/events_processed) and is not idempotent, so with two or more run-mode streamers the second streamer published value/N², the third value/N³, and so on.

Hoist the normalization out of the loop so it runs exactly once per run regardless of streamer count.

Validation: gRunAction.cc compiles clean (Geant4 11.4.1 dev container).

Fixes #105

publish_run_data called normalize_run_data inside the per-streamer loop.
normalize_run_data mutates the shared run_data_collaction in place
(replacing each normalized observable with value/events_processed) and is
not idempotent, so with two or more run-mode streamers the second
streamer published value/N^2, the third value/N^3, and so on. Hoist the
normalization out of the loop so it runs exactly once per run regardless
of streamer count.

Fixes gemc#105

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@maureeungaro maureeungaro merged commit d12c745 into gemc:main Jun 13, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[High] Run-level normalization applied once per streamer causes double-normalization

2 participants