Python-based EDM analysis » History » Version 9

« Previous - Version 9/22 (diff) - Next » - Current version
Gleb Lukicov, 10/27/2019 05:58 PM

Python-based EDM analysis

Python is awesome! You can start using it for your analysis in two ways: 1) writing Python-based ROOT macros (pyROOT), or interact with ROOT files directly in a JupyerLab environment (JupyROOT) 2) Convert ROOT file into Numpy/HDF/etc. format and fit using Python tools directly (e.g. scipy-optimize).


To install JupyterLab on your laptop follow the instructions here:
Make sure to go via the pip installation route (not anaconda!).

Many tutorials to get started with Jupyter are also available (e.g.

Finally, test that you can import ROOT into your JupyteLab notebook (e.g.
If you have ROOT installed via homebrew, you might need to import the path to ROOT explicitly i.e. (in the very first cell)

import sys
# add brew ROOT (Mac) to the system path
import ROOT as r

Alternatively, add "export JUPYROOT=/usr/local/Cellar/root/6.18.04/lib/root" to your .bash_profile and
import sys
# add brew ROOT (Mac) to the system path
import ROOT as r

Then you only need to change the path to ROOT in a single place, if you decide to update ROOT on your laptop.


To get started you need to set-up the official blinding tools on your laptop here:
Then go to the bottom of that page, and follow "Using the code in Python3". There are already examples provided for a 5 parameter fit by Kim!

Here is one for the tracker fit for an EDM-based analysis

That's it! The rest is the same as using a ROOT C macro, but being in a Jupyer environment one can execute things interactively and use native Python plotting tools.

ROOT-independent analysis
*This section will be updated with more details soon *