RooProjW with extended pdfs

Dear experts I am trying to plot the projection of an extended B and BBar datasets onto the deltat distribution, the projections work fine for individual pdfs but not for the extended pdf

    frame = var.frame()

    print("Plotting B0 tagged dataset...")
    datasets[0].plotOn(frame, R.RooFit.Binning(nbins), R.RooFit.MarkerColor(R.kRed), R.RooFit.Name("data B0 tag"))
    pdfs[0].plotOn(frame, R.RooFit.ProjWData(R.RooArgSet(*cond_vars), datasets[0]), R.RooFit.LineColor(R.kRed), R.RooFit.Name("pdf B0 tag"))

    print("Plotting B0bar tagged dataset...")
    datasets[1].plotOn(frame, R.RooFit.Binning(nbins), R.RooFit.MarkerColor(R.kBlue), R.RooFit.Name("data B0bar tag"))
    pdfs[1].plotOn(frame, R.RooFit.ProjWData(R.RooArgSet(*cond_vars), datasets[1]), R.RooFit.LineColor(R.kBlue), R.RooFit.Name("pdf B0bar tag"))

this is ran as

    fu.plot_sc(
        pdfs=[ws.pdf("pdf_full_td_btag"), ws.pdf("pdf_full_td_bartag")],
        datasets=[data_set_td_btag, data_set_td_bartag],
        var=ws.var("deltat"),
        cond_vars=[ws.var("deltaterr"), ws.var("mod_mbc"), ws.var("deltae"), ws.var('r'), ws.var("csobdtprime")],
        nbins=30,
        plotpath=f"{plot_dir}/sc.png",

    )
pdf_full_td_btag/bartag = nsig*sig_pdf_{btag/bartag} + n_bbar*bbbar_pdf + ncont*cont_pdf

I am getting the following image as the result

Hello @Vikas_Raj,
I think @jonas will be able to help you with this.

Hello,
I sort of found out the cause here, but I am still unsure about how to solve this.

If I try plotting only the signal pdf, with RooProjW, it comes out fine as expected, however if I change

pdfs[1].plotOn(frame, R.RooFit.ProjectionRange("subrange"), R.RooFit.ProjWData(R.RooArgSet(cond_vars), datasets[1]), R.RooFit.LineColor(R.kBlue), R.RooFit.Name("pdf B0bar tag"))

to just

pdfs[1].plotOn(frame)`

I get the same result, no pdf!!

In other words, the option R.RooFit.ProjWData(R.RooArgSet(cond_vars), datasets[1]), straight up does not work for fully extended pdfs.

I even tried using unextended pdf as a plotting device, and it still gives the same result. Is this some sort of bug, The root version I am using is 6.30/02 @jonas ?

Hi, I have a small update on this. So even though the fit has converged, and everything s fine. When I plot the individual datasets and pdfs, they seem fine. It is only for the combined thing that is having some issue.

So it is not an issue with RooProjW not working with extended pdfs.



?