Re: [ROOT] x error bars and fitting (2)

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Sep 13 2002 - 18:35:00 MEST


Hi Nicolas,

Thanks for your suggestion to use the error bars of the first/last point
when computing the fit range. It was easy to implement. Now in CVS.

Rene Brun

On Fri, 13 Sep 2002, Nicolas de Sereville wrote:

> Hi Rooters
> 
> When fitting TGraphErrors with a predefined function (e.g. "pol1") the
> range fitted seems to be by default [first point; last point of
> TGraphErrors].In the case of x error bars, it doesn't seem to take into
> account the left part of the error bar for the first point and the right
> part of the error bar for the last point.
> If the range of the "pol1" function is extended manually to include all
> the x error bars, then the fit is improved.
> 
> Is it an intented behaviour? if not, would it be possible to change the
> default range in order to include all the x error bars with something like :
> 	low range = first point - 2*xerrorbar
> 	up range  = last point + 2*xerrorbar
> 
> Here is a small script which intends to reproduce this feature.
> 
> Thanks in advance
> 
> Nicolas
> 
> P.S : root 3.02/03 on RH7.1
> 
> 
> void test()
> {
>    gStyle->SetOptFit(1);
> 
>    Double_t x[3]  = {1, 2, 3};
>    Double_t ex[3] = {0.1, 0.1, 0.1};
>    Double_t y[3]  = {1, 2.1, 2.9};
>    Double_t ey[3] = {0.1, 0.1, 0.1};
> 
>    TGraphErrors *gre = new TGraphErrors(3, x, y, ex, ey);
>    gre->Draw("A*");
> 
>    gre->Fit("pol1");
> 
>    TF1 *f1 = new TF1("f1", "pol1", 0, 4);
> //   gre->Fit("f1", "RV+");
> }
> 
> 
> -- 
> :-------------------------------:
> :     Nicolas DE SEREVILLE      :
> :         C.S.N.S.M.            :
> :        Batiment 104           :
> :     91405 ORSAY Campus        :
> : Tel : (+ 33) (0)1 69 15 48 57 :
> : Fax : (+ 33) (0)1 69 15 50 08 :
> :-------------------------------:
> 
> 



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