Get Log(L) from sub region of the fitted range

Dear experts,

I am fitting the di–muon mass range of [12-70] GeV with signal-plus-background hypothesis. My signal region is [25-30] GeV.

I access the value of log(L) at minimum found by the fit using the following lines:

x.setRange("FitRange",12.0,70.0);
RooFitResult* r = model.fitTo(data,Range("FitRange"),Save());
// print Log(L)
cout <<"  log (L) at minimum = " << r->minNll() << endl;

Now, I would like to get Log(L) value in the sidebands [12-25] GeV and
[30-70] GeV only. How can I do it ?

I need it to compare with Log(L) when I do only sideband fit with the only background hypothesis.

Thanks, Sasha.

Hi @anikiten,

That’s easy, fortunately!

After the fit, just create two NLL instances for the subranges and evaluate them, without fitting them.

Like:

// After doing fitTo for the full FitRange:
std::unique_ptr<RooAbsReal> nllLeft{model.createNLL(data, Range("R1"))};
std::unique_ptr<RooAbsReal> nllRight{model.createNLL(data, Range("R2"))};

std::cout << nllLeft->getVal() << std::endl;;
std::cout << nllRight->getVal() << std::endl;

Note that the NLL values of the subranges will not add up to the NLL of the total range, because for each NLL the pdf will be normalized to the given subrange. That’s why you can’t compare them without accounting for the different normalization integrals.

That being said, you can totally compare and NLL object from createNLL(Range("name")) with the NLL at the minimum stored in the fit result, if the fit was done in the same range! Which is I think what you want to do, so that’s good.

Cheers,
Jonas

Thank you, Jonas !

It works and I am happy :slightly_smiling_face:

Cheers, Sasha.

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