How can I update the content of a root file?

Hi rooters
I have a root file, it contains five histograms, I would like to open the file by using the update option.

TFile *f=new TFile(“test.root”,“update”);
then I would like to scale one of those histograms
TH1D h=(TH1D)f->Get(“h”);

I would like to update the histogram itself and not to create a new one beside the old one.

is there a way to do that?



TFile *f=new TFile("test.root","update"); TH1D *h=(TH1D*)f->Get("h"); h->Scale(10); h->Write("h",TObject::kOverwrite);
see doc of TObject::Write at … ject:Write%1