i am having problems with undefined symbols in the selection string of a TTree::Draw command. i have a TTree which contains entries of class (myClass) which has a variable array member and length(myClass->i[arrayLength], myClass->arrayLength).
the following commands draw correctly:
myTree->Draw(“i”,“i>0”,"");
myTree->Draw(“i”,“abs(i)>0”,"");
myTree->Draw(“i”,“multiplet->myfunc(1)>0”,"");
but the following returns an error:
myTree->Draw(“i”,“multiplet->myfunc(i)>0”,"");
Error: Symbol i is not defined in current scope FILE:(tmpfile) LINE:1
as well as this:
myTree->Draw(“i”,“multiplet->myfunc(i[0])>0”,"");
Error: Symbol i[0] is not defined in current scope FILE:(tmpfile) LINE:1
or even:
myTree->Draw(“i”,“i[0]>0 && multiplet->myfunc(i[0])>0”,"");
Error: Symbol i[0] is not defined in current scope FILE:(tmpfile) LINE:1
why is root incapable of recognizing the variable within the class function call? it works for math calls such as abs() or sqrt().
Currently TTree::Draw can call member functions only when fixed arguments. This is because we have not (yet?) understood the semantic of doing such (in term of the impiied loops). I.e. for myTree->Draw("i","multiplet->myfunc(i)>0",""); Do we mean for (k=0;k<n;k++) multiplet[k]->myfunc(i[k])>0orfor (k=0;k<n;k++) for (j=0;j<n;j++) multiplet[k]->myfunc(i[j])>0
is it possible to use a non-member function to do the same? I tried wrapping the member function in a simple macro, but the function is not recognized:
*ERROR 30 :
Bad numerical expression : "myFuncTestMacro(...)"
(Int_t)(-1)
I cannot make a simple tree entry based cut, since i need to select only certain elements within the myClass->i[] array.
The only other way I can think to do this is to manually modify and write each entry into a new tree, but this is very cumbersome in this situation.