User defined fitting algorithms with option "U"

Dear experts,

Hope you are doing well!

Recently we have been working on fitting a mass spectrum with is expected to be monotonically falling. The function I chose can be monotonically falling if the parameters are within a certain range but if one of them running out of the range, the function would lose its monotonically falling nature. To ensure the function is doing the right thing (keeps falling across the whole fitting range), what we want to do is to add a penalty term to the FCN when the derivative of the function becomes positive.

I found out that my using option “U”, one can specify the fitting algorithms, but unfortunately I did not find an example to help me get started (like how should the algorithm be defined, is it a function of FCN or something else?). Do you have any suggestions?

Thanks a lot for your kind help!

Best regards,
Sebastian

@moneta is in vacation but I hope he will be reply as soon as he will back…

Hi,

When using the option “U”, you can define your FCN function and passed to the fitter using TVirtualFitter::SetFCN.
An example on how it is used is inside this tutorial
https://root.cern.ch/doc/master/testUnfold7c_8C.html
Just look for the definition of the fcn function and when it is passed to the fitter calling
TVirtualFitter::SetFCN.

This procedure is however not recommended. I would suggest instead to use directly the ROOT::Fit::Fitter class as in this tutorial
https://root.cern.ch/doc/master/line3Dfit_8C.html

Cheers

Lorenzo

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