Hi Horst,
When you create a TTree, this object is assigned by default
to the current directory/file. You can fill a TTree without
changing the current directory. At the end of the process,
you must save the TTree header in the file where it was
initially created. Example with 2 TTrees:
TFile f1("f1.root","recreate");
TTree tree1("tree1",..);
TFile f2("f2.root","recreate");
TTree tree2("tree2"..)
...
//loop on events
f1.Fill();
f2.Fill();
...
//end of process
f1.cd();
tree1.Write();
f1.Close();
f2.cd();
tree2.Write();
f2.Close();
Assuming one TTree, you can write branches of this Tree
to different files via TBranch::SetFile
Rene Brun