Fit contour to point cloud

Hi everyone,

i would like to know if there is an easy way in ROOT to fit the contour of a plot like the one attached below. The data points are stored as double vectors.Point_cloud.pdf (36.5 KB)
At the end I would like to save the contour as a .root file. Do you have any suggestions how I can do this?

Thanks in advance!

Christian

May be:

https://root.cern/doc/master/fitCircle_8C.html
https://root.cern/doc/master/fitcont_8C.html

@moneta may have more ideas

Hi couet,

thank you for your reply. I’m not sure if this is what I’m looking for.
What I basically have is a TGraph object with the entries as double vectors:

TGraph* gr = new TGraph(excluded, exMass, exU2);

Is there a way to do a 3d fit or something and extract the contour as a .root file?

Thanks!

Christian

Hi Christian,
do you want the envelope (Einhüllende) of your
data points?
If this is right I 'd make a 2dim hist, draw it
h->Draw(“CONT LIST”);
and get the contour,
make sure max 1 entry in a bin

Otto

https://root.cern/doc/master/classTHistPainter.html#HP16a

Hi Otto and couet,

thank you for your replies. I have been able to get the contour of my point cloud. Do you know if there is a way to transform this contour in a TGraph object?

Thanks again

Christian

HI Christian,
in what form do have the contour?
If you follow Oliviers link:
https://root.cern/doc/master/classTHistPainter.html#HP16a
you should end up with a TGraph

Otto

Hi Otto,

I’ve had it as a TH2F object. After following the lines after //Get Contours in the link I’ve been able to extract the contour as a TGraph object.

Thanks again for your help!

Christian

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