I need to merge multiple root files from grid each of which contains just few histograms (but histograms themselves are sufficiently large) . In order to save computer resources, I prepared a macro with a loop each time merging a limited number of remote files into a local one . Unfortunately the macro stops right after execution of the first merge.
Below I insert one of the versions of macro, where I put the list of files inside a vector:
Unfortunately hadd is not applicable, since there are many files weighty files (up to 1 thousand X ~40 MB) in my grid director which I need to merge locally.
I also discovered that the first merged file itself is corrupted:
Attaching file merged0.root as _file0…
Warning in TFile::Init: file merged0.root probably not closed, trying to recover
Info in TFile::Recover: merged0.root, recovered key TH3D:h31 at address 238
Info in TFile::Recover: merged0.root, recovered key TH3D:h32 at address 54485712
Warning in TFile::Init: successfully recovered 2 keys
(TFile *) 0x2a76680
In my case typical file size is approximately 40 MB, but I discovered that there are some with 10 MB. Have tried to set filters on minimum file size 20, 30, and 35 MB, but the error happens again. Is there some more reliable way to check quality of the files? They contain just few histograms, no trees, folders and other complex structures.