Wednesday, October 12, 2016

hadd: Adding multiple Root files

If you have multiple .root files containing ntuples and wish to merge them into one file.  The structure of each file should be identical, for instance. For example, you have 3 files: file_0.root, file_1.root, and file_2.root.

 To merge these files, use the hadd command (found in $ROOTSYS/bin):

$ hadd result.root file_0.root file_1.root file_2.root

If you have large number of rootfiles, then can be merged like:

hadd result.root file_{0..2}.root