Static member function within the Draw method of a TTree

Dear Root experts,
I have a simple question: I would like to use a static member function within the Draw method of a TTree:

myTTree->Draw(“myClass::myFunc(var1,var2)”)

Where myFunc is something like:
double myClass::myFunc(double a, double b)
and it is declared static in the myClass.h file

I’m not running interactively ! I’m compiling the code !

How shell I compile the code, or in other words, what shell I to make this work :
myTTree->Draw(“myClass::myFunc(var1,var2)”)

Thanks,

  • Mauro.

I believe you should read “WHY TFormula CANNOT ACCEPT A CLASS MEMBER FUNCTION ?” in http://root.cern.ch/root/html/TFormula.html

If Draw can accept the name of a function, defined in your macro (I do not know, can it?), you can wrap
myclass::member(…) call using this function.

Sure, this looks bizarre.

Hi,

You can call a static member function of a class as long as:[ul]

  1. The function only take and return numerical arguments.
  2. A dictionary for the function has been created, compiled and loaded.
    [/ul]

Cheers,
Philippe.

Hi Philippe,
thanks.

I don’t know what does it mean: "A dictionary for the function has been created, compiled and loaded"
Can you please explain how to do it ?

Many thanks.

  • Mauro.

Hi Mauro,

See the User’s Guide (adding a class) or the FAQ: root.cern.ch/drupal/faq#n676

Cheers,
Philippe.