# Root and Roofit Chebyshev parameter comparison

Dear all Roofit experts,

Right now I am using the Roofit Chebyshev fitting function to fit the SideBand region to estimate the background in Signal Region. And to obtain the best fitting performance I am considering using the Chebyshev fitting in Root to have a rough view of the proper parameter values. But it seems the parameter values in Root and in Roofit are not that consistent.

The parameters given by Root are
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 5.28613e+03 1.81819e+02 8.81551e-03 -2.21654e-10
2 p1 -1.00650e+02 3.99181e+00 8.92255e-05 -2.13190e-08
3 p2 2.43159e-01 1.08098e-02 4.43067e-07 1.16268e-05

But the parameters given by RooFit are:
NO. NAME VALUE ERROR NEGATIVE POSITIVE
1 b0 -1.02501e+00 6.77973e-02 -6.53512e-02 6.43098e-02
2 b1 4.28238e-01 2.80908e-02 -2.80506e-02 2.79006e-02
3 b2 -9.99989e-02 2.46081e-02 at limit 1.71735e-02

The values are hugely different for the same Chebychev 3rd. Is there connection between the parameters in Roofit and Root? Or anyone know how to transfer the parameter values obtained from Root to the parameters in RooFit?

Many thanks!
Hai

The two plots are attached:

Hi,

The definition of the polynomial should be the same. The only difference is that in RooFit they are defined in the internal [-1,1].
I think it is always better to rescale the input x values to the [-1,1] interval, which is the natural range for the Chebyshev polynomial.
So If you apply this transformation you should get the same parameters.

``````// assuming xmin=0 and xmax = 110.
TF1 f("f","-1+2*(x- 0.)/(110.- 0.)",0.,110.);
TF1 fitFunction("fitFunc","cheb2( f(x) )", 0., 110. );
``````

A possible remaining difference is when fitting in RooFit the function are normalised in the given range.

Lorenzo

Dear Lorenzo,

Many thanks! And sorry for the late reply.

When I used the way you suggested above, it complains that:

input_line_290:1:121: error: expected ‘;’ after return statement
_ …TFormula____id17666861598529691319(Double_t x,Double_t p){ return ROOT::Math::Chebyshev2(x,p,p,p)x),) ; }_
_ ^_
_ ;_
_Error in TFormula::Eval: Can’t find TFormula____id17666861598529691319 function prototype with arguments Double_t
,Double_t
_

Do you know why? It seem that we can not give a function of x to the “cheb2( f(x) )” directly.

Hai

Dear Lorenzo,

We got around it by declaring a new function:

Double_t fitfunc1(Double_t *x, Double_t par){
Double_t xx = -1+2
(x- 70.)/(110.- 70.);
Double_t fitval = ROOT::Math::Chebyshev2(xx, par, par, par);
return fitval;
}

But we found another issue: the definition of chebychev function in Root and RooFit are different. In Root the first parameter of chebychev is the constant, p0*1, while in RooFit is only 1 itself. And when I tried to use the fitFunction->FixParameter(0,1) to fix the first parameter to be 1 as in RooFit, then the fitting of Root is divergent and much worse.

Kind regards,
Hai

Ho

This is expected because the Roofit function is normalized.

A Root fit is equivalent to an extended one in Roofit and you need to add an extra parameter to create the RooExtendPdf

Lorenzo

-------- Messaggio originale --------

Thanks! We will have a try.

Best,
Hai

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