Access ntuple variables


I have a ntuple ( with ntuple name vertex), with variables say: x, y and z. From command line I can draw the variable by


Now I want to make another variable by using these variable (x, y, z) like

double cut = x*x + y - z;

To do this I need to access these variables of the ntuple. How can I access these variable quickly from command line without defining branches? Also, I want to draw this new variable and use this as a cut. How can I do this?


To my understanding there are two ways to do that. The first way is to use GetV method. This method returns an pointer to an double array which could be easily used for other purposes. But to use that you first need to use Draw method. Please see the following link The other way is to use SetBranchAddress method, this way you need a loop to collect data from tree’s branches. This is easy to code, but not really very easy to use if you are dedicated to command line.

you can issue commands like

vertex.Draw("x+y","x*x + y - z>0") vertex.Draw("sqrt(x*x+y*y)","x>y")
see Users Guide for a very long list of examples