is there a simple way to use the TTree selection mechanism for any set of variables, like:
xClass->SetVariable( a );
xClass->SetVariable( b );
bool xClass->Select( “a>3 && b<5” );
It would be very useful for user defined cuts on variables in my GUI application.
I am not sure what you are requesting. I am not clear whether ‘a’ and ‘b’ are part of the TTree or free variables.
Did you checkTTree::SetAlias?
You can also use function calls TTree->Draw(“myfunc(treevar)”);
the variables are free.
I have an event display and I want to give the user the possibility to show only an event selection. The selection is given in a TGTextEntry and applied to variables, which are not part of a TTree.
This is somewhat confusing me. If you selection criteria does not reference the TTree at all, then it can not be selecting entries.
So I assume that you want to be able to support the user giving you a text string referencing either ‘free variables’ either ‘TTree variables’.
Currently this is not implemented (in a trivial manner). You could emulate it by replace the free variable by function call. I.e.
and load some script which defines
I am unsure about implementing this feature in the general case for free variable. This is because the only thing that is implementable is for the selection criteria to reference variables that are known to CINT.
In particular this means that the code:
tree->Draw("treevar < a");
would work when interpreted (because CINT knows a) but would fail in compiled mode (because CINT would NOT know a).
In addition, everytime I am trying to invision an implementation I get in trouble with ‘scoping’ issues of the variables.