I am trying to fit the sum of a double sided Crystal Ball (for signal) and an Exponential (for background) to a weighted
RooDataset, via an unbinned maximum likelihood fit.
I am performing the fit in a sub range of the master variable.
The fit goes fine, and the fitted values of the yields make sense. But when I attempt to plot the results, the background shape is a lot higher than the total fit. It looks like the normalization of the background is wrong. This happens even though I pass the
SumCoefRange option in the
fitTo command. I don’t understand why the normalization is off only for one of the fit components.
I am attaching my runnable test code, input workspace, and a screenshot of the fit output.
I would appreciate any advice on this issue.
myWS.root (155.5 KB) testScript.C (2.5 KB)
thank you for your thourough report and reproducer! @StephanH is probably the best person to help here!
That’s because RooFit normalises the background PDF to match the number of data events. That’s obviously wrong as you can see in the plot.
What you have to do is to use the
Components notation as follows:
So you are always plotting the sumPdf, and the total sum is normalised to the data. Then, you select only the named components (you can also select multiple using commas), but the normalisation is still with reference to the total sum.
For reference, this is how I got the sumPdf:
RooAbsPdf* sumPdf = static_cast<RooAbsPdf*>(
This is where all this is shown in a bit more detail:
Thank you! I would have never caught that mistake. Lesson learnt for the future.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.