Problems with TTree::Fill

Dear root users and developers!

I have an analysis program which is compiled with root and which outputs a small ntuple after execution with basic quantities that I would like to study. However, I quite frequently see these error messages:

Event Number: 90397
written to OUTtree as number: 35900
Error in : Failed filling branch:BKGevents.delta_phi, nbytes=-1
Error in : Failed filling branch:BKGevents.Transverse_Mass, nbytes=-1

When I check this entry in the written TTree afterwards I surprisingly find that the variables are filled:

BKGevents->Show(35900)
======> EVENT:35900
Ptmiss = 35.0629
Pttau = 36.4069
tauEta = 0.804153
delta_phi = 1.77471
Transverse_Mass = 55.4083

This has confused me for quite some time now, and I would be most thankful if somebody could help me!

Best regards

Bjarte

It is very likely that you are creating a memory ntuple.
The typical mistake is to do
TTree *T = new TTree(“T”,…
TFile *f = new TFile(…
instead of
TFile *f = new TFile(…
TTRee *T = new TTree(…

Rene