Cut-flow table with python #740
-
Hi experts,
And for now, if we use python with uproot and do all the parallel operation, I only can use mask method to cut each array elements, but I'm not sure how to do this step by step and have the cut-flow results. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
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)
eff_pt_eta = n_large_pt_small_eta / len(events) |
Beta Was this translation helpful? Give feedback.
-
Hi,
but then the way you open the file can be optimized based on the size of your input, and the way you store the counts can also be done a bit more neatly. |
Beta Was this translation helpful? Give feedback.
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
This corresponds to :