util#
General producers that might be utilized in various places.
Classes:
|
Functions:
|
Build an array containing only certain fields of an input array arr, preserving behaviors. |
|
Construct a LorentzVectorArray from an input array. |
|
Construct a PtEtaPhiMLorentzVectorArray from an input array. |
|
Construct a PtEtaPhiELorentzVectorArray from an input array. |
|
Return the sum of identically-structured arrays containing Lorentz vectors. |
|
Match entries in the source array src_lv to the closest entry in the destination array dst_lvs using delta-R as a metric. |
|
Like delta_r_match, except source array src_lvs can contain more than one entry per event. |
- class attach_coffea_behavior(*args, requires_func=law.util.no_value, setup_func=law.util.no_value, sandbox=law.util.no_value, call_force=law.util.no_value, max_chunk_size=law.util.no_value, pick_cached_result=law.util.no_value, inst_dict=None, **kwargs)[source]#
Bases:
ProducerAttributes:
Methods:
call_func(events[, collections])Add coffea's NanoEvents behavior to collections.
update_cls_dict(cls_name, cls_dict, get_attr)- call_force = True#
- call_func(events, collections=None, **kwargs)#
Add coffea’s NanoEvents behavior to collections.
This might become relevant in case some of the collections have been invalidated in a potential previous step. All information on source collection names, coffea - Columnar Object Framework For Effective Analysis type names, attributes to check whether the correct behavior is already attached, and fields to potentially skip is taken from
columnar_util.default_coffea_collections.However, this information is updated by collections when it is a dict. In case it is a list, its items are interpreted as names of collections defined as keys in the default collections for which the behavior should be attached.
- data_only = False#
- mc_only = False#
- nominal_only = False#
- shifts_only = None#
- skip_func()#
- static update_cls_dict(cls_name, cls_dict, get_attr)#
- ak_extract_fields(arr, fields, **kwargs)[source]#
Build an array containing only certain fields of an input array arr, preserving behaviors.
- lv_xyzt(arr: ak.Array, *, fields: list[str] = ['x', 'y', 'z', 't'], **kwargs)#
Construct a LorentzVectorArray from an input array.
- lv_mass(arr: ak.Array, *, fields: list[str] = ['pt', 'eta', 'phi', 'mass'], **kwargs)#
Construct a PtEtaPhiMLorentzVectorArray from an input array.
- lv_energy(arr: ak.Array, *, fields: list[str] = ['pt', 'eta', 'phi', 'energy'], **kwargs)#
Construct a PtEtaPhiELorentzVectorArray from an input array.
- lv_sum(lv_arrays)[source]#
Return the sum of identically-structured arrays containing Lorentz vectors.
- delta_r_match(src_lv, dst_lvs, max_dr=None, as_index=False)[source]#
Match entries in the source array src_lv to the closest entry in the destination array dst_lvs using delta-R as a metric.
The array src_lv should contain a single entry per event and dst_lvs should be a list of possible matches.
The parameter max_dr optionally indicates the maximum possible delta-R value for a match (if the best possible match has a higher value, it is not considered a valid match).
Returns a tuple (best_match, dst_lvs_filtered), where best_match is an array containing either the best match in dst_lvs per event (if as_index is false), or the index to be applied to dst_lvs in order to obtain the best match (if as_index is true). The second tuple entry, dst_lvs_filtered, is a view of dst_lvs with the best matches removed, and can be used for subsequent matching.
- delta_r_match_multiple(src_lvs, dst_lvs, max_dr=None, as_index=False)[source]#
Like delta_r_match, except source array src_lvs can contain more than one entry per event. The matching is done sequentially for each entry in src_lvs, with previous matches being filtered from the destination array each time to prevent double counting.