Hi,
I have written a root macro (att. 1) that adds historams written
in different *.root files, but fails when the number of
input files is >1000 (error message too many files open).
88854
SysError in TFile::TFile: file e88855.root can not be opened for reading (Too many open files)
Error in TH1F::Add: Attempt to add a non-existing histogram
Error in TH1F::Add: Attempt to add a non-existing histogram
Error in TH1F::Add: Attempt to add a non-existing histogram
Error in TH1F::Add: Attempt to add a non-existing histogram
etc…
I have googled the roottalk and found the references
to the same/similar problem, but could still not get my
code working: I cannot find a way to properly close
an opened file ;8-( Trying to close the file with
in_file->Close();
produces a segmentation error.
I have tried opening the file two different ways
(as some roottalk entries suggested) as in
TFile in_file = new TFile(Form(“e%d.root”,i));
//TFile in_file = TFile::Open(Form(“e%d.root”,i),“read”);
but it did not make any difference.
P.S. I use root5.22
add_histos.C (5.19 KB)