Not getting right mean and sigma from the distribution

Remove the “Q” option and compare the values of parameters that you get printed on your screen with these that you retrieve. See also the “STATUS” field (is it always “CONVERGED”?).

I removed Q but it did not changed anything.I checked if i print out the wrong number but it is right number. I do not know what makes it do grab wrong mean.

Attach your file with histograms here plus your macro so that we can “debug” it.

Here is the code full code and the prototype.Kind regards
problem_macro.C (18.1 KB)

problematic_fit_example.C (8.9 KB)

“input.root” is missing

Yes. It is very big to attach. So I attached the macro as a prototype. If u
run it you will see root output and the problem.

Kind regards

şunu yazdı:

The “problematic_fit_example.C” uses just 9x6 TH1D histograms, so prepare a small "input.root” which contains just these histograms (so that one can run this macro).
If you have ROOT 6, try: rootcp --help

I attached the right input file and right macro. Please use these two for diagnosis. I really appreciate your help.

Kind regards,
S.
just_subt.root (25.9 KB)
fitting_justsubt.C (4.0 KB)

All fits ended with an “Abnormal termination of minimization”, reporting either “STATUS=CALL LIMIT” or “STATUS=NOT POSDEF” (I did tell you to check the “STATUS”, didn’t I).

I tried to improve it so that one gets “STATUS=CONVERGED”, but it seems to me that you need to improve your “data model” (i.e. “improve” the fitting function).

fitting_justsubt.C (3.7 KB)

1 Like

Many thanks for your help. I want to ask what does line71 to 77 do?

Again many thanks for your all help.
S,

And one more question if I used another function as 2nd or 3rd order polynomial what should I do?

Try to change the first line into “#if 1” and run again.

Instead of "gaus(0)+x*[3]+[4]" try "gaus(0)+pol1(3)" (equal to "gaus(0)+[3]+x*[4]") or "gaus(0)+pol2(3)" or "gaus(0)+pol3(3)".

My aim of in this work is just get mean and sigma of the curve and use in the analysis. Could you please explain me briefly what lines 71 to line 77 does?Sorry I am new and did not understand it clearly. If I change the linear part to another function what should I consider?Many thanks and kind regards.
S.

C preprocessor

I have a question: If I want to use 2nd or 3rd order polynomial what should I do?

I have a question. I know gauss+lineer function does not define my data
well. If I want to use gaus+2nd or 3rd order how can I implement this
correction?

See my second to last post here.

Yes I read it. When I change 0 to 1 and change function gaus(0)+pol2(3) or gaus(0)+pol3(3) but it seems that it does not get right mean. Do not I expect mean at top point of the function?

I made this changes in the same code that you send me

TF1 *f = new TF1(Form(“template_function_PP_MB_pt_%02d”, ipt),
// “gaus(0)+pol2(3)”, 1., 2.7); // 1.059 1.90 is good
"gaus(0)+pol3(3)", 1.058, 2.20); // 1.059 1.90 is good
f->SetLineColor(kRed);
f->SetLineWidth(2);

// “reasonable” initial values for ALL parameters are really important
f->SetParameter(0, 3000.);
f->SetParLimits(0, 10., 10000.);
f->SetParameter(1, 1.4);
f->SetParLimits(1, 1., 2.);
f->SetParameter(2, 0.2);
f->SetParLimits(2, 0.01, 1.);

#if 1 /* 0 or 1 /
f->FixParameter(3, 0);
#else /
0 or 1 /
f->SetParameter(3, 0);
// f->SetParLimits(3, -10000., 10000.);
#endif /
0 or 1 */
f->SetParameter(4, 0.);
// f->SetParLimits(4, -10000., 10000.);
And when I checked me an and sigmas it did not show the right ones? Did I missunderstand you? What is my mistake?

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