Compute uncertainty of integral of a component of a TF1


I am wondering whether there is functionality in standard ROOT (not RooFit) to compute the uncertainty of a component of a TF1. E.g. if fitting a function TF1 f1(“f1”,“gaus(0)+pol2(3)”) to a spectrum, I’d like to get the integral and its uncertainty only for the gaus(0) component.

If there is no function available, how can I properly can do this myself?

Another related question: If using a signal component, where the “amplitude” parameter already represents the integral (like it should be the case for gausn), can I assume that the uncertainty of the integral is correctly represented by the uncertainty of this fit parameter?


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


thanks for the quick answer! Some follow-up questions:

  • according to the example electronPionID.C in the 2nd post, the integral error of the signal seems to be extracted only from the signal parameters covariance, right?
    TMatrixD c1g = c1.GetSub(0, 2, 0, 2);
    This seems to neglect correlations of background parameters with signal parameters. I.e. I can well imagine, that changing the background shape has impact on the signal integral. Or am I wrong?

  • you 3rd quote seems to address my 2nd question about, whether e.g. the error of par. 0 of a gausn is already representing the integral error of the signal component. But it didn’t seem to answer it but just points out the difference between gaus and gausn. Or did I miss something?

Best, Klaus

Run both macros from the first link using “fit_with_fixed_background” = “use_partial_covariance” = “kFALSE”. Then set both variables to “kTRUE” and run both macros again. Compare the obtained results.

See also: Wikipedia → Covariance matrix → Partial covariance matrix

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