Fitting TF1 to TH2

Hello. I am trying to perform a linear fit on a TH2D but it is not giving me the expected result. I believe this is because it is not considering the weights of each bin. Is there a way to fit a straight line to a TH2 that will make it consider the bin contents? Many thanks.

TH2 provides values as a function of two other variables, while a TF1 provides a value as a function of one variable. You most likely either want to use TF2 or generate a TProfile using TH2::ProfileX.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.