Error in <TTree::Fill>: Failed filling branch

Hi rooters,
I have the following problem filling a TTree :unamused: ,
does someone

I have a program (fusgamma_OneRing.cxx)
which reads one Tree of data, makes an analysis
and puts the output in 5 different Tree .

TFile *outtree = new TFile(outfile,“RECREATE”);
TTree *outT = new TTree(“h1_gam”,“reduced_data”);

TFile *outtree1 = new TFile(outfile1,“RECREATE”);
TTree *outT1 = new TTree(“h1_gam1”,“reduced_data”);

.
.
.
outT->Branch(“mulfu”,&mulfu,“mulfu/I”);
outT->Branch(“mulfi”,&mulfi,“mulfi/I”);
outT->Branch(“baffu”,baffu,“baffu[mulfu]/I”);
outT->Branch(“baffi”,baffi,“baffi[mulfi]/I”);
outT->Branch(“enfus”,enfus,“enfus[mulfu]/D”);
outT->Branch(“enfis”,enfis,“enfis[mulfi]/D”);
outT->Branch(“libfus”,&libfus,“libfus/I”);
outT->Branch(“libfis”,&libfis,“libfis/I”);

outT1->Branch(“mulfu1”,&mulfu1,“mulfu1/I”);
outT1->Branch(“mulfi”,&mulfi,“mulfi/I”);
outT1->Branch(“baffu1”,baffu1,“baffu1[mulfu1]/I”);
outT1->Branch(“baffi”,baffi,“baffi[mulfi]/I”);
outT1->Branch(“enfus1”,enfus1,“enfus1[mulfu1]/D”);
outT1->Branch(“enfis”,enfis,“enfis[mulfi]/D”);
outT1->Branch(“libfus1”,&libfus1,“libfus1/I”);
outT1->Branch(“libfis”,&libfis,“libfis/I”);

.
.
.
outT->Fill();
outT1->Fill();
.
.
.

I compiled the makefile and the program seemed to work.
But for one of the two systems which I want to analyze
I got this error

Error in TTree::Fill: Failed filling branch:h1_gam3.libfus3, 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(…)
Error in TTree::Fill: Failed filling branch:h1_gam3.libfis, nbytes=-1
Error in TTree::Fill: Failed filling branch:h1_gam4.mulfu4, nbytes=-1
This error is symptomatic of a Tree created as a memory-resident Tree
Instead of doing:

Then, I added a line outT->SetAutoSave(600000000);
for each Tree
(trying to increase the AutoSave)

TFile *outtree = new TFile(outfile,“RECREATE”);
TTree *outT = new TTree(“h1_gam”,“reduced_data”);
outT->SetAutoSave(600000000);

but now when I run my program I get again the same error

Any other suggestions ?

Thanks in advance,
R.

It looks like you changed the directory between the opening of the file and the creation of the Tree.
Could you post the shortest possible running script reproducing your problem?

Rene

Many thanks for your suggestions.

I have found the cause of my problem working around the different directories.

Cheers,
Rosetta