File conflict in Windows

From: Tom Roberts <tjrob_at_fnal.gov>
Date: Sun, 11 Feb 2007 14:38:15 -0600


I have having problems with a file conflict in Windows that does not happen in Linux.

I am using Root as a histogramming system, and have written a GUI to make it easier to use by non-experts. I run my simulation program, g4beamline, to generate a .root file, then open it in Root and generate some histograms from TNtuples contained in the file.

The problem comes when I try to iterate this. Once the file is open in Root, g4beamline gets an assert error that the NTuple it tried to create in the file does not exist (null pointer). While the file is open in Root, I cannot delete it using Windows explorer. If I remember to manually close the file in Root before re-running g4beamline, all is well -- g4beamline overwrites the old file with a new one, and Root can then open it and construct new histograms.

In Root the TFile is opened "READ", and in g4beamline the TFile is opened "RECREATE".

Does anyone know of a workaround? Or do my users just have to remember to close the file before re-running g4beamline?

For instance, is there some way to open the TFile with read+write in Root even though I will just be reading it -- will that trick Windows into letting another program write it simultaneously? Or is there some other way of "sharing" the file? In all cases when g4beamline runs it should delete the entire contents of the file and start over creating it.

Tom Roberts Received on Sun Feb 11 2007 - 21:38:23 CET

This archive was generated by hypermail 2.2.0 : Tue May 29 2007 - 23:50:01 CEST