Hi,
I have some code which makes a simple TF1 object in pyroot and am trying to extrapolate it to a TF2 object but coming across a few issues. I think it is a fairly simple problem… The code hopefully explains itself,
print '1D function'
def myFunc(x):
return x[0]
fa1 = TF1('fa1', myFunc, 0., 10.)
print fa1.Eval(5.)
print '\n2D function'
def myFunc2D(x, y):
return x[0] * y[0]
fa2 = TF2('fa2', myFunc2D, 0., 10., 0., 10.)
print fa2.Eval(5., 5.)
output
1D function
5.0
2D function
TypeError: myFunc2D() takes exactly 2 arguments (1 given)
Traceback (most recent call last):
File "test.py", line 36, in <module>
print fa3.Eval(5., 5.)
Exception: TFN python function call failed (C++ exception)
any ideas?
thanks
David