Calling protected FitResult::SetModelFunction(...)

Hi

I’m using class ROOT::Fit::Fitter for fitting. I would like to call two following protected member functions (class FitResult) from python:

protected: ROOT::Fit::FitResult::IModelFunction* ModelFunction() void SetModelFunction(ROOT::Fit::FitResult::IModelFunction* func)

If I do something like:

[code]

dir(ROOT.Fit.FitResult)

’_FitResult__ModelFunction’,
’_FitResult__SetModelFunction’,

fitter.Result()._FitResult__ModelFunction()
<ROOT.ROOT::Math::IParametricFunctionMultiDim object at 0x(nil)>

fitter.Result()._FitResult__SetModelFunction(modelfun)
fitter.Result()._FitResult__ModelFunction()
<ROOT.ROOT::Math::IParametricFunctionMultiDim object at 0x(nil)>[/code]

then it looks like calling _FitResult__ModelFunction() works but _FitResult__SetModelFunction(modelfun) does nothing, i.e no setting of “modelfun” which isn’t for sure null pointer. Maybe the problem is that fitter.Result() returns constant reference to FitResult. It confuse me that _FitResult__SetModelFunction(modelfun) does nothing and gives no errors/warnings.

Is it expeted behaviour? Is there any chance to get it working, i.e to set a model function?

I expect a fundamental problem but I may send full (not) working example if needed… :slight_smile:

Thank you in advance,
Jiri

Jiri,

neither can work: since they are protected, the dictionary stub functions are no-ops, so nothing that can be done really on the PyROOT side.

The difference in result is just the return type: ModelFunction() returns a pointer, so that’s what you get (a typed NULL-pointer), whereas SetModelFunction() returns void.

Cheers,
Wim

Hi Wim,

I expected something like that but I was not 100% sure :slight_smile: . Many thanks for your explenation.

Cheers,
Jiri