How PyROOT Works
The basics of PyROOT are well explained in this HOW-TO on the ROOT site. You have to make sure that Python can see ROOT:
export PYTHONPATH=$ROOTSYS/lib:$PYTHONPATH
and that ROOT can see Python:
export LD_LIBRARY_PATH=$ROOTSYS/lib:$PYTHONDIR/lib:\
$LD_LIBRARY_PATH
Now you can just use Python import statements to load the appropriate ROOT modules into your Python environment.
For example, (from the above HOWTO):
#!/bin/env python
# import the ROOT modules we will use (must be explicit)
from ROOT import gROOT, TCanvas, TF1
gROOT.Reset()
c1 = TCanvas('c1', 'Example with Formula', 200, 10, 700, 500)
# make a function
func1 = TF1('func1', 'abs(sin(x)/x)', 0, 10)
c1.SetGridx()
c1.SetGridy()
# draw the function
func1.Draw()
c1.Update()
# wait for input before destroying the ROOT window
raw_input("Press Enter To Continue: ")
And that's it. I have some of my scripts collected here in case they are useful to anyone learning PyROOT or Python.
My Scripts
xy_plot.py - plot a simple xy graph from a text file with two columns of data.