Hi @katrina09,
indeed, RooFit is well suited for this!
You can find the necessary code snippets for your task in the RooFit tutorials. In particular, take a look at:
- ROOT: tutorials/roofit/rf706_histpdf.C File Reference, which tells you how to build a pdf based of template histograms
- ROOT: tutorials/roofit/rf201_composite.C File Reference, which tells you how to create the normalized sum of two pdfs
Note that in ht e tutorial overview, there are also links to the Python version of both tutorials.
In summary, you have to:
- Wrap all you histograms in a
RooDataHist
- Create two
RooHistPdf
from the mc-based data-hists - Create a
RooAddPdf
from the twoRooHistPdf
- Fit the
RooAddPdf
to theRooDataHist
with the data
It will do a binned likelihood fit by the way, not a chi-square fit. If your data histogram is representing events, the likelihood fit is the right thing to do.
Let us know if you have any follow-up questions!
Jonas