TTree.Write() vs. TFile.Write()

Hi,

My code opens an output file and creates one tree (with a couple of branches).

Does it make a difference how I save the information & close the file at the end of the job?

output_file->cd();
root_tree->Write();
output_file->Close();

vs

output_file->cd();
output_file->Write();
output_file->Close();

Thanks.

–Christos

Hi Christos,

TFile::Write is interesting in case you have many objects in
file->GetList() collection in memory.
In case of one Tree, the two forms are equivalent. TFile::Write
makes a simple loop in the collection in memory.

see TTree::ChangeFile root.cern.ch/root/htmldoc/TTree. … ChangeFile

and the important Note at the end of this function in case
you write a large Tree.

Rene Brun