THnSparse Bin Access in PyRoot

Ho do you Set/Get bins on THnSparse objects in PyRoot?

I try:

hist.SetBinContent(array('l',binIndices), val)

And I get:

Thanks!

Edit: I’m using ROOT 5.26/00e (part of ATLAS Athena release 16.6.2)

Hi,

see the signature of the function: it expects an int* but your handing it a long*. Simply change the ‘l’ to ‘i’ and it should work as expected.

Cheers,
Wim