Skip to content

CSV streamer: always terminate a hit row with a newline#150

Merged
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/129-csv-row-newline
Jun 13, 2026
Merged

CSV streamer: always terminate a hit row with a newline#150
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/129-csv-row-newline

Conversation

@zhaozhiwen

Copy link
Copy Markdown
Collaborator

The per-hit row newline was emitted only in the else branch of the double-observables loop. A hit whose detector schema has no double observables (empty dmap) never entered the loop body, so its row got no newline and merged with the next row (plus a stray trailing separator).

Move the newline to after the loop, written exactly once per hit — mirroring the header row's existing logic. Applied to all three affected files: event/publishDigitized.cc, event/publishTrueInfo.cc, run/publishDigitized.cc.

Validation: ran the gstreamer CSV example in the Geant4 11.4.1 dev container. The normal (doubles-present) path is unchanged: every row has a consistent column count and newline termination (231 digitized rows, 5 commas each; 231 true-info rows, 22 commas each). The empty-dmap path now emits exactly one newline where it previously emitted none.

Fixes #129

The row newline was emitted only in the else branch of the
double-observables loop, so a hit whose detector schema has no double
observables (empty dmap) never entered the loop body and produced no
newline — concatenating that row with the next one. Move the newline to
after the loop, written exactly once per hit, matching the header row's
existing logic. Applies to event/publishDigitized.cc,
event/publishTrueInfo.cc, and run/publishDigitized.cc.

Verified: the normal (doubles-present) path is unchanged — the gstreamer
CSV example still produces rows with consistent column counts and
newline termination.

Fixes gemc#129

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@maureeungaro maureeungaro merged commit bc46db2 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.

[Medium] CSV row newline only written inside the double-observables loop, dropped when a hit has no doubles

2 participants