RootIO: explicitly write TTree to the correct TFile.
If gDirectory
is changed away from the TFile
created in the init
method of WriterRootTree
, the output root-file only contains a fraction of the events that has been flushed to disk while filling the tree while the last bit will end up in the new file which is currently pointed to by gDirectory
. This MR fixes this.