How to use the pyroofit.composites.SimFit function in pyroofit

To help you get started, we’ve selected a few pyroofit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github simonUU / PyrooFit / examples / simultaneous_fit.py View on Github external
df_mixed = {'mass': np.append(np.random.random_sample(1000)*7 - 3.5, np.random.normal(0, 0.5, 1000))}
df_mixed = pd.DataFrame(df_mixed)

df_bkg = {'mass': np.random.random_sample(2000)*7 - 3.5}
df_bkg = pd.DataFrame(df_bkg)

x = ROOT.RooRealVar('mass', 'M', 0, -3, 3, 'GeV')

pdf_sig = Gauss(x, mean=(-1, 1))
pdf_bkg = Chebychev(x, n=1)

pdf = pdf_sig + pdf_bkg

sf = SimFit(pdf, pdf_bkg)
sf.use_extended = True  # bug
sf.use_minos = True
sf.fit([(pdf, df_mixed), (pdf_bkg, df_bkg)])

#pdf_bkg.plot('simultaneous_fit_bkg.pdf', df_bkg)
pdf.plot('simultaneous_fit.pdf',
         df_mixed,
         nbins=20,
         extra_info=[["Legend"], ["More Legend"], ['#mu', *pdf_sig.get('mean')], ['#sigma', *pdf_sig.get('sigma')]])
pdf.get()

pyroofit

Python wrapper for RooFit to create fits easily with pandas DataFrames.

MIT
Latest version published 4 years ago

Package Health Score

39 / 100
Full package analysis

Similar packages