(no subject)

From: Venkatesh Kaushik (venkat@hepmail.uta.edu)
Date: Mon Nov 17 2003 - 04:18:44 MET


Hi ROOTers,
I have two sets of data points, which I am supposed to fit straights line
to. I try to fit both these with pol1, I observe two things
1) the chi square / dof value is horrible.
2) visually, i don't see the fit has done a good job.

i am not sure what's happening. are there any default fit
strategies/parameters that is messing up my fit?

here's my code snippet. i have also attached the output of this code.

/********************************************************************/
 # define Constrain 1

 // Data points are defined here.
 Double_t E[n]={5,10,15,20,50,75,100}, par[3];
 Int_t N[n]={77497,45361,28876,49716,13794,12370};

 Double_t E_Mean1[n]={125.68,214.17,356.12,496.4,1352.61,2067.54,3068.15};
 Double_t errE_Mean1[n]={1.95,1.7,2.53,2.93,12.08,52.08,52.08};

 Double_t E_Mean2[n]={118.43,215.47,359.58,500.81,1349.5,2019.48,3052.16};
 Double_t errE_Mean2[n]={0.3,1.97,2.24,2.86,10.78,37.96,47.94};

 // Define two graphs and error bars.
 TGraph *gr=new TGraphErrors(7,E,E_Mean1,errE,Err1);
 TGraph *gr1=new TGraphErrors(7,E,E_Mean2,errE,Err2);

 // put them in a multigraph.
 TMultiGraph *mg = new TMultiGraph();
   mg->Add(gr);
   mg->Add(gr1);
   mg->Draw("AP");
   // fit pol1 to both graphs.
   gr->Fit("pol1");
   TF1 *fline1=gr->GetFunction("pol1");
   if(Constrain)fline1->SetParameter(0,0);
   par[0] = fline1->GetParameter(0);
   par[1] = fline1->GetParameter(1);
   cout << par[0] << " " << par[1] << endl;
   fline1->SetLineColor(kRed);

   gr1->Fit("pol1");
   TF1 *fline2=gr1->GetFunction("pol1");
   if(Constrain)fline2->SetParameter(0,0);
   par[0] = fline2->GetParameter(0);
   par[1] = fline2->GetParameter(1);
   cout << par[0] << " " << par[1] << endl;
   fline2->SetLineColor(kBlue);

/********************************************************************/







Eliveonly_ecal.gif



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET