How can the list of values passing a TCut be accessed?

I can project a variable to a histogram on the basis of a TCut string using a command such as the following

where “histogram” is the title of an existing (empty) histogram, variable is a string of a variable’s name and selection is a string of another variable’s name (a variable that exists if the current event has passed a particular selection).

How could I get a very simple list of all of the values of the variable that are to be added to the histogram? This is of general use to me, but the immediate motivation is to be able to pass the list of values to a function that returns a histogram binning recommendation.

Search for “TEventList” and/or “TEntryList” and/or “TEntryListArray” in the TTree::Draw method description.

Great, thank you very much for your assistance with this.

Taking the TEventList approach, what I’ve done is the following:

How could I approach this object now in order to access all of the values for, say, el_pt it contains? Would I, say, loop over all of its entries and append the el_pt values for each entry to a Python list?

Taking the TEntryList approach, what I’ve done is the following:

However, it appears I’m using the arguments incorrectly here. Would you happen to know what arguments would be appropriate here? The variable and selection variables are as follows:

variable = "el_pt" selection = "e_MET_jets"

The idea is that the flag variable called e_MET_jets gets created if an event passes a particular cut. How could I get a tree to draw a variable to an EntryList on the basis of there being the variable e_MET_jets in existence it its events?