Hello,
I’m not sure this is a root problem or I’m just doing something wrong with c++… Anyhow I have a c++ program which read a tree and write many (thousends) of histogram in few files. The code I use is the following:
...
int nAlgo = 5;
int nBinPt_ = 250;
int nBinEta = 50;
TFile *myFile[nAlgo];
TH1F* hDist_GJ[nAlgo][nBinEta][nBinPt_];
for(int iAlg=0;iAlg<nAlgo;iAlg++) {
myFile[iAlg] = new TFile(Form("histoFile_DR%03u_%d.root",drInt,iAlg),"RECREATE");
for (Int_t i1=0; i1<nBinEta ; i1++)
for (Int_t i2=0; i2<nBinPt_ ; i2++) {
hDist_QJ[iAlg][i1][i2]= new TH1F(Form("hDist_QJ_%d_%d",i1,i2),"",200,0.5,1.5 );
}
}
...
for(int iAlg=0;iAlg<nAlgo;iAlg++) {
myFile[iAlg]->cd();
cout << "Writing file for algo:" << iAlg << endl;
myFile[iAlg]->Write();
}
cout << "End Writing and exiting" << endl;
return 0;
}
The problem is that the program compile, run but it’s not exiting… I see on the standard output:
End Writing and exiting
and then the program stuck. If I ctrl^C, the program stops, the output file is correctly written and I can use it…
I can survive like this but I cannot use my program in a script because it’s not exiting…
So my question is: is the example code correct? If you like I can give you a code example to run
Thanks for helping.
Attilio