2D fit in non-rectangular region


I didn’t found a solution to my problem, so I am forced to ask you for help.

My problem is the following: I have a 2D histogram and would like to make a 2D gaussian fit. However, histogram is gaussian-like not in a rectangular region, rather triangular, so the area of fit is not described by 4 numbers {{x_min, x_max}, {y_min, y_max}} but by the triangular (x,y) envelope. Is there any way to make the fit in the region described by the polygon on (x,y) plane or just give the number of bins to which the fit should be made? Of course I am able to shrink my triangular region of fit to rectangle, but then I’m loosing the fit precision, what is very important.

Thank you for any help.

Best regards,

I am playing myself with slightly different thing but maybe I do have an idea that might solve Your problem.
The thing is it would only work if Your axes are the same (similar) quantity. Then You might want to change the definition of Your axes so You get the full rectangle - lets say You have the nonempty bins under diagonal, x is observable A, y is observable B, if You now make a histogram where the axes will be x A-B and y is B, it should transfer the triangle to rectangle, right?

I see your point, thank you for your suggestion.

I also found the possible solution to my problem. I thought about writing my own minimization function, which would calculate chi-square using only chosen bins (lying in the area in which I want to do the fit, e.g. triangular), and use it with MINUIT. But first I need to learn how to work this tool.

Best regards,