Hi,
I d like to modify a tree and overwrite it in the same file and this several time. I have an issue with the file size. To summarise the problem I got to this piece of code which I would assume do nothing, but unfortunately it increases the file size.
void example(void) {
string filename = "example.root";
string treename = "tagsDumper/trees/gjet_13TeV_TTHHadronicTag";
string writingDir = "tagsDumper/trees/";
TFile *file = new TFile( filename.c_str(), "update" );
file->cd(writingDir.c_str());
cout << " ---- just opening the file" << endl;
gDirectory->ls();
cout << " ---- " << endl;
TTree *tree = (TTree*) file->Get( treename.c_str() );
TTree *newtree = tree->CloneTree();
newtree->SetName("toto-mon-toto-name");
newtree->SetTitle("toto-mon-toto-title");
//newtree->Write("",TObject::kOverwrite);
file->Close();
}
if I do that several time the file size increase each time by the size of the tree I am cloning.
When I check what is inside the file though, I don’t see anything new and the cloned tree is not there as expected. The original tree size is also not changed so I can not find anything new in the file.
What should I do to avoid that ? I tried to delete the cloned tree (new tree) but does not help.
I d like to avoid posting the example.root file which are private CMS data but I could if needed.
THanks,
Fabrice