Displaying specific parameters with RooFit


I’m starting to use PyRoot very recently and I’m very impressed.

When I fit and display the result of my fit, RooAbsPdf::paramOn works slightly different. Being more specific,

RooAbsPdf::paramOn(frame, RooFit.Parameters (RooArgSet (…)))

doesn’t work. Without RooFit.Parameters(), it works and shows all free parameters correctly, but I want to display only few of them.

Is this a simple bug, or is there any other way to do this?


not a RooFit expert here, but first question would be: what does “doesn’t work” mean?

Usually, problems with RooCmdArg, RooArgSet etc. is RooFit playing footloose with temporaries and from the looks of it, this is one of those cases: the const& going in ultimately gets cast to a non-cost ref and finally non-const pointer.

Such coding is “okay” in C++ under the assumption that the result of RooFit::Parameters is never stored, but only passed directly to a function. In python, however, the garbage collector tends to kick in earlier.

So, does the “doesn’t work” go away if you do something like:argset = RooArgSet(...) RooAbsPdf::paramOn(frame, RooFit.Parameters (argset))
If not, please define “doesn’t work.” :slight_smile:


1 Like


Thanks for your reply and I’m sorry for my ambiguous question.

What I meant “doesn’t work” is that the parameters what I specified in RooFit.Parameters () are not shown in the figure.

And as you advised,

args = RooArgSet (parameters...) RooAbsPdf::paramOn (frame, RooFit.Parameters (args))

is perfectly working and now I fully understand why problems like this happen. Thank you very much! :smiley: