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!


May be:

@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?



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


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


HI Christian,
in what form do have the contour?
If you follow Oliviers link:
you should end up with a TGraph


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!


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