Prya13
June 12, 2019, 3:51am
1
Dear All,
I have a distribution and I am trying to find the error associated with this histogram. I used h_pt ->Sumw2() before filling then I have a loop but I am getting zero for the error value.
Sample code:
double err_pt = 0;
for (ibins = 1; ibins <= h_pt->GetNbinsX();ibins++)
{
err_pt = pow(h_pt->GetBinError(ibins),2);
}
cout << err_pt << endl;
This is the distribution
Hi,
maybe you need a + here
err_pt+ = pow(h_pt->GetBinError(ibins),2);
otherwise you print the squared error of the last bin that is 0.
Cheers,
Stefano
Prya13
June 12, 2019, 1:00pm
3
Thank you for your response, however I tried that and got the following error:
error: expected primary-expression before ‘=’ token
err_pt+ = pow(h_pt->GetBinError(ibins),2);
Prya13
June 13, 2019, 1:32pm
5
Thank you Wile,
Still didn’t work. I did it another way.