# Splot with fixed yield

**URL:** <https://root-forum.cern.ch/t/splot-with-fixed-yield/64728>\
**Category:** Roofit and RooStats\
**Created:** [March 2, 2026, 3:17pm UTC](https://root-forum.cern.ch/t/splot-with-fixed-yield/64728 "2026-03-02T15:17:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pierabattista](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pierabattista/32/39766_2.png) [@pierabattista](https://root-forum.cern.ch/u/pierabattista)\
**Post date:** [March 2, 2026, 3:17pm UTC](https://root-forum.cern.ch/t/splot-with-fixed-yield/64728/1 "2026-03-02T15:17:44Z")

</div>

Dear experts, I have a question about the `Splot` function of ROOT with fixed yields.  
In my analysis, I am performing a simultaneous fit between two categories, which we can call category `A` and category `B`. Category `A` is what I am interested in splotting as my signal lies in that phase space.  
In category `B` I have the following yields:

- pk signal: floating

- combinatorial background: floating

In category `A` I have the following yields:

- signal yield: floating

- combinatorial background yield: floating

- misid 1 background yield: fixed to `pk signal` from category `B` \* constant number (this yield is basically the main reason why I am simultaneously fitting)

- misid 2 (B0) background yield: gaussian constrained

The way I have been splotting is the following:

```auto
#first I fit my simultaneous pdf to my combined cat A and cat B data
fit_results = simPdf.fitTo(comb_data, R.RooFit.Save(True))

# I build my floating yields
nsig = R.RooRealVar("nsig", "nsig", fit_result.floatParsFinal().find("N_{sig}").getVal(), 0, fit_result.floatParsFinal().find("N_{sig}").getVal()*10)
ncomb = R.RooRealVar("ncomb", "ncomb", fit_result.floatParsFinal().find("N_{comb,1}").getVal(), 0, fit_result.floatParsFinal().find("N_{comb,1}").getVal()*10)

#Then i build yields that are fixed but still RooRealVars
scale_pK = ws_rare.var("scale_pK")
nmisid1 = R.RooRealVar("nmisid1", "nmisid1", scale_pK.getVal() * fit_result.floatParsFinal().find("N_{misid,2}").getVal())
n_b0 = R.RooRealVar("n_b0", "n_b0", ws_rare.function("N_{B0}").getVal())

#Then i build my pdf from category A (dropping the simultaneity then as I am "fixing" the yield that depends on category B)
pdf = R.RooAddPdf("pdf", "pdf", R.RooArgList(pdf_ppi.getComponents().find("DSCBsignalfixed_gaussiansignalfixed"), pdf_ppi.getComponents().find("exponentialcomb_fit1"), pdf_ppi.getComponents().find("misid_pkfixed"), pdf_ppi.getComponents().find("B0_model")), R.RooArgList(nsig, ncomb, nmisid1, n_b0))
     
#Finally I define my splot
sData = R.RooStats.SPlot(
                "splot_data", "splot_data",
                data_ppi, pdf,
                R.RooArgList(nsig, ncomb, nmisid1, n_b0)
                )

```

The code runs and produces an output, with the sum of the weights in each event close to a Gaussian centred at 1, but with a wide spread (as shown in the picture). I am not sure if this is the expected output. I am also not fully sure that the `Splot`class can be used with fixed yields as I did. I tried searching for more information, but I could not find it on the Splot class page. I would appreciate any help in determining whether this is the correct way to use the class.

Thank you in advance,

Piera

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/4/9/49bbd7f8966623d9ceec167a174a579b6db5461f.png)

---

<div class="post-metadata">

**Author:** ![siliataider](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/siliataider/32/35694_2.png) [@siliataider](https://root-forum.cern.ch/u/siliataider)\
**Post date:** [March 3, 2026, 10:48am UTC](https://root-forum.cern.ch/t/splot-with-fixed-yield/64728/2 "2026-03-03T10:48:40Z")

</div>

maybe @jonas can help?

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [March 17, 2026, 10:49am UTC](https://root-forum.cern.ch/t/splot-with-fixed-yield/64728/3 "2026-03-17T10:49:08Z")

</div>

Closed on March 17, 2026, 10:49am UTC

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