#include "TFile.h" #include "TTree.h" void run() { int nrunr=0; int nsegm=0; int nstream=2; TFile*f = new TFile(Form("XYMG_run%d_%d_s%d.root",nrunr,nsegm,nstream),"recreate"); TTree*t= new TTree("t","XYMG DATA"); t->Refresh(); // I used Refresh(), but by replacing it by whatever action (i.e. t->Print() for example), it still works exit(1); }