fitting different subranges with different functions

From: Nevzat Guler <nguler_at_jlab.org>
Date: Fri, 13 Jul 2007 13:35:55 -0400 (EDT)

	Hello,
	I am having a difficulty in finding a nice fit to the data I
am sending in attachment. I am mostly using pol7 for similar data in different but this one fails. (By the way fitting converges if I don't include errors to the graph (TGraph), but when I fit TGraphErrors it fails..)
I have two questions:
1. Is there a flag that I can look when fit fails, so that I can try another function immediaetly in the program..

2.

        I am trying to find a way to fit different subranges with different functions but the demo multifit.C does not work for me. One of the things I tried by using this example is printed at the end of this email. The multifit.C example only uses parameters of fits from different subranges and using them as initial parameters it manages to find resulting combined fit. But what I need, I think, to fit different subranges and then combine resulting fits, merge them. One way I can think of to do this I can evaluate values of different fits and I can take their average in overlapping regions but it is not a good way to do this, I am wondering if there is a better and more reliable method..

        I will appreciate any suggestion.

Thanks,

   Double_t el_par[19];

   TF1 *g1    = new TF1("g1","pol2",1,7);
   TF1 *g2    = new TF1("g2","pol7",4,20);
   TF1 *g3    = new TF1("g3","pol7",10,25);
   TF1 *total = new TF1("total","pol2(0)+pol7(3)+pol7(11)",1.1,29);
   total->SetLineColor(2);
   EL_scl2EL->Fit("g1","R");
   EL_scl2EL->Fit("g2","R+");
   EL_scl2EL->Fit("g3","R+");
   g1->GetParameters(&el_par[0]);

   g2->GetParameters(&el_par[3]);
   g3->GetParameters(&el_par[11]);
   total->SetParameters(el_par);
   total->SetParameters(el_par);
   total->FixParameter(0,0.0);

   EL_scl2EL->Fit(total,"R+");

                                Nevzat Guler

Received on Fri Jul 13 2007 - 19:36:04 CEST

This archive was generated by hypermail 2.2.0 : Fri Jul 13 2007 - 23:50:02 CEST