31 static constexpr auto RESIDUAL_BIN_NUM = 500;
32 static constexpr auto PAR_BIN_NUM = 400;
34 static constexpr auto MAX_TIME_SEC = 800;
35 static constexpr auto TIME_BIN_NUM = 800;
36 static constexpr auto TIME_US_MAX = 100.;
37 static constexpr auto ITER_BIN_NUM = 200;
38 static constexpr auto ITER_MAX = 200.;
40 static const auto SLOPE_MAX = 10.;
41 static const auto OFFSET_MAX = 200.;
42 static constexpr auto residual_bin_num = 1000;
43 static constexpr auto max_residual = 300.;
44 static constexpr auto max_diff = 50;
46 auto set_x_title = [](
auto* hist, std::string_view title) ->
void { hist->GetXaxis()->SetTitle(title.data()); };
47 auto set_y_title = [](
auto* hist, std::string_view title) ->
void { hist->GetYaxis()->SetTitle(title.data()); };
50 "fit_time_duration",
"Time spent to fit the tracks", TIME_BIN_NUM, 0., TIME_US_MAX);
55 "fit_iterations",
"Iterations used to fit the tracks", ITER_BIN_NUM, 0., ITER_MAX);
56 set_y_title(
hist_fit_iterations_, fmt::format(
"Entries per {} iteration", ITER_MAX / ITER_BIN_NUM));
59 hist_a_xz_ = histograms.
add_hist<TH1D>(
"a_xz",
"slope of the xz plane", PAR_BIN_NUM, 0., SLOPE_MAX);
61 set_y_title(
hist_a_xz_, fmt::format(
"counts per {}", SLOPE_MAX / PAR_BIN_NUM));
63 hist_b_xz_ = histograms.
add_hist<TH1D>(
"b_xz",
"offset of the xz plane", PAR_BIN_NUM, 0., OFFSET_MAX);
65 set_y_title(
hist_b_xz_, fmt::format(
"counts per {}", OFFSET_MAX / PAR_BIN_NUM));
67 hist_a_yz_ = histograms.
add_hist<TH1D>(
"a_yz",
"slope of the yz plane", PAR_BIN_NUM, 0., SLOPE_MAX);
69 set_y_title(
hist_a_yz_, fmt::format(
"counts per {}", SLOPE_MAX / PAR_BIN_NUM));
71 hist_b_yz_ = histograms.
add_hist<TH1D>(
"b_yz",
"offset of the yz plane", PAR_BIN_NUM, 0., OFFSET_MAX);
73 set_y_title(
hist_b_yz_, fmt::format(
"counts per {}", OFFSET_MAX / PAR_BIN_NUM));
76 "counts of each module used for t_diff relation",
84 "difference between the fitted line and time values",
95 "difference between the fitted line and bar positions",
138 auto before_fit = std::chrono::steady_clock::now();
163 std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - before_fit);
183 auto predict = [](
const TrackFitPar& par,
double val) ->
double {
return (par.
slope * val) + par.
offset; };
187 const auto z_pos = hit.position.Z().value;
188 const auto x_pos = hit.position.X().value;
189 const auto y_pos = hit.position.Y().value;
190 const auto module_num = hit.module_id + 1;
193 const auto [time_diff_pos, bar_diff_pos] =
194 is_horizontal ? std::tuple{ x_pos, y_pos } : std::tuple{ y_pos, x_pos };
195 const auto [time_diff_par, bar_diff_par] =
197 const auto time_diff_val = predict(time_diff_par, z_pos) - time_diff_pos;
198 const auto bar_diff_val = predict(bar_diff_par, z_pos) - bar_diff_pos;