[RooFit] How to store fit results only for STATUS=CONVERGED

Hello,

I want to do the toy Monte Carlo study and want to let RooFit only store or draw the fitting results whose fit status is CONVERGED, but it seems I cannot do it. Even after I have removed the option “r”, as it says in:
http://root.cern.ch/root/html/src/RooMCStudy.cxx.html#xa2jt

I still could see some “nan”s if I write the fiting results into a file. And of course, it will not give a reasonable pull.

So how could I let RooFit only store the fit results whose fit status is OK? Abandoning the experiments whose fitting doesn’t coverage will not cause bias, right?

Thank you very much.

I would be interested to know this too. From speaking to others in my group, it seems like RooFitResult::covQual()==3 is a more useful measure of whether a fit has actually converged properly than RooFitResult::status()==0. However, there is no option currently to only write out fits for which this is the case. If anyone knows a simple way to stop fits which have not converged properly from having their results stored, it would be very much appreciated!

Thanks.

Hi,

Although one should in general be very careful doing this, as there is no guarantee that leaving out fits will not cause a bias, I see a strong practical point in being able to do this.

As a first step I’ll add the covQual and status integers to the fitParDataSet() returned by RooMCStudy so you can easily apply cuts yourself. Next I’ll also add an optional cut string to the various plotOn() functions in RooMCStudy so you can specify such selections in the plot. This will be available in the next minor ROOT release (and somewhat earlier in the ROOT SVN roofit/dev branch).

Wouter

[quote=“Wouter Verkerke”]
As a first step I’ll add the covQual and status integers to the fitParDataSet() returned by RooMCStudy so you can easily apply cuts yourself. Next I’ll also add an optional cut string to the various plotOn() functions in RooMCStudy so you can specify such selections in the plot. This will be available in the next minor ROOT release (and somewhat earlier in the ROOT SVN roofit/dev branch).
Wouter[/quote]

Hi, Wouter,

Thank you very much.

Could you please also add the nice options available in RooAbsPdf::paramOn to the RooMCStudy plotOn, e.g., Layout(Double_t xmin, Double_t xmax, Double_t ymax)? You know, sometimes the number go out of the box… Or we already could do it now?

Anyway, now we could write the fitresults out, then fit them by ourself.

Hi,

Yes, that should be easy. RooMCStudy will be undergoing some work in the next weeks in any case, so all of this will be included in the effort.

Wouter

[quote=“Wouter Verkerke”]Hi,

Yes, that should be easy. RooMCStudy will be undergoing some work in the next weeks in any case, so all of this will be included in the effort.

Wouter[/quote]

Hi

I know this is an old topic but it still seems relevant to me.

Has this been implemented now? I assume it has, given the age of the topic, but I cannot seem to find the fit status within the fitParDataSet().

My code is generating and fitting using the RooMCStudy generateAndFit function and within the RooMCStudy, I have defined in the FitOption(Save(kTRUE)), but there does not seem to be any status messages saved in the data set.

I have managed to access the fit status by defining RooFitResult objects but it would be easier if it was contained within the fitParDataSet() as I have that writing directly to a TTree and then making additional fits to the data from there.

Many thanks,

Ian