PyROOT

As a particle physicist I find the ROOT analysis framework indispensable. I prefer to use the Python interface to ROOT, mostly because I do the majority of my coding in Python these days. The documentation isn't perfect (this applies to all of ROOT, but it's slightly worse when using Python) so here are a few of my thoughts on PyROOT and some examples.

Why use Python with ROOT?

Getting Started with PyROOT

I've written many ROOT scripts in Python at this point. Recently I saw that there was a lot of duplicated code, especially dealing with flat files and plotting graphs. I abstracted the duplicated logic out into a module called 'root.py' (not to be confused of course with module ROOT!).

root.py

I have converted a couple of my older ROOT utilities over to using this module - they are:

xy_plot.py - plots x vs y from a flat file with two columns.

rel_diff.py - plots the relative difference between two data sets as a scatter plot.

My older pyROOT scripts are still available, but the above ones should accomplish the same thing in a much neater way.