RooSimultaneous and RooFFTConvPdf

Dear all,

I am trying to combine RooSimultaneous that is created from RooFFTConvPdf product with an efficiency function:

    t = RooRealVar("t", "t", -10., 30.)
    tau = RooRealVar("tau", "tau", 1.54, 0.1, 5.)
    tau2 = RooRealVar("tau2", "tau2", 0.9, 0.1, 3.)

    mean = RooRealVar("mean", "mean", 0)
    sigma = RooRealVar("sigma", "sigma", 0.5)
    
    gaussian_resol = RooGaussian("gauss", "gauss", t, mean, sigma)
    

    datahist = gaussian_resol.generateBinned(t, 100000)
    acceptance = RooFormulaVar("spline", "spline", "0.3+0.02*t", RooArgList(t))
    resol = RooHistPdf("res", "res", t, datahist)
    
    true = RooTruthModel("true", "true", t)
    model1 =  RooDecay("model1", "model1", t, tau, true, RooDecay.SingleSided)
    model2 = RooDecay("model2", "model2", t, tau2, true, RooDecay.SingleSided)
    cat = RooCategory("cat", "cat")
    cat.defineType("long")
    cat.defineType("short")


    model = RooSimultaneous("model", "model", cat)
    model.addPdf(model1, "long")
    model.addPdf(model2, "short")
    
    model1conv = RooFFTConvPdf("model1Conv", "model1Conv", t, model1, resol)
    model1Eff = RooEffProd("model1Eff", "model1Eff", model1conv, acceptance)
    model2conv = RooFFTConvPdf("model2Conv", "model2Conv", t, model2, resol)
    model2Eff = RooEffProd("model2Eff", "model2Eff", model2conv, acceptance)
 

    modelconv = RooFFTConvPdf("modelConv", "modelConv", t, model, resol)
    modelEff = RooEffProd("modelEff", "modelEff", modelconv, acceptance)
       
    frame1 = t.frame()
    data1 = model1Eff.generate(RooArgSet(t), 10000)
    data2 = model2Eff.generate(RooArgSet(t), 20000)
  
    data = RooDataSet("data", "data", RooArgSet(t), RooFit.Index(cat), RooFit.Import("long" , data1), RooFit.Import("short", data2))

    modelEff.fitTo(data)
    data.plotOn(frame1)
    modelEff.plotOn(frame1)

And I get the following error:

[#0] FATAL:InputArguments -- RooAbsCategoryLValue::setBin(cat) ERROR: ranges not implemented for setting bins in categories.
Traceback (most recent call last):
  File "/project/bfys/valukash/BsJpsiphi/p2vv/scripts/run2/fit/test_numtr2.py", line 65, in <module>
    fit()
  File "/project/bfys/valukash/BsJpsiphi/p2vv/scripts/run2/fit/test_numtr2.py", line 51, in fit
    modelEff.fitTo(data)
TypeError: none of the 2 overloaded methods succeeded. Full details:
  RooFitResult* RooAbsPdf::fitTo(RooAbsData& data, const RooLinkedList& cmdList) =>
    TypeError: takes at least 2 arguments (1 given)
  RooFitResult* RooAbsPdf::fitTo(RooAbsData& data, const RooCmdArg& arg1 = RooCmdArg::none(), const RooCmdArg& arg2 = RooCmdArg::none(), const RooCmdArg& arg3 = RooCmdArg::none(), const RooCmdArg& arg4 = RooCmdArg::none(), const RooCmdArg& arg5 = RooCmdArg::none(), const RooCmdArg& arg6 = RooCmdArg::none(), const RooCmdArg& arg7 = RooCmdArg::none(), const RooCmdArg& arg8 = RooCmdArg::none()) =>
    logic_error: Ranges not implemented for setting bins in categories.

I am not entirely sure what am I configuring wrong. Does anyone have a clue?

Thank you in advance.

ROOT version: 6.24/06
test_numtr2.py (2.4 KB)
log_new.txt (2.6 KB)

1 Like

Hi, thanks a lot for providing the reproducer!

I have provided a fix that will be integrated in the next patch releases, ROOT 6.26.12 and 6.28.02:

Note that using a RooSimultaneous as anything other than the top-level pdf is rarely used and therefore there might be more problems later on.

It would be better - also as a workaround for current ROOT - to create some RooFFTConvPdf and RooEffProds for each channel and then put them in the RooSimultaneous.

Cheers,
Jonas

Thanks @jonas! Do you know when will the 6.26.12 be released?

I don’t know, I invite @axel who probably has a better plan.

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