Fit drawing problem in TFraction fitter

Hey, I am trying fit my data histogram using TFraction fitter. There are 5 histograms used for comparing with data histogram. I am able to get fit parameter and status of fit is converged but fit does not draw on canvas.
Result for fit-
MIGRAD MINIMIZATION HAS CONVERGED.
MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
FCN=10.1953 FROM MIGRAD STATUS=CONVERGED 162 CALLS 163 TOTAL
EDM=1.42597e-06 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 frac0 6.45785e-03 6.48654e-01 2.24294e-03 -4.02795e-05
2 frac1 7.08057e-01 8.30752e-01 5.40100e-03 -3.34852e-04
3 frac2 2.21448e-07 8.67689e-01 4.67029e-03** at limit **
4 frac3 1.50142e-01 5.52238e-01 2.76796e-03 -5.13535e-04
5 frac4 3.33617e-03 5.90910e-01 2.23428e-03 4.37461e-04
ERR DEF= 0.5
fit status0

My script - fit1.C (1.5 KB)

How can I view my fit result ? Please help !!
Thanks.

Try with:

hist->Draw("Ep");
result->Draw("same"); // "same" or "hist same"

I tried that also but end up with this plot. Can it be due to high error bars ?

Try without error bars:

hist->Draw("hist"); // "Ep" or "hist"
result->Draw("same"); // "same" or "hist same"

Then it just gave histogram but still not the fit.

Can you post a macro we can run ? Your data files are missing.

Hi,

Look at these two lines, real close:

	   TH1F* result = (TH1F*) fit->GetPlot(); 
	   hist->Draw("PE");

Even @Wile_E_Coyote overlooked it :slight_smile: You get the histogram into the variable result, but then you draw the original histogram as pointed to by the variable called hist! Probably you meant:

	   TH1F* result = (TH1F*) fit->GetPlot(); 
	   result->Draw("PE");

Cheers, Axel.

@axel See the example in the TFractionFitter class reference.

Thanks, @Wile_E_Coyote I overlooked the commented code! Then we indeed need a way to reproduce this, as @couet pointed out.

RGAdata3.root (4.0 KB)
Water1.root (3.7 KB)
Carbon-dioxide1.root (3.8 KB)
Oxygen1.root (3.6 KB)
Nitrogen1.root (3.7 KB) Argon1.root (3.7 KB)

Thanks all for looking on this issue. @couet All data files are attached above as root files (histograms).
The main script is already attached in first message.

I noticed that you’re missing a proper:

TCanvas *c1 = new TCanvas("c1", "c1");

@Wile_E_Coyote That doesn’t help too.

   gROOT->cd();
   TObjArray *mc = new TObjArray(5);

or:

           result->SetDirectory(0);

Thank you everyone…

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