Simultaneous Fit Normalization Issue


Trying to do a simultaneous fit to a common term. Each dataset needs to be fitted on a different range, and I think that’s where part of the issue is. I believe that Roofit is fitting correctly, plotting the fit correctly, but when I plot the data it’s having trouble with the normalization. I get these warnings/errors

[#0] WARNING:Plotting -- RooHist::getFitRangeNEvt() WARNING: Number of normalization events associated to histogram is not equal to number of events in histogram due cut made in RooAbsData::plotOn() call. Automatic normalization over sub-range of plot variable assumes that the effect of that cut is uniform across the plot, which may be an incorrect assumption. To be sure of correct normalization explicit pass normalization information to RooAbsPdf::plotOn() call using Normalization()

[#0] ERROR:InputArguments -- RooArgSet::checkForDup: ERROR argument with name model1_Int[Energy|fit_BBG1T]_Norm[Energy] is already in this set

and a matching set for the second set of data. The warning suggests an explicit call to Normalization() in the plotOn() statement, but either I grossly misunderstand the documentation or it’s not working. Attached is the data, macro, and a pdf of the plots the macro produces (with odd data normalization).

Any help would be appreciated. Thanks!

ForumPost.pdf (31.7 KB)
ForumPost.root (90.1 KB)
ForumPost.C (2.7 KB)

Hello @usccaa,

so what’s happening is that RooFit cannot compute the desired number of events per category. It knows that you have N events in total, that’s why the red curve is higher than the data, but it doesn’t know how many events end up in which category. You can solve it like this:

const double entries1 = comb.sumEntries("sample==sample::BBG1T");
    Normalization(entries1, RooAbsReal::NumEvent),
const double entries2 = comb.sumEntries("sample==sample::BBG2T");
    Normalization(0.5, RooAbsReal::Relative),

What’s new is that I request the number of events after each cut, and then I scale the PDF explicitly. Just for illustrational purposes I show both ways of scaling a PDF:

  • Absolute number of Events
  • Relative scaling

Since you know the number of events, you would probably go for absolute scaling.

I believe I’ve solved the essential issue, but it’s confused me more about the workings of RooFit. If I implement your solution

cost double entries1 = comb.sumEntries("sample==sample::BBG1T");
spdf.plotOn(P1,Slice(sample,"BBG1T"),LineColor(kRed), ProjWData(sample,comb),Range("one"), Normalization(entries1,RooAbsReal::NumEvent);

I get something looking like ForumPost1.pdf. If I change both normalizations to the full dataset though

cost double entries = comb.sumEntries();
spdf.plotOn(P1,Slice(sample,"BBG1T"),LineColor(kRed), ProjWData(sample,comb),Range("one"), Normalization(entries,RooAbsReal::NumEvent);

I get something that looks correct (ForumPost2.pdf). If the “correct” normalization is the full number of entries then how are the pdfs plotted when no normalization is specified?

ForumPost1.pdf (31.3 KB)
ForumPost2.pdf (31.3 KB)

The only difference I see is that you used a named (previously defined) range. It could be that when you define a range on the fly opposed to using a previously-defined one, RooFit is unable to compute the fraction of each category. If you use names, that apparently succeeds, which is why you can just give the total number of events, and the fractions get calculated automatically.

Can you confirm that with
you get different results than with

I’ve changed the Range statement in the creation of the RooPlots, and all the plotting statements. Still getting wonky normalizations. I kept the named ranges in the fit statement of the RooSimultaneous function as I’m not clear on how to fit to multiranges without it.
ForumPost3.pdf (31.3 KB)
ForumPost.C (3.3 KB)

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