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:
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] .
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?
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.
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.