# Polynomial fit with RooPolynomial and RooGenericPDF

Dear experts,

I am fitting a Missing Mass Square distribution whose background is a polynomial shape. I tried to use RooPolynomial to fit the distribution but it remained unsuccessful. However, when I construct a generic PDF using RooGenericPdf it fits the same distribution well. The relevant part of the code is as follows

RooRealVar a0("a0", "", 3.91127e+01, -325.725, 325.725);
RooRealVar a1("a1", "", -1.18839e+01, -92.7361, 92.7361);
RooRealVar a2("a2", "", -2.04872e+0, -21.8625, 21.8625);
RooRealVar a3("a3", "", 4.10267e-01, -3.39566, 3.39566);
RooRealVar a4("a4", "", 7.36547e-02, -0.0883327, 0.0883327);

RooGenericPdf  gpdf("gpdf","","a0+a1*MMissSq+a2*pow(MMissSq,2)+a3*pow(MMissSq,3)+a4*pow(MMissSq,4)", RooArgList(a0,a1,MMissSq, a2,a3,a4));

This works well. However, if I use

RooPolynomial gpdf("gpdf"," ", MMissSq, RooArgList(a0,a1,a2,a3,a4));

This does not work. I thought both did the same job. Can anyone explain why both work differently?

Welcome to the ROOT Forum!
Maybe @jonas can help

Hi KKR!

The there is a difference. The RooPolynomial is defined with the constant hardcoded to 1. That’s because of the normalization condition, a polynomial with degree n with n+1 coefficient would be degenerate as a pdf.

But you can still define your polynomial with a variable a0 using “lowestOrder” parameter, setting the order of the first coefficient to actually be zero:

RooPolynomial gpdf("gpdf"," ",
MMissSq,
RooArgList(a0,a1,a2,a3,a4),
/*lowestOrder=*/0);

However, I would advise against this because now the minimum is not well defined (all parameters are determined only up to a common scaling constant). Better use this feature of RooPolynomial to start with a1:

RooPolynomial gpdf("gpdf"," ", MMissSq, RooArgList(a1,a2,a3,a4));

Cheers,
Jonas

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