my problem is: I need to subtract the content of two histograms but at some bins the result of this subtraction is completely wrong and I don’t know why. Here is the part of the code where I do this:
Did you intialise your array sigmaAUX before using it? If not, there could be any value in your array which you then add something to. I took the liberty to simplify your code slightly, this should evaluate to the same as before but without using the potentially uninitialised value.
The diff2 histogram is afterwards a 2D histogram with the same binning as h7. For this to work correctly, h7, and h8 need to be of the same shape (in terms of binning), otherwise it will try to interpolate values.
Yes, I did it in the begining of the code. I used your solution and the result is a little better but still not completely correct. Here is an example of what is going on: 0.000000 - 0.000000 = 14948650853597184.000000