I'm trying to store histograms in an array full of nested arrays that are created in multiple for a loop.
The error that I am getting is that: 'TH1F
' object has no attribute 'append'
Here's an example of how the code works (a simplified version):
hist = []
for c in range 2:
hist.append([])
for e in range 4:
hist[c].append([])
hist_m = ROOT.TH1F("some name","some name",0,0.0,50.0)
hist[c][e].append(hist_m)
for z in range 8:
hist[c][e].append([])
hist_m = ROOT.TH1F("some name","some name",0,0.0,50.0)
hist[c][e][z].append(hist_m) #crashes here
for pT in range 32:
hist[c][e][z].append([])
hist_m = ROOT.TH1F("some name","some name",0,0.0,50.0)
hist[c][e][z][pT].append(hist_m)
I'm trying to store all of these different histograms inside of this large array so that I can use them later in the code by simply using the index. But I am getting the error
'TH1F' object has no attribute 'append'
which I don't know how to fix. Any solutions?
The code crashes on this line:
hist[c][e][z].append( hist )
Thanks in advance!