Dear Rooters,
I would like to draw a function of a variable defined in a tree.
I see here [1] that it should be possible.
The following code [2] is a dummy example.
If I do it in an interactive way it works, but if I try to compile it it fails (in execution time):
Error in <TTreeFormula::Compile>: Bad numerical expression : "func(a)"
I read chapter 15 of ROOT manual, and followed “Adding a Class with a Shared Library”,
but maybe I missed something because I still get
Error in TTreeFormula::Compile: Bad numerical expression
Could you link me to some tutorial/example about this topic?
[quote]tree->Draw(“a.processValue(variable_in_tree)”)[/quote]This would work if ‘a’ was the name of a branch.
[quote]tree->Draw(“myClass::processValue(variable_in_tree)”)[/quote]would work if processValue was a static function. If neither of those 2 options is true, then this wont work directly. Instead you will need to either use the TTree::Draw syntax that take a script as input or use directly TTree::MakeProxy or TTree::MakeSelector.
This may seem stupid but: how do you do that for this simple example ? I have the same problem, but I do not understand which part of the documentation I should be looking at for this (apparently working) solution ?
See the ROOT FAQ on how to generate a dictionary: root.cern.ch/drupal/faq#n676
If you are still stuck after using this information (and re-reading the User’s Guide chapter on adding your own class), please send us what you try and how it failed.