Strange behaviour of RooMCStudy

Hi all,

I am trying to use the RooMCStudy for some fit tests I need, and I am having some trouble doing so.

First of all I define some pdf, then I use the generateAndFit method (generating and fitting using the same pdf) and I get perfect pulls. Then I do the same thing, same exact setup, and do:

mcs->generate(200, 0, kFALSE, “./prova_%04d.dat”);
mcs->fit(200, “./prova_%04d.dat”);

in this case I get very strange results! In particular the interest parameter central value and error distributions from the fits are ok, but when I require the pull distribution in this way (which would work with generateAndFit):

RooPlot* frame = mcs->plotPull(*N_sig, RooFit::Bins(50), RooFit::FitGauss(kTRUE)) ;

I just get a lot of Nan and Inf, and a blank canvas.

If instead I use the method this way:

RooPlot* frame3 = mcs->plotPull(*N_sig, -3., 3., 25, kTRUE);

whichever binning/range I use I get a sensible distribution. In this case though the gaussian fit on the pulls doesn’t converge well, and gives me completely crazy results, whereas if I fit with a simple gaussian by hand with root I get a very good fit of the pulls. When the gaussian fit is performed within the RooMCStudy tool, I get these errors adn warnings:

[#0] ERROR:InputArguments – RooAbsPdf::fitTo(pullGauss) ERROR: unrecognized command: mh

[#1] INFO:NumericIntegration – RooRealIntegral::init(pullGauss_Int[mupull]) using numeric integrator RooIntegrator1D to calculate Int(mupull)
[#1] INFO:Minization – RooMinuit::optimizeConst: activating const optimization

** 13 **MIGRAD 1000 1

[#0] WARNING:Minization – RooFitGlue: Minimized function has error status.
Returning maximum FCN so far (-1e+30) to force MIGRAD to back out of this region. Error log follows
Parameter values: pullMean=0, pullSigma=1
RooGenericPdf::pullGauss[ actualVars=(mupull,pullMean,pullSigma) formula=“exp(-0.5*(@0-@1)(@0-@1)/(@2@2))” ]
getLogVal() top-level p.d.f evaluates to zero @ actualVars=(mupull = -inf,pullMean = 0,pullSigma = 1)
getLogVal() top-level p.d.f evaluates to zero @ actualVars=(mupull = -inf,pullMean = 0,pullSigma = 1)

I attach a dummy macro for you to reproduce this.

The important thing for me is to understand if the gaussian fit not working is related to some deeper problems, since I need to use the RooMCStudy in the second kind of way for my studies.

Thanks, cheers,

check_for_biasstudy.C (3.14 KB)