2 A software layer to integrate Jupyter notebooks and ROOT.
5 1. [Install ROOT6](https:
6 2. Install dependencies: pip install jupyter metakernel
8 ## Start using ROOTbooks
9 Set up the ROOT environment (`. $ROOTSYS/bin/thisroot.[c]sh`) and
type in your
14 This will start
a ROOT-flavoured notebook server in your computer.
16 Alternatively,
if you would like to use the Jupyter command directly, you
19 cp -
r $ROOTSYS/etc/notebook/kernels/root ~/.local/share/jupyter/kernels
24 cp -
r $ROOTSYS/etc/notebook/kernels/root /Users/$USER/Library/Jupyter/kernels/
28 Once the server is up, you can use ROOT with two kernels:
30 1. ROOT
C++:
new kernel provided by ROOT
31 2. Python 2: already provided by Jupyter
34 ROOT offers
a C++ kernel that transforms the notebook in
a ROOT prompt.
35 Embedded graphics, syntax highlighting and tab completion are among
36 the features provided by
this kernel.
38 An
example of how you would plot
a histogram in
a C++ ROOTbook is:
41 TH1F h(
"h",
"ROOT Histo;X;Y",64,-4,4);
48 If you prefer to use Python, you can create
a new Python 2 kernel and
49 import the ROOT libraries:
53 And then you could
write something like:
56 h = ROOT.TH1F(
"h",
"ROOT Histo;X;Y",64,-4,4)
58 Additionally, you can mix Python and
C++ in the same notebook
59 by
using the **%%cpp** magic:
double write(int n, const std::string &file_name, const std::string &vector_type, int compress=0)
writing
tomato 1-D histogram with a float per channel (see TH1 documentation)}
virtual void FillRandom(const char *fname, Int_t ntimes=5000)
Fill histogram following distribution in function fname.
virtual void Draw(Option_t *option="")
Draw this histogram with options.