Indentifying corrupt TFiles, file probably not closed

Hi,
I want to identify corrupt TFiles before running a macro.
The way I know is to load them in root, and sometimes I get a warning:

Warning in <TFile::Init>: file file.root probably not closed, trying to recover

Is there an easy way to check this when generating the file, so I can tag the file?
Also, is there a way to check it afterwards?, some variable when loading the root file?
I tried with TFile.IsZombie() but doesn’t work in all cases…

Thanks in advance for you help!

Hi Jose,

The best is to avoid these cases. ROOT closes all files, so this happens usually only if ROOT gets killed.

See TFile::Recover() which explains that f.TestBit(TFile::kRecovered) will be set if keys have been recovered.

Cheers, Axel.

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