Hi,
I am trying to get a list with a set of histograms but when I try to append each one I get an error I don’t understand, it seems like the histograms cannot be added to a list? Is there a way I can do it?
This is my code:
histos = []
histo = TH2D("2dhist","Title",nmix,0,1,nmix,0,1)
for iW in range(nmix):
Wbr = iW*Step
for iH in range(nmix):
Hbr = iH*Step
Zbr = 1-(Wbr+Hbr)
nEvents = reweight(Histogram,mass,[Zbr,Wbr,Hbr])
histo.SetBinContent(iW+1,iH+1,nEvents)
histos.append[histo]
And this is the output with the error
Using file: output/VLQAnalysis_BBS_350_AF_ee.root
Using histotram: cut7_decay_flag
<class 'ROOT.TH1D'>
Traceback (most recent call last):
File "sensPlot.py", line 93, in <module>
histos.append[histo]
TypeError: 'builtin_function_or_method' object is unsubscriptable
Using extend instead of append gives me the same result, which is not surprising.
The reweight function just retuns a number based on the content on different bins of the histogram. The code works as expected if I do it for each histogram separately but I need to crate an array of them.
Thanks a lot in advance,
Juanpe.