Dear All,
I had an histogram plotted, and then one Gaussian function fitted on that data.
By using both GetBinError() and IntegralAndError()methods, I got the same error for both in my histogram. That’s what I was expecting. Thus, everything look alright by that point.
Then, I fitted my Gaussian, and I used Integral() and IntegralError() methods to get my integral and its error. I was expecting, surely, lower counts due to the integral’s estimations from the function. However, the error turned out almost 4 times higher. FIRST OF ALL, is that what we should be expecting? Namely, is it OK? Otherwise, why did it become higher but not lower than the histogram’s error by following the same decrease pattern?
Just to give an idea, I put that bit of the code:
//////////////////////////////////////////////////////////// 1 way to get the error and integral from TH1 //////////////////////////
for (int i = LL; i < UL+1 ; i++ ){
TotalCounts += h1->GetBinContent(i);
TotalError += std::pow(h1->GetBinError(i), 2.);
}
TotalErrorUpdated= sqrt(TotalError);
cout <<“From " <<LL << " to " << UL <<” Total GetBinContent: " << TotalCounts <<" ± " << TotalErrorUpdated << endl;
//////////////////////////////////////////////////////////// Another way to get the error and integral from TH1 //////////
double myerror;
double myintegral = h1->IntegralAndError(LL, UL, myerror, “”); // “” … or … “width”
cout << "IntegralAndError(…) = " << myintegral << " ± " << myerror << endl;
///////////////////////////////////////////////////////////// 1 way to get the error and integral from TF1 //////////////////////////
double GrossArea1 = g1->Integral(xVmin, xVmax) ;// ConfidenceLimitCorrection;
double Error_GA1 = g1-> IntegralError(xVmin, xVmax , gaussParameters, MyConvarienceMatrix) ;
cout <<"1st peak’s " << "Integral: "<< GrossArea1 << " ± "<< Error_GA1 << endl;
/////////////////////////////////////////////////////////////////////////////////////////