Skip to content

rng_count not working as expected with CombinationProxy objects

When I try to use the rng_count method defined in treefunctions.py on objects returned by the combine method, I found an unexpected error:

 File "/path/to/my/bamboovenv/lib/python3.7/site-packages/bamboo/treeoperations.py", line 1078, in fromRngFun
    accuExpr = adaptArg(accuFun(prevRes.result, rng._getItem(idx.result)))
AttributeError: 'CombinationProxy' object has no attribute '_getItem'

Here is a pseudocode version of what I expected to work was defining a set of objects:

jet_pairs = combine( jet_collection, N=2)
special_pair = rng_max_element_by( jet_pairs, lambda pair : jet_pair_specialness(pair[0], pair[1]) )

and then use the rng_count method, for example as an expression when plotting , with an expression such as:

expr = rng_count(special_pair, lambda jet : is_super_extra_special(jet) )

but this gives the above error. The same occurs if the rng_count function is called with no lambda specified. It would be nice to be able to do these kinds of operations.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information