Problem with Minos in python

Hello, I have a model and I want to use Minos only on the parameter p. If I do

model.fitTo(data, ROOT.RooFit.Minos(ROOT.RooArgSet(p)))

it runs minos on all the parameters, while if I do

s = ROOT.RooArgSet(p)
model.fitTo(data, ROOT.RooFit.Minos(p))

it runs Minos only on parameter p, as expected.

Hi,

did you mean:model.fitTo(data, ROOT.RooFit.Minos(s))If so, there is a known problem in several places with RooFit, where const-ness is cast away from temporaries, and then pointers to them taken that are stored. This accidentally works in C++, b/c folks write these on a single line, leaving the temporaries alive till the end of execution. In python, the ref-counting will destroy them too early.

Cheers,
Wim

[quote=“wlav”]Hi,

did you mean:model.fitTo(data, ROOT.RooFit.Minos(s))If so, there is a known problem in several places with RooFit, where const-ness is cast away from temporaries, and then pointers to them taken that are stored. This accidentally works in C++, b/c folks write these on a single line, leaving the temporaries alive till the end of execution. In python, the ref-counting will destroy them too early.

Cheers,
Wim[/quote]

Yes, exactly. I hope this can be fixed. By the way here I see two bugs: if the temporaries are destroied, why RooFit is not complaining?

Hi,

again, as I explained above, the rules for C++ and Python are different. In a line like this:model.fitTo(data, ROOT.RooFit.Minos(ROOT.RooArgSet(p)))in C++, the temporary has a life time of the whole of the statement. In Python, it ends the moment that the call is made, as no reference is taken to the temporary.

I have no idea how to fix this on the python side, w/o going over all RooFit methods, and customizing them individually.

Cheers,
Wim