Convert .root file into .h5 file format

Dear all,

I need to convert root trees into HDF5 file format. Preferably in CERN lxplus machine. Does anyone know how to do that? Thank you in advance!

I’ve tried the instructions written here root2hdf5 — rootpy 1.0.0.dev0 documentation on my lxplus machine, but it didn’t work.


FYI rootpy and root2hdf5 are not distributed by ROOT. Maybe @etejedor knows more about this

alternatively, there’s that: (untested)

I appreciate your help!

I’ve solved this problem.


could you describe your solution?

(that could be useful for other users of the forum)

Yeah, sure

It turned out simple. At least for my NTuples. I write a python script where it reads the branches from the root tree and writes them into the NumPy array. Then I created the hdf file and wrote these NumPy arrays to the hdf file.

It worked for me. In case that if someone is particularly interested, I can distribute my code.


FYI, I have a rather simple root2numpy convertion program that could have also worked for the first part: