merged selected patches from 4.0.0 branch

This commit is contained in:
maliakal_d 2018-08-24 13:10:16 +02:00
parent 7945d15beb
commit 1b55fdad86
20 changed files with 335 additions and 161 deletions

2
cmk.sh
View File

@ -145,7 +145,7 @@ else
fi
fi
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug "
#CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug "
#hdf5 rebuild
if [ $HDF5 -eq 1 ]; then

View File

@ -20,7 +20,7 @@ all: docs detUser slsMultiReceiver
docs: createdocs docspdf docshtml removedocs
createdocs: slsDetectorUsers.doxy slsDetectorUsers.h detectorData.h slsReceiverUsers.h mainClient.cpp mainReceiver.cpp
createdocs: slsDetectorUsers.doxy mainClient.cpp mainReceiver.cpp
doxygen slsDetectorUsers.doxy
docspdf:

View File

@ -54,7 +54,12 @@ int main(int argc, char **argv) {
/** - slsDetectorUsers Object is instantiated with appropriate ID */
slsDetectorUsers *pDetector = new slsDetectorUsers (id);
int ret = 1;
slsDetectorUsers *pDetector = new slsDetectorUsers (ret, id);
if (ret == 1) {
std::cout << "Error: Could not instantiate slsDetectorUsers" << std::endl;
return EXIT_FAILURE;
}
/** - if specified, load configuration file (necessary at least the first time it is called to properly configure advanced settings in the shared memory) */

View File

@ -81,7 +81,11 @@ LATEX_HIDE_INDICES = YES
SOURCE_BROWSER = YES
PREDEFINED = __cplusplus
INPUT = slsDetectorUsers.h detectorData.h slsReceiverUsers.h mainClient.cpp mainReceiver.cpp
INPUT = ../../slsDetectorSoftware/slsDetector/slsDetectorUsers.h \
../../slDetectorSoftware/slsDetectorAnalysis/detectorData.h \
../../slsReceiverSoftware/include/slsReceiverUsers.h \
mainClient.cpp \
mainReceiver.cpp
OUTPUT_DIRECTORY = slsDetectorUsersDocs

View File

@ -61,6 +61,11 @@ The \textit{data receiver}, which can be run on a different machine than the
client, receives the data from the detector and processes it. The receiver can
be configured, controlled and monitored by the client.
\item \textcolor{blue}{slsMultiReceiver}: \\
It is the same as the \textit{slsReceiver}, but that it is a single process
for many multiple slsReceiver child processes. One can configure the start TCP port,
number of slsReceiver processes and if call back should be enabled or not.
\item \textcolor{blue}{slsDetectorGUI}: \\
The \textit{graphical user interface}, which provides a user friendly way
of operating the detectors and data receivers with online data preview.
@ -110,13 +115,13 @@ conda config --add channels conda-forge
conda config --add channels slsdetectorgroup
#Install latest version
conda install sls_detector_software
conda install sls_detector_lib
conda install sls_detector_gui
#Install specific release (GLIBC2.14)
conda install sls_detector_software=3.1.0
#Install specific release
conda install sls_detector_lib=4.0.0
conda install sls_detector_gui=4.0.0
#Scientific Linux 6 version (GLIBC2.12)
conda install sls_detector_software=SL6_3.1.0
\end{verbatim}
\item The package including Python interface
\begin{verbatim}
@ -127,11 +132,9 @@ conda config --add channels sls_detector
#Install latest version
conda install sls_detector
#Install specific release (GLIBC2.14)
conda install sls_detector=3.1.0
#Install specific release
conda install sls_detector=4.0.0
#Scientific Linux 6 version (GLIBC2.12)
conda install sls_detector=SL6_3.1.0
\end{verbatim}
\end{itemize}
@ -148,13 +151,13 @@ acquisition system, or if one wants to download the source code and compile.
\begin{verbatim}
#Clone source code with specific release
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git --branch
3.1.0
4.0.0
\end{verbatim}
\item The package including Python interface
\begin{verbatim}
#Clone source code with specific release
git clone https://github.com/slsdetectorgroup/sls_detector.git --branch
3.1.0
4.0.0
\end{verbatim}
\end{itemize}
@ -437,14 +440,11 @@ the SLS Detector Package or a different detector type.
One can use the \verb=cleansharedmemory.sh= script available under the
slsDetector Package.
One can also just use the following commands to clean the shared memory
segments one by one.
\begin{verbatim}
#displays list of shared memeory segments
ipcs -m
#remove segments that have nattach equal to zero. They key is the first column
ipcrm -M [key]
\end{verbatim}
One can also just delete the files that are typically located under /dev/shm/ folder
and starts with slsDetectorPackage.
One no longer has to delete segments using ipcs.
\section{Software Upgrade}
@ -544,14 +544,14 @@ detector board the programming files and/or software package provided by
the SLS Detectors group.
\subsubsection{GOTTHARD Firmware}
\textit{For SLS Detector Package v3.1.0} \\
\textit{For SLS Detector Package v4.0.0} \\
\indent Minimum compatible version: \\
\indent \indent 11.01.2013 \\
\indent Latest version: \\
\indent \indent 08.02.2018 (50um and 25um Master) \\
\indent \indent 26.06.2018 (50um) \\
\indent \indent 08.02.2018 (25 um Master) \\
\indent \indent 09.02.2018 (25 um Slave) \\
Normally, the firmware will be upgraded by us as it requires programming the
FPGA via the USB-Blaster.
@ -636,9 +636,9 @@ detector board the programming files and/or software package provided by
the SLS Detectors group.
\subsubsection{EIGER Firmware}
\textit{For SLS Detector Package v3.1.0} \\
\indent Minimum compatible version: 16 \\
\indent Latest version: 20 \\
\textit{For SLS Detector Package v4.0.0} \\
\indent Minimum compatible version: 22 \\
\indent Latest version: 22 \\
\begin{enumerate}
@ -647,6 +647,20 @@ Detector Group.
\item If one does not have the bcp script, that should also be obtained from
the SLS Detector Group. It is required to program the bit files and requires
that tftp be installed on the pc.
\item Bring the detector into programmable mode by either of the following ways.
Both ways end up in just the central LED blinking.
\begin{enumerate}
\item hard reset on the back panel boards resulting in blinking LEDS
\item by having the following program running in the background.
\begin{verbatim}
boot_recovery
\end{verbatim}
\end{enumerate}
\item Start a terminal for each half module and run the following to see
progress.
\begin{verbatim}
nc -p 3000 -u bebxxx 3000
\end{verbatim}
\item Run the following to update firmware
\begin{verbatim}
#update back end fpga
@ -715,9 +729,9 @@ detector board the programming files and/or software package provided by
the SLS Detectors group.
\subsubsection{JUNGFRAU Firmware}
\textit{For SLS Detector Package v3.1.0} \\
\indent Minimum compatible version: 13.11.2017 \\
\indent Latest version: 13.11.2017 \\
\textit{For SLS Detector Package v4.0.0} \\
\indent Minimum compatible version: 15.06.2018 \\
\indent Latest version: 15.06.2018 \\
At times, one has to update the firmware, which then also requires updating the

View File

@ -1,5 +1,5 @@
/** API versions */
#define APIRECEIVER 0x180517
#define APIEIGER 0x180815
#define APIJUNGFRAU 0x180628
#define APIGOTTHARD 0x180529
#define APIRECEIVER 0x180718
#define APIEIGER 0x180820
#define APIJUNGFRAU 0x180820
#define APIGOTTHARD 0x180820

View File

@ -657,7 +657,9 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val){
/* parameters - timer */
int64_t setTimer(enum timerIndex ind, int64_t val){
#ifndef VIRTUAL
int64_t subdeadtime = 0;
#endif
int64_t subexptime = 0;
switch(ind){
case FRAME_NUMBER:
@ -723,7 +725,7 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
// get subexptime
subexptime = Feb_Control_GetSubFrameExposureTime();
#else
int64_t subexptime = eiger_virtual_subexptime*10;
subexptime = eiger_virtual_subexptime*10;
#endif
if(val >= 0){
printf(" Setting sub period: %lldns = subexptime(%lld) + subdeadtime(%lld)\n",
@ -787,13 +789,18 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
int64_t getTimeLeft(enum timerIndex ind) {
#ifdef VIRTUAL
return 0;
#else
switch(ind){
case MEASURED_PERIOD: return Feb_Control_GetMeasuredPeriod();
case MEASURED_SUBPERIOD: return Feb_Control_GetSubMeasuredPeriod();
return 0;
default:
cprintf(RED,"This timer left index (%d) not defined for Eiger\n",ind);
return -1;
}
#endif
}
@ -1612,9 +1619,13 @@ int stopStateMachine(){
}
int softwareTrigger() {
#ifdef VIRTUAL
return OK;
#else
if (!Feb_Control_SoftwareTrigger())
return FAIL;
return OK;
#endif
}

View File

@ -10,7 +10,7 @@
#define GOODBYE (-200)
#define PROGRAMMING_MODE (-200)
#define MIN_REQRD_VRSN_T_RD_API 0x171220
#define REQRD_FRMWR_VRSN 0x180226
#define REQRD_FRMWR_VRSN 0x180615
/* Struct Definitions */

View File

@ -2680,16 +2680,28 @@ int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t, int imod) {
return ret;
}
int64_t multiSlsDetector::getTimeLeft(timerIndex index) {
int64_t multiSlsDetector::getTimeLeft(timerIndex index, int imod) {
int64_t ret = -100;
{ // single
int id = -1, im = -1;
if (decodeNMod(imod, id, im) >= 0) {
if (id < 0 || id >= (int)detectors.size())
return -1;
ret = detectors[id]->getTimeLeft(index, im);
if (detectors[id]->getErrorMask())
setErrorMask(getErrorMask() | (1 << id));
return ret;
}
}
if (thisMultiDetector->masterPosition >= 0)
if (detectors[thisMultiDetector->masterPosition]) {
ret = detectors[thisMultiDetector->masterPosition]->getTimeLeft(index);
ret = detectors[thisMultiDetector->masterPosition]->getTimeLeft(index, imod);
if (detectors[thisMultiDetector->masterPosition]->getErrorMask())
setErrorMask(getErrorMask() | (1 << thisMultiDetector->masterPosition));
return ret;
}
return callDetectorMember(&slsDetector::getTimeLeft, index);
return callDetectorMember(&slsDetector::getTimeLeft, index, imod);
}
int multiSlsDetector::setSpeed(speedVariable index, int value) {

View File

@ -1048,9 +1048,10 @@ public:
* Set/get timer value left in acquisition (not all implemented for all detectors)
* @param index timer index
* @param t time in ns or number of...(e.g. frames, gates, probes)
* @param imod module number
* @returns timer set value in ns or number of...(e.g. frames, gates, probes)
*/
int64_t getTimeLeft(timerIndex index);
int64_t getTimeLeft(timerIndex index, int imod = -1);
/**
* Set speed

View File

@ -4355,7 +4355,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t, int imod) {
int64_t slsDetector::getTimeLeft(timerIndex index) {
int64_t slsDetector::getTimeLeft(timerIndex index, int imod) {
int fnum=F_GET_TIME_LEFT;

View File

@ -1164,9 +1164,10 @@ public:
* Set/get timer value left in acquisition (not all implemented for all detectors)
* @param index timer index
* @param t time in ns or number of...(e.g. frames, gates, probes)
* @param imod module number
* @returns timer set value in ns or number of...(e.g. frames, gates, probes)
*/
int64_t getTimeLeft(timerIndex index);
int64_t getTimeLeft(timerIndex index, int imod = -1);
/**
* Set speed

View File

@ -894,17 +894,17 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
\returns TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT, TEMPERATURE_10GE, TEMPERATURE_DCDC, TEMPERATURE_SODL,
TEMPERATURE_SODR, TEMPERATURE_FPGA2, TEMPERATURE_FPGA3, -1 when unknown mode
*/
static int getADCIndex(std::string s){
if (s=="temp_fpga") return TEMPERATURE_FPGA;
if (s=="temp_fpgaext") return TEMPERATURE_FPGAEXT;
if (s=="temp_10ge") return TEMPERATURE_10GE;
if (s=="temp_dcdc") return TEMPERATURE_DCDC;
if (s=="temp_sodl") return TEMPERATURE_SODL;
if (s=="temp_sodr") return TEMPERATURE_SODR;
if (s=="temp_fpgafl") return TEMPERATURE_FPGA2;
if (s=="temp_fpgafr") return TEMPERATURE_FPGA3;
return -1;
};
static int getADCIndex(std::string s){ \
if (s=="temp_fpga") return TEMPERATURE_FPGA; \
if (s=="temp_fpgaext") return TEMPERATURE_FPGAEXT; \
if (s=="temp_10ge") return TEMPERATURE_10GE; \
if (s=="temp_dcdc") return TEMPERATURE_DCDC; \
if (s=="temp_sodl") return TEMPERATURE_SODL; \
if (s=="temp_sodr") return TEMPERATURE_SODR; \
if (s=="temp_fpgafl") return TEMPERATURE_FPGA2; \
if (s=="temp_fpgafr") return TEMPERATURE_FPGA3; \
return -1; \
}; \
/**
@ -912,19 +912,43 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
\param s can be vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr, vthreshold, vrf, vrs, vtr, vcall, vcp
\returns E_Vcmp_ll, E_Vcmp_lr, E_Vcmp_rl, E_Vcmp_rr, THRESHOLD, E_Vrf, E_Vrs, E_Vtr, E_cal, E_Vcp , -1 when unknown mode
*/
static int getDACIndex(std::string s){
if (s=="vcmp_ll") return E_Vcmp_ll;
if (s=="vcmp_lr") return E_Vcmp_lr;
if (s=="vcmp_rl") return E_Vcmp_rl;
if (s=="vcmp_rr") return E_Vcmp_rr;
if (s=="vthreshold") return THRESHOLD;
if (s=="vrf") return E_Vrf;
if (s=="vrs") return E_Vrs;
if (s=="vtr") return E_Vtr;
if (s=="vcall") return E_cal;
if (s=="vcp") return E_Vcp;
return -1;
};
static int getDACIndex(std::string s){ \
if (s=="vcmp_ll") return E_Vcmp_ll; \
if (s=="vcmp_lr") return E_Vcmp_lr; \
if (s=="vcmp_rl") return E_Vcmp_rl; \
if (s=="vcmp_rr") return E_Vcmp_rr; \
if (s=="vthreshold") return THRESHOLD; \
if (s=="vrf") return E_Vrf; \
if (s=="vrs") return E_Vrs; \
if (s=="vtr") return E_Vtr; \
if (s=="vcall") return E_cal; \
if (s=="vcp") return E_Vcp; \
return -1; \
}; \
/**
@short returns receiver frame discard policy from std::string
\param s can be nodiscard, discardempty, discardpartial
\returns NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES, GET_FRAME_DISCARD_POLICY when unknown mode
*/
static frameDiscardPolicy getReceiverFrameDiscardPolicy(std::string s){ \
if (s=="nodiscard") return NO_DISCARD; \
if (s=="discardempty") return DISCARD_EMPTY_FRAMES; \
if (s=="discardpartial") return DISCARD_PARTIAL_FRAMES; \
return GET_FRAME_DISCARD_POLICY; \
}; \
/** returns std::string from frame discard policy
\param f can be NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES
\returns std::string nodiscard, discardempty, discardpartial, unknown
*/
static std::string getReceiverFrameDiscardPolicy(frameDiscardPolicy f){ \
switch (f) { \
case NO_DISCARD: return std::string("nodiscard"); \
case DISCARD_EMPTY_FRAMES: return std::string("discardempty"); \
case DISCARD_PARTIAL_FRAMES: return std::string("discardpartial"); \
default: return std::string("unknown"); \
}}; \
};

View File

@ -44,6 +44,12 @@ To address a specific controller i of detector j use:
<b>sls_detector_clnt j-i:cmd</b>
To use different shared memory segements for different detectors on the same
client pc, one can use environment variable <b>SLSDETNAME</b> set to any string to
different strings to make the shared memory segments unique. One can then use
the same multi detector id for both detectors as they have a different shared memory names.
For additional questions concerning the indexing of the detector, please refer to the SLS Detectors FAQ documentation.
The commands are sudivided into different pages depending on their functionalities:
@ -2249,7 +2255,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
++i;
/*! \page receiver
- <b>r_discardpolicy</b> sets/gets the frame discard policy in the receiver. 0 - no discard (default), 1 - discard only empty frames, 2 - discard any partial frame(fastest). \c Returns \c (int)
- <b>r_discardpolicy</b> sets/gets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName="r_discardpolicy"; //OK
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
@ -6383,14 +6389,12 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
else if(cmd=="r_discardpolicy") {
if (action==PUT_ACTION){
if (sscanf(args[1],"%d",&ival) && (ival >= 0) && (ival < NUM_DISCARD_POLICIES)) {
myDet->setReceiverFramesDiscardPolicy((frameDiscardPolicy)ival);
} else return string("could not scan frames discard policy\n");
frameDiscardPolicy f = myDet->getReceiverFrameDiscardPolicy(string(args[1]));
if (f == GET_FRAME_DISCARD_POLICY)
return string("could not scan frame discard policy. Options: nodiscard, discardempty, discardpartial\n");
myDet->setReceiverFramesDiscardPolicy(f);
}
char answer[100];
memset(answer, 0, 100);
sprintf(answer,"%d",myDet->setReceiverFramesDiscardPolicy());
return string(answer);
return myDet->getReceiverFrameDiscardPolicy(myDet->setReceiverFramesDiscardPolicy());
}
else if(cmd=="r_padding") {
@ -6424,7 +6428,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
os << "rx_fifodepth [val]\t sets receiver fifo depth to val" << std::endl;
os << "r_silent [i]\t sets receiver in silent mode, ie. it will not print anything during real time acquisition. 1 sets, 0 unsets." << std::endl;
os << "r_framesperfile s\t sets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
os << "r_discardpolicy s\t sets the frame discard policy in the receiver. 0 - no discard (default), 1 - discard only empty frames, 2 - discard any partial frame(fastest)." << std::endl;
os << "r_discardpolicy s\t sets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
os << "r_padding s\t enables/disables partial frames to be padded in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
}
if (action==GET_ACTION || action==HELP_ACTION){
@ -6436,7 +6440,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
os << "rx_fifodepth \t returns receiver fifo depth" << std::endl;
os << "r_silent \t returns receiver silent mode enable. 1 is silent, 0 not silent." << std::endl;
os << "r_framesperfile \t gets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
os << "r_discardpolicy \t gets the frame discard policy in the receiver. 0 - no discard (default), 1 - discard only empty frames, 2 - discard any partial frame(fastest)." << std::endl;
os << "r_discardpolicy \t gets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
os << "r_padding \t gets partial frames padding enable in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
}
return os.str();

View File

@ -6,7 +6,7 @@
using namespace std;
slsDetectorUsers::slsDetectorUsers(int id, int& ret) : myDetector(0), myCmd(0){
slsDetectorUsers::slsDetectorUsers(int& ret, int id) : myDetector(0), myCmd(0){
try {
myDetector=new multiSlsDetector(id);
} catch(...) {
@ -16,22 +16,18 @@ slsDetectorUsers::slsDetectorUsers(int id, int& ret) : myDetector(0), myCmd(0){
myCmd=new multiSlsDetectorCommand(myDetector);
ret = 0;
};
}
slsDetectorUsers::~slsDetectorUsers() {
if (myDetector)
delete myDetector;
};
}
string slsDetectorUsers::getDetectorDeveloper(){
return myDetector->getDetectorDeveloper();
}
int slsDetectorUsers::setOnline(int const online){
return myDetector->setOnline(online);
}
@ -48,7 +44,6 @@ int slsDetectorUsers::stopMeasurement(){
return myDetector->stopAcquisition();
}
int slsDetectorUsers::getDetectorStatus(){
return (int)myDetector->getRunStatus();
}
@ -57,12 +52,10 @@ string slsDetectorUsers::getFilePath(){
return myDetector->getFilePath();
}
string slsDetectorUsers::setFilePath(string s){
return myDetector->setFilePath(s);
}
string slsDetectorUsers::getFileName(){
return myDetector->getFileName();
}
@ -89,7 +82,7 @@ string slsDetectorUsers::setFlatFieldCorrectionDir(string dir){
string slsDetectorUsers::getFlatFieldCorrectionFile(){
return myDetector->getFlatFieldCorrectionFile();
};
}
int slsDetectorUsers::setFlatFieldCorrectionFile(string fname){
return myDetector->setFlatFieldCorrectionFile(fname);
@ -146,7 +139,6 @@ int slsDetectorUsers::setBitDepth(int i){
return myDetector->setDynamicRange(i);
}
int slsDetectorUsers::setSettings(int isettings){
return myDetector->slsDetectorBase::setSettings(isettings);
}
@ -166,43 +158,40 @@ int slsDetectorUsers::setThresholdEnergy(int e_ev, int tb, int isettings, int id
double slsDetectorUsers::setExposureTime(double t, bool inseconds, int imod){
if(!inseconds)
return myDetector->setExposureTime((int64_t)t,imod);
else {
// + 0.5 to round for precision lost from converting double to int64_t
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
if (t < 0) tms = -1;
tms = myDetector->setExposureTime(tms,imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
// + 0.5 to round for precision lost from converting double to int64_t
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
if (t < 0) tms = -1;
tms = myDetector->setExposureTime(tms,imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
double slsDetectorUsers::setExposurePeriod(double t, bool inseconds, int imod){
if(!inseconds)
return myDetector->setExposurePeriod((int64_t)t,imod);
else {
// + 0.5 to round for precision lost from converting double to int64_t
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
if (t < 0) tms = -1;
tms = myDetector->setExposurePeriod(tms,imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
// + 0.5 to round for precision lost from converting double to int64_t
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
if (t < 0) tms = -1;
tms = myDetector->setExposurePeriod(tms,imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
double slsDetectorUsers::setDelayAfterTrigger(double t, bool inseconds, int imod){
if(!inseconds)
return myDetector->setDelayAfterTrigger((int64_t)t,imod);
else {
// + 0.5 to round for precision lost from converting double to int64_t
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
if (t < 0) tms = -1;
tms = myDetector->setDelayAfterTrigger(tms,imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
// + 0.5 to round for precision lost from converting double to int64_t
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
if (t < 0) tms = -1;
tms = myDetector->setDelayAfterTrigger(tms,imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
int64_t slsDetectorUsers::setNumberOfGates(int64_t t, int imod){
@ -306,6 +295,44 @@ int slsDetectorUsers::enableGapPixels(int enable) {
return myDetector->enableGapPixels(enable);
}
std::string slsDetectorUsers::setReceiverFramesDiscardPolicy(std::string f) {
return myDetector->getReceiverFrameDiscardPolicy(
myDetector->setReceiverFramesDiscardPolicy(
myDetector->getReceiverFrameDiscardPolicy(f)));
}
int slsDetectorUsers::setReceiverPartialFramesPadding(int f) {
return myDetector->setReceiverPartialFramesPadding(f);
}
int slsDetectorUsers::setReceiverFramesPerFile(int f) {
return myDetector->setReceiverFramesPerFile(f);
}
int slsDetectorUsers::sendSoftwareTrigger() {
return myDetector->sendSoftwareTrigger();
}
double slsDetectorUsers::getMeasuredPeriod(bool inseconds, int imod) {
if(!inseconds)
return myDetector->getTimeLeft(slsReceiverDefs::MEASURED_PERIOD, imod);
int64_t tms = myDetector->getTimeLeft(slsReceiverDefs::MEASURED_PERIOD, imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
double slsDetectorUsers::getMeasuredSubFramePeriod(bool inseconds, int imod) {
if(!inseconds)
return myDetector->getTimeLeft(slsReceiverDefs::MEASURED_SUBPERIOD, imod);
int64_t tms = myDetector->getTimeLeft(slsReceiverDefs::MEASURED_SUBPERIOD, imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
void slsDetectorUsers::registerDataCallback(int( *userCallback)(detectorData*, int, int, void*), void *pArg){
myDetector->registerDataCallback(userCallback,pArg);
}
@ -343,8 +370,6 @@ void slsDetectorUsers::registerGetI0Callback( double (*func)(int,void*),void *ar
}
string slsDetectorUsers::putCommand(int narg, char *args[], int pos){
if(narg < 2)
return string("Error: Insufficient Parameters");
@ -358,8 +383,6 @@ string slsDetectorUsers::getCommand(int narg, char *args[], int pos){
}
int slsDetectorUsers::setClockDivider(int value) {
return myDetector->setClockDivider(value);
}
@ -408,7 +431,6 @@ int slsDetectorUsers::stopAcquisition() {
return myDetector->stopAcquisition();
}
int slsDetectorUsers::setReceiverSilentMode(int i) {
return myDetector->setReceiverSilentMode(i);
}
@ -465,3 +487,10 @@ double slsDetectorUsers::setSubFrameExposureDeadTime(double t, bool inseconds, i
}
}
int64_t slsDetectorUsers::setNumberOfStorageCells(int64_t t, int imod) {
return myDetector->setTimer(slsReceiverDefs::STORAGE_CELL_NUMBER, t, imod);
}
int slsDetectorUsers::setStoragecellStart(int pos) {
return myDetector->setStoragecellStart(pos);
}

View File

@ -25,7 +25,6 @@ class multiSlsDetectorCommand;
/*
\mainpage
<CENTER><H1>API for SLS detectors data acquisition</H1></CENTER>
@ -72,12 +71,11 @@ You can find examples of how this classes can be instatiated in mainClient.cpp
*/
/**
@libdoc The slsDetectorUsers class is a minimal interface class which should be instantiated by the users in their acquisition software (EPICS, spec etc.). More advanced configuration functions are not implemented and can be written in a configuration or parameters file that can be read/written.
*/
/**
@short Class for detector functionalities to embed the detector controls in the users custom interface e.g. EPICS, Lima etc.
@short The slsDetectorUsers class is a minimal interface class which should be instantiated by the users in their acquisition software (EPICS, spec etc.). More advanced configuration functions are not implemented and can be written in a configuration or parameters file that can be read/written.
Class for detector functionalities to embed the detector controls in the users custom interface e.g. EPICS, Lima etc.
*/
@ -88,26 +86,21 @@ class slsDetectorUsers
public:
/** @short default constructor
* @param id multi detector id
* @param ret address of return value. It will be set to 0 for success, else 1 for failure
* @param id multi detector id
* in creating multidetector object
*/
slsDetectorUsers(int id=0, int& ret);
slsDetectorUsers(int& ret, int id=0);
/** @short virtual destructor */
virtual ~slsDetectorUsers();
/**
@short useful to define subset of working functions
\returns "PSI" or "Dectris"
*/
std::string getDetectorDeveloper();
/** @short sets the onlineFlag
\param online can be: -1 returns wether the detector is in online (1) or offline (0) state; 0 detector in offline state; 1 detector in online state
\returns 0 (offline) or 1 (online)
@ -275,8 +268,6 @@ class slsDetectorUsers
int getDetectorSize(int &x0, int &y0, int &nx, int &ny);
/**
@short gets the maximum detector size
\param x0 horizontal position origin in channel number
\param y0 vertical position origin in channel number
\param nx number of channels in horiziontal
\param ny number of channels in vertical
\returns OK/FAIL
@ -376,7 +367,6 @@ class slsDetectorUsers
\returns number of frames
*/
int64_t setNumberOfCycles(int64_t t=-1, int imod = -1);
/**
@short set/get the external communication mode
@ -424,6 +414,7 @@ class slsDetectorUsers
/**
@short register calbback for accessing detector final data, also enables data streaming in client and receiver (if receiver exists)
\param userCallback function for plotting/analyzing the data. Its arguments are the data structure d and the frame number f, s is for subframe number for eiger for 32 bit mode
\param pArg argument
*/
void registerDataCallback(int( *userCallback)(detectorData* d, int f, int s, void*), void *pArg);
@ -431,6 +422,7 @@ class slsDetectorUsers
/**
@short register callback for accessing raw data - if the rawDataCallback is registered, no filewriting/postprocessing will be carried on automatically by the software - the raw data are deleted by the software
\param userCallback function for postprocessing and saving the data - p is the pointer to the data, n is the number of channels
\param pArg argument
*/
void registerRawDataCallback(int( *userCallback)(double* p, int n, void*), void *pArg);
@ -467,7 +459,7 @@ class slsDetectorUsers
/** Enable or disable streaming data from receiver (creates transmitting sockets)
* @param enable 0 to disable 1 to enable -1 to only get the value
* @param i 0 to disable 1 to enable -1 to only get the value
* @returns data streaming from receiver enable
*/
int enableDataStreamingFromReceiver(int i=-1);
@ -506,7 +498,7 @@ class slsDetectorUsers
/** (for expert users)
* Set/Get client streaming in ZMQ IP
* By default, it is the IP of receiver hostname
* @param i sets, empty std::string gets
* @param ip sets, empty std::string gets
* @returns client streaming in ZMQ IP
*/
std::string setClientDataStreamingInIP(std::string ip="");
@ -556,42 +548,92 @@ class slsDetectorUsers
*/
int enableGapPixels(int enable=-1);
/**
* Sets the frames discard policy in receiver
* frame discard policy options:
* @param f nodiscard (default),discardempty, discardpartial (fastest), get to get the value
* @returns f nodiscard (default),discardempty, discardpartial (fastest)
*/
std::string setReceiverFramesDiscardPolicy(std::string f="get");
/**
* Sets the frame padding in receiver
* @param f 0 does not partial frames, 1 pads partial frames (-1 gets)
* @returns partial frames padding enable
*/
int setReceiverPartialFramesPadding(int f = -1);
/**
* Sets the frames per file in receiver
* @param f frames per file, 0 is infinite ie. every frame in same file (-1 gets)
* @returns frames per file
*/
int setReceiverFramesPerFile(int f = -1);
/**
* Sends a software internal trigger (EIGER only)
* @returns 0 for success, 1 for fail
*/
int sendSoftwareTrigger();
/**
* get measured period between previous two frames(EIGER only)
* @param inseconds true if the value is in s, else ns
* @param imod module number (-1 for all)
* @returns measured period
*/
double getMeasuredPeriod(bool inseconds=false, int imod = -1);
/**
* get measured sub period between previous two sub frames in 32 bit mode (EIGER only)
* @param inseconds true if the value is in s, else ns
* @param imod module number (-1 for all)
* @returns measured sub period
*/
double getMeasuredSubFramePeriod(bool inseconds=false, int imod = -1);
/**
@short register calbback for accessing detector final data
\param func function to be called at the end of the acquisition. gets detector status and progress index as arguments
\param pArg argument
*/
void registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg);
/**
@short register calbback for reading detector position
\param func function for reading the detector position
\param arg argument
*/
void registerGetPositionCallback( double (*func)(void*),void *arg);
/**
@short register callback for connecting to the epics channels
\param func function for connecting to the epics channels
\param arg argument
*/
void registerConnectChannelsCallback( int (*func)(void*),void *arg);
/**
@short register callback to disconnect the epics channels
\param func function to disconnect the epics channels
\param arg argument
*/
void registerDisconnectChannelsCallback( int (*func)(void*),void *arg);
/**
@short register callback for moving the detector
\param func function for moving the detector
\param arg argument
*/
void registerGoToPositionCallback( int (*func)(double,void*),void *arg);
/**
@short register callback for moving the detector without waiting
\param func function for moving the detector
\param arg argument
*/
void registerGoToPositionNoWaitCallback( int (*func)(double,void*),void *arg);
/**
@short register calbback reading to I0
\param func function for reading the I0 (called with parameter 0 before the acquisition, 1 after and the return value used as I0)
\param arg argument
*/
void registerGetI0Callback( double (*func)(int,void*),void *arg);
@ -666,13 +708,13 @@ class slsDetectorUsers
/**
@short start receiver listening mode
\param returns OK or FAIL
\returns returns OK or FAIL
*/
int startReceiver();
/**
@short stop receiver listening mode
\param returns OK or FAIL
\returns returns OK or FAIL
*/
int stopReceiver();
@ -707,7 +749,7 @@ class slsDetectorUsers
/**
* reset frames caught in receiver
* should be called before startReceiver()
* @retuns OK or FAIL
* @returns OK or FAIL
*/
int resetFramesCaughtInReceiver();
@ -740,7 +782,7 @@ class slsDetectorUsers
/**
* Set sub frame exposure time (only for Eiger)
* @param i sub frame exposure time (-1 gets)
* @param t 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
@ -750,13 +792,28 @@ class slsDetectorUsers
/**
* 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 t sub frame dead time (-1 gets)
* @param inseconds true if the value is in s, else ns
* @param imod module number (-1 for all)
* @returns sub frame dead time in ns, or s if specified
*/
double setSubFrameExposureDeadTime(double t=-1, bool inseconds=false, int imod = -1);
/**
* set/get number of additional storage cells (Jungfrau)
* @param t number of additional storage cells. Default is 0. (-1 gets)
* @param imod module number (-1 for all)
* @returns number of additional storage cells
*/
int64_t setNumberOfStorageCells(int64_t t=-1, int imod = -1);
/**
* Set storage cell that stores first acquisition of the series (Jungfrau)
* @param pos storage cell index. Value can be 0 to 15. Default is 15. (-1 gets)
* @returns the storage cell that stores the first acquisition of the series
*/
int setStoragecellStart(int pos=-1);
/************************************************************************
STATIC FUNCTIONS
@ -836,12 +893,12 @@ class slsDetectorUsers
\returns auto, trigger, ro_trigger, gating, triggered_gating, unknown when wrong mode
*/
static int getTimingMode(std::string s){ \
static int getTimingMode(std::string s){ \
if (s== "auto") return 0; \
if (s== "trigger") return 1; \
if (s== "ro_trigger") return 2; \
if (s== "gating") return 3; \
if (s== "triggered_gating") return 4; \
if (s== "triggered_gating") return 4; \
return -1; };

View File

@ -291,9 +291,10 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
/**
get current timer value
\param index timer index
\param imod module number
\returns elapsed time value in ns or number of...(e.g. frames, gates, probes)
*/
virtual int64_t getTimeLeft(timerIndex index)=0;
virtual int64_t getTimeLeft(timerIndex index, int imod = -1)=0;
/**
* set storage cell that stores first acquisition of the series (Jungfrau only)

View File

@ -21,7 +21,12 @@ class detectorData {
\param dr dynamic range or bits per pixel (valid only for non MYTHEN detectors)
\param file_ind file index
*/
detectorData(double *val=NULL, double *err=NULL, double *ang=NULL, double f_ind=-1, const char *fname="", int np=-1, int ny=1, char *cval=NULL, int dbytes=0, int dr=0, long long int file_ind=-1) : values(val), errors(err), angles(ang), progressIndex(f_ind), npoints(np), npy(ny), cvalues(cval), databytes(dbytes), dynamicRange(dr), dgainvalues(NULL), fileIndex(file_ind) {
detectorData(double *val=NULL, double *err=NULL, double *ang=NULL, double f_ind=-1,
const char *fname="", int np=-1, int ny=1, char *cval=NULL, int dbytes=0, int dr=0,
long long int file_ind=-1) :
values(val), errors(err), angles(ang), progressIndex(f_ind),
npoints(np), npy(ny), cvalues(cval), databytes(dbytes),
dynamicRange(dr), dgainvalues(NULL), fileIndex(file_ind) {
strcpy(fileName,fname);
};
@ -30,7 +35,8 @@ class detectorData {
deletes also the arrays pointing to data/errors/angles if not NULL
cvalues are deleted by caller
*/
~detectorData() {if (values) delete [] values; if (errors) delete [] errors; if (angles) delete [] angles; if(dgainvalues) delete [] dgainvalues;};
~detectorData() {if (values) delete [] values; if (errors) delete [] errors;
if (angles) delete [] angles; if(dgainvalues) delete [] dgainvalues;};
//private:
double *values; /**< @short pointer to the data as double array (MYTHEN only) */
double *errors; /**< @short pointer to the errors */

View File

@ -2790,7 +2790,9 @@ int set_timer(int file_des) {
#ifdef VERBOSE
printf("setting timer %d to %lld ns\n",ind,tns);
#endif
#ifdef EIGERD
int64_t subexptime = 0;
#endif
switch(ind) {
#ifdef JUNGFRAUD
case STORAGE_CELL_NUMBER:
@ -5846,7 +5848,7 @@ int check_version(int file_des) {
sprintf(mess,"Client's detector SW API version: (0x%llx). "
"Detector's SW API Version: (0x%llx). "
"Incompatible, update client!\n",
client_requiredVersion, det_apiVersion);
(long long int)client_requiredVersion, (long long int)det_apiVersion);
cprintf(RED, "Warning: %s", mess);
}
@ -5856,7 +5858,7 @@ int check_version(int file_des) {
sprintf(mess,"Detector SW Version: (0x%llx). "
"Client's detector SW API Version: (0x%llx). "
"Incompatible, update detector software!\n",
det_version, client_requiredVersion);
(long long int)det_version, (long long int)client_requiredVersion);
cprintf(RED, "Warning: %s", mess);
}
}

View File

@ -8,9 +8,8 @@ class slsReceiver;
/**
@short Class for implementing the SLS data receiver in the users application. Callbacks can be defined for processing and/or saving data
*/
/**
@libdoc slsReceiverUsers is a class that can be instantiated in the users software to receive the data from the detectors. Callbacks can be defined for processing and/or saving data
slsReceiverUsers is a class that can be instantiated in the users software to receive the data from the detectors. Callbacks can be defined for processing and/or saving data
***********************************************/
class slsReceiverUsers {
@ -21,7 +20,7 @@ public:
* reads config file, creates socket, assigns function table
* @param argc from command line
* @param argv from command line
* @param succecc socket creation was successfull
* @param success socket creation was successfull
*/
slsReceiverUsers(int argc, char *argv[], int &success);
@ -46,16 +45,18 @@ public:
/**
@sort register calbback for starting the acquisition
@short register calbback for starting the acquisition
\param func callback to be called when starting the acquisition. Its arguments are filepath, filename, fileindex, datasize
\param arg argument
\return value is insignificant at the moment, we write depending on file write enable, users get data to write depending on call backs registered
*/
void registerCallBackStartAcquisition(int (*func)(char* filepath, char* filename, uint64_t fileindex, uint32_t datasize, void*),void *arg);
/**
@sort register callback for end of acquisition
@short register callback for end of acquisition
\param func end of acquisition callback. Argument nf is total frames caught
\param arg argument
\returns nothing
*/
void registerCallBackAcquisitionFinished(void (*func)(uint64_t nf, void*),void *arg);
@ -63,8 +64,9 @@ public:
/**
@sort register callback to be called when data are available (to process and/or save the data).
@short register callback to be called when data are available (to process and/or save the data).
\param func raw data ready callback. arguments are sls_receiver_header, dataPointer, dataSize
\param arg argument
\returns nothing
*/
void registerCallBackRawDataReady(void (*func)(char* header,
@ -72,8 +74,9 @@ public:
/**
@sort register callback to be called when data are available (to process and/or save the data).
@short register callback to be called when data are available (to process and/or save the data).
\param func raw data ready callback. arguments are sls_receiver_header, dataPointer, revDatasize is the reference of data size in bytes. Can be modified to the new size to be written/streamed. (only smaller value).
\param arg argument
\returns nothing
*/
void registerCallBackRawDataModifyReady(void (*func)(char* header,