Re-using file created with TFileMerger

Hi,

I’m stumbling across something which is either a bug, or maybe I don’t understand something. I’m not sure…

I just started using the file merging capabilities of PROOF. (I write “largish” ntuples on the worker nodes into temporary files and let PROOF merge them together.) This seems to work well in principle. But now I’d like to open the created (merged) files like

TFile* file = TFile::Open( "MyMergedFile.root", "UPDATE" );

I would actually like to update some elements of the file. (It’s a long story why I want to do it, but it should work, right?) When I try to open the file created by TFileMerger in “UPDATE” mode, I get the following:

And in fact, when I try to add new things to the file, I get many-many error messages. However the file should not be damaged. If I open it in “READ” mode, it opens correctly, and I can draw everything from it.

I tried reading through the TFileMerger code, but didn’t find anything obvious why the output file should not be updatable. Is this something expected?

Cheers,
Attila

Hi,

While I still didn’t find the source of my problems with TFileMerger, I managed to side-step the problem by creating a dumbed-down version of TFileMerger for myself. While this is not as elegant as if I would be able to use TFileMerger itself, it will do for the moment.

(My code does things in a much more simple manner, because I don’t have to care about generality. So because the code is so much simpler than that of TFileMerger, I can’t pinpoint why the files created by my class can be opened in UPDATE mode and the ones created by TFileMarger can’t. Strange…)

Cheers,
Attila

Hi Attila,

Could you send me a complete example reproducing your problem?

Thanks,
Philippe

Hi Philippe,

Attached is a very simple example that triggers this warning message. I don’t try to write to the file opened in in UPDATE mode, but it should produce some error messages. I could add a few lines to the code doing this if you’d like. I guess it should be pretty obvious what this macro is doing… :wink:

Cheers,
Attila
filemergererror.C (3.11 KB)

Hi Attila,

Thanks for reporting this problem and providing this example. I fixed the underlying problem in the svn trunk (at revision 27117) and added your example to our test suite.

Cheers,
Philippe