ROOT creating multiple trees

ROOT Version: 6.32.04
Platform: WSL2 Ubuntu

Hello! I am generating 1E5 events in Pythia and storing particle data into a ROOT file. However, as shown below, why does ROOT make more than one tree?

image

The tree_raw;1 stores 55901 entries and the tree_raw;2 stores 1E5 entries. Is there a memory limit of one tree? And does this affect the reading process?

Thanks in advance. Cheers.

Hi @phylmath, thank you for your question.

The default max size is 100 Gigabytes (and you can increase the limit!) - ROOT: TTree Class Reference

I’m adding @pcanal in the loop.

Cheers,
Dev

those are two cycles of the same tree. It’s like a backup history.
You can use Write(TObject::kOverwriteDelete) to only store the last cycle.

Hi ferhue. Thank you very much for the response. How do I write this in my code? I have a tree→Fill() at the end of each loop iteration and an output→Write() at the end of the code. Where do I add the TObject::kOverwriteDelete as you stated?

kOverwriteDelete is not in the TObject documentation; maybe you mean kWriteDelete?

@phylmath : In any case, maybe kOverwrite will do; just write the tree, not the file (supposing output is a TFile):

output->cd();
tree->Write("tree_raw",TObject::kOverwrite);
output->Close();

If kOverwrite does not do what you want, try kWriteDelete.

Yep sorry, kWriteDelete