SysError in <TFile::TFile>: file 0jet.root can not be opened (Too many open files)

Dear Developers,

I am writing a script to open 16 files and recreate 16 files. I have passed a string but it gives me error (as in topic). Then I removed the string and runs only one file but again it gives me the same error. I donot know how to remove this. Kindly help me to resolve this issue. I am attaching my script and root file path.

/afs/ (8.9 KB)


Move: TFile *ff = new TFile("0jet.root","RECREATE"); Z_Inv_mass->Write(); // ... tight_prof->Write(); to outside of the “for (Long64_t i = 0; i < nentries; i++)” loop (so, move it to below the closing “}” of this loop).
Also, replace: f->Close(); ff->Write(); ff->Close(); with: delete ff; delete f;

Thank you Wile it works.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.