ksamdev
1
Hi,
I cache plot entries in arrays: entries and erorr - and dump values into histogram with:
TH1::SetBinContent(…)
TH1::SetBinError(…)
methods. I’ve just realized, that Sumw2 should be also cached per bin and set in TH1.
How can it be set in TH1?
ksamdev
2
So, I see that TH1::GetSumw2() method will do the job for TH1. One more interesting observation:
Setting sumw2 per bin will automatically update the error, therefore only one function is sufficient to use, e.g. either:
TH1::SetBinError(bin, error);
or
TArrayD *array = TH1::GetSumw2();
array->SetAt(error * error, bin);
Is there any preference which one should be used?
It is more important now: how do I achieve the same effect with TH2? How bins are enumerated in TArrayD?
pcanal
3
Hi,
For a TH2, you can use TH1::SetBinError(binx, biny, error);
Cheers,
Philippe.