diff --git a/manual/manual-api/mainClient.cpp b/manual/manual-api/mainClient.cpp index 3c3156aef..ae4859501 100644 --- a/manual/manual-api/mainClient.cpp +++ b/manual/manual-api/mainClient.cpp @@ -71,11 +71,6 @@ int main(int argc, char **argv) { /** - registering data callback */ pDetector->registerDataCallback(&dataCallback, NULL); - /** - if receiver exists, enable data streaming from receiver to get the data */ - pDetector->enableDataStreamingFromReceiver(1); - /** - create zmq sockets in client to enable data streaming in of data from receiver/different process */ - pDetector->enableDataStreamingToClient(1); - /** - ensuring detector status is idle before starting acquisition. exiting if not idle */ diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index e581f44c0..42518e718 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -1974,10 +1974,26 @@ void multiSlsDetector::resetFinalDataQueue() { GATE_INTEGRATED_TIME } */ -int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t){ +int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t, int imod){ int64_t ret=-100; + // single (for gotthard 25 um) + if (imod != -1) { + if (imod >= 0 && imod < thisMultiDetector->numberOfDetectors) { + if (detectors[imod]) { + ret = detectors[imod]->setTimer(index,t,imod); + if(detectors[imod]->getErrorMask()) + setErrorMask(getErrorMask()|(1<numberOfDetectors; ++idet){ if(detectors[idet]){ iret[idet]= new int64_t(-1); - Task* task = new Task(new func2_t(&slsDetector::setTimer, - detectors[idet],index,t,iret[idet])); + Task* task = new Task(new func3_t(&slsDetector::setTimer, + detectors[idet],index,t,imod,iret[idet])); threadpool->add_task(task); } } diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h index a7acd3e6b..83b644b4c 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h @@ -688,9 +688,10 @@ class multiSlsDetector : public slsDetectorUtils { set/get timer value \param index timer index \param t time in ns or number of...(e.g. frames, gates, probes) + \param imod module number (gotthard delay can have different values) \returns timer set value in ns or number of...(e.g. frames, gates, probes) */ - int64_t setTimer(timerIndex index, int64_t t=-1); + int64_t setTimer(timerIndex index, int64_t t=-1, int imod = -1); /** set/get timer value \param index timer index diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index f7ea9a49c..a5ec53775 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -4589,7 +4589,7 @@ int slsDetector::startAndReadAllNoWait(){ GATE_INTEGRATED_TIME } */ -int64_t slsDetector::setTimer(timerIndex index, int64_t t){ +int64_t slsDetector::setTimer(timerIndex index, int64_t t, int imod){ int fnum=F_SET_TIMER,fnum2=F_SET_RECEIVER_TIMER; diff --git a/slsDetectorSoftware/slsDetector/slsDetector.h b/slsDetectorSoftware/slsDetector/slsDetector.h index 5a9fbe813..4c8855b64 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.h +++ b/slsDetectorSoftware/slsDetector/slsDetector.h @@ -1205,9 +1205,10 @@ class slsDetector : public slsDetectorUtils, public energyConversion { set/get timer value \param index timer index \param t time in ns or number of...(e.g. frames, gates, probes) + \param imod module number (pointless in slsDetector) \returns timer set value in ns or number of...(e.g. frames, gates, probes) */ - int64_t setTimer(timerIndex index, int64_t t=-1); + int64_t setTimer(timerIndex index, int64_t t=-1, int imod = -1); /** get current timer value diff --git a/slsDetectorSoftware/slsDetector/slsDetectorBase.h b/slsDetectorSoftware/slsDetector/slsDetectorBase.h index 11dd4ac0b..b9b604c4e 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorBase.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorBase.h @@ -369,16 +369,17 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef set/get timer value \param index timer index \param t time in ns or number of...(e.g. frames, gates, probes) + \param imod module number \returns timer set value in ns or number of...(e.g. frames, gates, probes) */ - virtual int64_t setTimer(timerIndex index, int64_t t=-1)=0; - int64_t setExposureTime(int64_t t=-1){return setTimer(ACQUISITION_TIME,t);}; - int64_t setSubFrameExposureTime(int64_t t=-1){return setTimer(SUBFRAME_ACQUISITION_TIME,t);}; - int64_t setExposurePeriod(int64_t t=-1){return setTimer(FRAME_PERIOD,t);}; - int64_t setDelayAfterTrigger(int64_t t=-1){return setTimer(DELAY_AFTER_TRIGGER,t);}; - int64_t setNumberOfGates(int64_t t=-1){return setTimer(GATES_NUMBER,t);}; - int64_t setNumberOfFrames(int64_t t=-1){return setTimer(FRAME_NUMBER,t);}; - int64_t setNumberOfCycles(int64_t t=-1){return setTimer(CYCLES_NUMBER,t);}; + virtual int64_t setTimer(timerIndex index, int64_t t=-1, int imod = -1) = 0; + int64_t setExposureTime(int64_t t=-1, int imod = -1){return setTimer(ACQUISITION_TIME,t,imod);}; + int64_t setSubFrameExposureTime(int64_t t=-1, int imod = -1){return setTimer(SUBFRAME_ACQUISITION_TIME,t,imod);}; + int64_t setExposurePeriod(int64_t t=-1, int imod = -1){return setTimer(FRAME_PERIOD,t,imod);}; + int64_t setDelayAfterTrigger(int64_t t=-1, int imod = -1){return setTimer(DELAY_AFTER_TRIGGER,t,imod);}; + int64_t setNumberOfGates(int64_t t=-1, int imod = -1){return setTimer(GATES_NUMBER,t,imod);}; + int64_t setNumberOfFrames(int64_t t=-1, int imod = -1){return setTimer(FRAME_NUMBER,t,imod);}; + int64_t setNumberOfCycles(int64_t t=-1, int imod = -1){return setTimer(CYCLES_NUMBER,t,imod);}; /** sets/gets the value of important readout speed parameters diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp b/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp index 56d5606f6..d4a5e41df 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp @@ -151,43 +151,58 @@ int slsDetectorUsers::setThresholdEnergy(int e_eV){ return myDetector->setThresholdEnergy(e_eV); } -double slsDetectorUsers::setExposureTime(double t, bool inseconds){ - int64_t tms = (int64_t)(t * (1E+9)); - if (t < 0) tms = -1; +double slsDetectorUsers::setExposureTime(double t, bool inseconds, int imod){ if(!inseconds) - return myDetector->setExposureTime((int64_t)t); - else - return ((1E-9) * (double)myDetector->setExposureTime(tms)); + return myDetector->setExposureTime((int64_t)t,imod); + else { + // + 0.5 to round for precision lost from converting double to int64_t + int64_t tms = (int64_t)(t * (1E+9) + 0.5); + if (t < 0) tms = -1; + tms = myDetector->setExposureTime(tms,imod); + if (tms < 0) + return -1; + return ((1E-9) * (double)tms); + } } -double slsDetectorUsers::setExposurePeriod(double t, bool inseconds){ - int64_t tms = (int64_t)(t * (1E+9)); - if (t < 0) tms = -1; +double slsDetectorUsers::setExposurePeriod(double t, bool inseconds, int imod){ if(!inseconds) - return myDetector->setExposurePeriod((int64_t)t); - else - return ((1E-9) * (double)myDetector->setExposurePeriod(tms)); + return myDetector->setExposurePeriod((int64_t)t,imod); + else { + // + 0.5 to round for precision lost from converting double to int64_t + int64_t tms = (int64_t)(t * (1E+9) + 0.5); + if (t < 0) tms = -1; + tms = myDetector->setExposurePeriod(tms,imod); + if (tms < 0) + return -1; + return ((1E-9) * (double)tms); + } } -double slsDetectorUsers::setDelayAfterTrigger(double t, bool inseconds){ - int64_t tms = (int64_t)(t * (1E+9)); - if (t < 0) tms = -1; +double slsDetectorUsers::setDelayAfterTrigger(double t, bool inseconds, int imod){ if(!inseconds) - return myDetector->setDelayAfterTrigger((int64_t)t); - else - return ((1E-9) * (double)myDetector->setDelayAfterTrigger(tms)); + return myDetector->setDelayAfterTrigger((int64_t)t,imod); + else { + // + 0.5 to round for precision lost from converting double to int64_t + int64_t tms = (int64_t)(t * (1E+9) + 0.5); + if (t < 0) tms = -1; + tms = myDetector->setDelayAfterTrigger(tms,imod); + if (tms < 0) + return -1; + return ((1E-9) * (double)tms); + } } -int64_t slsDetectorUsers::setNumberOfGates(int64_t t){ - return myDetector->setNumberOfGates(t); +int64_t slsDetectorUsers::setNumberOfGates(int64_t t, int imod){ + return myDetector->setNumberOfGates(t,imod); } -int64_t slsDetectorUsers::setNumberOfFrames(int64_t t){ - return myDetector->setNumberOfFrames(t); +int64_t slsDetectorUsers::setNumberOfFrames(int64_t t, int imod){ + return myDetector->setNumberOfFrames(t,imod); } -int64_t slsDetectorUsers::setNumberOfCycles(int64_t t){ - return myDetector->setNumberOfCycles(t); +int64_t slsDetectorUsers::setNumberOfCycles(int64_t t, int imod){ + return myDetector->setNumberOfCycles(t,imod); } int slsDetectorUsers::setTimingMode(int pol){ diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUsers.h b/slsDetectorSoftware/slsDetector/slsDetectorUsers.h index a3e80d91e..159a70924 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUsers.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorUsers.h @@ -315,47 +315,53 @@ class slsDetectorUsers @short set/get exposure time value \param t time in sn (-1 gets) \param inseconds true if the value is in s, else ns + \param imod module number (-1 for all) \returns timer set value in ns, or s if specified */ - double setExposureTime(double t=-1, bool inseconds=false); + double setExposureTime(double t=-1, bool inseconds=false, int imod = -1); /** @short set/get exposure period \param t time in ns (-1 gets) \param inseconds true if the value is in s, else ns + \param imod module number (-1 for all) \returns timer set value in ns, or s if specified */ - double setExposurePeriod(double t=-1, bool inseconds=false); + double setExposurePeriod(double t=-1, bool inseconds=false, int imod = -1); /** @short set/get delay after trigger \param t time in ns (-1 gets) \param inseconds true if the value is in s, else ns + \param imod module number (-1 for all) \returns timer set value in ns, or s if specified */ - double setDelayAfterTrigger(double t=-1, bool inseconds=false); + double setDelayAfterTrigger(double t=-1, bool inseconds=false, int imod = -1); /** @short set/get number of gates \param t number of gates (-1 gets) + \param imod module number (-1 for all) \returns number of gates */ - int64_t setNumberOfGates(int64_t t=-1); + int64_t setNumberOfGates(int64_t t=-1, int imod = -1); /** @short set/get number of frames i.e. number of exposure per trigger \param t number of frames (-1 gets) + \param imod module number (-1 for all) \returns number of frames */ - int64_t setNumberOfFrames(int64_t t=-1); + int64_t setNumberOfFrames(int64_t t=-1, int imod = -1); /** @short set/get number of cycles i.e. number of triggers \param t number of frames (-1 gets) + \param imod module number (-1 for all) \returns number of frames */ - int64_t setNumberOfCycles(int64_t t=-1); + int64_t setNumberOfCycles(int64_t t=-1, int imod = -1); /** diff --git a/slsDetectorSoftware/threadFiles/Task.h b/slsDetectorSoftware/threadFiles/Task.h index 66b295ba2..ecaec14c8 100644 --- a/slsDetectorSoftware/threadFiles/Task.h +++ b/slsDetectorSoftware/threadFiles/Task.h @@ -127,7 +127,7 @@ protected: func2_t * m10; func2_t * m11; func2_t * m12; - func2_t * m13; + func3_t * m13; func2_t * m14; func3_t * m15; func4_t * m16; @@ -152,7 +152,7 @@ public: Task(func2_t * t): SuperTask(),fnum(10){m10 = t;}; Task(func2_t * t): SuperTask(),fnum(11){m11 = t;}; Task(func2_t * t): SuperTask(),fnum(12){m12 = t;}; - Task(func2_t * t): SuperTask(),fnum(13){m13 = t;}; + Task(func3_t * t): SuperTask(),fnum(13){m13 = t;}; Task(func2_t * t): SuperTask(),fnum(14){m14 = t;}; Task(func3_t * t): SuperTask(),fnum(15){m15 = t;}; Task(func4_t * t): SuperTask(),fnum(16){m16 = t;};