Strange errors from IntegralError

Hi everyone,

I make a fitting histogram and find error of fit. This is an idea code of the process:

 TH1D* mass_D = new TH1D("m_D","Mass D^{#pm};m_{D^{#pm}}, GeV", 70, 1.86966 - 0.016, 1.86966 + 0.016);
  
  int nentries = (int) physics->GetEntries();
  for ( int i = 0; i < nentries; i++ ){
    physics->GetEntry(i);
    mass_D->Fill(mass);
  }
  
  mass_D->Sumw2();
  mass_D->Scale(1., "width");
  
  TF1* f_sum = new TF1("f_sum","gausn(0) + pol1(3)", 1.86966 - 0.016, 1.86966 + 0.016);
  ...
  TFitResultPtr res_fit_mD = mass_D->Fit(f_sum, "RS");
  
  TMatrixDSym covTot = res_fit_mD->GetCovarianceMatrix();
  
  TMatrixDSym covGauss(0, 2, covTot.GetMatrixArray());
  TMatrixDSym covLine(3, 4, covTot.GetMatrixArray());

  TF1* f_core = new TF1 ("f_core","gausn(0)", 1.86966 - 0.016, 1.86966 + 0.016);
  
  f_core->SetParameter(0, f_sum->GetParameter(0));  f_core->SetParError(0, f_sum->GetParError(0));
  f_core->SetParameter(1, f_sum->GetParameter(1));  f_core->SetParError(1, f_sum->GetParError(1));
  f_core->SetParameter(2, f_sum->GetParameter(2));  f_core->SetParError(2, f_sum->GetParError(2));
  
  TF1* f_bg = new TF1 ("f_bg","pol1(0)", 1.86966 - 0.016, 1.86966 + 0.016);
  
  f_bg->SetParameter(0, f_sum->GetParameter(3));  f_bg->SetParError(3, f_bg->GetParError(3));
  f_bg->SetParameter(1, f_sum->GetParameter(4));  f_bg->SetParError(4, f_bg->GetParError(4));
  ...
  cout << "В распределнии Гаусса: " << f_core->Integral(1.86966 - 0.016, 1.86966 + 0.016)
       << "\nВ линейном распределении: " << f_bg->Integral(1.86966 - 0.016, 1.86966 + 0.016) << endl;
  
  cout << "Вычисление ошибок инетгралов:"
       << "\nОшибка интеграла Гаусса: " << f_core->IntegralError(1.86966 - 0.016, 1.86966 + 0.016, f_core->GetParameters(), covGauss.GetMatrixArray() )
       << "\nОшибка линейной функции: " << f_bg->IntegralError(1.86966 - 0.016, 1.86966 + 0.016, f_bg->GetParameters(), covLine.GetMatrixArray() ) << endl;

The values of integrals:

В распределнии Гаусса: 89414.6
В линейном распределении: 15921.9

The values of integrals errors:

Вычисление ошибок инетгралов:
Ошибка интеграла Гаусса: 282632
Ошибка линейной функции: 283.189

And these errors look strange. Thay can’t be like that. Where may be a problem? Do I work with TMatrixDSym wrong?


ROOT Version: 6.26/06
Platform: Ubuntu
Compiler: Not Provided


ROOT Forum → Search → gausn pol1

1 Like

I changed

TMatrixDSym covGauss(0, 2, covTot.GetMatrixArray());
TMatrixDSym covLine(3, 4, covTot.GetMatrixArray());

to

TMatrixD covGauss = covTot.GetSub(0, 2, 0, 2);
TMatrixD covLine = covTot.GetSub(3, 4, 3, 4);

and this got a normal result. But I don’t understand why :slight_smile: . When I used TMatrixDSym constuctor did I get extra cells of the matrix?

your_matrix.Print();

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