Skip to content
Snippets Groups Projects
Commit 141d9788 authored by Wouter Deconinck's avatar Wouter Deconinck
Browse files

fix: emcal_barrel_pi0 fallback to stats if fit fails

parent ab354d5e
No related branches found
No related tags found
1 merge request!141fix: emcal_barrel_pi0 fallback to stats if fit fails
...@@ -190,9 +190,13 @@ void emcal_barrel_pi0_analysis( ...@@ -190,9 +190,13 @@ void emcal_barrel_pi0_analysis(
h3->SetLineWidth(2); h3->SetLineWidth(2);
h3->SetLineColor(kBlue); h3->SetLineColor(kBlue);
auto fit = h3->Fit("gaus","","", fitRange[1][0], fitRange[1][1]); auto fit = h3->Fit("gaus","","", fitRange[1][0], fitRange[1][1]);
double* res = h3->GetFunction("gaus")->GetParameters(); if (fit == 0) {
sigmaOverE = res[2] / meanE; double* res = h3->GetFunction("gaus")->GetParameters();
sigmaOverE = res[2] / meanE;
} else {
std::printf("Fit failed\n");
sigmaOverE = h3->GetStdDev() / h3->GetMean();
}
c1->SaveAs((fmt::format("results/emcal_barrel_pi0_{}.png", col[1])).c_str()); c1->SaveAs((fmt::format("results/emcal_barrel_pi0_{}.png", col[1])).c_str());
c1->SaveAs((fmt::format("results/emcal_barrel_pi0_{}.pdf", col[1])).c_str()); c1->SaveAs((fmt::format("results/emcal_barrel_pi0_{}.pdf", col[1])).c_str());
std::printf("Resolution %d\n", 1); std::printf("Resolution %d\n", 1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment