I am wondering how THistPainter decides whether the default plot option for a histogram includes the “E” option to draw error bars. I had assumed that TH1::GetBinError would return 0 if TH1::Sumw2 had not been called, but was pleasantly surprised to see it compute the sqrt(N) errors. This leaves me perplexed as to how THistPainter decides if it should use the “E” option, one could assume that it could be used in all instances. In the end I would like to replicate this behavior and only do something if the errors have been set.
I had done that previously, and just repeated the exercise. I found no indication of how to know if TH1::Sumw2 had been called or if the errors had been specified.
TH1::GetDefaultSumw2 seem to only tell me if the default is to enable Sumw2, it doesn’t specify if the user has called it. TH1::GetSumw2 returns a pointer to an array of the sums, but how do I know if they were calculated? What if calling that method actually performs the calculation first? The documentation here is lacking.
Thanks. In the meantime can I request that the documentation for TH1::GetSumw2 and TH1::GetSumw2N be updated? The latter has no description what so ever.