Current dir not associated with a file, TTree not written


I am encountering problems while trying to fill a TTree set as a global variable.

Actually I have to benchmark a third-party framework in C++/python, so I chose the quick & dirty option, that is to create custom header and source files including all the variables I need to fill, them being set as global variables. Amongst those variables are some histograms, a TTree, and the file where they are to be stored.

The filling and writing works fine for the histograms, but for the TTree I am experiencing the following issue at runtime :

Below is the way things are defined. I tried a few variations without any success for now, hence the welcoming of any suggestion.

[…] extern TFile* watchfile; extern TTree zetree; […]

TFile *watchfile = new TFile(“essailogbis.root”,“recreate”);
TTree zetree(“zetree”,“zetree”);
ZeFit zefit = {0};

int initialize()
// watchfile->cd();
initdone = true;
return 0;


Actually, despite the error, the TTree is written…


Somewhere in your code you have: zetree.Write();replace this by watchfile->Write();orzetree->GetCurrentFile()->Write();


Actually I had both lines, which explains why the tree was written anyway. Thanks !