Skip to content

Applying dR cut #497

Answered by nsmith-
ico1036 asked this question in Q&A
Apr 12, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

The missing ingredient is the nested option to ak.cartesian, e.g.

pair = ak.cartesian({"pho": events.Photon, "ele": events.Electron}, nested=True)
pho_sel_mask = ak.all(pair.pho.delta_r(pair.ele) > 0.5, axis=-1)

Since this is such a common operation, NanoEvents has a shortcut method metric_table, which could be used as:

pho_sel_mask = ak.all(events.Photon.metric_table(events.Electron) > 0.5, axis=-1)

(the default metric is delta_r)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ico1036
Comment options

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