ROOT utilities

rootils provides a more powerful interface to the ROOT libraries. Making easy things easy and hard things possible.

The aim is to provide a collection of useful tools which work well with each other but are easy to integrate with existing code.

So far there are useful things in the following modules:

  • rootils.tree -- dealing with TTrees
  • rootils.histo -- smarter histograms, data-MC comparision, etc
  • rootils.style -- collection of styles that are pretty by default

In the rootils module itself there are some generally useful functions, like save() which will try hard to save what ever kind of object you give to it and come up with a filename for it. In snippets/ there are some examples of how to use things.


This assumes you have python2.6 and ROOT5.24 installed and can use ROOT from python. There are several different methods of installing rootils, we will go through them in increasing order of complexity.

Easiest case, to install rootils run the following command:

$ python setup.py install

This will display a message and install rootils. You may need root privileges to install it. It will also install setuptools if you do not have it already.

If you want to install rootils to your home directory, because you do not have root privileges run the following command:

$ python setup.py install --user

This will fail if you do not have python2.6 yet, in this case some manual labour is required. Run the following command to install rootils:

$ python setup.py install --home=${HOME}

This will create a 'lib' directory in your home directory and install things there. As python does not look in that directory for packages by default you will have to add this directory to your PYTHONPATH by hand:

$ export PYTHONPATH=${HOME}}/lib/python/:${PYTHONPATH}

Start python and type "import rootils" to see if it worked.


The most up to date version of rootils can be found at:


If you want to do development on rootils it is convenient to setup things so that the files in this directory are used directly and not copied. This saves you from having to rerun the 'install' command after every change. To install in development mode run the following command:

$ python setup.py develop --prefix=${HOME}/.local/

This feature relies on PEP 370 which was introduce in python2.6 and so will not work properly if you are using an older version of python. If you have a older version of python you will have to modify your PYTHONPATH variable.

Copyright 2010, 2011 Tim Head <betatim@gmail.com> You may distribute rootils under the conditions of the GPLv2