normalized histograms errors

From: Ben Kilminster <bjk_at_fnal.gov>
Date: Wed, 23 Nov 2005 14:06:37 -0600


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 Wed Nov 23 2005 - 21:07:29 MET

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