Home | News | Documentation | Download

Getting pull distribution in RooMCStudy when using separate generator and fit models

similar issue asked here with no reply :
1> Pulls from RooMCStudy with different generating and fitting models
2> RooMCStudy pulls fail using different generate and fit models

I am doing a toy MC study for my fitting pdf.
I am using different generator and fitting pdf.
Both generator and fitting pdf have same shape.
The only parameters different in generator and fit pdf are the yields for signal and background.
For generator pdf it is fixed and for fit pdf it is floated with some random initial value not close to the
expected value to avoid bias.

RooMCStudy *mcstudy = new RooMCStudy(mdzdel1g,RooArgSet(M_dz,deltam),FitModel(mdzdel1f),Extended(),FitOptions(Save(kTRUE),PrintEvalErrors(0)));

But when I try to get the pull for my signal yield using:

RooPlot *frame3 = mcstudy->plotPull(num_sigf,FrameRange(-5.0,5.0));

I get following error:

RooDataSet::fitParData_mdzdel1f_mdzdel1g:fillHistogram: WARNING: data does not contain variable: num_sigfpull
 *** Break *** segmentation violation

Does anyone know how can I get the pull distribution for my fit variable num_sigf ?
Even if can somehow access the value of this variable for every toy fit, then i can simply plot
num_sigf[i]- constant/num_sigferr[i] .

Hi @amroo,

I remember a similar issue. It was caused by the fact that RooFit tries to find the equivalent parameters for generator and fit model to compute the pulls.
If I’m not mistaken, I fixed the crash, and there are some heuristics to connect the relevant parameters. Which ROOT version are you using?

See here:
https://sft.its.cern.ch/jira/browse/ROOT-10242

Also check the comments in this documentation here:
https://root.cern.ch/doc/master/classRooMCStudy.html#a1b704c4ccf1a27f3ab62c8664f7a5874

1 Like

I am using Root version: 6.12/06

While trying to fix the problem If was able to pull up the documentation that you mentioned, but couldn’t figure out after which Root version it was implemented.

I will update my ROOT version to 6.18/02 and report it here if it fixes the problem.

Thanks
@StephanH

Indeed, that documentation is the still unreleased 6.20. The bugfix should also be available in 18/02, though.

After installing Root version 6.18/02.

I have tried to plot the pull, It works perfectly. (as you mentioned in your reply)
Except now I see lots of warning printed out for variable matching and if their pull can be calculated or not.
For example

[#0] WARNING:Generation -- Fit parameter 'sigmar2_sig' does not have an error. A pull distribution cannot be generated. This might be caused by the parameter being constant or because the fits were not run.

[#0] WARNING:Generation -- The fit parameter 'num_sigf' is not in the model that was used to generate toy data. The parameter 'num_sig'=18151 was found at the same position in the generator model. It will be used to compute pulls.
If this is not desired, the parameters of the generator model need to be renamed or reordered.

But that is fine.

One more question:
Is there a way to store the MINUIT fit and error matrix status for every Toy sample ?
Because while making pull distributions, considering the samples for which fit fails doesn’t
make sense as the parameters returned from the fit cannot be trusted if the fit didn’t converge.

Thanks

Hi,

the warnings are expected. Do you consider them too aggressive? The first one could be removed, I guess.

You can indeed store the fit results, but the instructions on how to do that are a bit hidden. The constructor
https://root.cern.ch/doc/master/classRooMCStudy.html#a30126934f36ba75cf35f6aa8b06c60f9
takes a FitOptions argument. If you pass the option Save(), fit results are saved.

With fitResult() they can be retrieved.

Thanks @StephanH

Yes, I also think the first one can be removed
But the second one i don’t mind
Any case both are informative .

Thanks
Aman