I have a TH2F (like the one on the picture) and I need to fit the elliptical part with an ellipse. I tried to make a contour around it (second plot) using a list of one contour, but for some reason the “CONT LIST” draw option doesn’t work and I cannot retrieve the contour in a graph to fit it (I used “cont3 same” for drawing the contour). When I try the “CONT LIST” I don’t get any errors but the canvas is blank.
Could someone please tell me what would be the easiest way (procedure) to fit the circular part of this TH2F to an ellipse?
The LIST option used with the option CONT build a list of contours. As graphs. To retrieve them you can proceed like in this example: root.cern.ch/doc/master/ContourList_8C.html
If you want to fit an ellipse to a set of data points from a TGraph, see “${ROOTSYS}/tutorials/fit/fitEllipseTGraphRMM.cxx” and “${ROOTSYS}/tutorials/fit/fitEllipseTGraphDLSF.cxx”.
[quote=“couet”][quote]
When I try the “CONT LIST” I don’t get any errors but the canvas is blank.
[/quote]
The LIST option used with the option CONT build a list of contours. As graphs. To retrieve them you can proceed like in this example: root.cern.ch/doc/master/ContourList_8C.html[/quote]
Hi,
thanks, I have seen this example and actually tried to retrieve the TGraphs. My concern is that I cannot even obtain the number of contours (which is 1 in my case), by implementing the piece of code below. I get TotalConts = 0.
Thanks a lot for these! I want to try the one uses the “ROOT::Math::Minimizer” interface, but when I try to execute it (as it is, no modifications) i get an error: Error: Can’t call Minimizer::SetVariableLimits(0,xmin,xmax) in current scope EllipseTGraphRMM.cxx:186:
Possible candidates are…
Error: class,struct,union or type Minimizer not defined EllipseTGraphRMM.cxx:186: