Good morning
I’m using Roofit to fit a mass peak with a composite model.
Both the signal and the background are the sum of various pdf, which are expected to vary.
After the fit, I’m trying to compute the fraction of signal and one particular component of background contained in the region around the peak.
I tried using createIntegral on those component pdf, but RooFit treats them as independent and normalizes to 1, while I would like a fraction of the final pdf that I can relate to the total amount of events in the dataset.
For the whole signal there is an easy workaround, since the parameter that controls the fraction is easy to obtain in the model.
For the background component instead, since the components can vary, the fraction is not directly available.
The question is, is there a way to get the area fraction of a pdf component given only its name? Or alternatively, is there an easy workaround that I can use to obtain the wanted result?
Hi Elusian,
sorry for the delay on this. It looks like you already have something working. Maybe you could share some minimal working code that demonstrates the problem that you’re having.
Perhaps what you need is the RooExtendPdf class seen here since a regular pdf should always be normalised to one (probability density function and all that jazz)
If you’re still having problems there are some more examples here that go into more details of model building with roofit that should explain some things. Or else feel free to ask a question.
Hello and thanks for the answer.
My problem is not that it is not normalized to the amount of events, as the extended pdf would be. What I meant is that I would like the full model to be normalized to one, and ask for the fraction of the single components.
I looked at the example, and it is actually very similar to what I have in my code, aside from the amount of pdfs and the fact that I let RooAddPdf extend the pdf for me, instead of extending them before. I will modify that one a little to show my problem.
urgh. how’s that? But looking at your example I think you already have all the components you need.
I’m still struggling a little to follow the logic of your model; but, looking at your script I think you might just need to change the RooAddPdf definition to use a a single RooRealVal to represent the fraction rather than two as you do in line 43. Another way (but I guess you already thought of this) is just make a three component model?
so signal = f(component1)+ (1-f)(component2)
and model = g(signal)+(1-g)(background)
or model = a(component1) +b (component2) + c(component3)
but maybe neither of these options are what you’re going for?
I avoided making a 3 component model as I would be splitting the background component (yes, in the example it’s the signal, but in the real model it’s the background that has many subcomponents), while the model doesn’t really have that separation. I will go with that in the end, but I wanted to check if there was a better way to obtain the component fraction directly.
I don’t understand what you mean by use a single fraction instead of two, there are three components there, so I think I need at least 2 parameters.