The example function given here: http://wlav.web.cern.ch/wlav/pyroot/recipes.html#rcp-tpyfunction
unfortunately doesn’t work for me; it crashes python. The method using classes does work.
I’m using ROOT 5.10/00 and python 2.4.3 but I’ve tried it on a few systems and they all crash.
Here’s the code again:
[code]from ROOT import TF1, TCanvas
def identity( x ):
create an identity function
f = TF1( ‘pyf1’, identity, -1., 1. )
plot the function
c = TCanvas()