TTree::Draw with cuts on TLeafF objects

Hi ROOT,

I have a TTree with a branch which has multiple elements in it. I would like to use the method,

TTree::Draw(const char* varexp, const TCut& selection, Option_t* option = “”, Long64_t nentries = 1000000000, Long64_t firstentry = 0)

to apply cuts on the individual elements of the branch rather than the whole branch itself.

What I am trying to do…
In my TTree each entry corresponds to an event.
one of the branches corresponds to a container of track pseudorapidities (“track_eta”)
there is a corresponding branch, the value of which is the number of tracks in the event (“n_tracks”)
I want to plot the number of tracks in the event passing some pseudorapidity cut

Naively I was thinking it would be something like
my_ttree.Draw(“n_tracks”, “track_eta < 4.0”)
but since “n_tracks” is already set to a particular value I doesn’t work.

I have written code which loops over all the entries but was hoping there is an alternative way?

Hi,

I suppose you are looking for:my_ttree.Draw("n_tracks", "Sum$(track_eta < 4.0) > 0")however I don’t know what you mean by:[quote]since “n_tracks” is already set to a particular value I doesn’t work[/quote].

Cheers,
Philippe.