Hello,
I have a large rootfile in which I am trying to create a bunch of directories. Sometimes the directories already exist so I test for them using TDirectoryFile::GetDirectory before mkdir. I get the following errors when I run my code.
SysError in <TFile::Seek>: cannot seek to position -2095724719 in file data/rootfiles/InSANE72481.-1.root, retpos=-1 (Invalid argument)
SysError in <TFile::Seek>: cannot seek to position -2095724602 in file data/rootfiles/InSANE72481.-1.root, retpos=-1 (Invalid argument)
SysError in <TFile::Seek>: cannot seek to position -2095724485 in file data/rootfiles/InSANE72481.-1.root, retpos=-1 (Invalid argument)
SysError in <TFile::Seek>: cannot seek to position -2095724368 in file data/rootfiles/InSANE72481.-1.root, retpos=-1 (Invalid argument)
SysError in <TFile::Seek>: cannot seek to position -2095724251 in file data/rootfiles/InSANE72481.-1.root, retpos=-1 (Invalid argument)
SysError in <TFile::Seek>: cannot seek to position -2095724134 in file data/rootfiles/InSANE72481.-1.root, retpos=-1 (Invalid argument)
SysError in <TFile::Seek>: cannot seek to position -2095724017 in file data/rootfiles/InSANE72481.-1.root, retpos=-1 (Invalid argument)
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
return status was 6
The offending lines of code are
if ( !(f->GetDirectory(Form("/detectors/bigcal/hist%d",i + 1))) ) {
f->mkdir(Form("/detectors/bigcal/hist%d", i + 1));
}
If I comment out the if statement then every works fine! What is going on here?
Thanks!