Hi all.

Maybe this has been asked before, not sure.
I have a TH1F that i do copy using the python copy library (I do copy.deepcopy(hist) essentially) and then I do a devide of this copied histogram (which I call “hratio”) by another histogram. It is supposed to be my ratio plot that I put in a pad below the main pad where I plot one TH1F on top of the other (basically data vs. monte carlo). My code is a bit huge, so it does many different things, also setting the maximum of the main histogram BEFORE I do the copy. Hence, I wanted to reset the maximum in the ratio histogram, otherwise it will extend the y-axis till 300000-ish values, which doesn’t make any sense as the ratio should have values ~1.

Anyway, I have a problem with this. I do, for example,

to read the bin content in the first bin, but I get an error:

I have no idea what this means, I tried google-ing but that didn’t clarify it to me. Why does ROOT say it is of type MethodProxy while it clearly is a TH1F, judging from the following output (and from the fact that it can be drawn, but with wrong axis ranges):

print "hratio is " + str(hratio) hratio is <ROOT.TH1F object ("bcsv15br:=nosel:=caloMET0") at 0x2de4bc0>

Thank you very much for your help!


the MethodProxy is the bound method just before calling, i.e. this: “hratio.GetBinContent”. And to get that particular error, you’d have to be doing something like this: “hratio.GetBinContent[1]” (note the square brackets). I know that is not what you posted in the snippet, but it is the way to get that error.

If that’s not it, then I do have to have a reproducer to say anything sensible. I have, however, zero time to work on PyROOT, so if you do have a small, standalone reproducer and believe that it is a PyROOT problem rather than a coding error, file a bug report on to keep track of this issue.