Skip to content

Commit c621605

Browse files
authored
Merge pull request #28 from stephanlachnit/p-better-fitting
analysis: better fitting
2 parents f14c7ea + 8872f3e commit c621605

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

analysis/TBrun_all.C

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,13 @@ GausFitRes fit_sdep_hist(TF1& tf1_gaus, TH1* th1ptr,
108108
tf1_gaus.SetParameter(2, 0.45 * th1_2std);
109109
// Fit only in two sigma range
110110
tf1_gaus.SetRange(th1_mean-th1_2std, th1_mean+th1_2std);
111+
th1ptr->Fit(&tf1_gaus, "RQN");
112+
// Second fit with adjusted two sigma range
113+
auto fit1_mean = tf1_gaus.GetParameter(1);
114+
auto fit1_2std = 2 * tf1_gaus.GetParameter(2);
115+
tf1_gaus.SetRange(fit1_mean-fit1_2std, fit1_mean+fit1_2std);
111116
th1ptr->Fit(&tf1_gaus, "RQ");
117+
112118
std::ostringstream write_name;
113119
write_name << "Signal " << name << " " << beam_energy << " GeV";
114120
th1ptr->SetTitle((write_name.str()+";Signal [a.u.];count").c_str());
@@ -259,7 +265,13 @@ GausFitRes fit_eraw_hist(TF1& tf1_gaus, TH1* th1ptr,
259265
tf1_gaus.SetParameter(2, 0.45 * th1_2std);
260266
// Fit only in two sigma range
261267
tf1_gaus.SetRange(th1_mean-th1_2std, th1_mean+th1_2std);
268+
th1ptr->Fit(&tf1_gaus, "RQN");
269+
// Second fit with adjusted two sigma range
270+
auto fit1_mean = tf1_gaus.GetParameter(1);
271+
auto fit1_2std = 2 * tf1_gaus.GetParameter(2);
272+
tf1_gaus.SetRange(fit1_mean-fit1_2std, fit1_mean+fit1_2std);
262273
th1ptr->Fit(&tf1_gaus, "RQ");
274+
263275
std::ostringstream write_name;
264276
write_name << "Signal EM-Scale " << name << " " << beam_energy << " GeV";
265277
th1ptr->SetTitle((write_name.str()+";E^\\text{raw}\\,\\text{[GeV]};count").c_str());
@@ -451,7 +463,8 @@ void TBrun_all() {
451463
#endif
452464

453465
// Book EM-Scale histograms
454-
ROOT::RDF::TH1DModel th1dm_eraw {"th1dm_eraw", "th1dm_eraw", 200, 5., 45.};
466+
ROOT::RDF::TH1DModel th1dm_eraw {"th1dm_eraw", "th1dm_eraw", th1dm_sdep.fNbinsX,
467+
th1dm_sdep.fXLow / r_mean_el, th1dm_sdep.fXUp / r_mean_el};
455468
BEarray<ROOT::RDF::RResultPtr<TH1D>> th1s_eraw_pi, th1s_eraw_k, th1s_eraw_p;
456469
for (std::size_t n = 0; n < BEAM_ENERGIES.size(); ++n) {
457470
th1s_eraw_pi[n] = book_eraw_hist(th1dm_eraw, std::get<2>(rdfs_pi_filters), BEAM_ENERGIES[n]);

0 commit comments

Comments
 (0)