Error while merging root files using hadd

Hi all,

I have about 600 root files. I want to merge them into one using hadd. So i do:
‘’’’’’’’’’’
hadd a.root tree*
‘’’’’’’’’’’
I do tree* because all the 600 root files begin with the word ‘tree’. However i get an error that I have copied in a txt file and attached with this question.
My guess is that some particular root file(s) out of the 600 is(are) corrupted. I tried hadding a few root files and it worked fine. This reinforces the idea that this problem is being caused by a few files being corrupted. But i do not know how to find out those corrupted root files. Could you please help me with this?
I put all the root files in my lxplus here: /afs/cern.ch/work/d/dvats/public/JET
hadd_error.txt (37.1 KB)

One of the things you can try is

hadd a.root -n SomeSmallNumber tree*

where it would bunch them merge by a set of only “SomeSmallNumber” of files at a time.

@pcanal Thanks a lot. I did this with n=10.
Now i get that error at 15th cycle. Please look at the attached txt file.
hadd_error_2.txt (40.7 KB)
It seems to be merging 9 files at a time instead of 10. So i guess the corrupted file lies between 126th (9 times14) file and 135th (9 times 15) file.

@pcanal Using n=2. I was able to find that problem was being caused by 127th and 435th files which were ‘tree_SingleMuon_Run2017F_1-75.root’ and ‘tree_SingleMuon_Run2017F_430.root’. So i removed these files and i was able to successfuly run hadd. But i am still a bit confused because these 2 files seem to be fine. Also the size of a.root that i got is 8.7GB while the size of 586 individual files is 19GB. They should be of same size.
It would be great if you could share some ideas about these concerns. Thanks for helping me solve the problem :slight_smile:

But i am still a bit confused because these 2 files seem to be fine.

How do you assert that they are fine (if any of the data on the file is corrupted this could lead to the result you observed).

Also the size of a.root that i got is 8.7GB while the size of 586 individual files is 19GB. They should be of same size.

indeed. One source of expected difference is if the files are compressed differently.

To understand what is happening let’s focus on merging 2 (arbitrary but healthy) of the files. Then provide the result of ‘TTree::Print’ for all 3 trees (the 2 input and the output) as well as the size of the 3 files.