[RF] Fix ranged integrals with factorized variables
The `RooRealIntegral` class is smart enough to figure out which variables the function the integrated function doesn't depend on and trivially integrates them itself by multiplying with the variable definition range. However, if the integration range is a subrange of the variable range, this was not considered. This resulted in wrong results. for integrals like `pdf.createIntegral(x, "subrange")`, where the pdf doesn't depend on x. These kind of integrals can occur in the projections that the RooAddPdf does, so it's important that they work, and fixing this partially addresses #11486. This change also fixes a so-far unknown bug in the `RooXYChi2Var`, which also used these kind of integrals. Without this fix, the `Integrate()` feature for `chi2FitTo()` was completely broken, which can be seen in the output of the `rf609` tutorial with any previous ROOT version. The tutorial looks okay by chance, because the function is dominted by the quadratic term in `x` that is constant in the fit. But if one makes this a floating parameter, the problem gets obvious. Probably that was the reason why the main model parameter was set constant to begin with, to sweep the bug under the rug. Now, the tutorials are updated to have the quadratic coefficient floating too. And also `stressRooFit`, since the reference file has to be updated anyway. To demonstrate that things work correctly now, a new unit test was implemented that does the closure check of the `integrate()` feature of the `RooXYChi2Var` with a linear fit function.
Showing
- roofit/roofitcore/inc/RooRealIntegral.h 1 addition, 1 deletionroofit/roofitcore/inc/RooRealIntegral.h
- roofit/roofitcore/src/RooRealIntegral.cxx 1 addition, 1 deletionroofit/roofitcore/src/RooRealIntegral.cxx
- roofit/roofitcore/test/testTestStatistics.cxx 60 additions, 0 deletionsroofit/roofitcore/test/testTestStatistics.cxx
- test/stressRooFit_ref.root 0 additions, 0 deletionstest/stressRooFit_ref.root
- test/stressRooFit_tests.h 4 additions, 3 deletionstest/stressRooFit_tests.h
- tutorials/roofit/rf609_xychi2fit.C 6 additions, 3 deletionstutorials/roofit/rf609_xychi2fit.C
- tutorials/roofit/rf609_xychi2fit.py 6 additions, 3 deletionstutorials/roofit/rf609_xychi2fit.py
Loading
Please register or sign in to comment