I got random outputs from CopyTree in PyRoot

(1) Run the following code:

tree_in = TFile.Open("InputFile.root","read").Get("InputTree")
file_out = TFile.Open("OutputFile.root","RECREATE")
tree_in.CopyTree("").Write("NewName")
file_out.Close()

(2) You will see the “InputTree” in the outputfile with a totally random number of entries. The “NewName” tree has the correct number of entries which equals to tree_in.

Is that a bug or feature?

Hi,

can’t reproduce … not with Python and not with CINT. Which version of ROOT are you running?

Cheers,
Wim