So, in this table, p0 corresponds to the amplitude (in this case, 2-D, it is the peak height) of approximately 78 and p1 is the mean value in the x-axis, it is a negative value. I do not understood what happens, because the mean value in the x-axis is approximately 17 and why the amplitude value is 78 if the peak height in the graph is about 58??
to have a correct fit you need to provide some errors for your data points, for example 0 for x and y and sqrt(z) for z if z represents counts). Then you can fill and then fit a TGraph2DErrors. Without errors all the points have the same weights and the function will be pushed towards the tails
Hi,
I’m also having problems with drawing 2D gaussians (nothing to do with fitting). The amplitude drawn is most of the time completely different from the one set.
For example
TF2 *f2t = new TF2(“f2t”,"[0]*TMath::Gaus(x,[1],[2])*TMath::Gaus(y,[3],[4])",-10,10,-10,10);
f2t->SetParameters(0.9,3,.22,4,.03);
Gives me the attached figure (amplitude of .1 e-3). if I do cout<<" par0:"<< f2t->GetParameter(0);
this returns me the correct set amplitude ie: 0.9. Does anybody know what I might be doing wrong?
Many Thanks,
Sebastien
your gaussian has a very small width in the y direction. You should decrease the range in x and y. For example plot between -10 and + 10 sigma in x and y and you will get a right plot. Or you can increase the precision of th e plot by using more points. For example do
f2t->SetNpy(1000)
But I am getting a error messages: has 0 parameters instead of 2.
I was hoping to save my self some headache, So I was wondering if there is a pre-difinde function for this in ROOT? I am unable to find one in the TMath library. Dose any one have knowledge of this. I am using Pyroot if that changes anything.