Getting the [%] component value from a Roofit

Greeting Rooters, I am having a bit of trouble with a fit. The program seeks to fit a mass distribution with 5 RooKeysPdfs. One of the parameters/components is flixed and the other 3 in the RooArgList are free to vary between 0 and 1.0. When I do the fit and print out the parameter values I get the parameters and their errors of the components within the RooArgList, but not the [%] component.

Below is a portion of the relevant code:

RooRealVar q1(*fix, "emp");
RooRealVar q2("dy", "coeff",  0.5,0.0, 1.);
RooRealVar q3("jpsi", "coeff",  0.2,0.0, 1.);
RooRealVar q4("psip", "coeff",  0.1,0.0, 1.);
RooRealVar q5("jmix", "coeff",  0.3,0.0, 1.);

RooAddPdf *model = new RooAddPdf("model", "model", RooArgList(*rap[1], *rap[2], *rap[3], *rap[4], *rap[5]), RooArgList(q1, q2, q3, q4));
RooFitResult *res = model -> fitTo(*rds[0], RooFit::Save(), PrintLevel(0), NumCPU(2,0), Minimizer("Minuit2","migrad"));
res -> Print();

The rap[i]'s are the pointers to the RooKeysPDFs and rds[0] is the RooDataSet being fit to.

Any help is greatly appreciated.

Hi @scottmar1054,

  • Can you add what is printed in the terminal?
  • When you say [%] component, do you mean the values of the variables qX?
    If that’s the question, it should be as easy as q1.Print() or std::cout <<q1.getVal()`

Thanks for responding.

So the value and error of q1, q2, q3, and q4 are printed to the screen, but I also need q5. From what I understand from looking at some of the fitting output is that the fitter does:
distribution to be fitTo = q1rap1 + q2rap2 + q3rap3 + q4rap4 + [%]*rap5

With [%] is the left over percentage, so 1 - q1 - q2 - q3 - q4, which would be q5. However, q5 is not changed throughout the fit, since it is not in the RooArgList.

Hi,

It makes sense that q5 is not being changed if you don’t set it as a parameter. Indeed, the last coefficient is 1 - sum(qX) in your configuration, because the condition that a PDF should be normalised to unity removes one degree of freedom. In this sense, the last coefficient is also not a parameter of the fit, because the minimiser will not change it. It just follows from the above equation with standard error propagation.
If you want, you can still set q5 as a coefficient. The PDF will not anymore enforce that sum(qX) is 1, any more. It will switch to an extended likelihood fit, instead, i.e., it will measure the total number of data events.

Yeah, when I’ve done that the fit is a lot worse. I may just try adding a p0 term.

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