diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 8240f6c91..50d0d863b 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -1949,15 +1949,15 @@ Exposure Time of a sub frame. Only for Eiger in 32 bit mode <nobr> -Period between sub frames. Only for Eiger in 32 bit mode. +Dead time between sub frames. Only for Eiger in 32 bit mode. </nobr><br><nobr> Default value is 0. A value less than the required minimum is ignored. </nobr><br><nobr> - #subperiod# + #subdeadtime# </nobr> - Sub Frame Period: + Sub Frame Dead Time: diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index d07f51bb0..616d2ed4d 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -233,7 +233,7 @@ void qTabAdvanced::SetupWidgetWindow(){ spinSubExpTime->setValue(time); comboSubExpTimeUnit->setCurrentIndex((int)unit); //period - time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::SUBFRAME_PERIOD,-1)*(1E-9)))); + time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME,-1)*(1E-9)))); spinSubPeriod->setValue(time); comboSubPeriodUnit->setCurrentIndex((int)unit); @@ -1342,13 +1342,13 @@ void qTabAdvanced::SetSubPeriod() { "/" << spinSubPeriod->value() << qDefs::getUnitString((qDefs::timeUnit)comboSubPeriodUnit->currentIndex()) << endl; #endif - myDet->setTimer(slsDetectorDefs::SUBFRAME_PERIOD,(int64_t)timeNS); + myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME,(int64_t)timeNS); qDefs::checkErrorMessage(myDet,"qTabAdvanced::SetSubPeriod"); // update value in gui qDefs::timeUnit unit; double time = qDefs::getCorrectTime(unit,((double)( - myDet->setTimer(slsDetectorDefs::SUBFRAME_PERIOD,-1)*(1E-9)))); + myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME,-1)*(1E-9)))); spinSubPeriod->setValue(time); comboSubPeriodUnit->setCurrentIndex((int)unit); @@ -1605,7 +1605,7 @@ void qTabAdvanced::Refresh(){ comboSubExpTimeUnit->setCurrentIndex((int)unit); // subperiod - time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::SUBFRAME_PERIOD,-1)*(1E-9)))); + time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME,-1)*(1E-9)))); spinSubPeriod->setValue(time); comboSubPeriodUnit->setCurrentIndex((int)unit); diff --git a/slsDetectorSoftware/eigerDetectorServer/gitInfo.txt b/slsDetectorSoftware/eigerDetectorServer/gitInfo.txt index 63399ea00..3905c140d 100644 --- a/slsDetectorSoftware/eigerDetectorServer/gitInfo.txt +++ b/slsDetectorSoftware/eigerDetectorServer/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git -Repsitory UUID: b3ccd5e1a137ddb5f11bc88d51a80e9dd777bc09 -Revision: 346 +Repsitory UUID: 2a28333a96a40b7e48e68eee5be791b087a01b52 +Revision: 347 Branch: developer Last Changed Author: Dhanya_Thattil -Last Changed Rev: 3980 -Last Changed Date: 2018-08-15 18:03:20.000000002 +0200 ./Beb.c +Last Changed Rev: 3983 +Last Changed Date: 2018-08-16 18:51:42.000000002 +0200 ./Makefile.virtual diff --git a/slsDetectorSoftware/eigerDetectorServer/gitInfoEiger.h b/slsDetectorSoftware/eigerDetectorServer/gitInfoEiger.h index ebd9ee8b4..1d8a37c63 100644 --- a/slsDetectorSoftware/eigerDetectorServer/gitInfoEiger.h +++ b/slsDetectorSoftware/eigerDetectorServer/gitInfoEiger.h @@ -1,6 +1,6 @@ #define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git" -#define GITREPUUID "b3ccd5e1a137ddb5f11bc88d51a80e9dd777bc09" +#define GITREPUUID "2a28333a96a40b7e48e68eee5be791b087a01b52" #define GITAUTH "Dhanya_Thattil" -#define GITREV 0x3980 -#define GITDATE 0x20180815 +#define GITREV 0x3983 +#define GITDATE 0x20180816 #define GITBRANCH "developer" diff --git a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c index b1fa12e94..cb070d631 100644 --- a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c @@ -458,7 +458,7 @@ void setupDetector() { setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES); setTimer(ACQUISITION_TIME, DEFAULT_EXPTIME); setTimer(SUBFRAME_ACQUISITION_TIME, DEFAULT_SUBFRAME_EXPOSURE); - setTimer(SUBFRAME_PERIOD, DEFAULT_SUBFRAME_PERIOD); + setTimer(SUBFRAME_DEADTIME, DEFAULT_SUBFRAME_DEADTIME); setTimer(FRAME_PERIOD, DEFAULT_PERIOD); setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES); setDynamicRange(DEFAULT_DYNAMIC_RANGE); @@ -657,6 +657,8 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val){ /* parameters - timer */ int64_t setTimer(enum timerIndex ind, int64_t val){ + int64_t subdeadtime = 0; + int64_t subexptime = 0; switch(ind){ case FRAME_NUMBER: if(val >= 0){ @@ -694,11 +696,20 @@ int64_t setTimer(enum timerIndex ind, int64_t val){ case SUBFRAME_ACQUISITION_TIME: if(val >= 0){ - printf(" Setting sub exp time: %lldns\n",(long long int)val/10); + printf(" Setting sub exp time: %lldns\n",(long long int)val); #ifndef VIRTUAL + // calculate subdeadtime before settings subexptime + subdeadtime = Feb_Control_GetSubFramePeriod() - + Feb_Control_GetSubFrameExposureTime(); + Feb_Control_SetSubFrameExposureTime(val/10); + // set subperiod + Feb_Control_SetSubFramePeriod((val+subdeadtime)/10); #else + int64_t subdeadtime = eiger_virtual_subperiod*10 - + eiger_virtual_subexptime*10; eiger_virtual_subexptime = (val/(10)); + eiger_virtual_subperiod = (val+subdeadtime/10); #endif } #ifndef VIRTUAL @@ -707,19 +718,30 @@ int64_t setTimer(enum timerIndex ind, int64_t val){ return eiger_virtual_subexptime*10; #endif - case SUBFRAME_PERIOD: + case SUBFRAME_DEADTIME: +#ifndef VIRTUAL + // get subexptime + subexptime = Feb_Control_GetSubFrameExposureTime(); +#else + int64_t subexptime = eiger_virtual_subexptime*10; +#endif if(val >= 0){ - printf(" Setting sub period: %lldns\n",(long long int)val/10); + printf(" Setting sub period: %lldns = subexptime(%lld) + subdeadtime(%lld)\n", + (long long int)(val + subexptime), + (long long int)subexptime, + (long long int)val); + //calculate subperiod + val += subexptime; #ifndef VIRTUAL Feb_Control_SetSubFramePeriod(val/10); #else - eiger_virtual_subperiod = (val/(1E9)); + eiger_virtual_subperiod = (val/10); #endif } #ifndef VIRTUAL - return (Feb_Control_GetSubFramePeriod()); + return (Feb_Control_GetSubFramePeriod() - subexptime); #else - return eiger_virtual_subperiod*1e9; + return (eiger_virtual_subperiod*10 - subexptime); #endif case FRAME_PERIOD: diff --git a/slsDetectorSoftware/eigerDetectorServer/slsDetectorServer_defs.h b/slsDetectorSoftware/eigerDetectorServer/slsDetectorServer_defs.h index 31e8a0bbf..5eae871d9 100644 --- a/slsDetectorSoftware/eigerDetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorSoftware/eigerDetectorServer/slsDetectorServer_defs.h @@ -74,7 +74,7 @@ enum NETWORKINDEX {TXN_LEFT, TXN_RIGHT, TXN_FRAME,FLOWCTRL_10G}; #define DEFAULT_HIGH_VOLTAGE (0) #define DEFAULT_SETTINGS (DYNAMICGAIN) #define DEFAULT_SUBFRAME_EXPOSURE (2621440) // 2.6ms -#define DEFAULT_SUBFRAME_PERIOD (0) +#define DEFAULT_SUBFRAME_DEADTIME (0) #define DEFAULT_DYNAMIC_RANGE (16) #define DEFAULT_READOUT_MODE (NONPARALLEL) diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index 78c0d3813..db8c30abf 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -702,7 +702,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) { thisDetector->timerValue[SAMPLES_JCTB] = 1; thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME] = 0; thisDetector->timerValue[STORAGE_CELL_NUMBER] = 0; - thisDetector->timerValue[SUBFRAME_PERIOD] = 0; + thisDetector->timerValue[SUBFRAME_DEADTIME] = 0; thisDetector->actionMask = 0; for (int i = 0; i < MAX_ACTIONS; ++i) { strcpy(thisDetector->actionScript[i], "none"); @@ -2311,63 +2311,51 @@ int slsDetector::updateDetectorNoWait() { n += controlSocket->ReceiveDataOnly( &nm,sizeof(nm)); thisDetector->dataBytes=nm; - //t=setSettings(GET_SETTINGS); n += controlSocket->ReceiveDataOnly( &t,sizeof(t)); thisDetector->currentSettings=t; if((thisDetector->myDetectorType == EIGER) || (thisDetector->myDetectorType == MYTHEN)){ - //thr=getThresholdEnergy(); n += controlSocket->ReceiveDataOnly( &thr,sizeof(thr)); thisDetector->currentThresholdEV=thr; } - //retval=setFrames(tns); n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t)); thisDetector->timerValue[FRAME_NUMBER]=retval; - // retval=setExposureTime(tns); n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t)); thisDetector->timerValue[ACQUISITION_TIME]=retval; if(thisDetector->myDetectorType == EIGER){ - //retval=setSubFrameExposureTime(tns); n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t)); thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]=retval; - //retval=setSubFramePeriod(tns); n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t)); - thisDetector->timerValue[SUBFRAME_PERIOD]=retval; + thisDetector->timerValue[SUBFRAME_DEADTIME]=retval; } - //retval=setPeriod(tns); n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t)); thisDetector->timerValue[FRAME_PERIOD]=retval; if(thisDetector->myDetectorType != EIGER) { - //retval=setDelay(tns); n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t)); thisDetector->timerValue[DELAY_AFTER_TRIGGER]=retval; } - // retval=setGates(tns); if ((thisDetector->myDetectorType != JUNGFRAU) && (thisDetector->myDetectorType != EIGER)){ n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t)); thisDetector->timerValue[GATES_NUMBER]=retval; } - //retval=setProbes(tns); if (thisDetector->myDetectorType == MYTHEN){ n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t)); thisDetector->timerValue[PROBES_NUMBER]=retval; } - //retval=setTrains(tns); n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t)); thisDetector->timerValue[CYCLES_NUMBER]=retval; - //retval=setProbes(tns); if (thisDetector->myDetectorType == JUNGFRAUCTB){ n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t)); if (retval>=0) @@ -2376,10 +2364,7 @@ int slsDetector::updateDetectorNoWait() { thisDetector->roFlags=ro; - //retval=setProbes(tns); getTotalNumberOfChannels(); - // thisDetector->dataBytes=getTotalNumberOfChannels()* - //thisDetector->dynamicRange/8*thisDetector->timerValue[SAMPLES_JCTB]; } @@ -4299,7 +4284,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t, int imod) { //send acquisiton time/period/subexptime/frame/cycles/samples to receiver if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)|| (index==ACQUISITION_TIME) || (index==SUBFRAME_ACQUISITION_TIME) || - (index==SUBFRAME_PERIOD) || + (index==SUBFRAME_DEADTIME) || (index==SAMPLES_JCTB) || (index==STORAGE_CELL_NUMBER)){ string timername = getTimerType(index); if(ret != FAIL){ @@ -4350,7 +4335,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t, int imod) { setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET)); break; case SUBFRAME_ACQUISITION_TIME: - case SUBFRAME_PERIOD: + case SUBFRAME_DEADTIME: case SAMPLES_JCTB: setErrorMask((getErrorMask())|(RECEIVER_TIMER_NOT_SET)); break; @@ -5267,7 +5252,7 @@ string slsDetector::setReceiver(string receiverIP) { std::cout << "frame number:" << thisDetector->timerValue[FRAME_NUMBER] << endl; std::cout << "sub exp time:" << thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME] << endl; - std::cout << "sub period:" << thisDetector->timerValue[SUBFRAME_PERIOD] << endl; + std::cout << "sub dead time:" << thisDetector->timerValue[SUBFRAME_DEADTIME] << endl; std::cout << "dynamic range:" << thisDetector->dynamicRange << endl; std::cout << "flippeddatax:" << thisDetector->flippedData[X] << endl; if (thisDetector->myDetectorType == EIGER) { @@ -5313,7 +5298,7 @@ string slsDetector::setReceiver(string receiverIP) { if(thisDetector->myDetectorType == EIGER) { setTimer(SUBFRAME_ACQUISITION_TIME, thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]); - setTimer(SUBFRAME_PERIOD,thisDetector->timerValue[SUBFRAME_PERIOD]); + setTimer(SUBFRAME_DEADTIME,thisDetector->timerValue[SUBFRAME_DEADTIME]); } if(thisDetector->myDetectorType == JUNGFRAUCTB) setTimer(SAMPLES_JCTB,thisDetector->timerValue[SAMPLES_JCTB]); diff --git a/slsDetectorSoftware/slsDetector/slsDetectorBase.h b/slsDetectorSoftware/slsDetector/slsDetectorBase.h index 0c0fb5941..629375a47 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorBase.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorBase.h @@ -373,7 +373,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef 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 setSubFramePeriod(int64_t t=-1, int imod = -1){return setTimer(SUBFRAME_PERIOD,t,imod);}; + int64_t setSubFrameDeadTime(int64_t t=-1, int imod = -1){return setTimer(SUBFRAME_DEADTIME,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);}; @@ -862,8 +862,8 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0; }}; /** returns std::string from timer index - \param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER,PROBES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER, SUBFRAME_PERIOD - \returns std::string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number,probes_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time,storage_cell_number, subframe_period + \param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER,PROBES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER, SUBFRAME_DEADTIME + \returns std::string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number,probes_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time,storage_cell_number, SUBFRAME_DEADTIME */ static std::string getTimerType(timerIndex t){ \ switch (t) { \ @@ -882,7 +882,7 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0; case FRAMES_FROM_START_PG: return std::string("frames_from_start_pg"); \ case SAMPLES_JCTB: return std::string("samples_jctb"); \ case SUBFRAME_ACQUISITION_TIME: return std::string("subframe_acquisition_time"); \ - case SUBFRAME_PERIOD: return std::string("subframe_period"); \ + case SUBFRAME_DEADTIME: return std::string("subframe_deadtime"); \ case STORAGE_CELL_NUMBER: return std::string("storage_cell_number"); \ default: return std::string("unknown"); \ }}; diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index 4ad2afdfc..06ebd9cc6 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -598,9 +598,9 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) { ++i; /*! \page timing - - subperiod [i] sets/gets sub frame period in s. Used in EIGER only in 32 bit mode. \c Returns \c (double with 9 decimal digits) + - subdeadtime [i] sets/gets sub frame dead time in s. Subperiod is set in the detector = subexptime + subdeadtime. This value is normally a constant in the config file. Used in EIGER only in 32 bit mode. \c Returns \c (double with 9 decimal digits) */ - descrToFuncMap[i].m_pFuncName="subperiod"; // + descrToFuncMap[i].m_pFuncName="subdeadtime"; // descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer; ++i; @@ -5656,8 +5656,8 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) { index=SUBFRAME_ACQUISITION_TIME; else if (cmd=="period") index=FRAME_PERIOD; - else if (cmd=="subperiod") - index=SUBFRAME_PERIOD; + else if (cmd=="subdeadtime") + index=SUBFRAME_DEADTIME; else if (cmd=="delay") index=DELAY_AFTER_TRIGGER; else if (cmd=="gates") @@ -5696,7 +5696,7 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) { return string("cannot scan timer value ")+string(args[1]); if (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER || - index == SUBFRAME_PERIOD) { + index == SUBFRAME_DEADTIME) { // +0.5 for precision of eg.0.0000325 t = ( val * 1E9 + 0.5); }else t=(int64_t)val; @@ -5710,7 +5710,7 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) { if ((ret!=-1) && (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER || - index == SUBFRAME_PERIOD)) { + index == SUBFRAME_DEADTIME)) { rval=(double)ret*1E-9; sprintf(answer,"%0.9f",rval); } @@ -5739,7 +5739,7 @@ string slsDetectorCommand::helpTimer(int narg, char *args[], int action) { os << "samples t \t sets the number of samples expected from the jctb" << std::endl; os << "storagecells t \t sets number of storage cells per acquisition. For very advanced users only! For JUNGFRAU only. Range: 0-15. The #images = #frames * #cycles * (#storagecells+1)." << std::endl; os << "storagecell_start t \t sets the storage cell that stores the first acquisition of the series. Default is 0. For very advanced users only! For JUNGFRAU only. Range: 0-15." << std::endl; - os << "subperiod t \t sets sub frame period in s. Used in EIGER only in 32 bit mode. " << std::endl; + os << "subdeadtime t \t sets sub frame dead time in s. Subperiod is set in the detector = subexptime + subdeadtime. This value is normally a constant in the config file. Used in EIGER only in 32 bit mode. " << std::endl; os << std::endl; @@ -5756,7 +5756,7 @@ string slsDetectorCommand::helpTimer(int narg, char *args[], int action) { os << "samples \t gets the number of samples expected from the jctb" << std::endl; os << "storagecells \t gets number of storage cells per acquisition.For JUNGFRAU only." << std::endl; os << "storagecell_start \t gets the storage cell that stores the first acquisition of the series." << std::endl; - os << "subperiod \t gets sub frame period in s. Used in EIGER in 32 bit only." << std::endl; + os << "subperiod \t gets sub frame dead time in s. Used in EIGER in 32 bit only." << std::endl; os << std::endl; } diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp b/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp index c35d64dd4..0201bd59e 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp @@ -431,21 +431,31 @@ int slsDetectorUsers::getNMods() { return myDetector->getNMods(); } -double slsDetectorUsers::setSubFrameExposureTime(double t, bool inseconds){ - int64_t tms = (int64_t)(t * (1E+9)); - if (t < 0) tms = -1; - if(!inseconds) - return myDetector->setSubFrameExposureTime((int64_t)t); - else - return ((1E-9) * (double)myDetector->setSubFrameExposureTime(tms)); +double slsDetectorUsers::setSubFrameExposureTime(double t, bool inseconds, int imod){ + if(!inseconds) + return myDetector->setSubFrameExposureTime((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->setSubFrameExposureTime(tms,imod); + if (tms < 0) + return -1; + return ((1E-9) * (double)tms); + } } -double slsDetectorUsers::setSubFrameExposurePeriod(double t, bool inseconds){ - int64_t tms = (int64_t)(t * (1E+9)); - if (t < 0) tms = -1; - if(!inseconds) - return myDetector->setSubFramePeriod((int64_t)t); - else - return ((1E-9) * (double)myDetector->setSubFramePeriod(tms)); +double slsDetectorUsers::setSubFrameExposureDeadTime(double t, bool inseconds, int imod){ + if(!inseconds) + return myDetector->setSubFrameDeadTime((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->setSubFrameDeadTime(tms,imod); + if (tms < 0) + return -1; + return ((1E-9) * (double)tms); + } } diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUsers.h b/slsDetectorSoftware/slsDetector/slsDetectorUsers.h index 0b795f356..4101a3c47 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUsers.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorUsers.h @@ -738,17 +738,20 @@ class slsDetectorUsers * Set sub frame exposure time (only for Eiger) * @param i sub frame exposure time (-1 gets) * @param inseconds true if the value is in s, else ns + * @param imod module number (-1 for all) * @returns sub frame exposure time in ns, or s if specified */ - double setSubFrameExposureTime(double t=-1, bool inseconds=false); + double setSubFrameExposureTime(double t=-1, bool inseconds=false, int imod = -1); /** - * Set sub frame period (only for Eiger) - * @param i sub frame period (-1 gets) + * Set sub frame dead time (only for Eiger) + * Very advanced feature. Meant to be a constant in config file by an expert for each individual module + * @param i sub frame dead time (-1 gets) * @param inseconds true if the value is in s, else ns - * @returns sub frame period in ns, or s if specified + * @param imod module number (-1 for all) + * @returns sub frame dead time in ns, or s if specified */ - double setSubFrameExposurePeriod(double t=-1, bool inseconds=false); + double setSubFrameExposureDeadTime(double t=-1, bool inseconds=false, int imod = -1); /************************************************************************ diff --git a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c index 82a296847..2557212ba 100755 --- a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c +++ b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c @@ -2790,12 +2790,14 @@ int set_timer(int file_des) { #ifdef VERBOSE printf("setting timer %d to %lld ns\n",ind,tns); #endif + int64_t subexptime = 0; switch(ind) { #ifdef JUNGFRAUD case STORAGE_CELL_NUMBER: if (tns > MAX_STORAGE_CELL_VAL) { ret=FAIL; strcpy(mess,"Max Storage cell number should not exceed 15\n"); + cprintf(RED, "Warning: %s", mess); break; } #endif @@ -2804,14 +2806,19 @@ int set_timer(int file_des) { if (tns > ((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) ){ ret=FAIL; strcpy(mess,"Sub Frame exposure time should not exceed 5.368 seconds\n"); + cprintf(RED, "Warning: %s", mess); break; } retval = setTimer(ind,tns); break; - case SUBFRAME_PERIOD: - if (tns > ((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) ){ + case SUBFRAME_DEADTIME: + subexptime = setTimer(SUBFRAME_ACQUISITION_TIME, -1); + if ((tns + subexptime) > ((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) ){ ret=FAIL; - strcpy(mess,"Sub Frame Period should not exceed 5.368 seconds\n"); + sprintf(mess,"Sub Frame Period should not exceed 5.368 seconds. " + "So sub frame dead time should not exceed %lfu seconds (subexptime = %lf seconds)\n", + ((((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) - subexptime)/1E9), (subexptime/1E9)); + cprintf(RED, "Warning: %s", mess); break; } retval = setTimer(ind,tns); @@ -3651,7 +3658,7 @@ int send_update(int file_des) { if (n < 0) return printSocketReadError(); #ifdef SLS_DETECTOR_FUNCTION_LIST - retval=setTimer(SUBFRAME_PERIOD,GET_FLAG); + retval=setTimer(SUBFRAME_DEADTIME,GET_FLAG); #endif n = sendData(file_des,&retval,sizeof(int64_t),INT64); if (n < 0) return printSocketReadError(); diff --git a/slsReceiverSoftware/include/sls_receiver_defs.h b/slsReceiverSoftware/include/sls_receiver_defs.h index 812084b85..2b0227bb2 100755 --- a/slsReceiverSoftware/include/sls_receiver_defs.h +++ b/slsReceiverSoftware/include/sls_receiver_defs.h @@ -113,7 +113,7 @@ public: SAMPLES_JCTB, SUBFRAME_ACQUISITION_TIME, /**< subframe exposure time */ STORAGE_CELL_NUMBER, /**setSubExpTime(index[1]); break; - case SUBFRAME_PERIOD: - receiverBase->setSubPeriod(index[1]); + case SUBFRAME_DEADTIME: + receiverBase->setSubPeriod(index[1] + receiverBase->getSubExpTime()); break; case SAMPLES_JCTB: if (myDetectorType != JUNGFRAUCTB) { @@ -1079,8 +1079,8 @@ int slsReceiverTCPIPInterface::set_timer() { case SUBFRAME_ACQUISITION_TIME: retval=receiverBase->getSubExpTime(); break; - case SUBFRAME_PERIOD: - retval=receiverBase->getSubPeriod(); + case SUBFRAME_DEADTIME: + retval=(receiverBase->getSubPeriod() - receiverBase->getSubExpTime()); break; case SAMPLES_JCTB: if (myDetectorType != JUNGFRAUCTB) {