RooFit KeysPdf fails in 6.28, works in 6.26

This is a snippet of code with some IO stripped. RooKeysPdf fails to parameterize the function in 6.28 but the same code works in 6.26. I tried to do a reproducer but for a simple gaussian model both versions behaved ok. Was something changed in the implementation of keyspdf? Or weighted datasets?

import ROOT
ROOT.gROOT.SetBatch(True)


LcDst_M2_Min = 18
LcDst_M2_Max = 26.5

m2_LcDst     = ROOT.RooRealVar("m2_ac","m^{2}(#Lambda_{c}^{+}#bar{D}^{*0})",LcDst_M2_Min, LcDst_M2_Max, unit)
m_LcDst     = ROOT.RooRealVar("m_LcDst","m(#Lambda_{c}^{+}#bar{D}^{*0})",4300, 5150, "MeV")

legwt        = ROOT.RooRealVar("legendre_weight", "legendre_weight", -10, 10)

MCweighted  = ROOT.RooDataSet("MC", "m^{2}(#Lambda_{c}^{+}#bar{D}^{*0})", TTreeMC, ROOT.RooArgSet(m2_LcDst, legwt), "", "legendre_weight")
MCweightedMeV  = ROOT.RooDataSet("MC", "m(#Lambda_{c}^{+}#bar{D}^{*0})", TTreeMC, ROOT.RooArgSet(m_LcDst, legwt), "", "legendre_weight")

KDEmoments = ROOT.RooKeysPdf("KDEmoments","KDEmoments",m2_LcDst,MCweighted,ROOT.RooKeysPdf.MirrorBoth, 0.4)
KDEmomentsMeV = ROOT.RooKeysPdf("KDEmomentsMeV","KDEmomentsMeV",m_LcDst,MCweightedMeV,ROOT.RooKeysPdf.MirrorBoth)

These are the output logs I get. I just see it fails on PDF evaluation, not really clear why. Script is fairly simple. opening a file, creating a weighted dataset, KDE parametrizing it.

log626.txt (747 Bytes)
log628.txt (135.7 KB)

Hi @Mindaugas_Sarpis,

thanks for posting here, it’s very important to get feedback on the new releases!

Yes, there was a change in the implementation for ROOT 6.28:

The results that you got with the RooKeysPdf with weighted datasets in 6.26 and earlier were wrong, because the implementation used the numbers of entries in the dataset in places where the sum of weights should have been.

I would consider therefore both results as suspicious: for 6.26 because the implementation for RooKeysPdf based on weighted datasets was wrong, but also the presumably correct 6.28 implementation because it is not much tested yet and you get the evaluation errors.

The evaluation errors could be harmless, but I can’t say that for sure without seeing your model and datasets. If you want me to look into this, would it be possible to share the dataset and the full script so I can exactly reproduce the log?

Cheers,
Jonas

Hello

one issue that I observed in my analysis but did not have time to report yet is that the new version does not like negative weights, specifically in this line.

The symptoms are the same, the pdf goes to NaN, since that’s what gets in the internal weights and lookup table.

Can the legendre weight be negative?

Cheers,
Enrico

Edit: I see you reached the same conclusion Weighted Datasets for RooKeysPdf including negative weights · Issue #12639 · root-project/root · GitHub

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