chi2FiTo with YVar does not support Range option

Hello ROOT-experts,

I am using ROOT 6.26/10 and I am doing a fit on a x-y dataset with the chi2FitTo function. My code at the moment is practically equivalent to rf609_xychi2fit.py. For my study, I would like to expand it in order to perform fits in sub-ranges.

The issues is that when I pass the option YVar to the fit function, the function cannot accept a Range option, while it accepts it when no YVar is provided.

ERROR:InputArguments -- RooAbsPdf::chi2FitDriver(func) ERROR: unrecognized command: RangeWithName

This is also what it is reported in the documentation (for master) chi2FitTo[1/5] vs chi2FitTo[4/5] and looking directly at the code situation is similar.

Is there any fundamental reason while the various options Range, NumCPU, Optimize cannot be called when YVar is in the list?

Thank you,
Davide

Hi @dpm, welcome to the ROOT forum!

No, there is no fundamental reason for that. I have now implemented support for this, which will soon be available in ROOT master:

So in the next ROOT release, 6.30, this will work.

Until then, you have to create separate sub-RooDataSets for fitting the subranges.

Does that answer your question?

Cheers,
Jonas

Hello @jonas,
thank you very much for the prompt action and fix. Yes this solves my question!
I have a related question concerning subranges though, since looking at the pull request you have fixed RooDataset::reduce() function for XY datasets. I guess that in order to fit in subranges I have to create from scratch a reduced version of the total dataset instead of starting from the total RooDataset and then use the reduce function. Is this correct? (I think I figured out by myself that this is the case but would like to have a confirmation :slight_smile: )

Also I think I have a weird behaviour of residHist plot, not sure if it is related. As soon as I have a MLE confirming this I will open another post

Hi @dpm, you’re welcome!

I guess that in order to fit in subranges I have to create from scratch a reduced version of the total dataset instead of starting from the total RooDataset and then use the reduce function. Is this correct?

Yes, that is correct. You can’t use reduce() in the existing ROOT releases because it “forgets” to copy over the uncertainties. Indeed you need to create the reduced dataset manually.

Also I think I have a weird behaviour of residHist plot, not sure if it is related. As soon as I have a MLE confirming this I will open another post

I don’t know if it is related, but it will certainly be worth its own forum post :+1:

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