/NNLOops

Nasty Nested LOops

The UnlicenseUnlicense

Nasty Nested LOops

A zoo of typical operations on collections in HEP analyses.
HEP analysts often need to express operations of the form:

for e in events:
  for p in particles:
    do_stuff()

in which case particles would be a "nested collection".

The zoo is meant to be small but representative of what's out there in the wild, both in terms of requirements/usecases. For each problem we also present a non-exhaustive set of solutions. Typical approaches to express nasty nested loops are

  • work with collections imperatively
  • transparently aggregating SoA's in AoS's (as xAODs do, so you have to deal with Electrons rather than several different arrays each carrying one electron property) and work on these imperatively
  • using smart array/tensor/dataframe object (ROOT's RVec, numpy-like associative arrays like awkward-array, pandas-like dataframes like xframe)
  • introducing a domain specific language as in TTree::Draw or LINQtoROOT

The zoo can be found here.
Pull requests and issues are welcome.