v1.0.0-rc.31
This commit is contained in:
@@ -51,10 +51,19 @@ bool JFJochStateMachine::ImportPedestalG1G2(const JFJochReceiverOutput &receiver
|
||||
|
||||
void JFJochStateMachine::TakePedestalInternalAll(std::unique_lock<std::mutex> &ul) {
|
||||
if (experiment.GetDetectorSetup().GetDetectorType() == DetectorType::EIGER) {
|
||||
logger.Info("EIGER configuration");
|
||||
services.ConfigureDetector(experiment);
|
||||
logger.Info(" ... done ");
|
||||
return;
|
||||
try {
|
||||
logger.Info("EIGER configuration");
|
||||
services.ConfigureDetector(experiment);
|
||||
logger.Info(" ... done ");
|
||||
SetState(JFJochState::Idle,
|
||||
"EIGER detector configured",
|
||||
BrokerStatus::MessageSeverity::Success);
|
||||
return;
|
||||
} catch (const std::exception &e) {
|
||||
logger.Error("EIGER configuration error {}", e.what());
|
||||
SetState(JFJochState::Error, e.what(), BrokerStatus::MessageSeverity::Error);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
calibration = std::make_unique<JFCalibration>(experiment);
|
||||
@@ -402,6 +411,10 @@ std::optional<MeasurementStatistics> JFJochStateMachine::GetMeasurementStatistic
|
||||
tmp.indexing_rate = rcv_status->indexing_rate;
|
||||
tmp.bkg_estimate = rcv_status->bkg_estimate;
|
||||
tmp.collection_efficiency = rcv_status->efficiency;
|
||||
tmp.error_pixels = rcv_status->error_pixels;
|
||||
tmp.saturated_pixels = rcv_status->saturated_pixels;
|
||||
tmp.roi_beam_sum = rcv_status->roi_beam_sum;
|
||||
tmp.roi_beam_npixel = rcv_status->roi_beam_npixel;
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
@@ -485,7 +498,7 @@ SpotFindingSettings JFJochStateMachine::GetSpotFindingSettings() const {
|
||||
}
|
||||
|
||||
void JFJochStateMachine::AddDetectorSetup(const DetectorSetup &setup) {
|
||||
std::unique_lock ul(m);
|
||||
// Not thread safe, only during setup
|
||||
|
||||
if (detector_setup.empty()) {
|
||||
experiment.Detector(setup);
|
||||
@@ -498,7 +511,6 @@ void JFJochStateMachine::AddDetectorSetup(const DetectorSetup &setup) {
|
||||
}
|
||||
|
||||
DetectorList JFJochStateMachine::GetDetectorsList() const {
|
||||
std::unique_lock ul(m);
|
||||
DetectorList ret;
|
||||
|
||||
for (const auto &i: detector_setup) {
|
||||
@@ -515,8 +527,10 @@ DetectorList JFJochStateMachine::GetDetectorsList() const {
|
||||
tmp.readout_time = i.GetReadOutTime();
|
||||
ret.detector.emplace_back(std::move(tmp));
|
||||
}
|
||||
|
||||
ret.current_id = current_detector_setup;
|
||||
{
|
||||
std::unique_lock ul(current_detector_setup_mutex);
|
||||
ret.current_id = current_detector_setup;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -539,7 +553,10 @@ void JFJochStateMachine::SelectDetector(int64_t id) {
|
||||
gain_calibration = detector_setup[id].GetGainCalibration();
|
||||
pixel_mask = PixelMask(experiment);
|
||||
SetState(JFJochState::Inactive, detector_setup[id].GetDescription() + " selected; please initialize");
|
||||
current_detector_setup = id;
|
||||
{
|
||||
std::unique_lock ul(current_detector_setup_mutex);
|
||||
current_detector_setup = id;
|
||||
}
|
||||
} catch (const JFJochException &e) {
|
||||
logger.ErrorException(e);
|
||||
SetState(JFJochState::Error, e.what(), BrokerStatus::MessageSeverity::Error);
|
||||
@@ -552,13 +569,15 @@ void JFJochStateMachine::SetRadialIntegrationSettings(const AzimuthalIntegration
|
||||
|
||||
if (IsRunning())
|
||||
throw WrongDAQStateException("Cannot change radial integration settings during data collection");
|
||||
|
||||
experiment.ImportRadialIntegrationSettings(settings);
|
||||
{
|
||||
std::unique_lock ul(experiment_azimuthal_integration_settings_mutex);
|
||||
experiment.ImportAzimuthalIntegrationSettings(settings);
|
||||
}
|
||||
}
|
||||
|
||||
AzimuthalIntegrationSettings JFJochStateMachine::GetRadialIntegrationSettings() const {
|
||||
std::unique_lock ul(m);
|
||||
return experiment.GetRadialIntegrationSettings();
|
||||
std::unique_lock ul(experiment_azimuthal_integration_settings_mutex);
|
||||
return experiment.GetAzimuthalIntegrationSettings();
|
||||
}
|
||||
|
||||
bool JFJochStateMachine::IsRunning() const {
|
||||
@@ -797,3 +816,38 @@ void JFJochStateMachine::SetMetadataSocketSettings(const ZMQMetadataSettings &in
|
||||
ZMQMetadataSettings JFJochStateMachine::GetMetadataSocketSettings() {
|
||||
return services.GetMetadataSocketSettings();
|
||||
}
|
||||
|
||||
void JFJochStateMachine::GetStartMessageFromBuffer(std::vector<uint8_t> &v) {
|
||||
return services.GetStartMessageFromBuffer(v);
|
||||
}
|
||||
|
||||
void JFJochStateMachine::GetImageFromBuffer(std::vector<uint8_t> &v, int64_t image_number) {
|
||||
return services.GetImageFromBuffer(v, image_number);
|
||||
}
|
||||
|
||||
ImageBufferStatus JFJochStateMachine::GetImageBufferStatus() const {
|
||||
return services.GetImageBufferStatus();
|
||||
}
|
||||
|
||||
void JFJochStateMachine::ClearImageBuffer() const {
|
||||
std::unique_lock ul(m);
|
||||
|
||||
if (IsRunning())
|
||||
throw WrongDAQStateException("Cannot clear image buffer during data collection");
|
||||
|
||||
services.ClearImageBuffer();
|
||||
}
|
||||
|
||||
FileWriterSettings JFJochStateMachine::GetFileWriterSettings() const {
|
||||
std::unique_lock ul(m);
|
||||
return experiment.GetFileWriterSettings();
|
||||
}
|
||||
|
||||
void JFJochStateMachine::LoadFileWriterSettings(const FileWriterSettings &settings) {
|
||||
std::unique_lock ul(m);
|
||||
|
||||
if (IsRunning())
|
||||
throw WrongDAQStateException("Cannot change instrument metadata during data collection");
|
||||
|
||||
experiment.ImportFileWriterSettings(settings);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user