TFile->Write()

Hi List,

I am creating a root file with:

TFile* file = TFile::Open(“file_name.root”, “RECREATE”);

later on I have my event loop. Since the event loop takes quite some time, I would like to write my histograms once each 1 000 000 events. The problem is that if I write:

file->Write();

it creates all histograms once more, but with ;1 at the end of the name. Of course after some time I have a huge root file. My Question is how to make root overwrite the old histograms?

Thanks in advance,
Ivan

Hi Ivan
see the doc of TObject::Write, where it says that you can pass e.g. the argument kWriteDelete:

file->Write(0, TObject::kWriteDelete);Axel.

see documentation of TDirectory::Write

root.cern.ch/root/htmldoc/TDirec … tory:Write
root.cern.ch/root/htmldoc/TObjec … ject:Write

ie

file->Write(0,TObject::kOverwrite)

Rene