Skip to content

Cut-flow table with python #740

Discussion options

You must be logged in to vote

Hi @ZhenxuanZhang-Jensen, I'm not familiar with what "cut-flow" means (though I'm sure it's probably standard HEP language), but I think I can understand what you're trying do.

To compute the number o

is_large_pt = events.pt > 20
is_small_eta = events.eta < 2.4

eff_pt = ak.count_nonzero(is_large_pt) / len(events)

is_large_pt_and_small_eta = np.logical_and(
    is_large_pt, is_small_eta
)
eff_pt_eta = ak.count_nonzero(is_large_pt_and_small_eta) / len(events)

This corresponds to :

n_large_pt = 0
n_large_pt_small_eta = 0

for event in events:
    if event.pt > 20:
        n_large_pt += 1
        if event.eta < 2.4:
            n_large_pt_small_eta += 1

eff_pt = n_large_pt / len(events)
ef…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@ZhenxuanZhang-Jensen
Comment options

Answer selected by ZhenxuanZhang-Jensen
Comment options

You must be logged in to vote
1 reply
@ZhenxuanZhang-Jensen
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants