kratsg / optimization

Code for optimizing simple n-tuples
http://giordonstark.com/
MIT License
7 stars 9 forks source link

Allow counting of branches that pass a certain cut #29

Closed AvivCukierman closed 9 years ago

AvivCukierman commented 9 years ago

Given a list of branches (e.g. m_jet_largeR_0, m_jet_largeR_1, etc.), and a cut (e.g. ">200", or a window cut if that gets supported), create a value that counts the number of those branches that passed that cut. Then, allow us to cut on that value.

Perhaps in supercuts allow a flag called "derived" where you specify: list of branches initial cut (start,step,stop) (e.g. [200;100;500]) [or the initial cut could be fixed] final cut (start,step,stop) (e.g. [0;1;4])

Note that if TA only stores the top 4 large R jets, e.g., as it currently does, then the final cut could only go from 0 to 4. But I think that would be fine (e.g. top tagging is usually 0-1).

AvivCukierman commented 9 years ago

This is a long term issue I think. Don't know how to apply labels.

Edit: prefer it to be a short term issue.

mswiatlo commented 9 years ago

I agree we should have this, and hopefully sooner rather than later.

mswiatlo commented 9 years ago

Noting down for posterity:

If we use TTree, it's pretty easy to do something like:

(m_jet_largeR_0 > X) + (m_jet_largeR_1 > X) + (m_jet_largeR_2 > X) > Y as a specifiable user-cut-string, and then X and Y are entries in the supercuts to iterate over.

So for numpy mode, we can add a pre-processing step to numpy, if the user-cut-string is specified we iterate over the user-cut-string and its supercuts, creating a series of sub-ttrees the sub-ttrees are fed into numpy normally