# # use a class instanciating a TF1 object # import ROOT # class definition class polyFunc: def __call__(self,arr, par): return par[0] + par[1] * arr[0] + par[2] * arr[0] * arr[0] # Instanciate object myPol = polyFunc() # Instanciate TF1 object, need to set the number of parameter f = ROOT.TF1('pyfunc', myPol, -5., 5.,3) # Now set the function parameters f.SetParameters(5., 2., 0.5) # plot the function c = ROOT.TCanvas() f.Draw()