TTree::Draw() magic available?

Hello,

I was wondering if there is any way to solve the following problem with TTree:Draw() et al:

Suppose I have a tree with branches njet and jetpt:

t->Branch("njet", &njet, "njet/i"); t->Branch("jetpt", jetpt, "jetpt[njet]/F");

Is there any way to get to the jet multiplicity njet for a given cut on jetpt, say the number of jets per event with jetpt>10, using TTree::Draw()?

Thanks,
Philipp

Hi Philipp,

I think:tree->Draw("njet","njet>10");would do it.

Cheers,
Philippe.

Hi Philippe,

I haven’t tried it, but since none of the expressions reference jetpt at all, yet I want to count the jets per event which pass a certain jetpt threshold, I don’t believe it would work this way? Wouldn’t your expression yield the jet multiplicity for events with more than 10 jets?

Cheers,
Philipp

Hi Philipp,

Indeed, for ‘the number of jets per event with jetpt>10’, I think you need: tree->Draw("Sum$(jetpt>10)").

Cheers,
Philippe.

That does the trick!! I knew TTree::Draw() would come through again … :wink:

Thanks,
Philipp