Ruby-root: pass function pointer

Dear experts,

I am trying to pass to TF1 a function pointer defined in ruby, with the following ruby script, but not yet succeeded.

require 'libRuby'

def func_ruby(x, par)
  return par[0] + par[1] * x[0]
end

myFunc = TF1.new('myFunc', :func_ruby, 0, 1, 2)

I am not even sure this functionality (passing ruby function pointer to ROOT methods) is available in Ruby-root. In the Ruby-root’s authors document, ftp://root.cern.ch/root/RubyRoot.pdf at Appendix B.10, he says ‘this functionality would be implemented in the official ruby-root binding in the near future’.

Does anyone know how to do this, or if this functionality is available or not?

Thank you in advance.
Takeshi

Hello!

I am sorry, but I haven’t implemented this functionality in Ruby ROOT and I think it’s hard to implement it. I wonder how pyROOT is dealing with this issue…

Regards,
Elias