DeepLearnPhysics / larcv2

MIT License
13 stars 16 forks source link

Alternatives to ROOT #27

Open coreyjadams opened 6 years ago

coreyjadams commented 6 years ago

IMO, ROOT is a dependency that is somewhat of a limitation for larcv2. I think it would be nice to be able to deploy larcv without needing to (potentially) build ROOT on a system, say for example a student's laptop.

There are two places ROOT is used in larcv2, and they are independent I think.

  1. Root is used to generate python bindings for C++ code.
  2. Root is used to produce binary files for data persistence.

I think to address (1) there are several solutions available. The one I thought of first is boost.python, though that is not the only option. Cython also offers intriguing options, and in fact many options exist: https://wiki.python.org/moin/IntegratingPythonWithOtherLanguages.

For (2) I think hdf5 is an obvious choice for a broadly used data format. It also has the advantage of being an industry standard in a lot of ways. I have seen other software using hdf5 format that has larger file sizes compared to ROOT for the same data, though I think PyTables offers a better compression to deal with that: https://www.pytables.org/FAQ.html

In summary, probably the easiest path to replacing ROOT would be a combination of Cython and PyTables.

twongjirad commented 6 years ago

The other important feature root supported was serialization of c++ objects. without it, we would either have had to express all data objects as a compound structure of simple types or implement our own serialization (probably boost). For an image, that might be fine, but with all the meta data coming from the simulation, which comes as nice c++ objects stored in ROOT already, converting that seemed like a pain.

I also have some experience with cython. it's definitely nice -- but at least when i used it in the past, it is kind of pain to keep the cython class definitions up to date with changes to the c++ class. maybe its more automated at this point (or I used cython poorly). but for the lazy, it was attractive to just simply make the ROOT dictionary and get both serialization and python bindings in one shot.