Duplicated names in ROOT file


I have some code that dumps a TTree object to a file. Do you know why I am seeing three trees when open the file?

root [1] .ls
TFile**		output_electrons_v1.root
 TFile*		output_electrons_v1.root
  KEY: TTree	JINRTree_Run2;19	HWW tree BDT
  KEY: TTree	JINRTree_Run2;18	HWW tree BDT
  KEY: TTree	JINRTree_Run2;17	HWW tree BDT
  KEY: TDirectoryFile	Environment;1	Environment

Thank you!

search for “cycle” in :
root.cern.ch/root/htmldoc/guide … utput.html

Hi couet,

I think I don’t understand the documentation. I have multiple TTrees appearing in the output TFile, and this is confusing to anyone who opens the file but hasn’t read this forum. Am I supposed to live with this? Or am I missing the way of resolving it?

Thanks Wile. I saw this solution with TObject::kOverwrite, too. But I also noticed that for TTrees, we are explicitly told to call Write only on the TTree’s GetCurrentFile, and not on the TTree itself:


These seem like conflicting suggestions.