Problem with datasets append

Hello,
I have a problem when using Roofit and appending 2 datasets. I open an existing Root tree, loop over the first 3000 events, do some selection, and add the selected events to a newly created dataset. Then I loop over the next 3000 events, select again, and add
these to a 2nd newly created dataset.
Later on, in a different program, I read and append the 2 datasets. The number of entries is correctly displayed as the sum of the 2. But some errors appear while appending:

Error in TTree::Fill: Failed filling branch:d_h1.psimass, nbytes=-1
This error is symptomatic of a Tree created as a memory-resident Tree
Instead of doing:
TTree *T = new TTree(…)
TFile *f = new TFile(…)
you should do:
TFile *f = new TFile(…)
TTree *T = new TTree(…)

In this 2nd program I do not open any TTree. In the first program, I am pening first the
file containning the TTree, then getting the TTree (not the opposite order, as the error message suggests). What is wrong? How can I avoid this?
If I read the 6000 events from the TTree and put these after selection in a single dataset,
all in the 1st program, the errors mentioned above appear there also…
Thanks for help,

Catarina

Hi,

Which version of ROOT are you using?

This issue was fixed somewhere in the 5.17 series.

Wouter

I was using Root 5.16. Indeed, when I use version 5.18 the problem disappears. Thanxs!

Catarina