diff --git a/common/DiffractionExperiment.cpp b/common/DiffractionExperiment.cpp index c0757122..0bc1f0d7 100644 --- a/common/DiffractionExperiment.cpp +++ b/common/DiffractionExperiment.cpp @@ -78,12 +78,18 @@ DiffractionExperiment::DiffractionExperiment(const DetectorGeometry& geom) { internal.set_storage_cells(1); internal.set_storage_cell_start(15); - *internal.mutable_conv_geometry() = geom; - + Geometry(geom); Mode(DetectorMode::Conversion); } // setter functions +DiffractionExperiment &DiffractionExperiment::Geometry(const DetectorGeometry &input) { + check_min("Number of modules", input.GetModulesNum(), 1); + check_max("Number of modules", input.GetModulesNum(), 64); // if operating > 32M, would need to check the code anyway + + *internal.mutable_conv_geometry() = input; + return *this; +} DiffractionExperiment &DiffractionExperiment::Mode(DetectorMode input) { switch (input) { diff --git a/common/DiffractionExperiment.h b/common/DiffractionExperiment.h index 6a8277cd..8400ac10 100644 --- a/common/DiffractionExperiment.h +++ b/common/DiffractionExperiment.h @@ -36,6 +36,7 @@ public: explicit DiffractionExperiment(const JFJochProtoBuf::JungfraujochSettings &settings); // Methods below can be chained together + DiffractionExperiment& Geometry(const DetectorGeometry &input); DiffractionExperiment& Mode(DetectorMode input); DiffractionExperiment& DataStreams(int64_t input);