TH2D Divide error computing, Scaling

Dear Rooters,

I observe a strange behaviour when dividing 2D histograms (TH2D).
I first fill a few TH2Ds with ~10^5 entries, I divide two of them and then I plot some projection with errors. I always get by few orders of magnitude too high errors.

I tried histo->Sumw2() at many places (after creation. before filling, before dividing), but with no effect. I use version 3.10/02 .

Also Scaling behaves weirdly - if I histo2d->Scale(X), relative errors reduce by sqrt(X) - i guess they should not change while scaling…

with best regards and wishing good time developing :slight_smile:
0ndrej

Please send the shortest possible running script reproducing this problem.

REne

Dear Rene,

this is the shortest way I can do:

TH2D h2=new TH2D(“h2”,“test”,11,-5,5,11,-5,5)
TF2 f2 = new TF2(“f2”,"sin(xx+y
y)/(xx+yy)")
h2->FillRandom(“f2”,1000000)
TH2D *hh2=h2->Clone()
hh2->Sumw2()
TH2D *hh1=h2->Clone()
hh1->Sumw2()
hh1->Divide(hh2)
hh1->ProjectionX(“tmphh”,3,4)->Draw(“e”)

here one observes that the errors are way too large

hh1->Scale(10000.)
hh1->ProjectionX(“tmphh”,3,4)->Draw(“e”)

and here the relative errors change

with the best regards
0ndrej

Replace the line
hh1->ProjectionX(“tmphh”,3,4)->Draw(“e”);
by
hh1->ProjectionX(“tmphh”,3,4,“e”)->Draw(“e”);

You should get the following picture:

Rene


Hi Rene,

thank you for your help :slight_smile:

best regards
0ndrej