Take the following script:
#include "TFile.h"
#include "TH1F.h"
int main()
{
TFile * file = TFile::Open("file.root", "UPDATE");
file -> ls();
TH1 * h = (TH1*) file -> Get("h");
h -> Print("all");
h -> Fill(1.0);
h -> Write();
file -> Close();
return 0;
}
After successive iterations of the script I see there are multiple copies of the object in the file:
TFile** file.root
TFile* file.root
KEY: TH1F h;8 h
KEY: TH1F h;7 h
KEY: TH1F h;6 h
KEY: TH1F h;5 h
KEY: TH1F h;4 h
KEY: TH1F h;3 h
KEY: TH1F h;2 h
KEY: TH1F h;1 h
I feel uncomfortable with that. What I intend is to replace the existing version of the object in the file with a new version of it. How to do it?
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided