PyROOT issues with TH2D::FitSlicesX and ROOSTATS::LikelihoodIntervalPlot::Draw()

Dear all,

I encountered a rather peculiar behaviour in a Python I am currently writing and in which I use PyROOT. I first fit a TH2D using FitSlicesX. Later in my program I use Roostats to compute and draw a LikelihoodIntervalPlot. These two actions are executed within a for loop running of several files. At the first iteration everything is fine. However, at the second iteration the code crashes with the following Traceback Error :

***** Break *** segmentation violation**
SystemError Traceback (most recent call last)
/Users/mougeot_maxime/ownCloud/Documents/Argon/analysis/ in ()
34 tobj = ROOT.TObjArray()
35 f1 = ROOT.TF1(‘f1’,‘gaus(0)’,roilow,roimax)
—> 36 th2.FitSlicesX(f1,0,-1,0,‘QNR’,tobj)
37 data = ROOT.RooDataHist(“data”,“data”,
38 ROOT.RooArgList(t),\

SystemError: problem in C++; program state has been reset

I tracked the problem down as being due to the call of the Draw() function on my LikelihoodIntervalPlot object. When I comment out the call to draw the code terminates fine . My original code is rather long but I put together a small code which seems to show the same behaviour. I put the latter in attachment.

I would greatly appreciate some insights from more experienced people concerning this issue.

Thank you all in advance. (2.3 KB)
test_data.txt (69.9 KB)

I suspect a mismatch in Python vs C++ - but I’ve asked @etejedor and @mato for help; maybe they have an idea? If I were you I’d call f1.Dump() and th2.Dump() before the failing line, to make sure they are what you expect them to be.

It does not seem a PyROOT issue, the attached C++ reproducer also segfaults with the same error. Looks like a double delete inside the TMinuitMinimizer destructor. Attaching also the error thrown by @smaxwell’s code and by the C++ reproducer.

test.C (1.8 KB)

python_err.txt (34.4 KB)

cpp_err.txt (20.3 KB)

Thanks for taking the time to investigate this issue.

Does it mean it is a ROOT issue or is there just something fishy in the way I built the code ?

I could try to compute the profile likelihood using RooFit instead of RooStats and see what happens.



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