Re: [ROOT] TH!::Scale method end errors

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Mar 08 2001 - 10:58:50 MET


Jan,

By default, errors are computed as sqrt(bin content).
If you want TH1::Scale to take into account the errors, the errors must exist.
Do
   h->Sumw2();
   h->Scale(normFac);

Rene Brun

Jan Malinowski wrote:
> 
> Hello Rooters,
> 
> I have rescaled a histogram. I used TH1::Scale( Double_t ) method:
>           h->Scale( norFac );
> 
> I received strange errors, e.g.:
>           x-center    dN/dEsec       err-dN/dEs
>             11.22   7.2651e-007  8.5235e-004
>             14.13   4.6631e-007  6.8287e-004
> -----------
> When I made the same (I suppose) with:
>        Float_t cbin =h->GetBinContent( ib );
>        Float_t error=h->GetBinError( ib );
>        hO->SetBinContent(  ib,  (cbin*cScal)  );
>        hOl->SetBinError(  ib,  (error*cScal)  );
> 
> I received following results:
>          x-center    dN/dEsec      err-dN/dEs
>           11.22   7.2651e-007  1.5226e-008
>           14.13   4.6631e-007  1.2199e-008
> ------------
> Why is there such difference in the results?
> 
> Janek.



This archive was generated by hypermail 2b29 : Fri Jun 08 2001 - 11:51:20 MEST