Multiple trees with the same name

Hi all.
I’m really sorry to ask this question as I think everyone doing anything with ROOT trees have faced this problem. However I did not find a clear description of the mechanism behind and advices what to do.

I have created some tree with a C structure, quite similar to what is given in the ROOT tutorial here: … -structure
I will be able to post my code later, if asked.

Suddenly there are two trees in the file and moreover the indices are not even starting from 1 (19 and 20).
I see that tr and tr19 are actually the same object, but tr20 is different. Thus if I simply ask for the tree by the name which I know, “dataTree”, I will get the one with 380 entries, presumably with some data missing.
Next issue is the size of file. This is, of cause, a just an example here. In the full version I expect rather high data rate and I would like to enjoy the nice ROOT tree compression capability to minimize the disk space occupied. Is there any data redundancy or it just looks as if there are two trees?

Does it have to do something with TTree:Autosave()? Or TTree::SetMaxTreeSize()? Or incorrect file closing?

Thank you.

1 Like

Hi Egor,

You may want to review the discussion on the concept of “cycle” in the I/O chapter of the ROOT User’s Guide.

The lower numbered object is a backup copy of the meta data of the TTree to reduce the risk of data loss (in case of process or machine crash). The ‘duplication’ is limited to the meta data (name of the branches, type of the object in the branch, location of the baskets, etc.) .

The frequency at which there is a backup copy of the meta data done, is indeed controller by TTree::SetAutoSave.


For deleting the previous cycle and just stay with the newest one, use instead:

before closing the TFile.

Hello, the webpage is not displayed.I have the same problem.Can you help me?

1 Like

Thanks very much for your help.