Hi experts,
I am trying to merge a very large number of ROOT files using hadd. The exact command I use is something like:
Note the inclusion of -k to skip files where there is a problem. In certain cases, this appears to work and output.root has the expected number of events (minus the skipped file). In these cases, I get an error message:
Error in <TFile::Init>: file input_36434.root is truncated at 1572864 bytes: should be 4667415, trying to recover
Info in <TFile::Recover>: input_36434.root, recovered key TH1F:hDTotalMCWeight at address 218
Warning in <TFile::Init>: successfully recovered 1 keys
Error in <TFile::ReadBuffer>: error reading all requested bytes from file input_36434.root, got 0 of 6200
Warning in <TFile::GetRecordHeader>: input_36434.root: failed to read the StreamerInfo data from disk.
Error in <TFileMerger::AddFile>: cannot open file input_36434.root
hadd skipping file with error: input_36434.root
However, in other cases, it appears that the file list is truncated at the problematic file and all other files after the bad file are ignored. That is, if I have input_0.root input_1.root ... input 100.root
and input_50.root is bad, then only the first 50 files are hadded. In that case, the error message looks like:
Error in <TFile::Init>: file input_24662.root is truncated at 32768 bytes: should be 439544, trying to recover
Warning in <TFile::Init>: no keys recovered, file has been made a Zombie
Error in <TFileMerger::OpenExcessFiles>: cannot open file input_24662.root
Error in <TFile::Init>: file input_24662.root is truncated at 32768 bytes: should be 439544, trying to recover
Warning in <TFile::Init>: no keys recovered, file has been made a Zombie
Error in <TFileMerger::OpenExcessFiles>: cannot open file input_24662.root
Is there a way I can skip files of the latter kind without manually deleting them and rerunning the hadd?
Thanks in advance!
Best,
Sid