Guidetector (#54)

* WIP

* dacWidget

* main WIP

* advanced WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* works

* updated gui to chrono

* review fixes

* unitque ptrs in gui
This commit is contained in:
Dhanya Thattil
2019-08-26 19:14:22 +02:00
committed by GitHub
parent 7a4c1161ab
commit aafe049a9b
31 changed files with 709 additions and 1138 deletions

View File

@ -61,7 +61,7 @@ class Detector {
Result<int64_t> getReceiverVersion(Positions pos = {}) const;
Result<defs::detectorType> getDetectorType(Positions pos = {}) const;
/** Gets the total number of detectors */
int size() const;
@ -233,7 +233,7 @@ class Detector {
*/
void stopAcquisition();
/**
/** TODO: initially was getting acq flag, if set, check if detctor idle, then set, else exception & abort
* Clears the acquiring flag. This has to be done manually
* after an acquisition was aborted.
*/
@ -249,7 +249,7 @@ class Detector {
Result<uint64_t> getStartingFrameNumber(Positions pos = {}) const;
/** [Eiger][Jungfrau] */
void setStartingFrameNumber(uint64_t value, Positions pos);
void setStartingFrameNumber(uint64_t value, Positions pos = {});
/** [Eiger] Sends an internal software trigger to the detector */
void sendSoftwareTrigger(Positions pos = {});
@ -655,10 +655,12 @@ class Detector {
/** [Eiger] deadtime in ns, 0 = disabled */
Result<ns> getRateCorrection(Positions pos = {}) const;
/** [Eiger] Sets default rate correction from trimbit file */
void setDefaultRateCorrection(Positions pos = {});
/** //TODO: default, get, set
* [Eiger] Set Rate correction
* 0 disable correction, < 0: default dead time from trimbit file, > 0
* custom deadtime (advanced)
* 0 disable correction, > 0 custom deadtime, cannot be -1
*/
void setRateCorrection(ns dead_time, Positions pos = {});

View File

@ -1552,11 +1552,16 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/
int setAutoComparatorDisableMode(int ival = -1, int detPos = -1); //
/**
* Set Default Rate correction from trimbit file ( Eiger)
* @param detPos -1 for all detectors in list or specific detector position
*/
void setDefaultRateCorrection(int detPos = -1); //
/**
* Set Rate correction ( Eiger)
* @param t dead time in ns - if 0 disable correction,
* if >0 set dead time to t, if < 0 set deadtime to default dead time
* for current settings
* if >0 set dead time to t, cannot be < 0
* @param detPos -1 for all detectors in list or specific detector position
*/
void setRateCorrection(int64_t t = 0, int detPos = -1); //

View File

@ -1280,10 +1280,15 @@ class slsDetector : public virtual slsDetectorDefs {
*/
sls_detector_module getModule();
/**
* Set Default Rate correction from trimbit file(Eiger)
*/
void setDefaultRateCorrection();
/**
* Set Rate correction (Eiger)
* @param t dead time in ns - if 0 disable correction,
* if >0 set dead time to t, if < 0 set deadtime to default dead time
* if >0 set dead time to t, cannot be < 0
* for current settings
*/
void setRateCorrection(int64_t t = 0);

View File

@ -250,14 +250,14 @@ void Detector::setTimingMode(defs::timingMode value, Positions pos) {
void Detector::acquire() { pimpl->acquire(); }
void Detector::startAcquisition() {
if (getUseReceiverFlag({}).squash())
if (getUseReceiverFlag().squash(true))
pimpl->Parallel(&slsDetector::startReceiver, {});
pimpl->Parallel(&slsDetector::startAcquisition, {});
}
void Detector::stopAcquisition() {
pimpl->Parallel(&slsDetector::stopAcquisition, {});
if (getUseReceiverFlag({}).squash()) // TODO: problem for acquire()
if (getUseReceiverFlag().squash(true))
pimpl->Parallel(&slsDetector::stopReceiver, {});
}
@ -768,9 +768,9 @@ void Detector::setRxAddGapPixels(bool enable) {
Result<bool> Detector::getParallelMode(Positions pos) const {
auto res = pimpl->Parallel(&slsDetector::setReadOutFlags, pos,
defs::GET_READOUT_FLAGS);
Result<bool> booleanRes;
for (unsigned int i = 0; i < res.size(); ++i) {
booleanRes[i] = (res[i] & defs::PARALLEL) ? true : false;
Result<bool> booleanRes(res.size());
for (size_t i = 0; i < res.size(); ++i) {
booleanRes[i] = res[i] & defs::PARALLEL;
}
return booleanRes;
}
@ -783,9 +783,9 @@ void Detector::setParallelMode(bool value, Positions pos) {
Result<bool> Detector::getOverFlowMode(Positions pos) const {
auto res = pimpl->Parallel(&slsDetector::setReadOutFlags, pos,
defs::GET_READOUT_FLAGS);
Result<bool> booleanRes;
for (unsigned int i = 0; i < res.size(); ++i) {
booleanRes[i] = (res[i] & defs::SHOW_OVERFLOW) ? true : false;
Result<bool> booleanRes(res.size());
for (size_t i = 0; i < res.size(); ++i) {
booleanRes[i] = res[i] & defs::SHOW_OVERFLOW;
}
return booleanRes;
}
@ -824,6 +824,10 @@ Result<ns> Detector::getRateCorrection(Positions pos) const {
return pimpl->Parallel(&slsDetector::getRateCorrection, pos);
}
void Detector::setDefaultRateCorrection(Positions pos) {
pimpl->Parallel(&slsDetector::setDefaultRateCorrection, pos);
}
void Detector::setRateCorrection(ns dead_time, Positions pos) {
pimpl->Parallel(&slsDetector::setRateCorrection, pos, dead_time.count());
}

View File

@ -2358,7 +2358,20 @@ int multiSlsDetector::setAutoComparatorDisableMode(int ival, int detPos) {
return sls::minusOneIfDifferent(r);
}
void multiSlsDetector::setDefaultRateCorrection(int detPos) {
// single
if (detPos >= 0) {
detectors[detPos]->setDefaultRateCorrection();
}
// multi
parallelCall(&slsDetector::setDefaultRateCorrection);
}
void multiSlsDetector::setRateCorrection(int64_t t, int detPos) {
if (t < 0) {
throw sls::RuntimeError("Dead time has to be greater or equal to 0");
}
// single
if (detPos >= 0) {
detectors[detPos]->setRateCorrection(t);

View File

@ -2719,6 +2719,13 @@ sls_detector_module slsDetector::getModule() {
return myMod;
}
void slsDetector::setDefaultRateCorrection() {
FILE_LOG(logDEBUG1) << "Setting Default Rate Correction";
int64_t arg = -1;
sendToDetector(F_SET_RATE_CORRECT, arg, nullptr);
shm()->deadTime = -1;
}
void slsDetector::setRateCorrection(int64_t t) {
FILE_LOG(logDEBUG1) << "Setting Rate Correction to " << t;
sendToDetector(F_SET_RATE_CORRECT, t, nullptr);