Possible bug with RooFit in 6.18 & 6.18/02 using PyRoot

I’m having some issues with my PyROOT based RooFit code in 6.18, and was not seeing this in 6.16 so I’m wondering if it could be a bug related to some of the changes.

The problem comes up in fitTo and plotOn commands where I’m passing multiple optional arguments in. The strange thing is that this bug seems to be operating inconsistently (some plotOn and fitTo commands work fine, while others do not), which is puzzling me, but my code was working before I updated. One of the problematic lines is:

res=model.fitTo(sourceDataSet,ROOT.RooFit.Extended(1),ROOT.RooFit.Range("fitRange"),ROOT.RooFit.SumCoefRange("fitRange"),ROOT.RooFit.NumCPU(numCPUForFits),ROOT.RooFit.Verbose(0),ROOT.RooFit.PrintLevel(-1),ROOT.RooFit.Save(True))

The python code I’m running segfaults, and at the bottom the following message is shown:

Traceback (most recent call last):
  File "fitSim_floatAmplitude_fixedBinning.py", line 464, in <module>
    ROOT.RooFit.Save(True)
TypeError: none of the 2 overloaded methods succeeded. Full details:
  RooFitResult* RooAbsPdf::fitTo(RooAbsData& data, const RooCmdArg& arg1 = RooCmdArg::none(), const RooCmdArg& arg2 = RooCmdArg::none(), const RooCmdArg& arg3 = RooCmdArg::none(), const RooCmdArg& arg4 = RooCmdArg::none(), const RooCmdArg& arg5 = RooCmdArg::none(), const RooCmdArg& arg6 = RooCmdArg::none(), const RooCmdArg& arg7 = RooCmdArg::none(), const RooCmdArg& arg8 = RooCmdArg::none()) =>
    problem in C++; program state has been reset
  RooFitResult* RooAbsPdf::fitTo(RooAbsData& data, const RooLinkedList& cmdList) =>
    takes at most 2 arguments (8 given)

Deleting the last argument (ROOT.RooFit.Save(True)) does not fix the problem, with the error then occurring on the previous argument.

I know there were some changes with how RooArgSet and RooArgList worked behind the scenes, no longer relying on RooLinkedList. I’m not sure if that could somehow be related to the issues I’m seeing or whether it’s something else. But the same code works fine in 6.16. Any suggestions? Thank you!

I think @moneta and @etejedor can help you.

@StephanH could you comment on this?

Hi @shedges,

you are right that some things changed, but the error message you get from PyROOT can also be misleading. It appears also when there is a real crash after calling the method. Can you give me a bit more code to test?

I just wrote down a mock model, but that doesn’t crash:

import ROOT

x = ROOT.RooRealVar("x", "x", 1, -10, 10)
mean = ROOT.RooRealVar("mean", "mean", 1, -10, 10)
sig = ROOT.RooRealVar("sig", "sig", 1, -10, 10)
model = ROOT.RooGaussian("gaus", "gaus", x, mean, sig)
data = model.generate(ROOT.RooArgSet(x), 1000)

res=model.fitTo(data,
        ROOT.RooFit.Extended(1),
        ROOT.RooFit.Range("fitRange"),
        ROOT.RooFit.SumCoefRange("fitRange"),
        ROOT.RooFit.NumCPU(4),
        ROOT.RooFit.Verbose(0),
        ROOT.RooFit.PrintLevel(-1),
        ROOT.RooFit.Save(True))

print res

Hi Stephan,

Thanks for the response! I wasn’t sure the best way to upload code and test data, so I uploaded it to google drive: https://drive.google.com/file/d/1XZKZdYjJSPVhOmZgn2t4qv-wpuSj4Vee/view?usp=sharing

No problems with running the above code in 6.16/00, but I do have problems in 6.18/00 and 6.18/02.

I think you’re right about the error message probably being misleading. I have virtually identical code that uses RooKeysPdfs instead RooHistPdfs, which runs fine in 6.16/00 and 6.18/02, and uses the same plotOn and fitTo commands. I can post that too if it would be helpful.

Hello @shedges,

it’s indeed a bug in the new release of RooFit. A fix will come very soon, but you might have to work with the nightlies (https://root.cern/nightlies) until we release 6.18.04.

You can track it here:
https://sft.its.cern.ch/jira/browse/ROOT-10297

Hi @StephanH,

Thank you for looking into this!

Just to let you know:
The fix is already in the nightlies, you can use them since Friday. ROOT 6.18.04 is probably only a few weeks away.

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