-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[RF] Batchmode ignores depsAreCond in Conditional when creating a RooProdPdf #11332
Copy link
Copy link
Closed
Closed
Copy link
Description
- Checked for duplicates
Describe the bug
RooProdPdf can accept the parameter Conditional, which tells RooFit what observables this pdf needs to be normalized on.
This parameter has two forms:
- pdf, normalization observables, depsAreCond = false (default)
- pdf, conditional observables, depsAreCond = true
The two forms are supposed to be identical if {conditional observables} = {all observables} - {normalization observables}.
This is true when not using BatchMode.
With BatchMode on (cpu) instead what happens is that depsAreCond is always considered false and the pdf behaves as if conditional observables were normalization
Expected behavior
No difference between the two forms of the RooProdPdf, even when using BatchMode
To Reproduce
void test_batchmodecond() {
using namespace RooFit;
RooRealVar x("x", "", 0, 1);
RooRealVar xErr("xErr", "", 0.0001, 0.1);
RooGaussModel gm("gm", "", x, RooConst(0), xErr);
RooRealVar tau("tau", "", 0.4, 0, 1);
RooDecay decayPdf("decayPdf", "", x, tau, gm, RooDecay::SingleSided);
RooGamma errPdf("errPdf", "", xErr, RooConst(4), RooConst(0.005), RooConst(0));
RooProdPdf pdf1("pdf1", "", RooArgSet(errPdf), Conditional(decayPdf, x, false)); // what we want: decayPdf(x|xErr)*errPdf(xErr)
RooProdPdf pdf2("pdf2", "", RooArgSet(errPdf), Conditional(decayPdf, xErr, true)); // in theory the same as pdf1
RooProdPdf pdf3("pdf3", "", RooArgSet(errPdf), Conditional(decayPdf, xErr, false)); // wrong, normalizes decay in xErr and not in x
auto data = pdf1.generate(RooArgSet(x, xErr), NumEvents(10000));
// works with BatchMode = "cpu", because depsAreCond is false
pdf1.fitTo(*data
, Save(true)
, BatchMode("cpu")
, PrintLevel(-1)
)->Print("V");
// bad fit, actually normalizes as if decayPdf was normalized in xErr (ignores depsAreCond)
tau.setVal(0.4);
pdf2.fitTo(*data
, Save(true)
, BatchMode("cpu")
, PrintLevel(-1)
)->Print("V");
// works without batchmode
tau.setVal(0.4);
pdf2.fitTo(*data
, Save(true)
//, BatchMode("cpu")
, PrintLevel(-1)
)->Print("V");
// same as pdf2 with BatchMode
tau.setVal(0.4);
pdf3.fitTo(*data
, Save(true)
, BatchMode("cpu")
, PrintLevel(-1)
)->Print("V");
}Setup
ROOT master, from LCG dev3
ROOT 6.26.07 from LCG dev4
works in ROOT 6.24.06 from LCG 101
Additional context
Reactions are currently unavailable