The code compiles now but I run into this runtime error now. I have libhdf5_cpp.so.6 but not 8 in my /usr/lib64.
[wht34@icarus hdf2root]$ ./hdf2root --ver lux10_20130611T0605_f000001_eb00014.hdf5 lux10_20130611T0605_f000001_eb00014.hdf5.root
./hdf2root: error while loading shared libraries: libhdf5_cpp.so.8: cannot open shared object file: No such file or directory
[wht34@icarus hdf2root]$ ldd hdf2root.e | grep libhdf5_cpp.so.8
libhdf5_cpp.so.8 => not found
If the hdf5 libraries are located at /usr/local/hdf5/lib, the include files should be at /usr/local/hdf5/include.
In the configuration script you should define:
export HDF5CPP= /usr/local/hdf5
export LD_LIBRARY_PATH=$HDF5CPP/lib:$LD_LIBRARY_PATH
By the way, in which system are you trying to build the program?
DYLD_LIBRARY_PATH is used for macos, for linux systems it is LD_LIBRARY_PATH the variable which holds the path to the needed libraries.
Hello,
Thanks to your interest I have updated the code into a more professional fashion.
I have tried it and it works in both linux and mac os platforms.
Give it a try: github.com/delaossa/hdf2root
In the config folder there are various examples of configuration files.
Pick up the most similar to your system and modify it accordingly.
Good luck!
The git version of your code compiles fine but the executable still doesn’t do anything to the hdf5 test file.
It’ll just say converting … , but no root output comes out with hdf2root test.hdf5 test.root.
Here’s the log for the compilation and my env.sh file.
Actually by renaming the extension of my hdf5 to h5 the program does convert the h5 to root. The output created a bunch of broken trees however. Do you know if there’s any specially formatting of the hdf5 file in order to make this conversion to .root?
[wht34@icarus hdf2root-master]$ hdf2root test.h5 test.root
Converting test.h5 …
Error in TBranch::TLeaf: Illegal data type for nb_seqs/nb_seqs/c
Error in TBranch::TLeaf: Illegal data type for nb_chs/nb_chs/c
Error in TBranch::TLeaf: Illegal data type for trig_ch/trig_ch/c
Error in TBranch::TLeaf: Illegal data type for pulse_detect_pretrigger/pulse_detect_pretrigger/c
Error in TBranch::TLeaf: Illegal data type for pulse_end_posttrigger/pulse_end_posttrigger/c
Error in TBranch::TLeaf: Illegal data type for baseline_average_samples/baseline_average_samples/c
Error in TBranch::TLeaf: Illegal data type for sampling_freq_MHz/sampling_freq_MHz/c
Error in TBranch::TLeaf: Illegal data type for delay_buffer/delay_buffer/c
Error in TBranch::TLeaf: Illegal data type for vptg/vptg/c
Error in TBranch::TLeaf: Illegal data type for save_pair/save_pair/c
Error in TBranch::TLeaf: Illegal data type for baseline_freeze_enable/baseline_freeze_enable/c
Error in TBranch::TLeaf: Illegal data type for timestamp_clear/timestamp_clear/c
Error in TBranch::TLeaf: Illegal data type for end_address_threshold/end_address_threshold/c
Error in TBranch::TLeaf: Illegal data type for read_xlm/read_xlm/c
Error in TBranch::TLeaf: Illegal data type for water_thresh/water_thresh/c
Error in TBranch::TLeaf: Illegal data type for max_pulse_length/max_pulse_length/c
Error in TBranch::TLeaf: Illegal data type for write_log_files/write_log_files/c
Error in TBranch::TLeaf: Illegal data type for max_file_time_secs/max_file_time_secs/c
Hello,
Good. That means that the program works to such an extend…
It is true that the program filters the input files to have the .h5 extension. I have just fixed that and now it also accepts .hdf5 extensions. Update it from the git repository to get that version if you want.
Take into account that I made the program for my personal purpose and decided to shared it with others.
Normally, I only have to convert relatively simple hdf5 files and the program does its job.
But it is very likely that your files are more complex and/or they contain some elements that cannot be currently handled by hdf2root.
Would you send me one of your files so I can take a deeper look to it?
Another solution, if you are familiar with C++, is that you implement the missing features that you need and contribute to the hdf2root utility. The Git repository is also meant for that and you can “fork” the project, develop what you want, and eventually merge with the original one if success.
Are you up for this?
Dear delaossa,
thanks to your code I has been able to convert hdf file to root file (I just modified the extension from hdf5 to hdf).
I tried to visualize my root file with TreeViewer but I have some problem. And I would like understand if is just my fault or the output root file have some limit to fix. Probably not.
My hdf file has X value, Y value, Z value (equal to X value), a dataset called DATA that is a matrix 360X1024 and another dadaset with the errors of DATA so another matrix 360X1024.
Using TreeViewer when I put in in x_empty the Y value, in y_empty the X value (for my case the axis are inverse) and in z_empty the DATA. I try to plot I get out just a 2 dimensional graph in 3D plot and I and he is not able to associated the columns whit X-axes and the row with Y-axes, so I don’t have a surfacer as I would like have. It depends because the z_empty want a vector and not a matrix? I put in some information about my root file end I put in also the root file to better understand. What I would like see is a 3D plot with all my data…
[code]echo "root [3] TFile f2(“120195_120199.root”);
root [4] gDirectory->pwd()
120195_120199.root:/
root [5] .ls
TFile** 120195_120199.root Dump of HDF file
TFile* 120195_120199.root Dump of HDF file
KEY: TTree root;1 DataSets in root group
KEY: TTree entry1;1 DataSets in entry1 group
KEY: TTree data1;1 DataSets in data1 group
KEY: TTree root_att;1 Attributes of root group
KEY: TTree entry1_att;1 Attributes of entry1 group
KEY: TTree data1_att;1 Attributes of data1 group
data1->Print()
*Tree :data1 : DataSets in data1 group *
*Entries : 1 : Total = 2978283 bytes File Size = 2976213 *
Hi Alberto,
your code works fine, but looks like it skips datetime objects (such as 18-char-long YYYYMMDDHHMMSS.mmm), since non-supported.
Could this feature be added?
Alex