Correct way to write a function that return an n-dimensional array of TH1 objects