We write out fairly large ROOT files from simulation jobs. If the jobs end successfully, there’s no problem (obviously), but if a job crashes or is aborted early, quite often the ROOT file is unusable.
I thought that I could use TFile::Flush() at the end of each event to ensure that the the file on disk was as close to usable as possible. But if I end a job early, the resulting ROOT file is as empty as before I introduced the Flush() call.
Should I be using TFile::Write() for this purpose? If I do this on every event (essentially short-circuiting the buffers), should I call it with the kOverwrite or kWriteDelete option?