I get a problem in changing the name of collectabe string class in a root file. My root file, which is called ZJetsToNuNu_HT1200To2500_ext1.root, has the following structure:
I would like to change the name of the the first item named “tag” into “untagged”. When I point to it is says that item is a collectable string class. How can I change the name of it and save into a new root file?
I have tried like,
TFile *f = new TFile("ZJetsToNuNu_HT1200To2500_ext1.root", "update");
However, it does not change anything.
ROOT Version (5.34/36):
Can you try adding
It creates a new TObjString with “untagged” now, but the original “tag” is still there.
Can you try to delete the old “tag” by using
[quote]Q2. After closing and reopening the file the ls() changes and no
directory is shown.[/quote] humm … f.Open("test.root", "READ");Does NOT affect the object ‘j’ because TFile::Open is a static function that allocates and return a new object. i.e. TFile *f2 TFile::Open("test.root", "READ");
f2->Close();will work better.
Please also check the method documentation here:
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.