TGraphMultiErrors Fitting

Dear All,

I am using TGraphMultiErrors to plot two different uncertainties.
The graph looks ok but fitting only considers one of the errors.
Can you please help me with this?

   TGraphMultiErrors* gme1 = new TGraphMultiErrors("gme1", "", n, &Fq2e[NN], &Fq3e[NN],&eFq2e[NN],&eFq2e[NN],&Fq3e1[NN], &Fq3e1[NN]);
   gme1->AddYError(n, &eFq3e[NN], &eFq3e[NN]);
   TF1 *f2 = new TF1("f2","pol1",0.15,.33);
   gme1->Fit("f2","R");

I guess @moneta can help.

Hi,
I can reproduce the problem. This is a bug, I think it is caused by the fact that TGraphMuktiErrors::GetErrorY(point) does not return the sum of the errors but only the first one.
I will open a github issue.
As a workaround you should use for fitting the TGraphAsymmErrors or TGraphErrors that can be built by summing the errors

Lorenzo

2 Likes

Dear @moneta,

Thanks for your reply. I hope the issue gets resolved soon.
Can you please tell me how can I fit both the errors with TGraphAsymmErrors or TGraphErrors ?
Or is it even possible to fit with both the errors?

Hi,
Can you please provide your full code so I can show you how to use them.
You need basically to combine for each data point all your errors in one and use it to fill the new TGraphError class

Lorenzo

Dear @moneta,

I have attached the code and also sharing the link where the datafiles are kept.
Another thing is that I want to fit this with both the statistical and systematic uncertainty.
In the plot, both the errors are there but when we do fitting it considers only first errors.

Thanks

fscaltest.C (1.8 KB)

https://cernbox.cern.ch/index.php/s/C7puw2cVhb5wGqK

If you add

gme1->SetSumErrorsMode(TGraphMultiErrors::kSquareSum);

after the creation of the TGraphMultiErrors object then the uncertainties will add in quadrature. The uncertainty in the fitted parameters reflects this as well.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.