I know what you mean, we have done this many times. I assume you are referring this part of your code I show below:
TF1 *fg = new TF1(“fg”, “gaus”);
Double_t sb = 5.0; // sigma band for the fg integral (e.g. 3 or 5 or 7)
Int_t ch_min = 360, ch_max = 460; // “channel numbers”
TF1 *f1 = new TF1(“f1”, “gaus(0) + pol1(3)”, ch_min, ch_max);
f1->SetParameters(30000., 430., 10., 5000., 0.);
TFitResultPtr r1 = g1->Fit(f1, “WEMRS”);
TMatrixD c1 = r1->GetCovarianceMatrix();
TMatrixD c1g = c1.GetSub(0, 2, 0, 2);
Double_t s1, s1e;
fg->SetParameters(f1->GetParameters());
// fg->SetParErrors(f1->GetParErrors());
s1 = fg->Integral(fg->GetParameter(1) - sb * fg->GetParameter(2),
fg->GetParameter(1) + sb * fg->GetParameter(2));
s1e = fg->IntegralError(fg->GetParameter(1) - sb * fg->GetParameter(2),
fg->GetParameter(1) + sb * fg->GetParameter(2),
fg->GetParameters(),
c1g.GetMatrixArray());
std::cout << "gaus peak integral (mean +/- " << sb << " sigma) = "
<< s1 << " +/- " << s1e << std::endl;
You keep saying play the same game. I don’t get it. Of course, I know how to adapt this part to background as well.
The point is here when you say f1->SetParameters(30000., 430., 10., 5000., 0.);
As you know, as soon as we fix any of these parameters, we loose the error. I am asking what is your strategy of getting it back when they are still FIXED?
For instance, this part will not give me the error. I am avoiding to write all of the code. Because, I fixed the parameters where I store in my array of p_bg here.
double bcg_g1_error = bg->IntegralError( g1_X_LBE, g1_X_UBE , p_bg, cov_bg.GetMatrixArray()) / BinWidth;