Dear Root Experts,

I have the following problem

**Context Description:**

I am trying to obtain contour lines from a TH2F. The TH2F is the result of a fit so it display as z-axis the value of -2DeltaLL and on the x-y axis a coefficient in the fit.

The fit may result in multiple minima or in doughnut-like shapes.

My objective is to find all the closed curves for a given -2DeltaLL = A (where A = [2.30, 5.99] respectively for 68% and 95%)

**Problem:**

It seems that ROOT is unable find the second line for a given level and only returns the first one he finds.

What am i missing or is it the inner ROOT behaviour incapable of solving this problem?

**Minimum working example (pyROOT):**

```
import ROOT
import numpy
f = ROOT.TFile("higgsCombineTest.MultiDimFit.mH125.root")
t = f.Get("limit")
#TTree Draw limiting the Zaxis to a reasonable range
to_draw = ROOT.TString("{}:{}:2*deltaNLL".format("k_cHl1", "k_cHq3"))
n = t.Draw( to_draw.Data() , "deltaNLL<{} && deltaNLL>{}".format(10,-30), "l")
#Building the 2D graph from which we retrieve underlying 2D histo
x = np.ndarray((n), 'd', t.GetV1())
y = np.ndarray((n), 'd', t.GetV2())
z_ = np.ndarray((n), 'd', t.GetV3())
z = np.array([i-min(z_) for i in z_]) #shifting likelihood to 0 minimum
graphScan = ROOT.TGraph2D(n,x,y,z)
# fill empty bins with a high value otherwise contours
# are tricked by empty bins
for i in range(graphScan.GetHistogram().GetSize()):
if (graphScan.GetHistogram().GetBinContent(i+1) == 0):
graphScan.GetHistogram().SetBinContent(i+1, 100)
# Setting Z limits to reasonable amount
graphScan.GetZaxis().SetRangeUser(0, 10)
graphScan.GetHistogram().GetZaxis().SetRangeUser(0, 10)
#retrieve 2Dhisto and Contours
hist = graphScan.GetHistogram().Clone("arb_hist")
hist.SetContour(2, np.array([2.30, 5.99]))
hist.Draw("CONT Z LIST")
ROOT.gPad.Update()
conts = ROOT.gROOT.GetListOfSpecials().FindObject("contours")
cont_graphs = [conts.At(i).First() for i in range(len(conts))]
#Drawing
cs = ROOT.TCanvas("c", "c", 900, 800)
graphScan.GetHistogram().Draw("colz")
cs.Modified()
cs.Update()
for item in cont_graphs:
item.SetLineColor(ROOT.kRed)
item.SetLineWidth(1)
item.Draw("L same")
cs.Draw()
```

The results is the following:

I also tried to increase the number of levels

```
hist.SetContour(4, np.array([2.30, 5.99])
hist.SetContour(4, np.array([2.30,2.30, 5.99,5.99])
```

with same result.

I also attach the root file if someone is interested in reproducing the issue.

Thank you for your help.

Best,

Giacomo

higgsCombineTest.MultiDimFit.mH125.root (77.1 KB)

*ROOT Version:* 6.25

*Platform:* MacOS Big Sur

*Compiler:* Not Provided