Re: [ROOT] TH1 errors don't scale when dividing by TF1

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Apr 24 2002 - 21:36:15 MEST


Hi Andrew,

You must be using an old version. Scaling is correct
with versions 3.02 and 3.03

Rene Brun

On Wed, 24 Apr 2002, Andrew Hoover wrote:

> Hi,
>  I noticed that the errors on my histograms are not scaling
> when I divide the histogram by a TF1 function. The data points
> are correctly divided but not the errors. I wrote a stupid macro
> to try to understand this...
> 
> void test(){
> 
>  c1 = new TCanvas("c1","Data Analysis ",100,20,800,700);
>  c1->Divide(1,2);
> 
>  TH1D *h1 = new TH1D("h1","h1",5,0,5);
>  h1->Sumw2();
> 
>  TF1 *f1 = new TF1("f1","x",0,5);
>  TF1 *f2 = new TF1("f2","100",0,5);
> 
>  Double_t temp;
> 
>  for(Int_t i=0;i<10000;i++){
>    temp=f1->GetRandom();
>    h1->Fill(temp);
>  }
> 
>  c1.cd(1);
>  h1->DrawCopy();
>  c1.cd(2);
>  h1->Divide(f2);
>  h1->Draw();
> 
> }
> 
>  and you can see the errors are not scaled when h1 is divided by f2 which 
> is just a function equal to 100. Is this the intended behavior? Do I have 
> to loop through all the bins and use GetBinError() and SetBinError() to scale the 
> error bars? 
> 
> Andrew
> 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:51 MET