Empty CSVs delete themselves


I’ve got a Geant4 application that uses a sensitive detector and outputs hits to a CSV file. Every run, the CSV file is opened but if the sensitive detector has recorded no hits, the CSV file appears to delete itself upon the end of the run. This seems strange as even with no hits, I assumed the CSV file would remain and contain only the column headers and no data. Is this normal for Geant4 CSV management?

Thank you!

I had a similar issue with root files a few times.

It usually was one of three things. Either I wasn’t 1) writing/saving/closing the root file correctly in the analysis manager, 3) I wasn’t actually getting any hits because a mistake in the geometry/materials or 3) my conditions for a detection were wrong.

I suggest checking these out as possibilities.
If you’re still stuck, put a few G4cout around the suspected problem code and narrow down from there.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.