27#include <fmt/format.h>
34 void fill_module_parameters(
const std::vector<R3BNeulandHitModulePar>& old_module_pars,
35 R3B::Neuland::Cal2HitPar& new_module_pars)
37#ifdef HAS_CPP_STANDARD_23
38 auto t_sync_ref_par_iter = std::ranges::find(
41 auto t_sync_ref_par_iter = std::find_if(old_module_pars.begin(),
42 old_module_pars.end(),
43 [](
const R3BNeulandHitModulePar& par)
44 { return par.GetModuleId() == DEFAULT_TSYNC_REFERENCE_BAR_NUM; });
46 if (t_sync_ref_par_iter == old_module_pars.end())
48 throw R3B::logic_error(
49 fmt::format(
"Reference module for tsync parameter with the module number {} doesn't exist!",
52 const auto t_sync_ref_value = t_sync_ref_par_iter->GetTSync();
54 for (
const auto& par : old_module_pars)
56 auto new_par = R3B::Neuland::HitModulePar{};
58 new_par.module_num = par.GetModuleId();
59 new_par.t_diff.value = par.GetTDiff();
60 new_par.t_sync.value = par.GetTSync() - t_sync_ref_value;
61 new_par.effective_speed.value = -2 * par.GetEffectiveSpeed();
62 new_par.light_attenuation_length.value = par.GetLightAttenuationLength();
63 new_par.light_attenuation_factor.value =
71 new_par.pedestal.left().value = par.GetPedestal(left_index);
72 new_par.pedestal.right().value = par.GetPedestal(right_index);
74 new_par.energy_gain.left().value = par.GetEnergyGain(left_index);
75 new_par.energy_gain.right().value = par.GetEnergyGain(right_index);
77 new_par.pmt_saturation.left().value = par.GetPMTSaturation(left_index);
78 new_par.pmt_saturation.right().value = par.GetPMTSaturation(right_index);
80 new_par.pmt_threshold.left().value = par.GetPMTThreshold(left_index);
81 new_par.pmt_threshold.right().value = par.GetPMTThreshold(right_index);
103 for (
const auto& signal : signals)
113 const auto module_id =
static_cast<int>(barSignal.
module_num - 1);
117 for (
const auto& calSignal : calData)
121 static_cast<int>(
toIndex(side)),
122 calSignal.leading_time.value - calSignal.trigger_time.value,
123 static_cast<int>(calSignal.time_over_threshold.value));
135 if (track.Interactions.empty() or added_points_num < 6)
137 R3BLOG(debug,
"Failed to get the cosmic track!");
#define R3BLOG(severity, x)
void AddModulePar(const HitModulePar &module_par)
auto GetModuleSize() const -> auto
void EndOfEvent(unsigned int event_num=0) override
void Calibrate(Cal2HitPar &hit_par) override
void add_bar_signal(const BarCalData &barSignal, Side side)
HitCalibrationEngine hit_cal_engine_
CosmicTracker cosmic_tracker_
void AddSignals(const std::vector< BarCalData > &signals) override
auto mkdir(std::string_view dir_name) -> auto *
Int_t GetModuleId() const
Accessor functions.
void SetNumberOfPlanes(const Int_t nPlanes)
constexpr auto DEFAULT_TSYNC_REFERENCE_BAR_NUM
constexpr auto BarsPerPlane
constexpr auto TotalBarLength
constexpr auto toIndex(Side side) -> size_t
std::vector< CalDataSignal > left
std::vector< CalDataSignal > right