Hello everyone,
I am trying to get the error on the Integral of a TH1F histogram.
hist1->Integral(bin1, bin2)
Is there any pre-defined functionality to achieve this?
Thanks a lot !
Hello everyone,
I am trying to get the error on the Integral of a TH1F histogram.
hist1->Integral(bin1, bin2)
Is there any pre-defined functionality to achieve this?
Thanks a lot !
Hi,
You can use IntegralAndError
function showing here:
https://root.cern.ch/doc/master/classTH1.html#a72750b362fbf8fae7a4c26579ece18bb
An example
TH1F* hist = new TH1F( "hist", "", 10, 0, 10 );
hist -> Fill( 3, 4 );
hist -> Fill( 5 );
double integral_err;
double integral_val = hist->IntegralAndError( 3, 4, integral_err );
printf( "Integral = %.4f +- %.4f\n",
integral_val, integral_err );
return 0;
glad I can help.