DetectorSetup: Save gain calibration in shared pointer to avoid copying it when copying DiffractionExperiment

This commit is contained in:
2026-04-30 19:59:26 +02:00
parent 87fde1b32e
commit 58df84a324
4 changed files with 29 additions and 12 deletions
+12 -11
View File
@@ -40,14 +40,16 @@ DetectorSetup::DetectorSetup(const DetectorGeometryModular &geom, DetectorType d
DetectorSetup::DetectorSetup(std::shared_ptr<DetectorGeometry> in_geometry,
DetectorType in_detector_type,
const std::string &in_description,
const std::vector<std::string> &in_det_modules_hostname) :
geometry(std::move(in_geometry)),
description(in_description),
det_modules_hostname(in_det_modules_hostname),
detector_type(in_detector_type),
read_out_time(0),
min_frame_time(std::chrono::milliseconds(1)),
min_count_time(MIN_COUNT_TIME) {
const std::vector<std::string> &
in_det_modules_hostname)
: description(in_description),
geometry(std::move(in_geometry)),
det_modules_hostname(in_det_modules_hostname),
gain_calibration(std::make_shared<JFGainCalibration>()),
detector_type(in_detector_type),
read_out_time(0),
min_count_time(MIN_COUNT_TIME),
min_frame_time(std::chrono::milliseconds(1)) {
if (description.empty())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
@@ -124,8 +126,7 @@ void DetectorSetup::LoadGain(const std::vector<std::string> &filenames) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Mismatch in number of gain calibration files");
gain_file_names = filenames;
for (const auto& i: filenames)
gain_calibration.emplace_back(i);
gain_calibration->LoadGain(filenames);
}
DetectorSetup &DetectorSetup::UDPInterfaceCount(int64_t input) {
@@ -137,7 +138,7 @@ DetectorSetup &DetectorSetup::UDPInterfaceCount(int64_t input) {
}
const std::vector<JFModuleGainCalibration> &DetectorSetup::GetGainCalibration() const {
return gain_calibration;
return gain_calibration->GetCalibration();
}
int64_t DetectorSetup::GetUDPInterfaceCount() const {