mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 18:10:40 +02:00
Merge branch 'developer' into testing
This commit is contained in:
commit
47b0e46f15
@ -59,11 +59,9 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
|
||||
private slots:
|
||||
void SetSaveFileName(QString val);
|
||||
void AcquireThread();
|
||||
void UpdatePlot();
|
||||
|
||||
signals:
|
||||
void StartAcquireSignal();
|
||||
void AcquireFinishedSignal();
|
||||
void AbortSignal();
|
||||
void UpdateSignal();
|
||||
@ -74,6 +72,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
void SetupPlots();
|
||||
void GetStatistics(double &min, double &max, double &sum);
|
||||
void DetachHists();
|
||||
void AcquireThread();
|
||||
static void GetAcquisitionFinishedCallBack(double currentProgress,
|
||||
int detectorStatus,
|
||||
void *this_pointer);
|
||||
|
@ -87,7 +87,6 @@ void qDrawPlot::SetupWidgetWindow() {
|
||||
|
||||
void qDrawPlot::Initialization() {
|
||||
connect(this, SIGNAL(UpdateSignal()), this, SLOT(UpdatePlot()));
|
||||
connect(this, SIGNAL(StartAcquireSignal()), this, SLOT(AcquireThread()));
|
||||
}
|
||||
|
||||
void qDrawPlot::SetupPlots() {
|
||||
@ -657,7 +656,8 @@ void qDrawPlot::StartAcquisition() {
|
||||
xyRangeChanged = true;
|
||||
}
|
||||
|
||||
emit StartAcquireSignal();
|
||||
QtConcurrent::run(this, &qDrawPlot::AcquireThread);
|
||||
|
||||
LOG(logDEBUG) << "End of Starting Acquisition in qDrawPlot";
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@ target_compile_definitions(ctbDetectorServer_virtual
|
||||
|
||||
target_link_libraries(ctbDetectorServer_virtual
|
||||
PUBLIC pthread rt slsProjectCWarnings
|
||||
m
|
||||
)
|
||||
|
||||
set_target_properties(ctbDetectorServer_virtual PROPERTIES
|
||||
|
Binary file not shown.
Binary file not shown.
@ -67,6 +67,7 @@ int eiger_extgating = 0;
|
||||
int eiger_extgatingpolarity = 0;
|
||||
int eiger_nexposures = 1;
|
||||
int eiger_ntriggers = 1;
|
||||
int eiger_tau_ns = 0;
|
||||
|
||||
|
||||
#ifdef VIRTUAL
|
||||
@ -477,6 +478,7 @@ void setupDetector() {
|
||||
getSubExpTime(DEFAULT_SUBFRAME_DEADTIME);
|
||||
setPeriod(DEFAULT_PERIOD);
|
||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||
eiger_dynamicrange = DEFAULT_DYNAMIC_RANGE;
|
||||
setDynamicRange(DEFAULT_DYNAMIC_RANGE);
|
||||
eiger_photonenergy = DEFAULT_PHOTON_ENERGY;
|
||||
setParallelMode(DEFAULT_PARALLEL_MODE);
|
||||
@ -488,6 +490,7 @@ void setupDetector() {
|
||||
setStartingFrameNumber(DEFAULT_STARTING_FRAME_NUMBER);
|
||||
setReadNLines(MAX_ROWS_PER_READOUT);
|
||||
//SetPhotonEnergyCalibrationParameters(-5.8381e-5,1.838515,5.09948e-7,-4.32390e-11,1.32527e-15);
|
||||
eiger_tau_ns = DEFAULT_RATE_CORRECTION;
|
||||
setRateCorrection(DEFAULT_RATE_CORRECTION);
|
||||
int enable[2] = {DEFAULT_EXT_GATING_ENABLE, DEFAULT_EXT_GATING_POLARITY};
|
||||
setExternalGating(enable);//disable external gating
|
||||
@ -532,31 +535,27 @@ int readRegister(uint32_t offset, uint32_t* retval) {
|
||||
|
||||
|
||||
int setDynamicRange(int dr) {
|
||||
#ifdef VIRTUAL
|
||||
if (dr > 0) {
|
||||
LOG(logINFO, ("Setting dynamic range: %d\n", dr));
|
||||
eiger_dynamicrange = dr;
|
||||
}
|
||||
return eiger_dynamicrange;
|
||||
#else
|
||||
// setting dr
|
||||
if (dr > 0) {
|
||||
LOG(logDEBUG1, ("Setting dynamic range: %d\n", dr));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetDynamicRange(dr)) {
|
||||
|
||||
//EigerSetBitMode(dr);
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||
if (Beb_SetUpTransferParameters(dr))
|
||||
eiger_dynamicrange = dr;
|
||||
else LOG(logERROR, ("Could not set bit mode in the back end\n"));
|
||||
if (!Beb_SetUpTransferParameters(dr)) {
|
||||
LOG(logERROR, ("Could not set bit mode in the back end\n"));
|
||||
return eiger_dynamicrange;
|
||||
}
|
||||
}
|
||||
}
|
||||
//make sure back end and front end have the same bit mode
|
||||
dr= Feb_Control_GetDynamicRange();
|
||||
|
||||
return dr;
|
||||
#endif
|
||||
eiger_dynamicrange = dr;
|
||||
}
|
||||
// getting dr
|
||||
#ifndef VIRTUAL
|
||||
eiger_dynamicrange = Feb_Control_GetDynamicRange();
|
||||
#endif
|
||||
return eiger_dynamicrange;
|
||||
}
|
||||
|
||||
|
||||
@ -842,8 +841,9 @@ int setModule(sls_detector_module myMod, char* mess) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// trimbits
|
||||
|
||||
#ifndef VIRTUAL
|
||||
// trimbits
|
||||
if (myMod.nchan == 0) {
|
||||
LOG(logINFO, ("Setting module without trimbits\n"));
|
||||
} else {
|
||||
@ -872,6 +872,7 @@ int setModule(sls_detector_module myMod, char* mess) {
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//rate correction
|
||||
@ -891,17 +892,24 @@ int setModule(sls_detector_module myMod, char* mess) {
|
||||
else {
|
||||
setDefaultSettingsTau_in_nsec(myMod.tau);
|
||||
if (getRateCorrectionEnable()) {
|
||||
int64_t retvalTau = setRateCorrection(myMod.tau);
|
||||
if (myMod.tau != retvalTau) {
|
||||
sprintf(mess, "Cannot set module. Could not set rate correction\n");
|
||||
if (setRateCorrection(myMod.tau) == FAIL) {
|
||||
sprintf(mess, "Cannot set module. Rate correction failed.\n");
|
||||
LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n"));
|
||||
return FAIL;
|
||||
return FAIL;
|
||||
} else {
|
||||
int64_t retvalTau = getCurrentTau();
|
||||
if (myMod.tau != retvalTau) {
|
||||
sprintf(mess, "Cannot set module. Could not set rate correction\n");
|
||||
LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n"));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -1449,12 +1457,59 @@ int pulseChip(int n) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t setRateCorrection(int64_t custom_tau_in_nsec) {//in nanosec (will never be -1)
|
||||
int updateRateCorrection(char* mess) {
|
||||
int ret = OK;
|
||||
// recalculates rate correction table, or switches off in wrong bit mode
|
||||
if (eiger_tau_ns != 0) {
|
||||
switch (eiger_dynamicrange) {
|
||||
case 16:
|
||||
case 32:
|
||||
ret = setRateCorrection(eiger_tau_ns);
|
||||
break;
|
||||
default:
|
||||
setRateCorrection(0);
|
||||
strcpy(mess, "Rate correction Deactivated, must be in 32 or 16 bit mode");
|
||||
ret = FAIL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
getCurrentTau(); // update eiger_tau_ns
|
||||
return ret;
|
||||
}
|
||||
|
||||
int validateAndSetRateCorrection(int64_t tau_ns, char* mess) {
|
||||
// switching on in wrong bit mode
|
||||
if ((tau_ns != 0) &&
|
||||
(eiger_dynamicrange != 32) && (eiger_dynamicrange != 16)) {
|
||||
strcpy(mess,"Rate correction Deactivated, must be in 32 or 16 bit mode\n");
|
||||
LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
// default tau (-1, get proper value)
|
||||
if (tau_ns < 0) {
|
||||
tau_ns = getDefaultSettingsTau_in_nsec();
|
||||
if (tau_ns < 0) {
|
||||
strcpy(mess,"Default settings file not loaded. No default tau yet\n");
|
||||
LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
eiger_tau_ns = -1;
|
||||
}
|
||||
// user defined value (settings become undefined)
|
||||
else if (tau_ns > 0) {
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined (tau changed)\n"));
|
||||
eiger_tau_ns = tau_ns;
|
||||
}
|
||||
return setRateCorrection(tau_ns);
|
||||
}
|
||||
|
||||
int setRateCorrection(int64_t custom_tau_in_nsec) {//in nanosec (will never be -1)
|
||||
#ifdef VIRTUAL
|
||||
//deactivating rate correction
|
||||
if (custom_tau_in_nsec==0) {
|
||||
eiger_virtual_ratecorrection_variable = 0;
|
||||
return 0;
|
||||
return OK;
|
||||
}
|
||||
|
||||
//when dynamic range changes, use old tau
|
||||
@ -1484,22 +1539,21 @@ int64_t setRateCorrection(int64_t custom_tau_in_nsec) {//in nanosec (will never
|
||||
//different setting, calculate table
|
||||
else {
|
||||
eiger_virtual_ratetable_tau_in_ns = custom_tau_in_nsec;
|
||||
double period_in_sec = (double)(eiger_virtual_subexptime*10)/(double)1e9;
|
||||
eiger_virtual_ratetable_period_in_ns = eiger_virtual_subexptime*10;
|
||||
if (eiger_dynamicrange == 16)
|
||||
period_in_sec = eiger_virtual_exptime;
|
||||
eiger_virtual_ratetable_period_in_ns = period_in_sec*1e9;
|
||||
eiger_virtual_ratetable_period_in_ns = eiger_virtual_exptime;
|
||||
}
|
||||
//activating rate correction
|
||||
eiger_virtual_ratecorrection_variable = 1;
|
||||
LOG(logINFO, ("Rate Correction Value set to %lld ns\n",(long long int)eiger_virtual_ratetable_tau_in_ns));
|
||||
|
||||
return eiger_virtual_ratetable_tau_in_ns;
|
||||
return OK;
|
||||
#else
|
||||
|
||||
//deactivating rate correction
|
||||
if (custom_tau_in_nsec==0) {
|
||||
Feb_Control_SetRateCorrectionVariable(0);
|
||||
return 0;
|
||||
return OK;
|
||||
}
|
||||
|
||||
//when dynamic range changes, use old tau
|
||||
@ -1533,7 +1587,7 @@ int64_t setRateCorrection(int64_t custom_tau_in_nsec) {//in nanosec (will never
|
||||
if (ret<=0) {
|
||||
LOG(logERROR, ("Rate correction failed. Deactivating rate correction\n"));
|
||||
Feb_Control_SetRateCorrectionVariable(0);
|
||||
return ret;
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
//activating rate correction
|
||||
@ -1541,7 +1595,7 @@ int64_t setRateCorrection(int64_t custom_tau_in_nsec) {//in nanosec (will never
|
||||
LOG(logINFO, ("Rate Correction Value set to %lld ns\n", (long long int)Feb_Control_Get_RateTable_Tau_in_nsec()));
|
||||
Feb_Control_PrintCorrectedValues();
|
||||
|
||||
return Feb_Control_Get_RateTable_Tau_in_nsec();
|
||||
return OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1559,18 +1613,22 @@ int getDefaultSettingsTau_in_nsec() {
|
||||
|
||||
void setDefaultSettingsTau_in_nsec(int t) {
|
||||
default_tau_from_file = t;
|
||||
LOG(logINFO, ("Default tau set to %d\n", default_tau_from_file));
|
||||
LOG(logINFOBLUE, ("Default tau set to %d\n", default_tau_from_file));
|
||||
}
|
||||
|
||||
int64_t getCurrentTau() {
|
||||
if (!getRateCorrectionEnable())
|
||||
if (!getRateCorrectionEnable()) {
|
||||
eiger_tau_ns = 0;
|
||||
return 0;
|
||||
else
|
||||
}
|
||||
else {
|
||||
#ifndef VIRTUAL
|
||||
return Feb_Control_Get_RateTable_Tau_in_nsec();
|
||||
eiger_tau_ns = Feb_Control_Get_RateTable_Tau_in_nsec();
|
||||
#else
|
||||
return eiger_virtual_ratetable_tau_in_ns;
|
||||
eiger_tau_ns = eiger_virtual_ratetable_tau_in_ns;
|
||||
#endif
|
||||
return eiger_tau_ns;
|
||||
}
|
||||
}
|
||||
|
||||
void setExternalGating(int enable[]) {
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -31,6 +31,7 @@ target_compile_definitions(moenchDetectorServer_virtual
|
||||
|
||||
target_link_libraries(moenchDetectorServer_virtual
|
||||
PUBLIC pthread rt slsProjectCWarnings
|
||||
m
|
||||
)
|
||||
|
||||
set_target_properties(moenchDetectorServer_virtual PROPERTIES
|
||||
|
Binary file not shown.
Binary file not shown.
@ -413,7 +413,9 @@ int setCounterBit(int val);
|
||||
int pulsePixel(int n, int x, int y);
|
||||
int pulsePixelNMove(int n, int x, int y);
|
||||
int pulseChip(int n);
|
||||
int64_t setRateCorrection(int64_t custom_tau_in_nsec);
|
||||
int updateRateCorrection(char* mess);
|
||||
int validateAndSetRateCorrection(int64_t tau_ns, char* mess);
|
||||
int setRateCorrection(int64_t custom_tau_in_nsec);
|
||||
int getRateCorrectionEnable();
|
||||
int getDefaultSettingsTau_in_nsec();
|
||||
void setDefaultSettingsTau_in_nsec(int t);
|
||||
|
@ -217,3 +217,5 @@ int set_current_source(int);
|
||||
int get_timing_source(int);
|
||||
int set_timing_source(int);
|
||||
int get_num_channels(int);
|
||||
int update_rate_correction(int);
|
||||
|
||||
|
@ -317,6 +317,7 @@ const char* getFunctionName(enum detFuncs func) {
|
||||
case F_GET_TIMING_SOURCE: return "F_GET_TIMING_SOURCE";
|
||||
case F_SET_TIMING_SOURCE: return "F_SET_TIMING_SOURCE";
|
||||
case F_GET_NUM_CHANNELS: return "F_GET_NUM_CHANNELS";
|
||||
case F_UPDATE_RATE_CORRECTION: return "F_UPDATE_RATE_CORRECTION";
|
||||
|
||||
default: return "Unknown Function";
|
||||
}
|
||||
@ -510,6 +511,7 @@ void function_table() {
|
||||
flist[F_GET_TIMING_SOURCE] = &get_timing_source;
|
||||
flist[F_SET_TIMING_SOURCE] = &set_timing_source;
|
||||
flist[F_GET_NUM_CHANNELS] = &get_num_channels;
|
||||
flist[F_UPDATE_RATE_CORRECTION] = &update_rate_correction;
|
||||
|
||||
// check
|
||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||
@ -2844,61 +2846,12 @@ int send_update(int file_des) {
|
||||
ret = OK;
|
||||
int n = 0;
|
||||
int i32 = -1;
|
||||
int64_t i64 = -1;
|
||||
|
||||
i32 = lastClientIP;
|
||||
i32 = __builtin_bswap32(i32);
|
||||
n = sendData(file_des, &i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
// dr
|
||||
i32 = setDynamicRange(GET_FLAG);
|
||||
n = sendData(file_des,&i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
// settings
|
||||
#if defined(EIGERD) || defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(GOTTHARD2D)|| defined(MOENCHD)
|
||||
i32 = (int)getSettings();
|
||||
n = sendData(file_des,&i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
#endif
|
||||
|
||||
// #frames
|
||||
i64 = getNumFrames();
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
// #storage cell
|
||||
#ifdef JUNGFRAUD
|
||||
i64 = getNumAdditionalStorageCells();
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
#endif
|
||||
|
||||
// #triggers
|
||||
i64 = getNumTriggers();
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
// #bursts
|
||||
#ifdef GOTTHARD2D
|
||||
i64 = getNumBursts();
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
#endif
|
||||
|
||||
// timing mode
|
||||
i32 = (int)getTiming();
|
||||
n = sendData(file_des,&i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
// burst mode
|
||||
#ifdef GOTTHARD2D
|
||||
i32 = (int)getBurstMode();
|
||||
n = sendData(file_des,&i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
#endif
|
||||
|
||||
// number of channels
|
||||
#if defined(MOENCHD) || defined(CHIPTESTBOARDD)
|
||||
{
|
||||
@ -3498,35 +3451,13 @@ int set_rate_correct(int file_des) {
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
|
||||
int dr = setDynamicRange(-1);
|
||||
|
||||
// switching on in wrong bit mode
|
||||
if ((tau_ns != 0) && (dr != 32) && (dr != 16)) {
|
||||
ret = FAIL;
|
||||
strcpy(mess,"Rate correction Deactivated, must be in 32 or 16 bit mode\n");
|
||||
LOG(logERROR,(mess));
|
||||
}
|
||||
|
||||
// switching on in right mode
|
||||
else {
|
||||
if (tau_ns < 0) {
|
||||
tau_ns = getDefaultSettingsTau_in_nsec();
|
||||
if (tau_ns < 0) {
|
||||
ret = FAIL;
|
||||
strcpy(mess,"Default settings file not loaded. No default tau yet\n");
|
||||
LOG(logERROR,(mess));
|
||||
}
|
||||
}
|
||||
else if (tau_ns > 0) {
|
||||
//changing tau to a user defined value changes settings to undefined
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined (tau changed)\n"));
|
||||
}
|
||||
if (ret == OK) {
|
||||
int64_t retval = setRateCorrection(tau_ns);
|
||||
validate64(tau_ns, retval, "set rate correction", DEC);
|
||||
}
|
||||
ret = validateAndSetRateCorrection(tau_ns, mess);
|
||||
int64_t retval = getCurrentTau(); // to update eiger_tau_ns (for update rate correction)
|
||||
if (ret == FAIL) {
|
||||
strcpy(mess, "Rate correction failed\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
validate64(tau_ns, retval, "set rate correction", DEC);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -6930,4 +6861,22 @@ int get_num_channels(int file_des) {
|
||||
LOG(logDEBUG1, ("Get number of channels sretval:[%d, %d]\n", retvals[0], retvals[1]));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, retvals, sizeof(retvals));
|
||||
}
|
||||
|
||||
|
||||
|
||||
int update_rate_correction(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
||||
#ifndef EIGERD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
LOG(logINFO, ("Update Rate Correction\n"));
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
ret = updateRateCorrection(mess);
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
@ -785,6 +785,47 @@ std::vector<std::string> CmdProxy::DacCommands() {
|
||||
}
|
||||
|
||||
/* acquisition */
|
||||
|
||||
std::string CmdProxy::ReceiverStatus(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "running, idle]\n\tReceiver listener status."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getReceiverStatus({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
throw sls::RuntimeError("Cannot put. Did you mean to use command 'rx_start' or 'rx_stop'?");
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::DetectorStatus(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[running, error, transmitting, finished, waiting, idle]\n\tDetector status."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getDetectorStatus({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
throw sls::RuntimeError("Cannot put. Did you mean to use command 'start' or 'stop'?");
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/* Network Configuration (Detector<->Receiver) */
|
||||
|
||||
std::string CmdProxy::UDPDestinationIP(int action) {
|
||||
|
@ -691,8 +691,8 @@ class CmdProxy {
|
||||
{"rx_stop", &CmdProxy::rx_stop},
|
||||
{"start", &CmdProxy::start},
|
||||
{"stop", &CmdProxy::stop},
|
||||
{"rx_status", &CmdProxy::rx_status},
|
||||
{"status", &CmdProxy::status},
|
||||
{"rx_status", &CmdProxy::ReceiverStatus},
|
||||
{"status", &CmdProxy::DetectorStatus},
|
||||
{"rx_framescaught", &CmdProxy::rx_framescaught},
|
||||
{"rx_missingpackets", &CmdProxy::rx_missingpackets},
|
||||
{"startingfnum", &CmdProxy::startingfnum},
|
||||
@ -934,6 +934,8 @@ class CmdProxy {
|
||||
std::string DacValues(int action);
|
||||
std::vector<std::string> DacCommands();
|
||||
/* acquisition */
|
||||
std::string ReceiverStatus(int action);
|
||||
std::string DetectorStatus(int action);
|
||||
/* Network Configuration (Detector<->Receiver) */
|
||||
std::string UDPDestinationIP(int action);
|
||||
std::string UDPDestinationIP2(int action);
|
||||
@ -1363,12 +1365,6 @@ class CmdProxy {
|
||||
EXECUTE_SET_COMMAND_NOID(stop, stopDetector,
|
||||
"\n\tStops detector state machine.");
|
||||
|
||||
GET_COMMAND(rx_status, getReceiverStatus,
|
||||
"running, idle]\n\tReceiver listener status.");
|
||||
|
||||
GET_COMMAND(status, getDetectorStatus,
|
||||
"[running, error, transmitting, finished, waiting, idle]\n\tDetector status.");
|
||||
|
||||
GET_COMMAND(rx_framescaught, getFramesCaught,
|
||||
"\n\tNumber of frames caught by receiver.");
|
||||
|
||||
|
@ -234,8 +234,7 @@ Result<ns> Detector::getPeriodLeft(Positions pos) const {
|
||||
}
|
||||
|
||||
Result<defs::timingMode> Detector::getTimingMode(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::setTimingMode, pos,
|
||||
defs::GET_TIMING_MODE);
|
||||
return pimpl->Parallel(&Module::getTimingMode, pos);
|
||||
}
|
||||
|
||||
void Detector::setTimingMode(defs::timingMode value, Positions pos) {
|
||||
@ -923,7 +922,7 @@ void Detector::setClientZmqIp(const IpAddr ip, Positions pos) {
|
||||
// Eiger Specific
|
||||
|
||||
Result<int> Detector::getDynamicRange(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::setDynamicRange, pos, -1);
|
||||
return pimpl->Parallel(&Module::getDynamicRange, pos);
|
||||
}
|
||||
|
||||
void Detector::setDynamicRange(int value) {
|
||||
|
@ -462,6 +462,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
std::string currentFileName;
|
||||
uint64_t currentAcquisitionIndex = -1, currentFrameIndex = -1,
|
||||
currentFileIndex = -1;
|
||||
int currentProgress = -1;
|
||||
uint32_t currentSubFrameIndex = -1, coordX = -1, coordY = -1,
|
||||
flippedDataX = -1;
|
||||
|
||||
@ -540,6 +541,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
currentFileName = zHeader.fname;
|
||||
currentAcquisitionIndex = zHeader.acqIndex;
|
||||
currentFrameIndex = zHeader.frameIndex;
|
||||
currentProgress = zHeader.progress;
|
||||
currentFileIndex = zHeader.fileIndex;
|
||||
currentSubFrameIndex = zHeader.expLength;
|
||||
coordY = zHeader.row;
|
||||
@ -559,6 +561,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
<< "\n\tcurrentFrameIndex: " << currentFrameIndex
|
||||
<< "\n\tcurrentFileIndex: " << currentFileIndex
|
||||
<< "\n\tcurrentSubFrameIndex: " << currentSubFrameIndex
|
||||
<< "\n\tcurrentProgress: " << currentProgress
|
||||
<< "\n\tcoordX: " << coordX << "\n\tcoordY: " << coordY
|
||||
<< "\n\tflippedDataX: " << flippedDataX
|
||||
<< "\n\tcompleteImage: " << completeImage;
|
||||
@ -613,7 +616,6 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
|
||||
// send data to callback
|
||||
if (data) {
|
||||
setCurrentProgress(currentFrameIndex + 1);
|
||||
char* image = multiframe;
|
||||
int imagesize = multisize;
|
||||
|
||||
@ -630,7 +632,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
<< "\n\timagesize: " << imagesize
|
||||
<< "\n\tdynamicRange: " << dynamicRange;
|
||||
|
||||
thisData = new detectorData(getCurrentProgress(),
|
||||
thisData = new detectorData(currentProgress,
|
||||
currentFileName, nDetPixelsX, nDetPixelsY, image,
|
||||
imagesize, dynamicRange, currentFileIndex, completeImage);
|
||||
|
||||
@ -1004,38 +1006,6 @@ void DetectorImpl::registerDataCallback(void (*userCallback)(detectorData *,
|
||||
enableDataStreamingToClient(dataReady == nullptr ? 0 : 1);
|
||||
}
|
||||
|
||||
double DetectorImpl::setTotalProgress() {
|
||||
int64_t tot = Parallel(&Module::getTotalNumFramesToReceive, {})
|
||||
.tsquash("Inconsistent number of total frames (#frames x #triggers(or bursts) x #storage cells)");
|
||||
if (tot == 0) {
|
||||
throw RuntimeError("Invalid Total Number of frames (0)");
|
||||
}
|
||||
totalProgress = tot;
|
||||
LOG(logDEBUG1) << "Set total progress " << totalProgress << std::endl;
|
||||
return totalProgress;
|
||||
}
|
||||
|
||||
double DetectorImpl::getCurrentProgress() {
|
||||
std::lock_guard<std::mutex> lock(mp);
|
||||
return 100. * progressIndex / totalProgress;
|
||||
}
|
||||
|
||||
void DetectorImpl::incrementProgress() {
|
||||
std::lock_guard<std::mutex> lock(mp);
|
||||
progressIndex += 1;
|
||||
std::cout << std::fixed << std::setprecision(2) << std::setw(6)
|
||||
<< 100. * progressIndex / totalProgress << " \%";
|
||||
std::cout << '\r' << std::flush;
|
||||
}
|
||||
|
||||
void DetectorImpl::setCurrentProgress(int64_t i) {
|
||||
std::lock_guard<std::mutex> lock(mp);
|
||||
progressIndex = (double)i;
|
||||
std::cout << std::fixed << std::setprecision(2) << std::setw(6)
|
||||
<< 100. * progressIndex / totalProgress << " \%";
|
||||
std::cout << '\r' << std::flush;
|
||||
}
|
||||
|
||||
int DetectorImpl::acquire() {
|
||||
// ensure acquire isnt started multiple times by same client
|
||||
if (!isAcquireReady()) {
|
||||
@ -1056,7 +1026,7 @@ int DetectorImpl::acquire() {
|
||||
|
||||
bool receiver =
|
||||
Parallel(&Module::getUseReceiverFlag, {}).squash(false);
|
||||
progressIndex = 0;
|
||||
|
||||
setJoinThreadFlag(false);
|
||||
|
||||
// verify receiver is idle
|
||||
@ -1066,7 +1036,6 @@ int DetectorImpl::acquire() {
|
||||
Parallel(&Module::stopReceiver, {});
|
||||
}
|
||||
}
|
||||
setTotalProgress();
|
||||
|
||||
startProcessingThread();
|
||||
|
||||
@ -1106,12 +1075,10 @@ int DetectorImpl::acquire() {
|
||||
dataProcessingThread.join();
|
||||
|
||||
if (acquisition_finished != nullptr) {
|
||||
// same status for all, else error
|
||||
int status = static_cast<int>(ERROR);
|
||||
auto t = Parallel(&Module::getRunStatus, {});
|
||||
if (t.equal())
|
||||
status = t.front();
|
||||
acquisition_finished(getCurrentProgress(), status, acqFinished_p);
|
||||
int status = Parallel(&Module::getRunStatus, {}).squash(ERROR);
|
||||
auto a = Parallel(&Module::getReceiverProgress, {});
|
||||
int progress = (*std::min_element (a.begin(), a.end()));
|
||||
acquisition_finished((double)progress, status, acqFinished_p);
|
||||
}
|
||||
|
||||
sem_destroy(&sem_newRTAcquisition);
|
||||
@ -1130,8 +1097,14 @@ int DetectorImpl::acquire() {
|
||||
return OK;
|
||||
}
|
||||
|
||||
void DetectorImpl::printProgress(double progress) {
|
||||
std::cout << std::fixed << std::setprecision(2) << std::setw(6)
|
||||
<< progress << " \%";
|
||||
std::cout << '\r' << std::flush;
|
||||
}
|
||||
|
||||
|
||||
void DetectorImpl::startProcessingThread() {
|
||||
setTotalProgress();
|
||||
dataProcessingThread = std::thread(&DetectorImpl::processData, this);
|
||||
}
|
||||
|
||||
@ -1142,7 +1115,9 @@ void DetectorImpl::processData() {
|
||||
}
|
||||
// only update progress
|
||||
else {
|
||||
int64_t caught = -1;
|
||||
double progress = 0;
|
||||
printProgress(progress);
|
||||
|
||||
while (true) {
|
||||
// to exit acquire by typing q
|
||||
if (kbhit() != 0) {
|
||||
@ -1152,16 +1127,18 @@ void DetectorImpl::processData() {
|
||||
Parallel(&Module::stopAcquisition, {});
|
||||
}
|
||||
}
|
||||
// get progress
|
||||
caught = Parallel(&Module::getFramesCaughtByReceiver, {0})
|
||||
.squash();
|
||||
|
||||
// updating progress
|
||||
if (caught != -1) {
|
||||
setCurrentProgress(caught);
|
||||
// get and print progress
|
||||
double temp = (double)Parallel(&Module::getReceiverProgress, {0}).squash();
|
||||
if (temp != progress) {
|
||||
printProgress(progress);
|
||||
progress = temp;
|
||||
}
|
||||
|
||||
// exiting loop
|
||||
if (getJoinThreadFlag()) {
|
||||
// print progress one final time before exiting
|
||||
progress = (double)Parallel(&Module::getReceiverProgress, {0}).squash();
|
||||
printProgress(progress);
|
||||
break;
|
||||
}
|
||||
// otherwise error when connecting to the receiver too fast
|
||||
|
@ -354,13 +354,7 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
||||
int InsertGapPixels(char *image, char *&gpImage, bool quadEnable, int dr,
|
||||
int &nPixelsx, int &nPixelsy);
|
||||
|
||||
double setTotalProgress();
|
||||
|
||||
double getCurrentProgress();
|
||||
|
||||
void incrementProgress();
|
||||
|
||||
void setCurrentProgress(int64_t i = 0);
|
||||
void printProgress(double progress);
|
||||
|
||||
void startProcessingThread();
|
||||
|
||||
@ -405,12 +399,6 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
||||
* from ext. process) */
|
||||
sem_t sem_endRTAcquisition;
|
||||
|
||||
/** Total number of frames/images for next acquisition */
|
||||
double totalProgress{0};
|
||||
|
||||
/** Current progress or frames/images processed in current acquisition */
|
||||
double progressIndex{0};
|
||||
|
||||
/** mutex to synchronize main and data processing threads */
|
||||
mutable std::mutex mp;
|
||||
|
||||
|
@ -396,14 +396,6 @@ void Module::initializeDetectorStructure(detectorType type) {
|
||||
shm()->controlPort = DEFAULT_PORTNO;
|
||||
shm()->stopPort = DEFAULT_PORTNO + 1;
|
||||
sls::strcpy_safe(shm()->settingsDir, getenv("HOME"));
|
||||
shm()->currentSettings = UNINITIALIZED;
|
||||
shm()->nFrames = 1;
|
||||
shm()->nTriggers = 1;
|
||||
shm()->nBursts = 1;
|
||||
shm()->nAddStorageCells = 0;
|
||||
shm()->timingMode = AUTO_TIMING;
|
||||
shm()->burstMode = BURST_INTERNAL;
|
||||
shm()->deadTime = 0;
|
||||
sls::strcpy_safe(shm()->rxHostname, "none");
|
||||
shm()->rxTCPPort = DEFAULT_PORTNO + 2;
|
||||
shm()->useReceiverFlag = false;
|
||||
@ -420,7 +412,6 @@ void Module::initializeDetectorStructure(detectorType type) {
|
||||
shm()->nChip.x = parameters.nChipX;
|
||||
shm()->nChip.y = parameters.nChipY;
|
||||
shm()->nDacs = parameters.nDacs;
|
||||
shm()->dynamicRange = parameters.dynamicRange;
|
||||
}
|
||||
|
||||
int Module::sendModule(sls_detector_module *myMod,
|
||||
@ -719,54 +710,11 @@ void Module::updateCachedDetectorVariables() {
|
||||
if (client.sendCommandThenRead(fnum, nullptr, 0, nullptr, 0) ==
|
||||
FORCE_UPDATE) {
|
||||
int n = 0, i32 = 0;
|
||||
int64_t i64 = 0;
|
||||
sls::IpAddr lastClientIP;
|
||||
n += client.Receive(&lastClientIP, sizeof(lastClientIP));
|
||||
LOG(logDEBUG1)
|
||||
<< "Updating detector last modified by " << lastClientIP;
|
||||
|
||||
// dr
|
||||
n += client.Receive(&i32, sizeof(i32));
|
||||
shm()->dynamicRange = i32;
|
||||
|
||||
// settings
|
||||
if (shm()->myDetectorType == EIGER || shm()->myDetectorType == JUNGFRAU ||
|
||||
shm()->myDetectorType == GOTTHARD || shm()->myDetectorType == GOTTHARD2 ||
|
||||
shm()->myDetectorType == MOENCH) {
|
||||
n += client.Receive(&i32, sizeof(i32));
|
||||
shm()->currentSettings = static_cast<detectorSettings>(i32);
|
||||
}
|
||||
|
||||
// frame number
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->nFrames = i64;
|
||||
|
||||
// storage cell
|
||||
if (shm()->myDetectorType == JUNGFRAU) {
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->nAddStorageCells = i64;
|
||||
}
|
||||
|
||||
// triggers
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->nTriggers = i64;
|
||||
|
||||
// bursts
|
||||
if (shm()->myDetectorType == GOTTHARD2) {
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->nBursts = i64;
|
||||
}
|
||||
|
||||
// timing mode
|
||||
n += client.Receive(&i32, sizeof(i32));
|
||||
shm()->timingMode = static_cast<timingMode>(i32);
|
||||
|
||||
// burst mode
|
||||
if (shm()->myDetectorType == GOTTHARD2) {
|
||||
n += client.Receive(&i32, sizeof(i32));
|
||||
shm()->burstMode = static_cast<burstMode>(i32);
|
||||
}
|
||||
|
||||
// number of channels (depends on #samples, adcmask)
|
||||
if (shm()->myDetectorType == CHIPTESTBOARD ||
|
||||
shm()->myDetectorType == MOENCH) {
|
||||
@ -863,49 +811,21 @@ std::vector<std::string> Module::getConfigFileCommands() {
|
||||
}
|
||||
|
||||
slsDetectorDefs::detectorSettings Module::getSettings() {
|
||||
return sendSettingsOnly(GET_SETTINGS);
|
||||
int arg = -1;
|
||||
int retval = -1;
|
||||
sendToDetector(F_SET_SETTINGS, arg, retval);
|
||||
LOG(logDEBUG1) << "Settings: " << retval;
|
||||
return static_cast<detectorSettings>(retval);
|
||||
}
|
||||
|
||||
slsDetectorDefs::detectorSettings
|
||||
Module::setSettings(detectorSettings isettings) {
|
||||
LOG(logDEBUG1) << "Module setSettings " << isettings;
|
||||
|
||||
if (isettings == -1) {
|
||||
return getSettings();
|
||||
}
|
||||
|
||||
// eiger: only set shm, setting threshold loads the module data
|
||||
void Module::setSettings(detectorSettings isettings) {
|
||||
if (shm()->myDetectorType == EIGER) {
|
||||
switch (isettings) {
|
||||
case STANDARD:
|
||||
case HIGHGAIN:
|
||||
case LOWGAIN:
|
||||
case VERYHIGHGAIN:
|
||||
case VERYLOWGAIN:
|
||||
shm()->currentSettings = isettings;
|
||||
return shm()->currentSettings;
|
||||
default:
|
||||
std::ostringstream ss;
|
||||
ss << "Unknown settings " << ToString(isettings)
|
||||
<< " for this detector!";
|
||||
throw RuntimeError(ss.str());
|
||||
}
|
||||
throw RuntimeError("Cannot set settings for Eiger. Use threshold energy.");
|
||||
}
|
||||
|
||||
// others: send only the settings, detector server will update dac values
|
||||
// already in server
|
||||
return sendSettingsOnly(isettings);
|
||||
}
|
||||
|
||||
slsDetectorDefs::detectorSettings
|
||||
Module::sendSettingsOnly(detectorSettings isettings) {
|
||||
int arg = static_cast<int>(isettings);
|
||||
int retval = -1;
|
||||
LOG(logDEBUG1) << "Setting settings to " << arg;
|
||||
sendToDetector(F_SET_SETTINGS, arg, retval);
|
||||
LOG(logDEBUG1) << "Settings: " << retval;
|
||||
shm()->currentSettings = static_cast<detectorSettings>(retval);
|
||||
return shm()->currentSettings;
|
||||
}
|
||||
|
||||
int Module::getThresholdEnergy() {
|
||||
@ -944,8 +864,11 @@ void Module::setThresholdEnergy(int e_eV, detectorSettings isettings,
|
||||
else if (shm()->myDetectorType == MOENCH) {
|
||||
setAdditionalJsonParameter("threshold", std::to_string(e_eV));
|
||||
}
|
||||
throw RuntimeError(
|
||||
|
||||
else {
|
||||
throw RuntimeError(
|
||||
"Set threshold energy not implemented for this detector");
|
||||
}
|
||||
}
|
||||
|
||||
void Module::setThresholdEnergyAndSettings(int e_eV,
|
||||
@ -954,7 +877,7 @@ void Module::setThresholdEnergyAndSettings(int e_eV,
|
||||
|
||||
// if settings provided, use that, else use the shared memory variable
|
||||
detectorSettings is =
|
||||
((isettings != GET_SETTINGS) ? isettings : shm()->currentSettings);
|
||||
((isettings != GET_SETTINGS) ? isettings : getSettings());
|
||||
|
||||
// verify e_eV exists in trimEneregies[]
|
||||
if (shm()->trimEnergies.empty() || (e_eV < shm()->trimEnergies.front()) ||
|
||||
@ -999,8 +922,7 @@ void Module::setThresholdEnergyAndSettings(int e_eV,
|
||||
linearInterpolation(e_eV, trim1, trim2, myMod1.tau, myMod2.tau);
|
||||
}
|
||||
|
||||
shm()->currentSettings = is;
|
||||
myMod.reg = shm()->currentSettings;
|
||||
myMod.reg = is;
|
||||
myMod.eV = e_eV;
|
||||
setModule(myMod, tb);
|
||||
if (getSettings() != is) {
|
||||
@ -1161,101 +1083,64 @@ uint64_t Module::getStartingFrameNumber() {
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t Module::getTotalNumFramesToReceive() {
|
||||
int64_t repeats = shm()->nTriggers;
|
||||
// gotthard2 & auto & burst mode, use nBursts instead of nTriggers
|
||||
if (shm()->myDetectorType == GOTTHARD2) {
|
||||
// auto mode (either bursts or no repeats)
|
||||
if (shm()->timingMode == AUTO_TIMING) {
|
||||
if (shm()->burstMode != BURST_OFF) {
|
||||
repeats = shm()->nBursts;
|
||||
} else {
|
||||
repeats = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (shm()->nFrames * repeats * (int64_t)(shm()->nAddStorageCells + 1));
|
||||
}
|
||||
|
||||
void Module::sendTotalNumFramestoReceiver() {
|
||||
if (shm()->useReceiverFlag) {
|
||||
int64_t arg = getTotalNumFramesToReceive();
|
||||
LOG(logDEBUG1) << "Sending total number of frames (#f x #t x #s) to Receiver: " << arg;
|
||||
sendToReceiver(F_RECEIVER_SET_NUM_FRAMES, arg, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t Module::getNumberOfFrames() {
|
||||
int64_t retval = -1;
|
||||
sendToDetector(F_GET_NUM_FRAMES, nullptr, retval);
|
||||
LOG(logDEBUG1) << "number of frames :" << retval;
|
||||
if (shm()->nFrames != retval) {
|
||||
shm()->nFrames = retval;
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
return shm()->nFrames;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void Module::setNumberOfFrames(int64_t value) {
|
||||
LOG(logDEBUG1) << "Setting number of frames to " << value;
|
||||
sendToDetector(F_SET_NUM_FRAMES, value, nullptr);
|
||||
shm()->nFrames = value;
|
||||
sendTotalNumFramestoReceiver();
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logDEBUG1) << "Sending number of frames to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_NUM_FRAMES, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t Module::getNumberOfTriggers() {
|
||||
int64_t retval = -1;
|
||||
sendToDetector(F_GET_NUM_TRIGGERS, nullptr, retval);
|
||||
LOG(logDEBUG1) << "number of triggers :" << retval;
|
||||
if (shm()->nTriggers != retval) {
|
||||
shm()->nTriggers = retval;
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
return shm()->nTriggers;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void Module::setNumberOfTriggers(int64_t value) {
|
||||
LOG(logDEBUG1) << "Setting number of triggers to " << value;
|
||||
sendToDetector(F_SET_NUM_TRIGGERS, value, nullptr);
|
||||
shm()->nTriggers = value;
|
||||
sendTotalNumFramestoReceiver();
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logDEBUG1) << "Sending number of triggers to Receiver: " << value;
|
||||
sendToReceiver(F_SET_RECEIVER_NUM_TRIGGERS, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t Module::getNumberOfBursts() {
|
||||
int64_t retval = -1;
|
||||
sendToDetector(F_GET_NUM_BURSTS, nullptr, retval);
|
||||
LOG(logDEBUG1) << "number of bursts :" << retval;
|
||||
if (shm()->nBursts != retval) {
|
||||
shm()->nBursts = retval;
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
return shm()->nBursts;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void Module::setNumberOfBursts(int64_t value) {
|
||||
LOG(logDEBUG1) << "Setting number of bursts to " << value;
|
||||
sendToDetector(F_SET_NUM_BURSTS, value, nullptr);
|
||||
shm()->nBursts = value;
|
||||
sendTotalNumFramestoReceiver();
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logDEBUG1) << "Sending number of bursts to Receiver: " << value;
|
||||
sendToReceiver(F_SET_RECEIVER_NUM_BURSTS, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int Module::getNumberOfAdditionalStorageCells() {
|
||||
int prevVal = shm()->nAddStorageCells;
|
||||
int retval = -1;
|
||||
sendToDetector(F_GET_NUM_ADDITIONAL_STORAGE_CELLS, nullptr, retval);
|
||||
LOG(logDEBUG1) << "number of storage cells :" << retval;
|
||||
shm()->nAddStorageCells = retval;
|
||||
if (prevVal != retval) {
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
return shm()->nAddStorageCells;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void Module::setNumberOfAdditionalStorageCells(int value) {
|
||||
LOG(logDEBUG1) << "Setting number of storage cells to " << value;
|
||||
sendToDetector(F_SET_NUM_ADDITIONAL_STORAGE_CELLS, value, nullptr);
|
||||
shm()->nAddStorageCells = value;
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
|
||||
int Module::getNumberOfAnalogSamples() {
|
||||
@ -1305,16 +1190,13 @@ void Module::setExptime(int64_t value) {
|
||||
}
|
||||
LOG(logDEBUG1) << "Setting exptime to " << value << "ns";
|
||||
sendToDetector(F_SET_EXPTIME, value, nullptr);
|
||||
if (shm()->myDetectorType == EIGER && prevVal != value && shm()->dynamicRange == 16) {
|
||||
int r = getRateCorrection();
|
||||
if (r != 0) {
|
||||
setRateCorrection(r);
|
||||
}
|
||||
}
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logDEBUG1) << "Sending exptime to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_EXPTIME, value, nullptr);
|
||||
}
|
||||
if (prevVal != value) {
|
||||
updateRateCorrection();
|
||||
}
|
||||
}
|
||||
|
||||
int64_t Module::getPeriod() {
|
||||
@ -1358,17 +1240,14 @@ void Module::setSubExptime(int64_t value) {
|
||||
prevVal = getSubExptime();
|
||||
}
|
||||
LOG(logDEBUG1) << "Setting sub exptime to " << value << "ns";
|
||||
sendToDetector(F_SET_SUB_EXPTIME, value, nullptr);
|
||||
if (shm()->myDetectorType == EIGER && prevVal != value && shm()->dynamicRange == 32) {
|
||||
int r = getRateCorrection();
|
||||
if (r != 0) {
|
||||
setRateCorrection(r);
|
||||
}
|
||||
}
|
||||
sendToDetector(F_SET_SUB_EXPTIME, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logDEBUG1) << "Sending sub exptime to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_SUB_EXPTIME, value, nullptr);
|
||||
}
|
||||
if (prevVal != value) {
|
||||
updateRateCorrection();
|
||||
}
|
||||
}
|
||||
|
||||
int64_t Module::getSubDeadTime() {
|
||||
@ -1466,48 +1345,68 @@ int64_t Module::getMeasurementTime() const {
|
||||
return retval;
|
||||
}
|
||||
|
||||
slsDetectorDefs::timingMode Module::setTimingMode(timingMode value) {
|
||||
int fnum = F_SET_TIMING_MODE;
|
||||
//auto arg = static_cast<int>(pol);
|
||||
slsDetectorDefs::timingMode Module::getTimingMode() {
|
||||
int arg = -1;
|
||||
timingMode retval = GET_TIMING_MODE;
|
||||
LOG(logDEBUG1) << "Setting communication to mode " << value;
|
||||
sendToDetector(fnum, static_cast<int>(value), retval);
|
||||
sendToDetector(F_SET_TIMING_MODE, arg, retval);
|
||||
LOG(logDEBUG1) << "Timing Mode: " << retval;
|
||||
shm()->timingMode = retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int Module::setDynamicRange(int n) {
|
||||
// TODO! Properly handle fail
|
||||
int prevDr = shm()->dynamicRange;
|
||||
void Module::setTimingMode(timingMode value) {
|
||||
timingMode retval = GET_TIMING_MODE;
|
||||
LOG(logDEBUG1) << "Setting timing mode to " << value;
|
||||
sendToDetector(F_SET_TIMING_MODE, static_cast<int>(value), retval);
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logDEBUG1) << "Sending timing mode to Receiver: " << value;
|
||||
sendToReceiver(F_SET_RECEIVER_TIMING_MODE, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int Module::getDynamicRange() {
|
||||
int arg = -1;
|
||||
int retval = -1;
|
||||
sendToDetector(F_SET_DYNAMIC_RANGE, arg, retval);
|
||||
LOG(logDEBUG1) << "Dynamic Range: " << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void Module::setDynamicRange(int n) {
|
||||
int prev_val = n;
|
||||
if (shm()->myDetectorType == EIGER) {
|
||||
prev_val = getDynamicRange();
|
||||
}
|
||||
|
||||
int retval = -1;
|
||||
LOG(logDEBUG1) << "Setting dynamic range to " << n;
|
||||
sendToDetector(F_SET_DYNAMIC_RANGE, n, retval);
|
||||
LOG(logDEBUG1) << "Dynamic Range: " << retval;
|
||||
shm()->dynamicRange = retval;
|
||||
|
||||
if (shm()->useReceiverFlag) {
|
||||
n = shm()->dynamicRange;
|
||||
int arg = retval;
|
||||
retval = -1;
|
||||
LOG(logDEBUG1) << "Sending dynamic range to receiver: " << n;
|
||||
sendToReceiver(F_SET_RECEIVER_DYNAMIC_RANGE, n, retval);
|
||||
LOG(logDEBUG1) << "Sending dynamic range to receiver: " << arg;
|
||||
sendToReceiver(F_SET_RECEIVER_DYNAMIC_RANGE, arg, retval);
|
||||
LOG(logDEBUG1) << "Receiver Dynamic range: " << retval;
|
||||
}
|
||||
|
||||
// changes in dr
|
||||
int dr = shm()->dynamicRange;
|
||||
if (prevDr != dr && shm()->myDetectorType == EIGER) {
|
||||
updateRateCorrection();
|
||||
if (n != prev_val) {
|
||||
// update speed for usability
|
||||
if (dr == 32) {
|
||||
LOG(logINFO) << "Setting Clock to Quarter Speed to cope with Dynamic Range of 32"; setClockDivider(RUN_CLOCK, 2);
|
||||
} else {
|
||||
LOG(logINFO) << "Setting Clock to Full Speed to cope with Dynamic Range of " << dr; setClockDivider(RUN_CLOCK, 0);
|
||||
switch (n) {
|
||||
case 32:
|
||||
LOG(logINFO) << "Setting Clock to Quarter Speed to cope with Dynamic Range of 32";
|
||||
setClockDivider(RUN_CLOCK, 2);
|
||||
break;
|
||||
case 16:
|
||||
LOG(logINFO) << "Setting Clock to Full Speed to cope with Dynamic Range of " << n;
|
||||
setClockDivider(RUN_CLOCK, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
updateRateCorrection();
|
||||
}
|
||||
|
||||
return shm()->dynamicRange;
|
||||
}
|
||||
|
||||
int Module::setDAC(int val, dacIndex index, int mV) {
|
||||
@ -1701,7 +1600,9 @@ std::string Module::setReceiverHostname(const std::string &receiverIP) {
|
||||
LOG(logDEBUG1) << printReceiverConfiguration();
|
||||
|
||||
setReceiverUDPSocketBufferSize(0);
|
||||
sendTotalNumFramestoReceiver();
|
||||
setNumberOfFrames(getNumberOfFrames());
|
||||
setNumberOfTriggers(getNumberOfTriggers());
|
||||
setTimingMode(getTimingMode());
|
||||
setExptime(getExptime());
|
||||
setPeriod(getPeriod());
|
||||
|
||||
@ -1711,7 +1612,7 @@ std::string Module::setReceiverHostname(const std::string &receiverIP) {
|
||||
case EIGER:
|
||||
setSubExptime(getSubExptime());
|
||||
setSubDeadTime(getSubDeadTime());
|
||||
setDynamicRange(shm()->dynamicRange);
|
||||
setDynamicRange(getDynamicRange());
|
||||
activate(-1);
|
||||
enableTenGigabitEthernet(-1);
|
||||
setQuad(getQuad());
|
||||
@ -1739,7 +1640,12 @@ std::string Module::setReceiverHostname(const std::string &receiverIP) {
|
||||
|
||||
case MYTHEN3:
|
||||
sendNumberofCounterstoReceiver(getCounterMask());
|
||||
setDynamicRange(shm()->dynamicRange);
|
||||
setDynamicRange(getDynamicRange());
|
||||
break;
|
||||
|
||||
case GOTTHARD2:
|
||||
setNumberOfBursts(getNumberOfBursts());
|
||||
setBurstMode(getBurstMode());
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -2374,15 +2280,17 @@ slsDetectorDefs::burstMode Module::getBurstMode() {
|
||||
int retval = -1;
|
||||
sendToDetector(F_GET_BURST_MODE, nullptr, retval);
|
||||
LOG(logDEBUG1) << "Burst mode:" << retval;
|
||||
shm()->burstMode = static_cast<slsDetectorDefs::burstMode>(retval);
|
||||
return shm()->burstMode;
|
||||
return static_cast<slsDetectorDefs::burstMode>(retval);
|
||||
}
|
||||
|
||||
void Module::setBurstMode(slsDetectorDefs::burstMode value) {
|
||||
int arg = static_cast<int>(value);
|
||||
LOG(logDEBUG1) << "Setting burst mode to " << arg;
|
||||
sendToDetector(F_SET_BURST_MODE, arg, nullptr);
|
||||
shm()->burstMode = value;
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logDEBUG1) << "Sending burst mode to Receiver: " << value;
|
||||
sendToReceiver(F_SET_RECEIVER_BURST_MODE, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
bool Module::getCurrentSource() {
|
||||
@ -2950,37 +2858,23 @@ void Module::setDefaultRateCorrection() {
|
||||
LOG(logDEBUG1) << "Setting Default Rate Correction";
|
||||
int64_t arg = -1;
|
||||
sendToDetector(F_SET_RATE_CORRECT, arg, nullptr);
|
||||
shm()->deadTime = -1;
|
||||
}
|
||||
|
||||
void Module::setRateCorrection(int64_t t) {
|
||||
LOG(logDEBUG1) << "Setting Rate Correction to " << t;
|
||||
sendToDetector(F_SET_RATE_CORRECT, t, nullptr);
|
||||
shm()->deadTime = t;
|
||||
}
|
||||
|
||||
int64_t Module::getRateCorrection() {
|
||||
int64_t retval = -1;
|
||||
LOG(logDEBUG1) << "Getting rate correction";
|
||||
sendToDetector(F_GET_RATE_CORRECT, nullptr, retval);
|
||||
shm()->deadTime = retval;
|
||||
LOG(logDEBUG1) << "Rate correction: " << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void Module::updateRateCorrection() {
|
||||
if (shm()->deadTime != 0) {
|
||||
switch (shm()->dynamicRange) {
|
||||
case 16:
|
||||
case 32:
|
||||
setRateCorrection(shm()->deadTime);
|
||||
break;
|
||||
default:
|
||||
setRateCorrection(0);
|
||||
throw sls::RuntimeError(
|
||||
"Rate correction Deactivated, must be in 32 or 16 bit mode");
|
||||
}
|
||||
}
|
||||
LOG(logDEBUG1) << "Updating rate correction";
|
||||
sendToDetector(F_UPDATE_RATE_CORRECTION);
|
||||
}
|
||||
|
||||
std::string Module::printReceiverConfiguration() {
|
||||
@ -3281,6 +3175,15 @@ uint64_t Module::getReceiverCurrentFrameIndex() const {
|
||||
return retval;
|
||||
}
|
||||
|
||||
int Module::getReceiverProgress() const {
|
||||
int retval = -1;
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_GET_RECEIVER_PROGRESS, nullptr, retval);
|
||||
LOG(logDEBUG1) << "Current Progress of Receiver: " << retval;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
void Module::setFileWrite(bool value) {
|
||||
if (!shm()->useReceiverFlag) {
|
||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (file write enable)");
|
||||
|
@ -14,7 +14,7 @@
|
||||
class ServerInterface;
|
||||
|
||||
#define SLS_SHMAPIVERSION 0x190726
|
||||
#define SLS_SHMVERSION 0x200324
|
||||
#define SLS_SHMVERSION 0x200402
|
||||
|
||||
namespace sls{
|
||||
|
||||
@ -62,33 +62,6 @@ struct sharedSlsDetector {
|
||||
/** number of dacs per module*/
|
||||
int nDacs;
|
||||
|
||||
/** dynamic range of the detector data */
|
||||
int dynamicRange;
|
||||
|
||||
/** detector settings (standard, fast, etc.) */
|
||||
slsDetectorDefs::detectorSettings currentSettings;
|
||||
|
||||
/** number of frames */
|
||||
int64_t nFrames;
|
||||
|
||||
/** number of triggers */
|
||||
int64_t nTriggers;
|
||||
|
||||
/** number of bursts */
|
||||
int64_t nBursts;
|
||||
|
||||
/** number of additional storage cells */
|
||||
int nAddStorageCells;
|
||||
|
||||
/** timing mode */
|
||||
slsDetectorDefs::timingMode timingMode;
|
||||
|
||||
/** burst mode */
|
||||
slsDetectorDefs::burstMode burstMode;
|
||||
|
||||
/** rate correction in ns (needed for default -1) */
|
||||
int64_t deadTime;
|
||||
|
||||
/** ip address/hostname of the receiver for client control via TCP */
|
||||
char rxHostname[MAX_STR_LENGTH];
|
||||
|
||||
@ -309,10 +282,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
*/
|
||||
std::vector<std::string> getConfigFileCommands();
|
||||
|
||||
/**
|
||||
* Get detector settings
|
||||
* @returns current settings
|
||||
*/
|
||||
detectorSettings getSettings();
|
||||
|
||||
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2
|
||||
@ -320,18 +289,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
* [Gotthard2] Options: DYNAMICGAIN, FIXGAIN1, FIXGAIN2
|
||||
* [Moench] Options: G1_HIGHGAIN, G1_LOWGAIN, G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN,
|
||||
* G2_LOWCAP_HIGHGAIN, G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN
|
||||
* [Eiger] Only stores them locally in shm Options: STANDARD, HIGHGAIN, LOWGAIN, VERYHIGHGAIN, VERYLOWGAIN
|
||||
*/
|
||||
detectorSettings setSettings(detectorSettings isettings);
|
||||
|
||||
/**
|
||||
* Send detector settings only (set only for Jungfrau, Gotthard, Moench, get
|
||||
* for all) Only the settings enum is sent to the detector, where it will
|
||||
* initialize al the dacs already hard coded in the detector server
|
||||
* @param isettings settings
|
||||
* @returns current settings
|
||||
*/
|
||||
detectorSettings sendSettingsOnly(detectorSettings isettings);
|
||||
void setSettings(detectorSettings isettings);
|
||||
|
||||
/**
|
||||
* Get threshold energy (Mythen and Eiger)
|
||||
@ -445,10 +404,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
*/
|
||||
uint64_t getStartingFrameNumber();
|
||||
|
||||
int64_t getTotalNumFramesToReceive();
|
||||
|
||||
void sendTotalNumFramestoReceiver();
|
||||
|
||||
int64_t getNumberOfFrames();
|
||||
|
||||
void setNumberOfFrames(int64_t value);
|
||||
@ -556,22 +511,17 @@ class Module : public virtual slsDetectorDefs {
|
||||
* [Gotthard2] only in continuous mode */
|
||||
int64_t getMeasurementTime() const;
|
||||
|
||||
/**
|
||||
* Set/get timing mode
|
||||
* @param value timing mode (-1 gets)
|
||||
* @returns current timing mode
|
||||
*/
|
||||
timingMode setTimingMode(timingMode value = GET_TIMING_MODE);
|
||||
|
||||
timingMode getTimingMode();
|
||||
void setTimingMode(timingMode value);
|
||||
|
||||
int getDynamicRange();
|
||||
/**
|
||||
* Set/get dynamic range
|
||||
* (Eiger: If i is 32, also sets clkdivider to 2, if 16, sets clkdivider to
|
||||
* 1)
|
||||
* @param i dynamic range (-1 get)
|
||||
* @returns current dynamic range
|
||||
* \sa sharedSlsDetector
|
||||
*/
|
||||
int setDynamicRange(int n = -1);
|
||||
void setDynamicRange(int n);
|
||||
|
||||
/**
|
||||
* Set/get dacs value
|
||||
@ -1467,6 +1417,7 @@ class Module : public virtual slsDetectorDefs {
|
||||
* @returns current frame index of receiver
|
||||
*/
|
||||
uint64_t getReceiverCurrentFrameIndex() const;
|
||||
int getReceiverProgress() const;
|
||||
|
||||
|
||||
void setFileWrite(bool value);
|
||||
|
@ -118,7 +118,12 @@ int ClientInterface::functionTable(){
|
||||
flist[F_GET_RECEIVER_TYPE] = &ClientInterface::set_detector_type;
|
||||
flist[F_SEND_RECEIVER_DETHOSTNAME] = &ClientInterface::set_detector_hostname;
|
||||
flist[F_RECEIVER_SET_ROI] = &ClientInterface::set_roi;
|
||||
flist[F_RECEIVER_SET_NUM_FRAMES] = &ClientInterface::set_num_frames;
|
||||
flist[F_RECEIVER_SET_NUM_FRAMES] = &ClientInterface::set_num_frames;
|
||||
flist[F_SET_RECEIVER_NUM_TRIGGERS] = &ClientInterface::set_num_triggers;
|
||||
flist[F_SET_RECEIVER_NUM_BURSTS] = &ClientInterface::set_num_bursts;
|
||||
flist[F_SET_RECEIVER_NUM_ADD_STORAGE_CELLS] = &ClientInterface::set_num_add_storage_cells;
|
||||
flist[F_SET_RECEIVER_TIMING_MODE] = &ClientInterface::set_timing_mode;
|
||||
flist[F_SET_RECEIVER_BURST_MODE] = &ClientInterface::set_burst_mode;
|
||||
flist[F_RECEIVER_SET_NUM_ANALOG_SAMPLES]= &ClientInterface::set_num_analog_samples;
|
||||
flist[F_RECEIVER_SET_NUM_DIGITAL_SAMPLES]= &ClientInterface::set_num_digital_samples;
|
||||
flist[F_RECEIVER_SET_EXPTIME] = &ClientInterface::set_exptime;
|
||||
@ -195,7 +200,8 @@ int ClientInterface::functionTable(){
|
||||
flist[F_INCREMENT_FILE_INDEX] = &ClientInterface::increment_file_index;
|
||||
flist[F_SET_ADDITIONAL_JSON_PARAMETER] = &ClientInterface::set_additional_json_parameter;
|
||||
flist[F_GET_ADDITIONAL_JSON_PARAMETER] = &ClientInterface::get_additional_json_parameter;
|
||||
|
||||
flist[F_GET_RECEIVER_PROGRESS] = &ClientInterface::get_progress;
|
||||
|
||||
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
||||
LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
||||
getFunctionNameFromEnum((enum detFuncs)i) << ") located at " << flist[i];
|
||||
@ -415,8 +421,85 @@ int ClientInterface::set_roi(Interface &socket) {
|
||||
|
||||
int ClientInterface::set_num_frames(Interface &socket) {
|
||||
auto value = socket.Receive<int64_t>();
|
||||
if (value <= 0) {
|
||||
throw RuntimeError("Invalid number of frames " +
|
||||
std::to_string(value));
|
||||
}
|
||||
verifyIdle(socket);
|
||||
LOG(logDEBUG1) << "Setting num frames to " << value;
|
||||
impl()->setNumberOfFrames(value);
|
||||
int64_t retval = impl()->getNumberOfFrames();
|
||||
validate(value, retval, "set number of frames", DEC);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::set_num_triggers(Interface &socket) {
|
||||
auto value = socket.Receive<int64_t>();
|
||||
if (value <= 0) {
|
||||
throw RuntimeError("Invalid number of triggers " +
|
||||
std::to_string(value));
|
||||
}
|
||||
verifyIdle(socket);
|
||||
LOG(logDEBUG1) << "Setting num triggers to " << value;
|
||||
impl()->setNumberOfTriggers(value);
|
||||
int64_t retval = impl()->getNumberOfTriggers();
|
||||
validate(value, retval, "set number of triggers", DEC);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::set_num_bursts(Interface &socket) {
|
||||
auto value = socket.Receive<int64_t>();
|
||||
if (value <= 0) {
|
||||
throw RuntimeError("Invalid number of bursts " +
|
||||
std::to_string(value));
|
||||
}
|
||||
verifyIdle(socket);
|
||||
LOG(logDEBUG1) << "Setting num bursts to " << value;
|
||||
impl()->setNumberOfBursts(value);
|
||||
int64_t retval = impl()->getNumberOfBursts();
|
||||
validate(value, retval, "set number of bursts", DEC);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::set_num_add_storage_cells(Interface &socket) {
|
||||
auto value = socket.Receive<int>();
|
||||
if (value < 0) {
|
||||
throw RuntimeError("Invalid number of additional storage cells " +
|
||||
std::to_string(value));
|
||||
}
|
||||
verifyIdle(socket);
|
||||
LOG(logDEBUG1) << "Setting num additional storage cells to " << value;
|
||||
impl()->setNumberOfAdditionalStorageCells(value);
|
||||
int retval = impl()->getNumberOfAdditionalStorageCells();
|
||||
validate(value, retval, "set number of additional storage cells", DEC);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::set_timing_mode(Interface &socket) {
|
||||
auto value = socket.Receive<int>();
|
||||
if (value < 0 || value >= NUM_TIMING_MODES) {
|
||||
throw RuntimeError("Invalid timing mode " +
|
||||
std::to_string(value));
|
||||
}
|
||||
verifyIdle(socket);
|
||||
LOG(logDEBUG1) << "Setting timing mode to " << value;
|
||||
impl()->setTimingMode(static_cast<timingMode>(value));
|
||||
int retval = impl()->getTimingMode();
|
||||
validate(value, retval, "set timing mode", DEC);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::set_burst_mode(Interface &socket) {
|
||||
auto value = socket.Receive<int>();
|
||||
if (value < 0 || value >= NUM_BURST_MODES) {
|
||||
throw RuntimeError("Invalid burst mode " +
|
||||
std::to_string(value));
|
||||
}
|
||||
verifyIdle(socket);
|
||||
LOG(logDEBUG1) << "Setting burst mode to " << value;
|
||||
impl()->setBurstMode(static_cast<burstMode>(value));
|
||||
int retval = impl()->getBurstMode();
|
||||
validate(value, retval, "set burst mode", DEC);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
@ -1425,3 +1508,9 @@ int ClientInterface::get_additional_json_parameter(Interface &socket) {
|
||||
LOG(logDEBUG1) << "additional json parameter (" << arg << "):" << retval;
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int ClientInterface::get_progress(Interface &socket) {
|
||||
int retval = impl()->getProgress();
|
||||
LOG(logDEBUG1) << "progress retval: " << retval;
|
||||
return socket.sendResult(retval);
|
||||
}
|
@ -60,6 +60,11 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
int set_detector_hostname(sls::ServerInterface &socket);
|
||||
int set_roi(sls::ServerInterface &socket);
|
||||
int set_num_frames(sls::ServerInterface &socket);
|
||||
int set_num_triggers(sls::ServerInterface &socket);
|
||||
int set_num_bursts(sls::ServerInterface &socket);
|
||||
int set_num_add_storage_cells(sls::ServerInterface &socket);
|
||||
int set_timing_mode(sls::ServerInterface &socket);
|
||||
int set_burst_mode(sls::ServerInterface &socket);
|
||||
int set_num_analog_samples(sls::ServerInterface &socket);
|
||||
int set_num_digital_samples(sls::ServerInterface &socket);
|
||||
int set_exptime(sls::ServerInterface &socket);
|
||||
@ -137,6 +142,8 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
int increment_file_index(sls::ServerInterface &socket);
|
||||
int set_additional_json_parameter(sls::ServerInterface &socket);
|
||||
int get_additional_json_parameter(sls::ServerInterface &socket);
|
||||
int get_progress(sls::ServerInterface &socket);
|
||||
|
||||
|
||||
Implementation *impl() {
|
||||
if (receiver != nullptr) {
|
||||
|
@ -17,7 +17,7 @@ const std::string DataStreamer::TypeName = "DataStreamer";
|
||||
|
||||
|
||||
DataStreamer::DataStreamer(int ind, Fifo* f, uint32_t* dr, ROI* r,
|
||||
uint64_t* fi, int fd, int* nd, bool* qe) :
|
||||
uint64_t* fi, int fd, int* nd, bool* qe, uint64_t* tot) :
|
||||
ThreadObject(ind, TypeName),
|
||||
runningFlag(0),
|
||||
generalData(nullptr),
|
||||
@ -31,7 +31,8 @@ DataStreamer::DataStreamer(int ind, Fifo* f, uint32_t* dr, ROI* r,
|
||||
startedFlag(false),
|
||||
firstIndex(0),
|
||||
completeBuffer(nullptr),
|
||||
quadEnable(qe)
|
||||
quadEnable(qe),
|
||||
totalNumFrames(tot)
|
||||
{
|
||||
numDet[0] = nd[0];
|
||||
numDet[1] = nd[1];
|
||||
@ -241,6 +242,7 @@ int DataStreamer::SendHeader(sls_receiver_header* rheader, uint32_t size, uint32
|
||||
zHeader.imageSize = size;
|
||||
zHeader.acqIndex = acquisitionIndex;
|
||||
zHeader.frameIndex = frameIndex;
|
||||
zHeader.progress = 100 * ((double)(frameIndex + 1) / (double)(*totalNumFrames));
|
||||
zHeader.fname = fileNametoStream;
|
||||
zHeader.frameNumber = header.frameNumber;
|
||||
zHeader.expLength = header.expLength;
|
||||
|
@ -31,9 +31,10 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
* @param fd flipped data enable for x dimension
|
||||
* @param nd pointer to number of detectors in each dimension
|
||||
* @param qe pointer to quad Enable
|
||||
* @param tot pointer to total number of frames
|
||||
*/
|
||||
DataStreamer(int ind, Fifo* f, uint32_t* dr, ROI* r,
|
||||
uint64_t* fi, int fd, int* nd, bool* qe);
|
||||
uint64_t* fi, int fd, int* nd, bool* qe, uint64_t* tot);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@ -207,5 +208,8 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
/** Quad Enable */
|
||||
bool* quadEnable;
|
||||
|
||||
/** Total number of frames */
|
||||
uint64_t* totalNumFrames;
|
||||
|
||||
};
|
||||
|
||||
|
@ -95,7 +95,13 @@ void Implementation::InitializeMembers() {
|
||||
streamingSrcIP = sls::IpAddr{};
|
||||
|
||||
// detector parameters
|
||||
numberOfFrames = 0;
|
||||
numberOfTotalFrames = 0;
|
||||
numberOfFrames = 1;
|
||||
numberOfTriggers = 1;
|
||||
numberOfBursts = 1;
|
||||
numberOfAdditionalStorageCells = 0;
|
||||
timingMode = AUTO_TIMING;
|
||||
burstMode = BURST_OFF;
|
||||
acquisitionPeriod = SAMPLE_TIME_IN_NS;
|
||||
acquisitionTime = 0;
|
||||
subExpTime = 0;
|
||||
@ -267,7 +273,7 @@ void Implementation::setDetectorType(const detectorType d) {
|
||||
auto fifo_ptr = fifo[i].get();
|
||||
listener.push_back(sls::make_unique<Listener>(
|
||||
i, myDetectorType, fifo_ptr, &status, &udpPortNum[i], ð[i],
|
||||
&numberOfFrames, &dynamicRange, &udpSocketBufferSize,
|
||||
&numberOfTotalFrames, &dynamicRange, &udpSocketBufferSize,
|
||||
&actualUDPSocketBufferSize, &framesPerFile, &frameDiscardMode,
|
||||
&activated, &deactivatedPaddingEnable, &silentMode));
|
||||
dataProcessor.push_back(sls::make_unique<DataProcessor>(
|
||||
@ -347,7 +353,7 @@ void Implementation::setDetectorPositionId(const int id) {
|
||||
for (unsigned int i = 0; i < dataProcessor.size(); ++i) {
|
||||
dataProcessor[i]->SetupFileWriter(
|
||||
fileWriteEnable, (int *)numDet, &framesPerFile, &fileName, &filePath,
|
||||
&fileIndex, &overwriteEnable, &detID, &numThreads, &numberOfFrames,
|
||||
&fileIndex, &overwriteEnable, &detID, &numThreads, &numberOfTotalFrames,
|
||||
&dynamicRange, &udpPortNum[i], generalData);
|
||||
}
|
||||
assert(numDet[1] != 0);
|
||||
@ -508,7 +514,7 @@ void Implementation::setFileWriteEnable(const bool b) {
|
||||
dataProcessor[i]->SetupFileWriter(
|
||||
fileWriteEnable, (int *)numDet, &framesPerFile, &fileName,
|
||||
&filePath, &fileIndex, &overwriteEnable, &detID, &numThreads,
|
||||
&numberOfFrames, &dynamicRange, &udpPortNum[i], generalData);
|
||||
&numberOfTotalFrames, &dynamicRange, &udpPortNum[i], generalData);
|
||||
}
|
||||
}
|
||||
|
||||
@ -594,6 +600,24 @@ uint64_t Implementation::getAcquisitionIndex() const {
|
||||
return min;
|
||||
}
|
||||
|
||||
int Implementation::getProgress() const {
|
||||
// get minimum of processed frame indices
|
||||
uint64_t currentFrameIndex = -1;
|
||||
uint32_t flagsum = 0;
|
||||
|
||||
for (const auto &it : dataProcessor) {
|
||||
flagsum += it->GetStartedFlag();
|
||||
uint64_t curr = it->GetProcessedIndex();
|
||||
currentFrameIndex = curr < currentFrameIndex ? curr : currentFrameIndex;
|
||||
}
|
||||
// no data processed
|
||||
if (flagsum != dataProcessor.size()) {
|
||||
currentFrameIndex = -1;
|
||||
}
|
||||
|
||||
return (100.00 * ((double)(currentFrameIndex + 1) / (double)numberOfTotalFrames));
|
||||
}
|
||||
|
||||
std::vector<uint64_t> Implementation::getNumMissingPackets() const {
|
||||
std::vector<uint64_t> mp(numThreads);
|
||||
for (int i = 0; i < numThreads; i++) {
|
||||
@ -603,7 +627,7 @@ std::vector<uint64_t> Implementation::getNumMissingPackets() const {
|
||||
if (numLinesReadout != MAX_EIGER_ROWS_PER_READOUT) {
|
||||
totnp = ((numLinesReadout * np) / MAX_EIGER_ROWS_PER_READOUT);
|
||||
}
|
||||
totnp *= numberOfFrames;
|
||||
totnp *= numberOfTotalFrames;
|
||||
mp[i] = listener[i]->GetNumMissingPacket(stoppedFlag, totnp);
|
||||
}
|
||||
return mp;
|
||||
@ -745,7 +769,7 @@ void Implementation::startReadout() {
|
||||
|
||||
// wait for all packets
|
||||
const int numPacketsToReceive =
|
||||
numberOfFrames * generalData->packetsPerFrame * listener.size();
|
||||
numberOfTotalFrames * generalData->packetsPerFrame * listener.size();
|
||||
if (totalPacketsReceived != numPacketsToReceive) {
|
||||
while (totalPacketsReceived != previousValue) {
|
||||
LOG(logDEBUG3)
|
||||
@ -842,7 +866,7 @@ void Implementation::SetupWriter() {
|
||||
attr.nPixelsX = generalData->nPixelsX;
|
||||
attr.nPixelsY = generalData->nPixelsY;
|
||||
attr.maxFramesPerFile = framesPerFile;
|
||||
attr.totalFrames = numberOfFrames;
|
||||
attr.totalFrames = numberOfTotalFrames;
|
||||
attr.exptimeNs = acquisitionTime;
|
||||
attr.subExptimeNs = subExpTime;
|
||||
attr.subPeriodNs = subPeriod;
|
||||
@ -932,7 +956,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
auto fifo_ptr = fifo[i].get();
|
||||
listener.push_back(sls::make_unique<Listener>(
|
||||
i, myDetectorType, fifo_ptr, &status, &udpPortNum[i],
|
||||
ð[i], &numberOfFrames, &dynamicRange,
|
||||
ð[i], &numberOfTotalFrames, &dynamicRange,
|
||||
&udpSocketBufferSize, &actualUDPSocketBufferSize,
|
||||
&framesPerFile, &frameDiscardMode, &activated,
|
||||
&deactivatedPaddingEnable, &silentMode));
|
||||
@ -963,7 +987,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
}
|
||||
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
||||
i, fifo[i].get(), &dynamicRange, &roi, &fileIndex,
|
||||
fd, (int*)nd, &quadEnable));
|
||||
fd, (int*)nd, &quadEnable, &numberOfTotalFrames));
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(
|
||||
&numThreads, streamingPort, streamingSrcIP);
|
||||
@ -1107,7 +1131,7 @@ void Implementation::setDataStreamEnable(const bool enable) {
|
||||
}
|
||||
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
||||
i, fifo[i].get(), &dynamicRange, &roi, &fileIndex,
|
||||
fd, (int*)nd, &quadEnable));
|
||||
fd, (int*)nd, &quadEnable, &numberOfTotalFrames));
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(
|
||||
&numThreads, streamingPort, streamingSrcIP);
|
||||
@ -1225,6 +1249,26 @@ void Implementation::setAdditionalJsonParameter(const std::string &key, const st
|
||||
* Detector Parameters *
|
||||
* *
|
||||
* ************************************************/
|
||||
void Implementation::updateTotalNumberOfFrames() {
|
||||
int64_t repeats = numberOfTriggers;
|
||||
// gotthard2: auto mode
|
||||
// burst mode: (bursts instead of triggers)
|
||||
// non burst mode: no bursts or triggers
|
||||
if (myDetectorType == GOTTHARD2 &&timingMode == AUTO_TIMING) {
|
||||
if (burstMode == BURST_OFF) {
|
||||
repeats = numberOfBursts;
|
||||
} else {
|
||||
repeats = 1;
|
||||
}
|
||||
}
|
||||
numberOfTotalFrames = numberOfFrames * repeats *
|
||||
(int64_t)(numberOfAdditionalStorageCells + 1);
|
||||
if (numberOfTotalFrames == 0) {
|
||||
throw sls::RuntimeError("Invalid total number of frames to receive: 0");
|
||||
}
|
||||
LOG(logINFO) << "Total Number of Frames: " << numberOfTotalFrames;
|
||||
}
|
||||
|
||||
uint64_t Implementation::getNumberOfFrames() const {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return numberOfFrames;
|
||||
@ -1232,9 +1276,69 @@ uint64_t Implementation::getNumberOfFrames() const {
|
||||
|
||||
void Implementation::setNumberOfFrames(const uint64_t i) {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
numberOfFrames = i;
|
||||
LOG(logINFO) << "Number of Frames: " << numberOfFrames;
|
||||
updateTotalNumberOfFrames();
|
||||
}
|
||||
|
||||
uint64_t Implementation::getNumberOfTriggers() const {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return numberOfTriggers;
|
||||
}
|
||||
|
||||
void Implementation::setNumberOfTriggers(const uint64_t i) {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
numberOfTriggers = i;
|
||||
LOG(logINFO) << "Number of Triggers: " << numberOfTriggers;
|
||||
updateTotalNumberOfFrames();
|
||||
}
|
||||
|
||||
uint64_t Implementation::getNumberOfBursts() const {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return numberOfBursts;
|
||||
}
|
||||
|
||||
void Implementation::setNumberOfBursts(const uint64_t i) {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
numberOfBursts = i;
|
||||
LOG(logINFO) << "Number of Bursts: " << numberOfBursts;
|
||||
updateTotalNumberOfFrames();
|
||||
}
|
||||
|
||||
int Implementation::getNumberOfAdditionalStorageCells() const {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return numberOfAdditionalStorageCells;
|
||||
}
|
||||
|
||||
void Implementation::setNumberOfAdditionalStorageCells(const int i) {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
numberOfAdditionalStorageCells = i;
|
||||
LOG(logINFO) << "Number of Additional Storage Cells: " << numberOfAdditionalStorageCells;
|
||||
updateTotalNumberOfFrames();
|
||||
}
|
||||
|
||||
slsDetectorDefs::timingMode Implementation::getTimingMode() const {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return timingMode;
|
||||
}
|
||||
|
||||
void Implementation::setTimingMode(const slsDetectorDefs::timingMode i) {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
timingMode = i;
|
||||
LOG(logINFO) << "Timing Mode: " << timingMode;
|
||||
updateTotalNumberOfFrames();
|
||||
}
|
||||
|
||||
slsDetectorDefs::burstMode Implementation::getBurstMode() const {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return burstMode;
|
||||
}
|
||||
|
||||
void Implementation::setBurstMode(const slsDetectorDefs::burstMode i) {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
burstMode = i;
|
||||
LOG(logINFO) << "Burst Mode: " << burstMode;
|
||||
updateTotalNumberOfFrames();
|
||||
}
|
||||
|
||||
uint64_t Implementation::getAcquisitionPeriod() const {
|
||||
|
@ -75,6 +75,7 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
runStatus getStatus() const;
|
||||
uint64_t getFramesCaught() const;
|
||||
uint64_t getAcquisitionIndex() const;
|
||||
int getProgress() const;
|
||||
std::vector<uint64_t> getNumMissingPackets() const;
|
||||
void startReceiver();
|
||||
void setStoppedFlag(bool stopped);
|
||||
@ -134,8 +135,19 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
* Detector Parameters *
|
||||
* *
|
||||
* ************************************************/
|
||||
void updateTotalNumberOfFrames();
|
||||
uint64_t getNumberOfFrames() const;
|
||||
void setNumberOfFrames(const uint64_t i);
|
||||
uint64_t getNumberOfTriggers() const;
|
||||
void setNumberOfTriggers(const uint64_t i);
|
||||
uint64_t getNumberOfBursts() const;
|
||||
void setNumberOfBursts(const uint64_t i);
|
||||
int getNumberOfAdditionalStorageCells() const;
|
||||
void setNumberOfAdditionalStorageCells(const int i);
|
||||
timingMode getTimingMode() const;
|
||||
void setTimingMode(const timingMode i);
|
||||
burstMode getBurstMode() const;
|
||||
void setBurstMode(const burstMode i);
|
||||
uint64_t getAcquisitionTime() const;
|
||||
void setAcquisitionTime(const uint64_t i);
|
||||
uint64_t getAcquisitionPeriod() const;
|
||||
@ -266,7 +278,13 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
std::map<std::string, std::string> additionalJsonHeader;
|
||||
|
||||
// detector parameters
|
||||
uint64_t numberOfTotalFrames;
|
||||
uint64_t numberOfFrames;
|
||||
uint64_t numberOfTriggers;
|
||||
uint64_t numberOfBursts;
|
||||
int numberOfAdditionalStorageCells;
|
||||
timingMode timingMode;
|
||||
burstMode burstMode;
|
||||
uint64_t acquisitionPeriod;
|
||||
uint64_t acquisitionTime;
|
||||
uint64_t subExpTime;
|
||||
|
@ -40,6 +40,8 @@ struct zmqHeader {
|
||||
uint64_t acqIndex{0};
|
||||
/** frame index (starting at 0 for each acquisition) */
|
||||
uint64_t frameIndex{0};
|
||||
/** progress in percentage */
|
||||
int progress{0};
|
||||
/** file name prefix */
|
||||
std::string fname{""};
|
||||
/** header from detector */
|
||||
|
@ -245,7 +245,8 @@ class slsDetectorDefs {
|
||||
AUTO_TIMING, /**< internal timing */
|
||||
TRIGGER_EXPOSURE, /**< trigger mode i.e. exposure is triggered */
|
||||
GATED, /**< gated */
|
||||
BURST_TRIGGER /**< trigger a burst of frames */
|
||||
BURST_TRIGGER, /**< trigger a burst of frames */
|
||||
NUM_TIMING_MODES
|
||||
};
|
||||
|
||||
/**
|
||||
@ -448,7 +449,8 @@ class slsDetectorDefs {
|
||||
enum burstMode {
|
||||
BURST_OFF,
|
||||
BURST_INTERNAL,
|
||||
BURST_EXTERNAL
|
||||
BURST_EXTERNAL,
|
||||
NUM_BURST_MODES
|
||||
};
|
||||
|
||||
/**
|
||||
@ -480,7 +482,6 @@ struct detParameters {
|
||||
int nChipX{0};
|
||||
int nChipY{0};
|
||||
int nDacs{0};
|
||||
int dynamicRange{0};
|
||||
|
||||
detParameters() = default;
|
||||
explicit detParameters(slsDetectorDefs::detectorType type) {
|
||||
@ -491,7 +492,6 @@ struct detParameters {
|
||||
nChipX = 10;
|
||||
nChipY = 1;
|
||||
nDacs = 8;
|
||||
dynamicRange = 16;
|
||||
break;
|
||||
case slsDetectorDefs::detectorType::JUNGFRAU:
|
||||
nChanX = 256;
|
||||
@ -499,7 +499,6 @@ struct detParameters {
|
||||
nChipX = 4;
|
||||
nChipY = 2;
|
||||
nDacs = 8;
|
||||
dynamicRange = 16;
|
||||
break;
|
||||
case slsDetectorDefs::detectorType::CHIPTESTBOARD:
|
||||
nChanX = 36;
|
||||
@ -507,7 +506,6 @@ struct detParameters {
|
||||
nChipX = 1;
|
||||
nChipY = 1;
|
||||
nDacs = 24;
|
||||
dynamicRange = 16;
|
||||
break;
|
||||
case slsDetectorDefs::detectorType::MOENCH:
|
||||
nChanX = 32;
|
||||
@ -515,7 +513,6 @@ struct detParameters {
|
||||
nChipX = 1;
|
||||
nChipY = 1;
|
||||
nDacs = 8;
|
||||
dynamicRange = 16;
|
||||
break;
|
||||
case slsDetectorDefs::detectorType::EIGER:
|
||||
nChanX = 256;
|
||||
@ -523,7 +520,6 @@ struct detParameters {
|
||||
nChipX = 4;
|
||||
nChipY = 1;
|
||||
nDacs = 16;
|
||||
dynamicRange = 16;
|
||||
break;
|
||||
case slsDetectorDefs::detectorType::MYTHEN3:
|
||||
nChanX = 128 * 3;
|
||||
@ -531,7 +527,6 @@ struct detParameters {
|
||||
nChipX = 10;
|
||||
nChipY = 1;
|
||||
nDacs = 16;
|
||||
dynamicRange = 32;
|
||||
break;
|
||||
case slsDetectorDefs::detectorType::GOTTHARD2:
|
||||
nChanX = 128;
|
||||
@ -539,7 +534,6 @@ struct detParameters {
|
||||
nChipX = 10;
|
||||
nChipY = 1;
|
||||
nDacs = 14;
|
||||
dynamicRange = 16;
|
||||
break;
|
||||
default:
|
||||
throw sls::RuntimeError("Unknown detector type! " + std::to_string(type));
|
||||
|
@ -197,6 +197,7 @@ enum detFuncs{
|
||||
F_GET_TIMING_SOURCE,
|
||||
F_SET_TIMING_SOURCE,
|
||||
F_GET_NUM_CHANNELS,
|
||||
F_UPDATE_RATE_CORRECTION,
|
||||
|
||||
NUM_DET_FUNCTIONS,
|
||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this (detector server should not compile anyway) */
|
||||
@ -211,6 +212,11 @@ enum detFuncs{
|
||||
F_SEND_RECEIVER_DETHOSTNAME,
|
||||
F_RECEIVER_SET_ROI,
|
||||
F_RECEIVER_SET_NUM_FRAMES,
|
||||
F_SET_RECEIVER_NUM_TRIGGERS,
|
||||
F_SET_RECEIVER_NUM_BURSTS,
|
||||
F_SET_RECEIVER_NUM_ADD_STORAGE_CELLS,
|
||||
F_SET_RECEIVER_TIMING_MODE,
|
||||
F_SET_RECEIVER_BURST_MODE,
|
||||
F_RECEIVER_SET_NUM_ANALOG_SAMPLES,
|
||||
F_RECEIVER_SET_NUM_DIGITAL_SAMPLES,
|
||||
F_RECEIVER_SET_EXPTIME,
|
||||
@ -287,6 +293,8 @@ enum detFuncs{
|
||||
F_INCREMENT_FILE_INDEX,
|
||||
F_SET_ADDITIONAL_JSON_PARAMETER,
|
||||
F_GET_ADDITIONAL_JSON_PARAMETER,
|
||||
F_GET_RECEIVER_PROGRESS,
|
||||
|
||||
NUM_REC_FUNCTIONS
|
||||
};
|
||||
|
||||
@ -480,6 +488,7 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_GET_TIMING_SOURCE: return "F_GET_TIMING_SOURCE";
|
||||
case F_SET_TIMING_SOURCE: return "F_SET_TIMING_SOURCE";
|
||||
case F_GET_NUM_CHANNELS: return "F_GET_NUM_CHANNELS";
|
||||
case F_UPDATE_RATE_CORRECTION: return "F_UPDATE_RATE_CORRECTION";
|
||||
|
||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||
@ -494,6 +503,11 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_SEND_RECEIVER_DETHOSTNAME: return "F_SEND_RECEIVER_DETHOSTNAME";
|
||||
case F_RECEIVER_SET_ROI: return "F_RECEIVER_SET_ROI";
|
||||
case F_RECEIVER_SET_NUM_FRAMES: return "F_RECEIVER_SET_NUM_FRAMES";
|
||||
case F_SET_RECEIVER_NUM_TRIGGERS: return "F_SET_RECEIVER_NUM_TRIGGERS";
|
||||
case F_SET_RECEIVER_NUM_BURSTS: return "F_SET_RECEIVER_NUM_BURSTS";
|
||||
case F_SET_RECEIVER_NUM_ADD_STORAGE_CELLS: return "F_SET_RECEIVER_NUM_ADD_STORAGE_CELLS";
|
||||
case F_SET_RECEIVER_TIMING_MODE: return "F_SET_RECEIVER_TIMING_MODE";
|
||||
case F_SET_RECEIVER_BURST_MODE: return "F_SET_RECEIVER_BURST_MODE";
|
||||
case F_RECEIVER_SET_NUM_ANALOG_SAMPLES: return "F_RECEIVER_SET_NUM_ANALOG_SAMPLES";
|
||||
case F_RECEIVER_SET_NUM_DIGITAL_SAMPLES:return "F_RECEIVER_SET_NUM_DIGITAL_SAMPLES";
|
||||
case F_RECEIVER_SET_EXPTIME: return "F_RECEIVER_SET_EXPTIME";
|
||||
@ -570,6 +584,7 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_INCREMENT_FILE_INDEX: return "F_INCREMENT_FILE_INDEX";
|
||||
case F_SET_ADDITIONAL_JSON_PARAMETER: return "F_SET_ADDITIONAL_JSON_PARAMETER";
|
||||
case F_GET_ADDITIONAL_JSON_PARAMETER: return "F_GET_ADDITIONAL_JSON_PARAMETER";
|
||||
case F_GET_RECEIVER_PROGRESS: return "F_GET_RECEIVER_PROGRESS";
|
||||
|
||||
case NUM_REC_FUNCTIONS: return "NUM_REC_FUNCTIONS";
|
||||
default: return "Unknown Function";
|
||||
|
@ -1,12 +1,12 @@
|
||||
/** API versions */
|
||||
#define GITBRANCH "developer"
|
||||
#define APILIB 0x200227
|
||||
#define APIRECEIVER 0x200227
|
||||
#define APIGUI 0x200227
|
||||
#define APICTB 0x200331
|
||||
#define APIGOTTHARD 0x200331
|
||||
#define APIGOTTHARD2 0x200331
|
||||
#define APIJUNGFRAU 0x200331
|
||||
#define APIMYTHEN3 0x200331
|
||||
#define GITBRANCH "removeshm"
|
||||
#define APICTB 0x200402
|
||||
#define APIGOTTHARD 0x200402
|
||||
#define APIGOTTHARD2 0x200402
|
||||
#define APIJUNGFRAU 0x200402
|
||||
#define APIMYTHEN3 0x200402
|
||||
#define APIMOENCH 0x200331
|
||||
#define APIEIGER 0x200331
|
||||
#define APIEIGER 0x200402
|
||||
#define APILIB 0x200402
|
||||
#define APIRECEIVER 0x200402
|
||||
#define APIGUI 0x200331
|
||||
|
@ -158,6 +158,7 @@ int ZmqSocket::SendHeader(
|
||||
"\"size\":%u, "
|
||||
"\"acqIndex\":%lu, "
|
||||
"\"frameIndex\":%lu, "
|
||||
"\"progress\":%u, "
|
||||
"\"fname\":\"%s\", "
|
||||
"\"data\": %d, "
|
||||
"\"completeImage\": %d, "
|
||||
@ -193,6 +194,7 @@ int ZmqSocket::SendHeader(
|
||||
header.imageSize,
|
||||
header.acqIndex,
|
||||
header.frameIndex,
|
||||
header.progress,
|
||||
header.fname.c_str(),
|
||||
header.data ? 1 : 0,
|
||||
header.completeImage ? 1 : 0,
|
||||
@ -324,6 +326,7 @@ int ZmqSocket::ParseHeader(const int index, int length, char *buff,
|
||||
zHeader.imageSize = document["size"].GetUint();
|
||||
zHeader.acqIndex = document["acqIndex"].GetUint64();
|
||||
zHeader.frameIndex = document["frameIndex"].GetUint64();
|
||||
zHeader.progress = document["progress"].GetUint();
|
||||
zHeader.fname = document["fname"].GetString();
|
||||
|
||||
zHeader.frameNumber = document["frameNumber"].GetUint64();
|
||||
|
Loading…
x
Reference in New Issue
Block a user