# RooFit: Simultaneous fit with coefficients

Dear Root experts,

I construct RooSimultaneous PDF that is :

category 1 = c_a1 * PDF11 + c_1 * PDF12
category 2 = c_a2 * PDF21 + c_2 * PDF22

and c_a1 = c_a2, as linked.

But I’d like to set c_a1 and c_a2 :

c_a1 = c_bf * c_s1
c_a2 = c_bf * c_s2

Is it possible? If then, how can I do that?
If you know how to do, then please let me know.

Thank you.

Best regards,
Kyungho Kim

ps. followings are my brief code for declaring simultaneous PDF.

``````// Histogram PDF from TH1
RooHistPdf sig_ehpdf("sig_ehpdf", "sig_ehpdf", RooArgList(pl), *sig_edh, 2);
// mean and sigma from .root file
RooRealVar gmean_e( "gmean_e", "gmean_e", ((RooRealVar*)bkg_e->floatParsFinal().at(0))->getValV());
RooRealVar gsigma_e( "gsigma_e", "gsigma_e", ((RooRealVar*)bkg_e->floatParsFinal().at(1))->getValV());
RooGaussian gauss_e("gauss_e", "gauss_e", pl, gmean_e, gsigma_e);

// 1st model PDF
RooRealVar cebkg("cebkg", "cebkg", 397, 0, 1000);   // bkg coefficient
RooArgList mode_e(sig_ehpdf, gauss_e, "mode_e");
RooArgList coef_e(c_bf, cebkg, "coef_e");

RooHistPdf sig_mhpdf("sig_mhpdf", "sig_mhpdf", RooArgList(pl), *sig_mdh, 2);
RooRealVar gmean_m( "gmean_m", "gmean_m", ((RooRealVar*)bkg_m->floatParsFinal().at(0))->getValV());
RooRealVar gsigma_m( "gsigma_m", "gsigma_m", ((RooRealVar*)bkg_m->floatParsFinal().at(1))->getValV());
RooGaussian gauss_m("gauss_m", "gauss_m", pl, gmean_m, gsigma_m);

RooRealVar cmbkg("cmbkg", "cmbkg", 189, 0, 1000);
RooArgList mode_m(sig_mhpdf, gauss_m, "mode_m");
RooArgList coef_m(c_bf, cmbkg, "coef_m");

RooCategory sample("sample", "sample");
sample.defineType("emode");
sample.defineType("mmode");

RooSimultaneous simPdf("simPdf", "simultaneous pdf", sample);
simPdf.fitTo(combData);
``````

@StephanH could you help here?

Hello @K.H.Kim,

Yes, it’s possible. It should look something like this:

``````RooProduct c_a1("prod_bf_s1", "c_bf * c_s1", RooArgList(c_bf, c_s1));
``````

It works! Thank you, @StephanH and @Axel !

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