Hi,
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.