From bdfdd5dbdae89a9f1e8458bfb07e8ca991096f95 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Fri, 9 Aug 2019 11:55:27 +0200 Subject: [PATCH 1/3] WIP --- slsDetectorSoftware/include/Detector.h | 126 ++++++++++++++++-- .../include/multiSlsDetector.h | 6 +- slsDetectorSoftware/src/Detector.cpp | 112 +++++++++++----- 3 files changed, 195 insertions(+), 49 deletions(-) diff --git a/slsDetectorSoftware/include/Detector.h b/slsDetectorSoftware/include/Detector.h index 403fc8671..09f68284d 100644 --- a/slsDetectorSoftware/include/Detector.h +++ b/slsDetectorSoftware/include/Detector.h @@ -115,14 +115,6 @@ class Detector { Result getFileOverWrite(Positions pos = {}) const; void setFileOverWrite(bool value, Positions pos = {}); - // Time - Result getExptime(Positions pos = {}) const; - void setExptime(ns t, Positions pos = {}); - Result getSubExptime(Positions pos = {}) const; - void setSubExptime(ns t, Positions pos = {}); - Result getPeriod(Positions pos = {}) const; - void setPeriod(ns t, Positions pos = {}); - // dhanya /** * Get multidetector Id @@ -560,6 +552,33 @@ class Detector { */ void setNumberOfDigitalSamples(int64_t value, Positions pos = {}); + /** + * Get exposure time in ns + * @param pos detector position + * @returns exposure time in ns + */ + Result getExptime(Positions pos = {}) const; + + /** + * Set exposure time in ns + * @param value exposure time in ns + * @param pos detector position + */ + void setExptime(ns t, Positions pos = {}); + + /** + * Get period in ns + * @param pos detector position + * @returns period in ns + */ + Result getPeriod(Positions pos = {}) const; + + /** + * Set period in ns + * @param value period in ns + * @param pos detector position + */ + void setPeriod(ns t, Positions pos = {}); /** * Get delay after trigger in ns(Gotthard, Jungfrau) * @param pos detector position @@ -574,19 +593,32 @@ class Detector { */ void setDelayAfterTrigger(ns value, Positions pos = {}); + /** + * Get sub frame exposure time in ns (Eiger in 32 bit mode) + * @param pos detector position + * @returns sub frame exposure time in ns + */ + Result getSubExptime(Positions pos = {}) const; + + /** + * Set sub frame exposure time after trigger (Eiger in 32 bit mode) + * @param value sub frame exposure time in ns + * @param pos detector position + */ + void setSubExptime(ns t, Positions pos = {}); /** * Get sub frame dead time in ns (Eiger in 32 bit mode) * @param pos detector position - * @returns delay after trigger in ns + * @returns sub frame dead time in ns */ - Result getSubFrameDeadTime(Positions pos = {}) const; + Result getSubDeadTime(Positions pos = {}) const; /** * Set sub frame dead time after trigger (Eiger in 32 bit mode) - * @param value delay after trigger in ns + * @param value sub frame dead time in ns * @param pos detector position */ - void setSubFrameDeadTime(ns value, Positions pos = {}); + void setSubDeadTime(ns value, Positions pos = {}); /** * Get storage cell delay (Jungfrau) @@ -604,6 +636,76 @@ class Detector { */ void setStorageCellDelay(ns value, Positions pos = {}); + /** + * Get number of Frames left (Gotthard, Jungfrau, CTB) + * @param pos detector position + * @returns number of Frames left + */ + Result getNumberOfFramesLeft(Positions pos = {}) const; + + /** + * Get number of Cycles left (Gotthard, Jungfrau, CTB) + * @param pos detector position + * @returns number of Cycles left + */ + Result getNumberOfCyclesLeft(Positions pos = {}) const; + /** + * Get exposure time left in ns (Gotthard) + * @param pos detector position + * @returns exposure time left in ns + */ + Result getExptimeLeft(Positions pos = {}) const; + + /** + * Get period left in ns (Gotthard, Jungfrau, CTB) + * @param pos detector position + * @returns period left in ns + */ + Result getPeriodLeft(Positions pos = {}) const; + + /** + * Get delay after trigger left in ns(Gotthard, Jungfrau, CTB) + * @param pos detector position + * @returns delay after trigger left in ns + */ + Result getDelayAfterTriggerLeft(Positions pos = {}) const; + + /** + * Get number of frames from start up of detector (Jungfrau, CTB) + * @param pos detector position + * @returns number of frames from start up of detector + */ + Result getNumberOfFramesFromStart(Positions pos = {}) const; + + /** + * Get time from detector start in ns (Jungfrau, CTB) + * @param pos detector position + * @returns time from detector start in ns + */ + Result getActualTime(Positions pos = {}) const; + + /** + * Get timestamp at a frame start in ns(Jungfrau, CTB) + * @param pos detector position + * @returns timestamp at a frame start in ns + */ + Result getMeasurementTime(Positions pos = {}) const; + + /** + * Get measured period between previous two frames in ns (Eiger) + * @param pos detector position + * @returns measured period between previous two frames in ns + */ + Result getMeasuredPeriod(Positions pos = {}) const; + + /** + * Get measured sub frame period between previous two frames in ns (Eiger in + * 32 bit mode) + * @param pos detector position + * @returns measured sub frame period between previous two frames in ns + */ + Result getMeasuredSubFramePeriod(Positions pos = {}) const; + // Erik Result getFramesCaughtByReceiver(Positions pos = {}) const; diff --git a/slsDetectorSoftware/include/multiSlsDetector.h b/slsDetectorSoftware/include/multiSlsDetector.h index 1cf4076a0..34315ceaf 100755 --- a/slsDetectorSoftware/include/multiSlsDetector.h +++ b/slsDetectorSoftware/include/multiSlsDetector.h @@ -818,7 +818,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns sub frame dead time in ns, or s if specified */ - double getMeasuredPeriod(bool inseconds = false, int detPos = -1); + double getMeasuredPeriod(bool inseconds = false, int detPos = -1);// /** * Get sub period between previous two sub frames in 32 bit mode (EIGER) @@ -827,7 +827,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns sub frame dead time in ns, or s if specified */ - double getMeasuredSubFramePeriod(bool inseconds = false, int detPos = -1); + double getMeasuredSubFramePeriod(bool inseconds = false, int detPos = -1);// /** * Set/get timer value left in acquisition (not all implemented for all @@ -838,7 +838,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @returns timer set value in ns or number of...(e.g. frames, * probes) */ - int64_t getTimeLeft(timerIndex index, int detPos = -1); + int64_t getTimeLeft(timerIndex index, int detPos = -1);// /** * Set speed diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 4741a3bdd..b7812920f 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -51,11 +51,6 @@ Result Detector::getRegister(uint32_t addr, Positions pos) { return pimpl->Parallel(&slsDetector::readRegister, pos, addr); } -Result Detector::getExptime(Positions pos) const { - return pimpl->Parallel(&slsDetector::setTimer, pos, defs::ACQUISITION_TIME, - -1); -} - Result Detector::getStartingFrameNumber(Positions pos) const { return pimpl->Parallel(&slsDetector::getStartingFrameNumber, pos); } @@ -63,29 +58,6 @@ void Detector::setStartingFrameNumber(uint64_t value, Positions pos) { pimpl->Parallel(&slsDetector::setStartingFrameNumber, pos, value); } -void Detector::setExptime(ns t, Positions pos) { - pimpl->Parallel(&slsDetector::setTimer, pos, defs::ACQUISITION_TIME, - t.count()); -} - -Result Detector::getSubExptime(Positions pos) const { - return pimpl->Parallel(&slsDetector::setTimer, pos, - defs::SUBFRAME_ACQUISITION_TIME, -1); -} - -void Detector::setSubExptime(ns t, Positions pos) { - pimpl->Parallel(&slsDetector::setTimer, pos, - defs::SUBFRAME_ACQUISITION_TIME, t.count()); -} - -Result Detector::getPeriod(Positions pos) const { - return pimpl->Parallel(&slsDetector::setTimer, pos, defs::FRAME_PERIOD, -1); -} - -void Detector::setPeriod(ns t, Positions pos) { - pimpl->Parallel(&slsDetector::setTimer, pos, defs::FRAME_PERIOD, t.count()); -} - // File void Detector::setFileName(const std::string &fname, Positions pos) { pimpl->Parallel(&slsDetector::setFileName, pos, fname); @@ -366,15 +338,18 @@ void Detector::setNumberOfCycles(int64_t value) { } Result Detector::getNumberOfStorageCells() const { - return pimpl->Parallel(&slsDetector::setTimer, {}, defs::STORAGE_CELL_NUMBER, -1); + return pimpl->Parallel(&slsDetector::setTimer, {}, + defs::STORAGE_CELL_NUMBER, -1); } void Detector::setNumberOfStorageCells(int64_t value) { - pimpl->Parallel(&slsDetector::setTimer, {}, defs::STORAGE_CELL_NUMBER, value); + pimpl->Parallel(&slsDetector::setTimer, {}, defs::STORAGE_CELL_NUMBER, + value); } Result Detector::getNumberOfAnalogSamples(Positions pos) const { - return pimpl->Parallel(&slsDetector::setTimer, pos, defs::ANALOG_SAMPLES, -1); + return pimpl->Parallel(&slsDetector::setTimer, pos, defs::ANALOG_SAMPLES, + -1); } void Detector::setNumberOfAnalogSamples(int64_t value, Positions pos) { @@ -382,13 +357,32 @@ void Detector::setNumberOfAnalogSamples(int64_t value, Positions pos) { } Result Detector::getNumberOfDigitalSamples(Positions pos) const { - return pimpl->Parallel(&slsDetector::setTimer, pos, defs::DIGITAL_SAMPLES, -1); + return pimpl->Parallel(&slsDetector::setTimer, pos, defs::DIGITAL_SAMPLES, + -1); } void Detector::setNumberOfDigitalSamples(int64_t value, Positions pos) { pimpl->Parallel(&slsDetector::setTimer, pos, defs::DIGITAL_SAMPLES, value); } +Result Detector::getExptime(Positions pos) const { + return pimpl->Parallel(&slsDetector::setTimer, pos, defs::ACQUISITION_TIME, + -1); +} + +void Detector::setExptime(ns t, Positions pos) { + pimpl->Parallel(&slsDetector::setTimer, pos, defs::ACQUISITION_TIME, + t.count()); +} + +Result Detector::getPeriod(Positions pos) const { + return pimpl->Parallel(&slsDetector::setTimer, pos, defs::FRAME_PERIOD, -1); +} + +void Detector::setPeriod(ns t, Positions pos) { + pimpl->Parallel(&slsDetector::setTimer, pos, defs::FRAME_PERIOD, t.count()); +} + Result Detector::getDelayAfterTrigger(Positions pos) const { return pimpl->Parallel(&slsDetector::setTimer, pos, defs::DELAY_AFTER_TRIGGER, -1); @@ -399,12 +393,22 @@ void Detector::setDelayAfterTrigger(ns value, Positions pos) { value.count()); } -Result Detector::getSubFrameDeadTime(Positions pos) const { +Result Detector::getSubExptime(Positions pos) const { + return pimpl->Parallel(&slsDetector::setTimer, pos, + defs::SUBFRAME_ACQUISITION_TIME, -1); +} + +void Detector::setSubExptime(ns t, Positions pos) { + pimpl->Parallel(&slsDetector::setTimer, pos, + defs::SUBFRAME_ACQUISITION_TIME, t.count()); +} + +Result Detector::getSubDeadTime(Positions pos) const { return pimpl->Parallel(&slsDetector::setTimer, pos, defs::SUBFRAME_DEADTIME, -1); } -void Detector::setSubFrameDeadTime(ns value, Positions pos) { +void Detector::setSubDeadTime(ns value, Positions pos) { pimpl->Parallel(&slsDetector::setTimer, pos, defs::SUBFRAME_DEADTIME, value.count()); } @@ -419,6 +423,46 @@ void Detector::setStorageCellDelay(ns value, Positions pos) { value.count()); } +Result Detector::getNumberOfFramesLeft(Positions pos) const { + return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::FRAME_NUMBER); +} + +Result Detector::getNumberOfCyclesLeft(Positions pos) const { + return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::CYCLES_NUMBER); +} + +Result Detector::getExptimeLeft(Positions pos) const { + return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::ACQUISITION_TIME); +} + +Result Detector::getPeriodLeft(Positions pos) const { + return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::FRAME_PERIOD); +} + +Result Detector::getDelayAfterTriggerLeft(Positions pos) const { + return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::DELAY_AFTER_TRIGGER); +} + +Result Detector::getNumberOfFramesFromStart(Positions pos) const { + return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::FRAMES_FROM_START); +} + +Result Detector::getActualTime(Positions pos) const { + return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::ACTUAL_TIME); +} + +Result Detector::getMeasurementTime(Positions pos) const { + return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::MEASUREMENT_TIME); +} + +Result Detector::getMeasuredPeriod(Positions pos) const { + return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::MEASURED_PERIOD); +}; + +Result Detector::getMeasuredSubFramePeriod(Positions pos) const { + return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::MEASURED_SUBPERIOD); +}; + // Erik Result Detector::getFramesCaughtByReceiver(Positions pos) const { return pimpl->Parallel(&slsDetector::getFramesCaughtByReceiver, pos); From a3c5c1641732ae5477a4390a7b802053b300d9ca Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Fri, 9 Aug 2019 12:01:01 +0200 Subject: [PATCH 2/3] WIP --- slsDetectorSoftware/include/Result.h | 4 +++ slsDetectorSoftware/src/multiSlsDetector.cpp | 31 +++++--------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/slsDetectorSoftware/include/Result.h b/slsDetectorSoftware/include/Result.h index 193b37db6..9d5f2ae7e 100644 --- a/slsDetectorSoftware/include/Result.h +++ b/slsDetectorSoftware/include/Result.h @@ -107,6 +107,10 @@ template > class Result { */ T squash() const { return Squash(vec); } + /** + * If all elements are equal it returns the front value + * otherwise throws an exception with custom message provided + */ T tsquash(const std::string &error_msg) { if (equal()) return vec.front(); diff --git a/slsDetectorSoftware/src/multiSlsDetector.cpp b/slsDetectorSoftware/src/multiSlsDetector.cpp index 58fd11603..4a451ba1d 100755 --- a/slsDetectorSoftware/src/multiSlsDetector.cpp +++ b/slsDetectorSoftware/src/multiSlsDetector.cpp @@ -4160,34 +4160,19 @@ void multiSlsDetector::registerDataCallback( } int multiSlsDetector::setTotalProgress() { - int nf = 1, nc = 1, ns = 1; - - Result temp = Parallel(&slsDetector::setTimer, {}, FRAME_NUMBER, -1); - if (!temp.equal()) { - throw RuntimeError("Inconsistent number of frames"); - } - nf = temp.squash(); - - temp = Parallel(&slsDetector::setTimer, {}, CYCLES_NUMBER, -1); - if (!temp.equal()) { - throw RuntimeError("Inconsistent number of cycles"); - } - nc = temp.squash(); - - if (getDetectorTypeAsEnum() == JUNGFRAU) { - temp = Parallel(&slsDetector::setTimer, {}, STORAGE_CELL_NUMBER, -1); - if (!temp.equal()) { - throw RuntimeError("Inconsistent number of additional storage cells"); - } - ns = temp.squash() + 1; - } - + int nf = Parallel(&slsDetector::setTimer, {}, FRAME_NUMBER, -1).tsquash("Inconsistent number of frames"); + int nc = Parallel(&slsDetector::setTimer, {}, CYCLES_NUMBER, -1).tsquash("Inconsistent number of cycles"); if (nf == 0 || nc == 0) { throw RuntimeError("Number of frames or cycles is 0"); } - totalProgress = nf * nc * ns; + int ns = 1; + if (getDetectorTypeAsEnum() == JUNGFRAU) { + ns = Parallel(&slsDetector::setTimer, {}, STORAGE_CELL_NUMBER, -1).tsquash("Inconsistent number of additional storage cells"); + ++ns; + } + totalProgress = nf * nc * ns; FILE_LOG(logDEBUG1) << "nf " << nf << " nc " << nc << " ns " << ns; FILE_LOG(logDEBUG1) << "Set total progress " << totalProgress << std::endl; return totalProgress; From 1a60b59a48f8358ba306241ca690895719bdbbd3 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Fri, 9 Aug 2019 12:11:42 +0200 Subject: [PATCH 3/3] size --- slsDetectorGui/src/qTabAdvanced.cpp | 2 +- slsDetectorGui/src/qTabDataOutput.cpp | 4 ++-- slsDetectorGui/src/qTabDebugging.cpp | 2 +- slsDetectorGui/src/qTabDeveloper.cpp | 4 ++-- slsDetectorSoftware/include/Detector.h | 2 +- slsDetectorSoftware/include/multiSlsDetector.h | 6 +----- slsDetectorSoftware/include/multiSlsDetectorClient.h | 2 +- slsDetectorSoftware/include/slsDetectorUsers.h | 2 +- slsDetectorSoftware/src/Detector.cpp | 8 ++++---- slsDetectorSoftware/src/multiSlsDetector.cpp | 10 +++++----- slsDetectorSoftware/src/slsDetectorCommand.cpp | 2 +- slsDetectorSoftware/src/slsDetectorUsers.cpp | 4 ++-- 12 files changed, 22 insertions(+), 26 deletions(-) diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 9efa24faf..0faad922a 100755 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -124,7 +124,7 @@ void qTabAdvanced::PopulateDetectors() { SLOT(SetDetector(int))); comboDetector->clear(); - for (int i = 0; i < myDet->getNumberOfDetectors(); ++i) + for (int i = 0; i < myDet->size(); ++i) comboDetector->addItem(QString(myDet->getHostname(i).c_str())); comboDetector->setCurrentIndex(0); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 58942a86f..da7b9d55b 100755 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -80,8 +80,8 @@ void qTabDataOutput::PopulateDetectors() { comboDetector->clear(); comboDetector->addItem("All"); - if (myDet->getNumberOfDetectors() > 1) { - for (int i = 0; i < myDet->getNumberOfDetectors(); ++i) + if (myDet->size() > 1) { + for (int i = 0; i < myDet->size(); ++i) comboDetector->addItem(QString(myDet->getHostname(i).c_str())); } } diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index 936efcba5..a62373c50 100755 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -55,7 +55,7 @@ void qTabDebugging::PopulateDetectors() { FILE_LOG(logDEBUG) << "Populating detectors"; comboDetector->clear(); - for (int i = 0; i < myDet->getNumberOfDetectors(); ++i) { + for (int i = 0; i < myDet->size(); ++i) { comboDetector->addItem(QString(myDet->getHostname(i).c_str())); } } diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index e62f5ac4c..7326740ad 100755 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -124,8 +124,8 @@ void qTabDeveloper::PopulateDetectors() { comboDetector->clear(); comboDetector->addItem("All"); - if (myDet->getNumberOfDetectors() > 1) { - for (int i = 0; i < myDet->getNumberOfDetectors(); ++i) + if (myDet->size() > 1) { + for (int i = 0; i < myDet->size(); ++i) comboDetector->addItem(QString(myDet->getHostname(i).c_str())); } comboDetector->setCurrentIndex(0); diff --git a/slsDetectorSoftware/include/Detector.h b/slsDetectorSoftware/include/Detector.h index c9f080aef..ae35ccbd6 100644 --- a/slsDetectorSoftware/include/Detector.h +++ b/slsDetectorSoftware/include/Detector.h @@ -205,7 +205,7 @@ class Detector { * Returns the total number of detectors in the multidetector structure * @returns total number of detectors in the multidetector structure */ - int getTotalNumberOfDetectors() const; + int size() const; /** * Returns the number of detectors in the multidetector structure diff --git a/slsDetectorSoftware/include/multiSlsDetector.h b/slsDetectorSoftware/include/multiSlsDetector.h index 0383b3ea5..8fa7c3a55 100755 --- a/slsDetectorSoftware/include/multiSlsDetector.h +++ b/slsDetectorSoftware/include/multiSlsDetector.h @@ -381,7 +381,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * Returns the number of detectors in the multidetector structure * @returns number of detectors */ - int getNumberOfDetectors() const;// + int size() const;// /** * Returns number of detectors in dimension d @@ -872,10 +872,6 @@ class multiSlsDetector : public virtual slsDetectorDefs { */ int getDataBytes(int detPos = -1); - /** - * Returns the number of detectors in the multi structure*/ - size_t size() const { return detectors.size(); } - /** * Set/get dacs value * @param val value (in V) diff --git a/slsDetectorSoftware/include/multiSlsDetectorClient.h b/slsDetectorSoftware/include/multiSlsDetectorClient.h index e370d4905..c627d1813 100755 --- a/slsDetectorSoftware/include/multiSlsDetectorClient.h +++ b/slsDetectorSoftware/include/multiSlsDetectorClient.h @@ -101,7 +101,7 @@ class multiSlsDetectorClient { return; } } - if (parser.detector_id() >= detPtr->getNumberOfDetectors()) { + if (parser.detector_id() >= detPtr->size()) { os << "position is out of bounds.\n"; return; } diff --git a/slsDetectorSoftware/include/slsDetectorUsers.h b/slsDetectorSoftware/include/slsDetectorUsers.h index 1b93f9445..734aabbc8 100755 --- a/slsDetectorSoftware/include/slsDetectorUsers.h +++ b/slsDetectorSoftware/include/slsDetectorUsers.h @@ -99,7 +99,7 @@ public: * Returns the number of detectors in the multidetector structure * @returns number of detectors */ - int getNumberOfDetectors() const; + int size() const; /** * Returns the maximum number of channels of all detectors diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 7002fe296..014f14fd0 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -142,8 +142,8 @@ Result Detector::getDetectorTypeAsString(Positions pos) const { return pimpl->Parallel(&slsDetector::getDetectorTypeAsString, pos); } -int Detector::getTotalNumberOfDetectors() const { - return pimpl->getNumberOfDetectors(); +int Detector::size() const { + return pimpl->size(); } defs::coordinates Detector::getNumberOfDetectors() const { @@ -675,8 +675,8 @@ Result Detector::getAutoCompDisable(Positions pos) const { } void Detector::setPowerChip(bool on, Positions pos) { - if (on && pimpl->getNumberOfDetectors() > 3) { - for (int i = 0; i != pimpl->getNumberOfDetectors(); ++i) { + if (on && pimpl->size() > 3) { + for (int i = 0; i != pimpl->size(); ++i) { pimpl->powerChip(static_cast(on), i); usleep(1000 * 1000); } diff --git a/slsDetectorSoftware/src/multiSlsDetector.cpp b/slsDetectorSoftware/src/multiSlsDetector.cpp index 4a451ba1d..843fb1f41 100755 --- a/slsDetectorSoftware/src/multiSlsDetector.cpp +++ b/slsDetectorSoftware/src/multiSlsDetector.cpp @@ -660,7 +660,7 @@ std::string multiSlsDetector::getDetectorTypeAsString(int detPos) { return sls::concatenateIfDifferent(r); } -int multiSlsDetector::getNumberOfDetectors() const { return detectors.size(); } +int multiSlsDetector::size() const { return detectors.size(); } int multiSlsDetector::getNumberOfDetectors(dimension d) const { return multi_shm()->numberOfDetector[d]; @@ -747,7 +747,7 @@ void multiSlsDetector::setDetectorOffset(dimension d, int off, int detPos) { int multiSlsDetector::getQuad(int detPos) { int retval = detectors[0]->getQuad(); - if (retval && getNumberOfDetectors() > 1) { + if (retval && size() > 1) { throw RuntimeError("Quad type is available only for 1 Eiger Quad Half " "module, but it Quad is enabled for 1st readout"); } @@ -755,7 +755,7 @@ int multiSlsDetector::getQuad(int detPos) { } void multiSlsDetector::setQuad(const bool enable, int detPos) { - if (enable && getNumberOfDetectors() > 1) { + if (enable && size() > 1) { throw RuntimeError("Cannot set Quad type as it is available only for 1 " "Eiger Quad Half module."); } @@ -2238,7 +2238,7 @@ void multiSlsDetector::setROI(int n, ROI roiLimits[], int detPos) { ymin = roiLimits[i].ymin; ymax = roiLimits[i].ymax; - if (getNumberOfDetectors() > 1) { + if (size() > 1) { // check roi max values idet = decodeNChannel(xmax, ymax, channelX, channelY); FILE_LOG(logDEBUG1) << "Decoded Channel max vals: " << std::endl @@ -2885,7 +2885,7 @@ int multiSlsDetector::powerChip(int ival, int detPos) { } // multi delayed call for safety - if (ival >= 0 && getNumberOfDetectors() > 3) { + if (ival >= 0 && size() > 3) { std::vector r; r.reserve(detectors.size()); for (auto &d : detectors) { diff --git a/slsDetectorSoftware/src/slsDetectorCommand.cpp b/slsDetectorSoftware/src/slsDetectorCommand.cpp index 112fe18ed..c2a00202f 100755 --- a/slsDetectorSoftware/src/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/src/slsDetectorCommand.cpp @@ -2175,7 +2175,7 @@ std::string slsDetectorCommand::cmdAcquire(int narg, const char * const args[], if (action == HELP_ACTION) { return helpAcquire(HELP_ACTION); } - if (!myDet->getNumberOfDetectors()) { + if (!myDet->size()) { FILE_LOG(logERROR) << "This shared memory has no detectors added. Aborting."; return std::string("acquire failed"); } diff --git a/slsDetectorSoftware/src/slsDetectorUsers.cpp b/slsDetectorSoftware/src/slsDetectorUsers.cpp index 36f115d37..f4b83b178 100755 --- a/slsDetectorSoftware/src/slsDetectorUsers.cpp +++ b/slsDetectorSoftware/src/slsDetectorUsers.cpp @@ -4,8 +4,8 @@ -int slsDetectorUsers::getNumberOfDetectors() const { - return detector.getNumberOfDetectors(); +int slsDetectorUsers::size() const { + return detector.size(); } int slsDetectorUsers::getMaximumDetectorSize(int &nx, int &ny){