LSF of a TH2F

Hi,
I have a 2dim histogram, which is more or less a gaussian in each slice in either dimension, but with the centers of the gaussians displaced linearly from slice to slice (think of it as a fuzzy line y=p*x + gauss). I want to check that it’s really linear, and I want to extract the “best” value for p.

For TGraph I’d know how to fit this - LeastSquare(Linear)Fit. But for TH2 this doesn’t seem to exist. What’s the easiest way of doing that? Reading the TH2F bin by bin, and adding points to the TGraph according to the bin’s entries?

If this is really the easiest way to do it - would adding an interface to TH2 which returns a TGraph make sense?

Cheers, Axel.

root cvs 2004-01-21, win32gcc

see TH1::FitSlicesX

Rene

Hi,
Wow. That’s such a nice method!!! Thanks for the rather obvious hint; I should have been able to find that myself…
Axel.