Skip to content

Allow using combinations as ranges if based on a single container

Pieter David requested to merge piedavid/bamboo:combinationranges into master

Closes https://gitlab.cern.ch/cp3-cms/bamboo/-/issues/86 and https://gitlab.cern.ch/cp3-cms/bamboo/-/issues/76

The main limitation is that this reuses the same code that allows selected and sorted collections, so it only works for combinations that are based on the same collection (it should work through selections and sorts, so any N-jet combinations should work if all based on e.g. Jet_*, but not for electron-muon combinations). The reason for that is that the loop is done in C++ on the list of indices, so making it work for arbitrary collections would mean implementing the loop operation in python (the size and types are known), or an additional layer of indirection in C++... possible but quite invasive, so I hope the current solution covers most use cases.

The test case I added is quite basic, so additional testing by someone with a more complicated use case for this would be welcome.

Merge request reports