-
Hi all, I try to do following selection using Coffea. Photon = [ [ pho1 ], [ pho2, pho3 ], [ ] ] I try following method. pho_ele_pair` = `ak.argcartesian([Photon,Electron])
pho,ele = ak.unzip(pho_ele_pair) pho > [ [0,0], [1,1,2,2], [ ] ] pho.delta_r(ele) > 0.5
The result should be pho_sel_mask = [ [F], [T, F] , [ ] ] but I can't find solution. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The missing ingredient is the 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 |
Beta Was this translation helpful? Give feedback.
The missing ingredient is the
nested
option toak.cartesian
, e.g.Since this is such a common operation, NanoEvents has a shortcut method metric_table, which could be used as:
(the default metric is
delta_r
)