Proof TChain with a TTree friend

Hello,

I have a TChain, and a small indexed TTree, which I friend to the TChain. I then use the Draw method with the branches in the TChain and the TTree. e.g.

This all works fine.

However, I am experimenting with using PROOF, and it appears I can’t do things this way.

TProof *proof = new TProof::Open("workers=2"); chain->setProof(); Error in <TDSet::TDSet>: Only TChains supported. Found illegal tree myTree

Is it possible in PROOF to have tchains working with ttrees in the way I am describing?

I know this was a long time ago, but in the interest of helping future users, I have now worked out how to make this work…

Put the TTree in a file, then create a TChain out of the TTree, and add this TChain as a friend

TFile f1("friend.root","RECREATE");
myTree->Write("myTree");
f1.Close()
TChain *c = new TChain("myTree");c->Add("friend.root");
myChain->AddFriend(c);
myChain->BuildIndex("myIndex"); //if you have an indexed friend tree, for some reason you have to rebuild the index if you want it to work in single core. But for PROOF, it appears to work without the BuildIndex.... still seems PROOF can be very weird at times!!!
...
myChain->SetProof(true);
myChain->Draw("....");

This works at least in Proof-Lite… I don’t know what would happen if the query was shipped off to a remote cluster, i.e. if the “friend.root” file would get correctly sent with it or not??

1 Like