Suppose I needed to access the ith element of only a one-dimensional array. For the 10th entry I would do the following:

tree.GetEntry(10)
tree.GetLeaf("TDC1190").GetValue(i)
This only returns zeros, probably because TDC1190 is a two dimensional array. How can I access these elements directly?

yes, a 2D array is simply handed back as a 1D array. The values should be correct, however. You can either calculate the indices, or reshape it using numpy.

(And yes, with a compression factor of 145, I readily suspect it really is full of zeroes. Use tree.Scan() to have the C++ side of things print the values, if you still doubt it.)

Thanks for the reply. I still have one more problem. “evt.TDC1190[1][1]” and “evt.TDC1190[2][1]” are the first and second hits from a detector. With only ‘i’ as my index, how would I know what entry I am reading specifically?

you need to know the dimensions of the 2D array. If this is NxM, then [i][j] is iM+j as indexed in the 1D array. So in your example, NxM = 2x3, and [1][1] (i.e. value ‘5’) is found at 1D location 13+1 = 4, as you’ve shown in the flattened layout.