# Bug with RooExtendPdf produces inconsistency in rf204b\_extendedLikelihood\_rangedFit.C between before 6.26 and after 6.28

**URL:** <https://root-forum.cern.ch/t/bug-with-rooextendpdf-produces-inconsistency-in-rf204b-extendedlikelihood-rangedfit-c-between-before-6-26-and-after-6-28/64962>\
**Category:** Roofit and RooStats\
**Created:** [July 29, 2026, 2:22pm UTC](https://root-forum.cern.ch/t/bug-with-rooextendpdf-produces-inconsistency-in-rf204b-extendedlikelihood-rangedfit-c-between-before-6-26-and-after-6-28/64962 "2026-07-29T14:22:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![atsushi](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/ed655f/32.png) [@atsushi](https://root-forum.cern.ch/u/atsushi)\
**Post date:** [July 29, 2026, 2:22pm UTC](https://root-forum.cern.ch/t/bug-with-rooextendpdf-produces-inconsistency-in-rf204b-extendedlikelihood-rangedfit-c-between-before-6-26-and-after-6-28/64962/1 "2026-07-29T14:22:05Z")

</div>

Dear experts,

I am reporting a bug in RooExtendPdf, which can be seen in [rf204b\_extendedLikelihood\_rangedFit.C](https://root.cern/doc/master/rf204b __extendedLikelihood__ rangedFit_8C.html) of the tutorial. In the recent versions, the fit using RooExtendPdf class has wrong best-fit values of N=4494 (and \alpha is biased as well) while the fit using the composite of signal and background PDFs implemented by RooAddPdf correctly fits the distribution with N=9990.

Looking back into the past versions, this issue appears since version 6.28.

Best regards,  
Atsushi

---

<div class="post-metadata">

**Author:** ![siliataider](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/siliataider/32/35694_2.png) [@siliataider](https://root-forum.cern.ch/u/siliataider)\
**Post date:** [July 29, 2026, 2:54pm UTC](https://root-forum.cern.ch/t/bug-with-rooextendpdf-produces-inconsistency-in-rf204b-extendedlikelihood-rangedfit-c-between-before-6-26-and-after-6-28/64962/2 "2026-07-29T14:54:47Z")

</div>

Hi @atsushi , thanks for your report.

The best place to report bugs is actually the GitHub issues tracker: [Issues · root-project/root · GitHub](https://github.com/root-project/root/issues)

Maybe it’s best if your move your bug report there?

Thanks!

Silia

---

<div class="post-metadata">

**Author:** ![atsushi](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/ed655f/32.png) [@atsushi](https://root-forum.cern.ch/u/atsushi)\
**Post date:** [July 29, 2026, 3:16pm UTC](https://root-forum.cern.ch/t/bug-with-rooextendpdf-produces-inconsistency-in-rf204b-extendedlikelihood-rangedfit-c-between-before-6-26-and-after-6-28/64962/4 "2026-07-29T15:16:51Z")

</div>

Done. Thank you.

---

<div class="post-metadata">

**Author:** ![jonas](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jonas/32/24756_2.png) [@jonas](https://root-forum.cern.ch/u/jonas)\
**Post date:** [August 6, 2026, 6:55am UTC](https://root-forum.cern.ch/t/bug-with-rooextendpdf-produces-inconsistency-in-rf204b-extendedlikelihood-rangedfit-c-between-before-6-26-and-after-6-28/64962/5 "2026-08-06T06:55:10Z")

</div>

For future reference, this was fixed in the following PR:

> <https://github.com/root-project/root/pull/22989>
>
> RooExtendPdf is self-normalized, so it delegates both the shape normalization an…d the extended-term fraction to the wrapped pdf. In a fit over a sub-range, the fit machinery sets the normalization range only on the outer RooExtendPdf; it was never propagated to the wrapped pdf. As a result the wrapped pdf stayed normalized over the full range, which collapsed the fitted yield N to the number of events in the fit range (instead of reinterpreting it to the range requested in the constructor) and biased the shape parameters.
> 
> This regressed with the multi-range fit rework in https://github.com/root-project/root/commit fa10523706087d2d46214dcafa2bec3ca2eac789 (v6.28), and is visible in the rf204b\_extendedLikelihood\_rangedFit tutorial, where the RooExtendPdf fit disagreed with the equivalent RooAddPdf fit.
> 
> Propagate the normalization range to the wrapped pdf during graph compilation, mirroring what RooAddPdf does for its components. This is gated on likelihood mode: for a binned chi2 the per-bin predictions must stay normalized over the full range so that the chi2 remains additive across sub-ranges.
> 
> Closes https://github.com/root-project/root/issues/22959.
> 
> 🤖 Done with the help of AI.
> 
> A second commit fixes up minor issues with the comments in the related tutorial.
> 
> Note that this doesn't fix the old \`"legacy"\` NLL evaluation backend, but this is on its way out anyway.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [August 20, 2026, 6:55am UTC](https://root-forum.cern.ch/t/bug-with-rooextendpdf-produces-inconsistency-in-rf204b-extendedlikelihood-rangedfit-c-between-before-6-26-and-after-6-28/64962/6 "2026-08-20T06:55:35Z")

</div>

Closed on August 20, 2026, 6:55am UTC

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