I am trying to pass STL-based branches to a custom user function in TTree::Draw, and am not sure of the correct method signature for doing this. The setup is basically the following:
TTree “Events”
-> Branch float search_value
-> Branch vector values_to_search
I have a function in MyFile.C
float match_value(float search_value, vector values_to_search)
{
/* Loop over values_to_search, find search_value, do a calculation based on the result index */
}
I would like to do the following
gROOT.LoadMacro(‘MyFile.C’)
Events->Draw(‘match_value(search_value, values_to_search)’, …)
The LoadMacro step compiles fine.
However, I am not sure of the correct method signature for the vector type. Should it be a vector? vector*? The former crashes, the latter gives a “Bad numerical expression” message in TTreeFormula::Compile.
Can anyone tell me the correct way to pass that branch?