I’m pretty new to Fit/RooFit, and I need some help to get started with my current project.
My goal is to find the best-fit parameters to weigh histograms into the desired shape. This means I have three TH1s (mc1, mc2, data); I want to give mc1 and mc2 different weights to make them fit the shape of data (sth like par[0]*mc1+par[1]*mc2=data maybe by minimizing chi2 between the weighted MC and Data). Since par[0]+par[1] !=1, TFractionFitter does not work for me. Is there any way I can achieve this through Fit/RooFit? Could someone give me some hints?
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 two RooHistPdf
Fit the RooAddPdf to the RooDataHist 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