Why I'm getting "ERROR file /path/to/old_friend.root does not exist"? How can clean this data?

I have a .root file with a tree (call it tree A) containing lots of data. I have previously friended A to another tree, B, using the BuildIndex() function on both A and B.

Since then I have stopped using B and deleted it. Now every time I try to open A it says;

TFile::TFile     ERROR file /path/to/old_friend.root does not exist

over and over again. I feel guilty for deleting its friend and leaving it lonely…
How can I make this stop?

Tree A is a large xAOD, so it contains various compiled objects including some metadata objects.


ROOT Version: 6.24/06
Platform: NAME=“CentOS Linux” VERSION=“7 (Core)” ID_LIKE=“rhel fedora” CLUSTER=“sunrise”
Compiler: pyroot


Hi @Day,

Sorry for the late reply. Maybe @pcanal can give a hint here.

Cheers,
J.

Try (maybe on a copy of the file was ‘safety’):

std::unique_ptr<TFile> file{ TFile::Open("a.root", "UPDATE");
auto tree = file->Get<TTree>("A");
tree->GetListOfFriends()->Clear();
file->Write();
1 Like

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