Hello,
I am using root version 5.26. My problem is not exactly root problem but a
generic fitting problem on 2D histograms. I am sorry if it is inappropriate to
ask about here. I am trying to make a Gaussian fit on many different 2D
histograms with two prominent peaks on each but moving around from histogram
to histogram. Later, I will also try other histograms with multiple peaks. I
am using a fit function like:
double g2(double *x, double *par)
{
double r1 = double((x[0]-par[1])/par[2]);
double r2 = double((x[1]-par[3])/par[4]);
return par[0]*TMath::Exp(-0.5*(r1*r1+r2*r2));
}
Also tried combination fit like:
double fun2(double *x, double *par)
{
double *p1 = &par[0];
double *p2 = &par[5];
double result = g2(x,p1) + g2(x,p2);
return result;
}
But in both cases, the fit result is hugely dependent on the the initial
parameters and often fails for many of the histograms since the peaks are
moving around. Only way I could think is to find peak locations in each
histogram and supply initial parameters based on those. I would like to ask
your opinions if this is worth trying or are there better ways.
Thanks, - Nevzat Guler
Received on Mon Nov 01 2010 - 09:01:59 CET
This archive was generated by hypermail 2.2.0 : Tue Nov 02 2010 - 11:50:01 CET