Area enclosed by contour?

Hello!

Is there a way to find the area enclosed by a TH2D contour? I fill a TH2D object with 1000 points, and then I find the contour line that encloses 90% of the points. I would like to find the area that my contour line encloses.

May be you can try to retrieve this contour in a TGraph as explained here:
https://root.cern/doc/master/ContourList_8C.html
Then on this TGraph use: https://root.cern/doc/master/classTGraph.html#a06b6dfc69d4fe9336ade71a47864f974

Hello! Thank you so much for your response! I believe that I can successfully determine the area of a contour using this method.

One problem I ran into (for any readers who would like to implement this method): I was trying to draw the contours differently from the tutorial macro. I was trying to draw my contour using the option “CONT3 LIST”, but ROOT did not save the contours as special objects using this option. Only when I drew my contour as “CONT LIST” did ROOT save the contours as special objects I could grab later.

Other than that, I did not run into any problems with this method. Thanks again!

Yes you need CONT LIST as said in the doc:
https://root.cern/doc/master/classTHistPainter.html#HP16a

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