RE: normalized histograms errors

From: Tobias Raufer <T.Raufer1_at_physics.ox.ac.uk>
Date: Thu, 24 Nov 2005 10:17:58 -0000


Hi Ben,

>From quickly running your macro I can't see anything wrong with the
error bars. You have two separate histograms H and K, one with 9 entries in total and one with 3. So when you normalize them, they get of course scaled by different factors. That's why after the normalization, the x=6 bin has a larger error bar rhan the x=3 bin.

To confirm this, put all your entries in a single histogram. Then the errors on both these bins stay exactly the same.

Best,

        Tobi

---
Tobias Raufer
Denys Wilkinson Building
Keble Road, Oxford OX1 3RH, UK

Tel.  +44 (0)1865 273385
Fax. +44 (0)1865 273418
tobias.raufer_at_physics.ox.ac.uk
 


>-----Original Message-----
>From: owner-roottalk_at_pcroot.cern.ch
>[mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Ben Kilminster
>Sent: 23 November 2005 20:07
>To: roottalk_at_pcroot.cern.ch
>Subject: [ROOT] normalized histograms errors
>
>Hi,
>
>The errors on my normalized histograms are not what I'd expect
>them to be. To demonstrate this, I have included a macro (see below).
>
>In the following macro, I plot two histograms on the same
>canvas. The top histogram has two histograms overlayed. The
>bottom canvas is the
>same but with the histograms normalized. Notice that in the bottom
>canvas the errors are larger for the x=6 bin than for the x=3
>bin even though they have the same number of entries, and have
>the same-sized error bars in the top canvas.
>
>Is this the desired behavior ?
>If so, is there a way I can switch the errors of normalized
>histograms so that their errors are relatively comparable
>(Ie, error in bin 3 is the same as the error in bin 6) ?
>I have tried using TH1F::Sumw2() before plotting them in the
>second plot, but no luck.
>
>~Ben
>
>{
>
>TH1F *K = new TH1F("K","No norm",10,0,10); TH1F *H = new
>TH1F("H","Norm",10,0,10);
>K->SetLineColor(kBlue);
>
>H->Fill(2);H->Fill(2);H->Fill(2);H->Fill(2);H->Fill(2);H->Fill(2);
>H->Fill(3);H->Fill(3);H->Fill(3);
>
>K->Fill(6);K->Fill(6);K->Fill(6);
>
>TCanvas *C = new TCanvas("C", "test", 600,800);
>C->Divide(1,2);
>// top canvas has no normalization
>C->cd(1);
>H->DrawCopy("elp");
>K->DrawCopy("same, elp");
>
>H->SetNormFactor();
>K->SetNormFactor();
>
>// bottom canvas is normalized
>C->cd(2);
>K->Draw("elp");
>H->Draw("same, elp");
>
>}
>
>
Received on Thu Nov 24 2005 - 11:18:04 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:13 MET