version 1.0.0-rc.16

This commit is contained in:
2024-10-11 11:11:37 +02:00
parent 040c43084e
commit b605b95127
227 changed files with 3881 additions and 2176 deletions
+42 -5
View File
@@ -113,11 +113,11 @@ void DetectorWrapper::Initialize(const DiffractionExperiment& experiment,
det.loadTrimbits(trim_files[2 * i + 1], {2 * i + 1});
}
}
det.setTimingMode(slsDetectorDefs::timingMode::BURST_TRIGGER);
auto energy_threshold = experiment.GetEIGERThreshold_keV();
if (energy_threshold.has_value())
det.setThresholdEnergy(std::lround(energy_threshold.value() * 1000.0));
}
if (det_type == DetectorType::JUNGFRAU) {
auto tx_delay = experiment.GetDetectorSetup().GetTxDelay();
if (tx_delay.size() == experiment.GetModulesNum()) {
@@ -140,6 +140,27 @@ void DetectorWrapper::Initialize(const DiffractionExperiment& experiment,
}
}
switch (experiment.GetDetectorTiming()) {
case DetectorTiming::Auto:
det.setTimingMode(slsDetectorDefs::timingMode::AUTO_TIMING);
break;
case DetectorTiming::Trigger:
det.setTimingMode(slsDetectorDefs::timingMode::TRIGGER_EXPOSURE);
break;
case DetectorTiming::Burst:
if (det_type == DetectorType::JUNGFRAU)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Burst timing mode not supported with JUNGFRAU");
det.setTimingMode(slsDetectorDefs::timingMode::BURST_TRIGGER);
break;
case DetectorTiming::Gated:
if (det_type == DetectorType::JUNGFRAU)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Gated timing mode not supported with JUNGFRAU");
det.setTimingMode(slsDetectorDefs::timingMode::GATED);
break;
}
det.setHighVoltage(experiment.GetDetectorSetup().GetHighVoltage());
} catch (const std::exception &e) {
logger.ErrorException(e);
@@ -159,7 +180,13 @@ void DetectorWrapper::Start(const DiffractionExperiment& experiment) {
if (det.size() != 2 * experiment.GetModulesNum())
throw JFJochException(JFJochExceptionCategory::Detector,
"Discrepancy in module number between DAQ and detector");
// det.setThresholdEnergy(std::lround(experiment.GetPhotonEnergy_keV() * 1000.0/ 2.0));
auto energy_threshold = experiment.GetEIGERThreshold_keV();
if (!experiment.GetEIGERThreshold_keV().has_value()) {
int expected_threshold = std::lround(experiment.GetPhotonEnergy_keV() * 1000.0 / 2.0);
if (det.getThresholdEnergy().squash(0) != expected_threshold)
det.setThresholdEnergy(expected_threshold);
}
}
try {
@@ -240,6 +267,8 @@ void DetectorWrapper::Trigger() {
}
DetectorState DetectorWrapper::GetState() const {
if (det.empty())
return DetectorState::NOT_CONNECTED;
try {
bool is_idle = true;
bool is_waiting = true;
@@ -333,7 +362,15 @@ std::vector<int64_t> DetectorWrapper::GetHighVoltage() const {
}
DetectorStatus DetectorWrapper::GetStatus() const {
DetectorStatus status;
DetectorStatus status{};
if (det.empty())
return DetectorStatus{
.detector_state = DetectorState::NOT_CONNECTED,
.power_state = DetectorPowerState::OFF,
.detector_server_version = "N/A"
};
status.detector_server_version = GetDetectorServerVersion();
status.detector_state = GetState();
if (det_type == DetectorType::JUNGFRAU) {