I want to integrate a function F(x,y,z) using the TF3::Integral method. I read (x,y,z,F) from an ascii and I don’t want to use global variables, so I’d like to do the following:
[ul]
[li] read (x,y,z,F) and store them in a class CData.[/li]
[li] define a function iFunc with access to CData private members.[/li]
[li] use iFunc to construct a TF3:
is there a way to do this?
Thanks in advance
Pablo
edit: I’ve tried to define iFunc as a CData friend function and as a CData member functions without success
I am surprised this works for you, because it shouldn’t. The correct way to make a TFx object using a member function of a class and without using a global object, is to do as explained in
The example is for a TF1, but it works also for a TF3. One needs to add in the constructor the range values for the y and z axis, i.e. using the constructor defined at line 53 of TF1.h: root.cern.ch/root/htmldoc/src/TF3.h.html#53
If I understand it correctly, static members of classes are instanced on the first instance of the class, and they are the same for all the instances off the class.
For sure I’m using classes with members defined as static!