71 std::ifstream input(file_name);
72 if (!input.is_open()) {
73 LOG(error) << Form(
"[STS Charge Calibration] Error opening file: %s", file_name.c_str());
78 LOG(info) << Form(
"[STS Charge Calibration] Loading configuration from file: %s", file_name.c_str());
80 int32_t address, side, asic_idx, nb_channels, nb_adc;
81 double dyn_range, threshold, time_res, dead_time, noise, znr;
84 std::unique_ptr<CbmStsParAsic> default_asic =
85 std::make_unique<CbmStsParAsic>(128, 31, 75000., 3000., 5., 800., 1000., 3.9789e-3);
88 std::unique_ptr<CbmStsParModule> default_module = std::make_unique<CbmStsParModule>(2048, 128);
89 default_module->SetAllAsics(*default_asic);
92 while (std::getline(input, line)) {
98 std::istringstream str_stream(line);
99 str_stream >> std::hex >> address >> std::dec >> side >> asic_idx >> nb_channels >> nb_adc >> dyn_range >> threshold
100 >> time_res >> dead_time >> noise >> znr;
103 LOG(info) <<
"[STS Charge Calibration] Using same configuration for all modules";
110 fParams[address] = *default_module;
114 std::unique_ptr<CbmStsParAsic> custom_asic =
115 std::make_unique<CbmStsParAsic>(nb_channels, nb_adc, dyn_range, threshold, time_res, dead_time, noise, znr);
117 if (asic_idx == -1) {
119 LOG(info) << Form(
"[STS Charge Calibration] Using same configuration for all ASICs in module 0x%x", address);
120 fParams[address].SetAllAsics(*custom_asic);
124 LOG(info) << Form(
"[STS Charge Calibration] Using same configuration for all ASICs in module 0x%x, side %u",
126 for (
int idx = 0; idx < 8; idx++) {
127 fParams[address].SetAsic(idx + 8 * side, *custom_asic);
133 fParams[address].SetAsic(asic_idx, *custom_asic);
134 fParams[address].SetAsic(asic_idx + 8, *custom_asic);
137 fParams[address].SetAsic(asic_idx + 8 * side, *custom_asic);