Possible bug in integration of RooBDecay and RooAbsAnaConvPdf


I got an incorrect result when trying to integrate RooBDecay. Consider the following example to reproduce the problem:

#include <iostream>
#include "RooTruthModel.h"
#include "RooConstVar.h"
#include "RooRealVar.h"
#include "RooBDecay.h"

int main(int argc, char **argv)
    RooRealVar dt = RooRealVar("dt", "dt", 0, 10);
    RooBDecay bcpg = RooBDecay("bcpg0", "bcpg0", dt, RooFit::RooConst(1.547), RooFit::RooConst(0), RooFit::RooConst(1), RooFit::RooConst(1), RooFit::RooConst(1.547), RooFit::RooConst(1.547), RooFit::RooConst(0.472), RooTruthModel("tm", "truth model", dt), RooBDecay::DecayType::SingleSided);
    dt.setRange("integral", 2, 2);
    std::cout << bcpg.createIntegral({dt}, {dt}, "integral")->getVal() << std::endl;
    return 0;

The integral interval is [2, 2] but the integration output is 0.775946, which should definitely be 0. This integration result is the same as that of ranges like [0, 2] or [1, 2], which implies that the lower limit of the integral interval is ineffective and somehow hardcoded to be 0.

By debugging the code, I could approximately locate the problem to be at around line 510 or line 513 of ROOT: roofit/roofitcore/src/RooAbsAnaConvPdf.cxx Source File or around line 441 of ROOT: roofit/roofitcore/src/RooTruthModel.cxx Source File, but I am not sure, and I can’t locate it more precisely without much understanding of the details of RooFit’s calculation.

This problem does not exist in other PDFs like RooGaussian and RooExponential.

The ROOT version I am using is 6.28.06, though I think the problem may exist in many previous versions.

Dear @anfeng ,

Thanks for writing on the forum and for the reproducer! I can also see the unexpected value and I will ask @jonas to take a look too.


Thanks for reporting this!

I have fixed it in a PR that will soon be merged to ROOT master:

It will be part of the upcoming patch release 6.30.02 (it comes too late for 6.30.00).

If you want to use it before the patch release, you can also use the ROOT nightlies once the PR is merged:


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