I want to fit a polN function on a histogram in a given range. Let’s say this function is the 1st order pol1.
I have checked the fit options that I can use in the link. I am not using predefined function in the meantime.
That’s what I picked for the fitting options: h1->Fit(new_Bcg, “LRS”); I am not sure to add C and F as an option. I use “ROOT::Math::MinimizerOptions::SetDefaultMinimizer(“Minuit2”);” indeed in the very beginning of the code.
If I FIX the parameters as the values of what they has to be precisely , then the fit is nice. However, I can’t get the integral error of the fit in a certain range due to the FIXING.
On the other hand, if I set par. limits or just initialize them as to the precise values, the fit is terrible because of FLEXıBLE parameter CHOOSING.
What do you suggest?
That’s the line to read out some values after fit to give you an idea:
cout << “\nBackground integral: " << new_Bcg->Integral( Bcg_x1_LowE , Bcg_x2_UpE) / BinWidth <<” ± "
<< new_Bcg->IntegralError( Bcg_x1_LowE , Bcg_x2_UpE, p_bcg, cov_mat.GetMatrixArray()) / BinWidth << endl ;
Without fixing the parameters. OBVIOUSLY THE BAD ONE.
After fixing the parameters. CORRECT ONE.