TFile and HDF5

Hi Rooters

In this post I am looking for advices, sorry if this is not the right place to do so but I don’t know wich other Forum is best.

I am working on a project where C++, HDF5 and Python are used. Persistency with HDF5 cannot be changed since it involves many differents other related projects. There is no way I can change that, and besides HDF5 is pretty good in our field since we have no need for TTrees-like object.
However I believe we can gain a lot using CINT, as an automatic dictionnary generator (to be used with PyROOT instead of our not-working SWIG) and streamer generators for objects. Right now we have to generate everything by hand, it is very painful, error prone and we don’t have automatic shema evolution. Basically I am trying to get people using ROOT in the project with HDF5 contraints. I have already convinced some people that Root classes through PyROOT can be great for data post-processing and with the help of the PyROOT Forum I was also able to generate Python dictionnaries for our own C++ classes. I still have the persistency problem at hand.

So here are my 2 questions:

  1. Do you think if it is feasible to create a “THDF5File” object in a reasonable amount of time (If I use a trainee working with me for 3 months for instance) and if yes, where should I start? For instance there is a TXMLFile that does what I want but in XML. Is it a good start for me to study TXMLFile source files eventhough TXMLFile doesn’t support directories (and I need them)?

  2. I read on ROOT discussions that HDF5 is used with ROOT in AstroRoot. Those people also have HDF5 constraints. Do you know if they have already some solutions and should I contact them? It is hard to tell from their homepage what is their FITS format.

ROOT could be a BIG help for Persistencey in our project. I have made some research and there is nothing comparable to TFILE when it comes to C++ object persistency, even BOOST::Serialization is far behind.

Thank for your help


I have contacted Reiner Rohlfs who is involved in AstroRoot and asked him to answer your question.


Hi Matthieu,

I want to reply to you 2nd point about AstrROOT. AstroROOT is NOT able to access HDF5 files. I developed AstroROOT but have no idea about the HDF5 standard. The FITS format is a difinition how to store astronomical data as images and tables in binary files with header information. And AstroROOT is able to access data in these files, using a standard library called cftisio.

May be someone else can help you with more information, how to connect ROOT and HDF5.


Hi Reiner

Thansk for your answer: I was confused, I though AstroROOT used HDF5 files. Too Bad for me :frowning:
I will see by myself what I can do, little hope to convince my colleagues to switch file format to ROOT’s own though…