eiger server: changed subperiod to subdeadtime, changing subexptime or subdeadtime sets subperiod in eiger server

This commit is contained in:
2018-08-17 13:45:09 +02:00
parent 2a28333a96
commit 4e446f1f39
14 changed files with 110 additions and 83 deletions

View File

@ -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]);

View File

@ -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"); \
}};

View File

@ -598,9 +598,9 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
++i;
/*! \page timing
- <b>subperiod [i]</b> sets/gets sub frame period in s. Used in EIGER only in 32 bit mode. \c Returns \c (double with 9 decimal digits)
- <b>subdeadtime [i]</b> 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;
}

View File

@ -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);
}
}

View File

@ -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);
/************************************************************************