Fitting with roofit

Hello. I want to use roofit like test.

pic1

But my code doesn’t work. This is my code.

RooRealVar x("x", "x", 0, 4500);

RooRealVar a("a", "a", -0.001, -20, 10);

RooExponential f("f", "f", a, x); //exp

RooRealVar a0("a0", "a0", 1);

RooRealVar a1("a1", "a1", 0,-1,1);

RooRealVar a2("a2", "a2", 1, 0, 10);

RooPolynomial ff("f1", "f1", x, RooArgList(a0, a1), 0);

RooAddPdf f3("f3", "f3", RooArgList(f,ff), x);

I checked that only f or ff works. But f+ff doesn’t work.

Thank you for your help.

Regards.

Nea

Hi @Nea ,
welcome to the ROOT forum and sorry for the very late reply!
We need @moneta or @jonas here, let’s ping them.

Cheers,
Enrico

Hi,

The code seems correct but I don’t think you can fit an exponential plus a second order polynomial the data above in the full range. You might need to fit in a restricted range or need to perform separate fits in separate ranges or build a function representing better your model, e.g. using a gamma or a log-normal distribution ?

Cheers

Lorenzo

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