Using TTDraw::Draw to count events cutting on event arrays

Hi,
I’ve got an ntuple that contains muon and jet information. I’d like to
know the number of events that pass a muon pt & fit cut and also have at
least two jets. I can write a script, but I was trying to see if I could do it
from the TTree::Draw command line. For example, I can do the following:

CollectionTree->Draw(“Length$(sqrt(jet_Px2+jet_Py2)>15)”) and
that will give me a histogram of the number of jets that pass that cut in
each event.

So I tried something like the following:

CollectionTree->Draw("(Length$(sqrt(jet_Px2+jet_Py2)>15)>=2)*(Length$(sqrt(muon_Px2+muon_Py2)>4)>0)")

but that didn’t seem to give me a sensible answer. Is this possible or do I
have to resort to a small function file? Or is there a totally different
approach I should be using?

Many thanks!
Cheers,
Gordon.

Hi Gordon,

Length$ give you the total number of elements on which the expression must be evaluated!

would be closer.

See also: root.cern.ch/root/html/TTree.htm … GetEntries:

Cheers,
Philippe.