Index of a variable in a TNtuple

ROOT Version: 6.28
Platform: Windows 11
Compiler: Cling, Visual C++

How do I find the index of a variable by name so I can find it in an fArgs array?

Maybe this example can help ?

Seems to be just drawing. I want to extract values by names and then use them in furture calculations.

I’ve alread cobbled together my own way of doing it, rather than have to hardwire in the numbers.
You think there be a function to return the value given the name as Draw has to do that anyway, but I haven’t found one.
What I do is parse the string with the variable list to recover thier index. It is awkward, but works.

It also retrieves the Ntuple variables in vectors.

Yes, I know how to do that with GetArgs. You still have to put in the index by hand to fetch the one you want.

I have some vague recollection of using TBranch for this purpose (fetching value by name), but don’t remember what it was. I suppose I could try to find the source code for Draw which must do it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.