How to write a Histogram to a given file?

Hello… im looking for a way, to write a Histo, to a given file, like
TH1F->Write(TFile);

Right now, i only can write to the file, that is currently open, but i want to have more files open at the same time, reading from one, and writing to various others… how can I do this, without reopening the file i want to write to all the time?

Thx,
Thomas

Hi,

Either attach the histogram to the TFile:histo->SetDirectory(file);and then write the filefile->Write() or explicitly write the histofile->WriteObject(histo);

Cheers,
Philippe.