Background > Full_Model?


ROOT Version: 6.15.01
Platform: Windows 10
Compiler: Not Provided


Hello,

I am trying to fit a histogram with Roofit with the following PDF:

RooRealVar x("x","mass",20.,500.);

         x.setRange("Range1",80.,110.) ;
         x.setRange("Range2",0.,79.);
         x.setRange("Range3",110.,500.);
         
         
         RooRealVar a1("a1","a1",-50,100);
         RooRealVar a2("a2","a2",-50,400);
         RooRealVar a3("a3","a3",-50,400);
         RooRealVar a4("a4","a4",-500,100);
         RooRealVar a5("a5","a5",-50,100);
         RooRealVar a6("a6","a6",-50,1000);
         RooRealVar a7("a7","a7",-50,1000);
         RooRealVar a8("a8","a8",-50,100);
         RooRealVar a9("a9","a9",-50,100);
         RooRealVar aa("aa","aa",-50,100);

         RooRealVar cmean("cmean","Central value of CB",0.,-3,25);
         RooRealVar csigma("csigma","Width of CB",20,0,50.);
         RooRealVar calpha("calpha","Alpha",7.,0,10);
         RooRealVar cn("cn","Order",6,-10.,20.);
         RooCBShape c_crystalball("c_crystalball", "convolution signal Region: CB", x,cmean,csigma,calpha,cn);

         RooRealVar cmass("cmass","Mass value for BW", 91.1876);
         RooRealVar cwidth("cwidth","Spread of the BW", 0.0848368,0,10);
         RooBreitWigner c_BW("c_BW","convolution signal Region:BW",x,cmass, cwidth );


         RooFFTConvPdf CxB("CxB","CB (X) BW",x,c_crystalball,c_BW) ;
        

         RooRealVar b("b", "Number of background events", 0, 4200);
         RooRealVar s("s", "Number of signal events", 0, 600);

         RooBernstein bg_bern("bg_bern","background",x, RooArgList(a1,a2,a3,a4,a5,a6,a7,a8,a9));
         RooAddPdf fullModel("fullModel", "CxB + bg_bern", RooArgList(CxB, bg_bern), RooArgList(s, b));

         RooFitResult* r = fullModel.fitTo(dh,Save()) ;

However, the background (bg_bern) turns out to be greater than the full model pdf value for some observables. I believe this is because the full model assumes -ve values and is forced to be zero there?

At any rate, any ideas about this one? Since there are a lot of parameters, can someone please help me figure this out?

Capture

Are you saying the black dotted line is background model? Maybe in this case they’re normalized to 1? What if you multiply background by b and full model by (s+b) ?

Hello @RongkunWang,

Yes, the black dotted line is supposed to be my background model.
I checked it after

and you were right, it was a normalisation issue. So I did

fullModel.plotOn(frame2,LineColor(kRed),Normalization(b.getVal()+s.getVal()));
bg_bern.plotOn(frame2,LineColor(kBlack),LineStyle(2),Normalization(b.getVal()));

and that looks much nicer :
Capture

The only problem left is when I do the fitting, root complains that at few observables the pdf becomes negative. How do I prevent that? It seems to me that this is because of some poor parameter initialisation.

The coefficient of Bernstein polynomial can go negative, so it’s possible for your model to become negative. maybe you can try a value larger than -50 for lowerLimit? This might reduce the probability for full model to go to negative.

And do you really need 8-order polynomial? This is an interesting bkg shape you fitted (wavy) , maybe 3-5 would also be enough? Usually if less parameters can do the job, it will be better.

I reduced the number of parameters to 6 and tried a 0 - 400 limit (i.e. all parameters positive)

The fit looks like this :

However, the console log says that the


 MINUIT WARNING IN HESSE
 ============== Second derivative enters zero, param 1
 MINUIT WARNING IN HESSE
 ============== Second derivative zero for parameter1
  MNHESS FAILS AND WILL RETURN DIAGONAL MATRIX. 
 FCN=-7652.37 FROM HESSE     STATUS=FAILED          3 CALLS        1500 TOTAL
                     EDM=6.70818e-05    STRATEGY= 1  ERROR MATRIX UNCERTAINTY 100.0 per cent

Attaching the full output

output.txt (11.7 KB)

Hi,

The Migrad, the minimization converges. The Hesse to calculate error of parameters doesn’t converges… Maybe you can try Minos for the error as it’s more accurate.

And you’re using 5 parameter in RooBerstein, which means it’s an order of 4.

At the low mass end, background is not modelled very well, allowing some of the coefficient to < 0 might be useful. Also the rising edge of signal is not described by the model. Maybe you can tune the bkg model first and see? Also it would be nice if you plot signal model as well.

Could you show me how to call Minos to calculate the error in parameters, in my code? I was of the belief that Hesse and Migrad are default options.

And this is strange, I plotted the fullmodel and the background on top of my original histogram and I get the same issue I had in the beginning, i.e. Background > FullModel. I thought plotting with histogram takes care of the normalisation?

[data points made invisible to make things less cluttered]

check here:

https://root.cern.ch/doc/master/classRooAbsPdf.html#a8f802a3a93467d5b7b089e3ccaec0fa8

I thought plotting with histogram takes care of the normalisation?

The RooFit’s utility normalization, plotOn will not care what’s on the canvas. It’s from ROOT Core’s TH1::Fit

Does this mean that the background and Full model fit still has that issue (ie background > Full model) or is it a normalisation issue?

Hi,

It’s just how RooFit treat function form(only the shape) and the normalization separately, and it’s different to TH1::Fit. If you normalize with correct N and it looks well, the fitting should has no issue.

Cheers,
Rongkun

For example in my case, with 9 parameters, the fit (full model) looked well and migrad had converged. The only issue was the pdf took negative values at some values of x and the background when plotted on top of the Full model appeared to be greater than the full model.

What could be causing that?

Hi,

As I said, your coefficient has negative value, which possibly causes negative pdf. You need to tune them yourself.

background when plotted on top of the Full model appeared to be greater than the full model.

This I already answered you, there’s no problem.

Cheers,
Rongkun

1 Like

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