mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 01:50:40 +02:00
Merge branch 'developer' into rxctb
This commit is contained in:
commit
20720bc073
11
.clang-tidy
11
.clang-tidy
@ -18,8 +18,15 @@ Checks: '*,
|
||||
-google-readability-todo,
|
||||
-google-readability-braces-around-statements'
|
||||
|
||||
WarningsAsErrors: '*'
|
||||
HeaderFilterRegex: '.*'
|
||||
HeaderFilterRegex: \.h
|
||||
AnalyzeTemporaryDtors: false
|
||||
FormatStyle: none
|
||||
CheckOptions:
|
||||
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
|
||||
- { key: readability-identifier-naming.FunctionCase, value: lower_case }
|
||||
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
|
||||
- { key: readability-identifier-naming.MethodCase, value: CamelCase }
|
||||
- { key: readability-identifier-naming.StructCase, value: CamelCase }
|
||||
- { key: readability-identifier-naming.VariableCase, value: lower_case }
|
||||
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
|
||||
...
|
||||
|
@ -168,7 +168,29 @@ if (SLS_USE_PYTHON)
|
||||
endif(SLS_USE_PYTHON)
|
||||
|
||||
configure_file( .clang-tidy
|
||||
${CMAKE_BINARY_DIR}/.clang-tidy )
|
||||
${CMAKE_BINARY_DIR}/.clang-tidy
|
||||
)
|
||||
|
||||
|
||||
if (DOXYGEN_FOUND)
|
||||
# set input and output files
|
||||
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doxygen/Doxyfile.in)
|
||||
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
||||
|
||||
# request to configure the file
|
||||
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
|
||||
message("Doxygen build started")
|
||||
|
||||
# note the option ALL which allows to build the docs together with the application
|
||||
add_custom_target( docs
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating API documentation with Doxygen"
|
||||
VERBATIM )
|
||||
else (DOXYGEN_FOUND)
|
||||
message("Doxygen need to be installed to generate the doxygen documentation")
|
||||
endif (DOXYGEN_FOUND)
|
||||
|
||||
|
||||
if(SLS_MASTER_PROJECT)
|
||||
# Set install dir CMake packages
|
||||
|
2482
doxygen/Doxyfile.in
Normal file
2482
doxygen/Doxyfile.in
Normal file
File diff suppressed because it is too large
Load Diff
@ -331,23 +331,23 @@ where the {\tt{GapPixelsBetweenModules\_x}} are the one on the short side of the
|
||||
IMPORTANT: to have faster readout and smaller dead time, one can configure {\tt{clkdivider}}, i.e. the speed at which the data are read, i.e. 200/100/50~MHz for {\tt{clkdivider 0/1/2}} and the dead time between frames through {\tt{flags parallel}}, i.e. acquire and read at the same time or acquire and then read out.
|
||||
The configuration of this timing variables allows to achieve different frame rates. NOTE THAT IN EIGER, WHATEVER YOU DO, THE FRAME RATE LIMITATIONS COME FROM THE NETWORK BOTTLENECK AS THE HARDWARE GOES FASTER THAN THE DATA OUT.
|
||||
|
||||
In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from the boards (independent on how the chip is set), the continuous frame rates are listed in table~\ref{tcont}.
|
||||
In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from the boards (independent on how the chip is set), the continuous frame rates are listed in table~\ref{tcont}. The time to send out the frame out of the board
|
||||
\begin{table}
|
||||
\begin{tabular}{|c|c|c|c|}
|
||||
\begin{tabular}{|c|c|c|c|c|}
|
||||
\hline
|
||||
GbE & dynamic range & continuos maximum frame rate(Hz) & minimum period ($\mu$s)\\
|
||||
GbE & dynamic range & continuos maximum frame rate(Hz) & minimum period ($\mu$s)& time to send out data ($\mu$s)\\
|
||||
\hline
|
||||
1 & 16 & \textbf{256} & 3901\\
|
||||
1 & 16 & \textbf{256} & 3901 & \\
|
||||
\hline
|
||||
1 & 32 & \textbf{128} & 7820\\
|
||||
1 & 32 & \textbf{128} & 7820 & \\
|
||||
\hline
|
||||
10 & 16 & \textbf{2560} & 391\\
|
||||
10 & 4 & \textbf{10240} & 98 & 100\\
|
||||
\hline
|
||||
10 & 32 & \textbf{1280}& 782\\
|
||||
10 & 8 & \textbf{5120} & 196 & 200\\
|
||||
\hline
|
||||
10 & 8 & \textbf{5120} & 196\\
|
||||
10 & 16 & \textbf{2560} & 391 & 400\\
|
||||
\hline
|
||||
10 & 4 & \textbf{10240} & 98\\
|
||||
10 & 32 & \textbf{1280}& 782 & 800\\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\caption{Frame rate limits for the CONTINUOS streaming out of images, i.e. the data rate out is just below 1Gb/s or 10Gb/s.}
|
||||
@ -475,7 +475,9 @@ Here below are the final tables for settting the detcetor correctly:
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
\item BUFFERED redout (images stored on board memories, such that the maximum frame rate can be achieved for a limited amount of frames. {\tt{flags parallel}}, {\tt{clkdivider 0}} are always set. In 32-bit no extra {\tt{subdeadtime}} is assumed. The difference between {\tt{exptime}} and {\tt{period}} has to be $\approx$5 $\mu$s:
|
||||
BE CAREFUL that if you have the transmission delays setup (see sec.~\ref{network}), this will slow down the sending of the data and you risk to fill up the memories of the boards on eiger (30000 images in 4 bit mode) and you will get corrupted data (parts of the memory on the boads will be overwritten).
|
||||
|
||||
\item BUFFERED readout (images stored on board memories, such that the maximum frame rate can be achieved for a limited amount of frames. {\tt{flags parallel}}, {\tt{clkdivider 0}} are always set. In 32-bit no extra {\tt{subdeadtime}} is assumed. The difference between {\tt{exptime}} and {\tt{period}} has to be $\approx$5 $\mu$s:
|
||||
\begin{center}
|
||||
\begin{tabular}{ |c| c| }
|
||||
\hline
|
||||
@ -654,6 +656,19 @@ sls_detector_put 0-ratecorr -1
|
||||
|
||||
Every time either the rate corrections are activated, $\tau$ is changed or the subframe length is changed, then a new correction table is evaluated. Note that computing the correction table is time consuming.
|
||||
|
||||
Here in figure~\ref{rateplots} you can find typical values of $\tau$ and typical values of the rates for which we have small non linerities (10\% non linearity) as a function of the beam energy.
|
||||
\begin{figure}[t]
|
||||
\begin{center}
|
||||
\includegraphics[width=.7\textwidth]{tauvsE}
|
||||
\includegraphics[width=.7\textwidth]{Ratecapabilityflux}
|
||||
\end{center}
|
||||
\caption{Typical values of the dead time for the detector and safe fluxes as a function of the beam energy}.
|
||||
\label{rateplots}
|
||||
\end{figure}
|
||||
|
||||
|
||||
|
||||
|
||||
\section{Dependent parameters and limits}
|
||||
Here is a list of dependent parameters:
|
||||
\begin{enumerate}
|
||||
@ -702,7 +717,7 @@ LEDs on the backpanel board at the back of each half module signal:
|
||||
|
||||
|
||||
|
||||
\subsection{Delays in sending for 1Gb/s, 10Gb/s, 10Gb flow control, receiver fifo}
|
||||
\subsection{Delays in sending for 1Gb/s, 10Gb/s, 10Gb flow control, receiver fifo}\label{network}
|
||||
|
||||
Extremely advanced options allow to:
|
||||
\begin{itemize}
|
||||
@ -731,6 +746,7 @@ for X in $(seq 0 4); do ./sls_detector_put $X:txndelay_left $((X*100000)); done
|
||||
./sls_detector_put txndelay_frame zzzz
|
||||
\end{verbatim}
|
||||
In the example before, it would be: {\tt{zzzz}}=4*100000+ 100000
|
||||
To decide the size of the transmission delays, look at subsection~\ref{delays}.
|
||||
|
||||
\item Readjust the size of the fifo of the receiver between listening and writing (useful when writing is limited)
|
||||
\begin{verbatim}
|
||||
@ -749,6 +765,18 @@ To activate back a module, do:
|
||||
\end{verbatim}
|
||||
|
||||
\end{itemize}
|
||||
|
||||
\section{Choose correct transmission delays}\label{delays}
|
||||
|
||||
Transmission delays should be chosen only to accomodate the writing speed of the disk. The 10Gb network should be optimised independently to allow no packet loss situation. This can be done by turning off the writing of the files and check only for missing frames.
|
||||
|
||||
Table~\ref{tcont} gives the times that are needed to transfer 1 images out of the 10~Gb Ethernet connection. This reflects the CONTINUOS frame rate achieavable. The disk speed can be monitored with {\tt{dstat}}. One you have worked out this, you can calculated the {\tt{txndelay\_frame}} delay as:
|
||||
|
||||
\begin{equation}
|
||||
{\tt{txndelay\_frame}}=-tsending+dr \cdot \frac{4*256*256*N\_half\_modules}{1024 \cdot 1000 \cdot disk\_speed [MB/s]}
|
||||
\end{equation}
|
||||
In 4-bit mode, for a disk seed of 320MB/s, the {\tt{txndelay\_frame}} is 300~$\mu$s (30000 to be set up to the detector). The sending time is 100~$\mu$s, such that an total ackievable writing sped of 1/400~$\mu$s (2.5~kHz) in achieved.
|
||||
|
||||
\section{Setting up the PC settings for 10Gb}\label{10g}
|
||||
|
||||
For configuring well the 10Gb card not to loose packets,
|
||||
|
BIN
manual/manual-client/Ratecapabilityflux.png
Normal file
BIN
manual/manual-client/Ratecapabilityflux.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
manual/manual-client/tauvsE.png
Normal file
BIN
manual/manual-client/tauvsE.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
@ -124,14 +124,14 @@ endif()
|
||||
install(TARGETS sls_detector_put sls_detector_get sls_detector_acquire sls_detector_help DESTINATION bin)
|
||||
|
||||
|
||||
if(DOXYGEN_FOUND)
|
||||
add_custom_target(doc
|
||||
${DOXYGEN_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/slsDetectorUsers.doxy
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Generating API documentation with Doxygen" VERBATIM
|
||||
)
|
||||
endif()
|
||||
# if(DOXYGEN_FOUND)
|
||||
# add_custom_target(doc
|
||||
# ${DOXYGEN_EXECUTABLE}
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/slsDetectorUsers.doxy
|
||||
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
# COMMENT "Generating API documentation with Doxygen" VERBATIM
|
||||
# )
|
||||
# endif()
|
||||
|
||||
if (SLS_USE_TESTS)
|
||||
add_subdirectory(tests)
|
||||
|
@ -1660,7 +1660,7 @@ class slsDetector : public virtual slsDetectorDefs{
|
||||
* @param i file index
|
||||
* @returns file index
|
||||
*/
|
||||
int setFileIndex(int i);
|
||||
int setFileIndex(int file_index);
|
||||
|
||||
/**
|
||||
* Gets the file index
|
||||
@ -1781,21 +1781,21 @@ class slsDetector : public virtual slsDetectorDefs{
|
||||
* @param i is -1 to get, 0 to disable and 1 to enable
|
||||
* @returns if 10Gbe is enabled
|
||||
*/
|
||||
int enableTenGigabitEthernet(int i = -1);
|
||||
int enableTenGigabitEthernet(int value = -1);
|
||||
|
||||
/**
|
||||
* Set/get receiver fifo depth
|
||||
* @param i is -1 to get, any other value to set the fifo deph
|
||||
* @returns the receiver fifo depth
|
||||
*/
|
||||
int setReceiverFifoDepth(int i = -1);
|
||||
int setReceiverFifoDepth(int n_frames = -1);
|
||||
|
||||
/**
|
||||
* Set/get receiver silent mode
|
||||
* @param i is -1 to get, 0 unsets silent mode, 1 sets silent mode
|
||||
* @returns the receiver silent mode enable
|
||||
*/
|
||||
bool setReceiverSilentMode(int i = -1);
|
||||
bool setReceiverSilentMode(int value = -1);
|
||||
|
||||
/**
|
||||
* If data streaming in receiver is enabled,
|
||||
|
@ -24,12 +24,12 @@ class detectorData;
|
||||
|
||||
|
||||
/*
|
||||
\mainpage
|
||||
<CENTER><H1>API for SLS detectors data acquisition</H1></CENTER>
|
||||
<HR>
|
||||
*/
|
||||
/**
|
||||
\mainpage
|
||||
\subpage CLI
|
||||
|
||||
|
||||
<H1>API for SLS detectors data acquisition</H1>
|
||||
|
@ -163,10 +163,10 @@ bool multiSlsDetector::isAcquireReady() {
|
||||
FILE_LOG(logWARNING) << "Acquire has already started. "
|
||||
"If previous acquisition terminated unexpectedly, "
|
||||
"reset busy flag to restart.(sls_detector_put busy 0)";
|
||||
return FAIL;
|
||||
return FAIL != 0u;
|
||||
}
|
||||
multi_shm()->acquiringFlag = true;
|
||||
return OK;
|
||||
return OK != 0u;
|
||||
}
|
||||
|
||||
int multiSlsDetector::checkDetectorVersionCompatibility(int detPos) {
|
||||
@ -352,11 +352,11 @@ std::string multiSlsDetector::exec(const char *cmd) {
|
||||
char buffer[bufsize];
|
||||
std::string result = "";
|
||||
FILE *pipe = popen(cmd, "r");
|
||||
if (!pipe) {
|
||||
if (pipe == nullptr) {
|
||||
throw RuntimeError("Could not open pipe");
|
||||
}
|
||||
try {
|
||||
while (!feof(pipe)) {
|
||||
while (feof(pipe) == 0) {
|
||||
if (fgets(buffer, bufsize, pipe) != nullptr) {
|
||||
result += buffer;
|
||||
}
|
||||
@ -379,7 +379,7 @@ void multiSlsDetector::setHostname(const char *name, int detPos) {
|
||||
|
||||
// multi
|
||||
// this check is there only to allow the previous detsizechan command
|
||||
if (multi_shm()->numberOfDetectors) {
|
||||
if (multi_shm()->numberOfDetectors != 0) {
|
||||
FILE_LOG(logWARNING) << "There are already detector(s) in shared memory."
|
||||
"Freeing Shared memory now.";
|
||||
freeSharedMemory();
|
||||
@ -430,7 +430,7 @@ void multiSlsDetector::addSlsDetector(const std::string &hostname) {
|
||||
multi_shm()->numberOfChannels += detectors[pos]->getTotalNumberOfChannels();
|
||||
|
||||
detectors[pos]->setHostname(hostname);
|
||||
detectors[pos]->setOnline(true);
|
||||
detectors[pos]->setOnline(1);
|
||||
}
|
||||
|
||||
void multiSlsDetector::addSlsDetector(std::unique_ptr<slsDetector> det){
|
||||
@ -800,9 +800,9 @@ int multiSlsDetector::writeConfigurationFile(const std::string &fname) {
|
||||
++iline;
|
||||
|
||||
// single detector configuration
|
||||
for (size_t idet = 0; idet < detectors.size(); ++idet) {
|
||||
for (auto & detector : detectors) {
|
||||
outfile << std::endl;
|
||||
ret1 = detectors[idet]->writeConfigurationFile(outfile, this);
|
||||
ret1 = detector->writeConfigurationFile(outfile, this);
|
||||
if (ret1 == FAIL) {
|
||||
ret = FAIL;
|
||||
}
|
||||
@ -1720,11 +1720,11 @@ int multiSlsDetector::setNumberofUDPInterfaces(int n, int detPos) {
|
||||
auto r = parallelCall(&slsDetector::setNumberofUDPInterfaces,n);
|
||||
|
||||
// redo the zmq sockets
|
||||
if (previouslyClientStreaming) {
|
||||
if (previouslyClientStreaming != 0) {
|
||||
enableDataStreamingToClient(0);
|
||||
enableDataStreamingToClient(1);
|
||||
}
|
||||
if (previouslyReceiverStreaming) {
|
||||
if (previouslyReceiverStreaming != 0) {
|
||||
enableDataStreamingFromReceiver(0);
|
||||
enableDataStreamingFromReceiver(1);
|
||||
}
|
||||
@ -1792,7 +1792,7 @@ void multiSlsDetector::setClientDataStreamingInPort(int i, int detPos) {
|
||||
}
|
||||
}
|
||||
|
||||
if (prev_streaming) {
|
||||
if (prev_streaming != 0) {
|
||||
enableDataStreamingToClient(0);
|
||||
enableDataStreamingToClient(1);
|
||||
}
|
||||
@ -1832,7 +1832,7 @@ void multiSlsDetector::setReceiverDataStreamingOutPort(int i, int detPos) {
|
||||
}
|
||||
}
|
||||
|
||||
if (prev_streaming) {
|
||||
if (prev_streaming != 0) {
|
||||
enableDataStreamingFromReceiver(0, detPos);
|
||||
enableDataStreamingFromReceiver(1, detPos);
|
||||
}
|
||||
@ -1851,7 +1851,7 @@ int multiSlsDetector::getReceiverStreamingPort(int detPos) {
|
||||
}
|
||||
|
||||
void multiSlsDetector::setClientDataStreamingInIP(const std::string &ip, int detPos) {
|
||||
if (ip.length()) {
|
||||
if (ip.length() != 0u) {
|
||||
int prev_streaming = enableDataStreamingToClient(-1);
|
||||
|
||||
// single
|
||||
@ -1865,7 +1865,7 @@ void multiSlsDetector::setClientDataStreamingInIP(const std::string &ip, int det
|
||||
}
|
||||
}
|
||||
|
||||
if (prev_streaming) {
|
||||
if (prev_streaming != 0) {
|
||||
enableDataStreamingToClient(0);
|
||||
enableDataStreamingToClient(1);
|
||||
}
|
||||
@ -1884,7 +1884,7 @@ std::string multiSlsDetector::getClientStreamingIP(int detPos) {
|
||||
}
|
||||
|
||||
void multiSlsDetector::setReceiverDataStreamingOutIP(const std::string &ip, int detPos) {
|
||||
if (ip.length()) {
|
||||
if (ip.length() != 0u) {
|
||||
int prev_streaming = enableDataStreamingFromReceiver(-1, detPos);
|
||||
|
||||
// single
|
||||
@ -1898,7 +1898,7 @@ void multiSlsDetector::setReceiverDataStreamingOutIP(const std::string &ip, int
|
||||
}
|
||||
}
|
||||
|
||||
if (prev_streaming) {
|
||||
if (prev_streaming != 0) {
|
||||
enableDataStreamingFromReceiver(0, detPos);
|
||||
enableDataStreamingFromReceiver(1, detPos);
|
||||
}
|
||||
@ -1973,7 +1973,7 @@ std::string multiSlsDetector::getAdditionalJsonParameter(const std::string &key,
|
||||
}
|
||||
|
||||
int multiSlsDetector::setDetectorMinMaxEnergyThreshold(const int index, int value, int detPos) {
|
||||
std::string parameter = (index ? "emax" : "emin");
|
||||
std::string parameter = (index != 0 ? "emax" : "emin");
|
||||
|
||||
std::string result;
|
||||
if (value < 0) {
|
||||
@ -2315,8 +2315,8 @@ const slsDetectorDefs::ROI *multiSlsDetector::getROI(int &n, int detPos) {
|
||||
// get each detector's roi array
|
||||
for (size_t idet = 0; idet < detectors.size(); ++idet) {
|
||||
temp = detectors[idet]->getROI(index);
|
||||
if (temp) {
|
||||
if (index) {
|
||||
if (temp != nullptr) {
|
||||
if (index != 0) {
|
||||
FILE_LOG(logINFO) << "detector " << idet << ":";
|
||||
}
|
||||
for (int j = 0; j < index; ++j) {
|
||||
@ -2334,7 +2334,7 @@ const slsDetectorDefs::ROI *multiSlsDetector::getROI(int &n, int detPos) {
|
||||
}
|
||||
|
||||
// empty roi
|
||||
if (!n) {
|
||||
if (n == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -2582,7 +2582,7 @@ int multiSlsDetector::activate(int const enable, int detPos) {
|
||||
int multiSlsDetector::setDeactivatedRxrPaddingMode(int padding, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setDeactivatedRxrPaddingMode(padding);
|
||||
return static_cast<int>(detectors[detPos]->setDeactivatedRxrPaddingMode(padding));
|
||||
}
|
||||
|
||||
// multi
|
||||
@ -3024,14 +3024,14 @@ multiSlsDetector::setReceiverFramesDiscardPolicy(frameDiscardPolicy f, int detPo
|
||||
|
||||
int multiSlsDetector::setPartialFramesPadding(bool padding, int detPos) {
|
||||
if (detPos >= 0)
|
||||
return detectors[detPos]->setPartialFramesPadding(padding);
|
||||
return static_cast<int>(detectors[detPos]->setPartialFramesPadding(padding));
|
||||
auto r = parallelCall(&slsDetector::setPartialFramesPadding, padding);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::getPartialFramesPadding(int detPos) const {
|
||||
if (detPos >= 0)
|
||||
return detectors[detPos]->getPartialFramesPadding();
|
||||
return static_cast<int>(detectors[detPos]->getPartialFramesPadding());
|
||||
auto r = parallelCall(&slsDetector::getPartialFramesPadding);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
@ -3152,7 +3152,7 @@ int multiSlsDetector::getFramesCaughtByReceiver(int detPos) {
|
||||
auto r = parallelCall(&slsDetector::getFramesCaughtByReceiver);
|
||||
|
||||
// prevent divide by all or do not take avg when -1 for "did not connect"
|
||||
if ((!detectors.size()) || (sls::anyEqualTo(r, -1))) {
|
||||
if ((detectors.empty()) || (sls::anyEqualTo(r, -1))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -3170,7 +3170,7 @@ int multiSlsDetector::getReceiverCurrentFrameIndex(int detPos) {
|
||||
auto r = parallelCall(&slsDetector::getReceiverCurrentFrameIndex);
|
||||
|
||||
// prevent divide by all or do not take avg when -1 for "did not connect"
|
||||
if ((!detectors.size()) || (sls::anyEqualTo(r, -1))) {
|
||||
if ((detectors.empty()) || (sls::anyEqualTo(r, -1))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -3242,7 +3242,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
if (getDetectorTypeAsEnum() == EIGER) {
|
||||
eiger = true;
|
||||
nX *= 2;
|
||||
gappixelsenable = detectors[0]->enableGapPixels(-1) >= 1 ? true : false;
|
||||
gappixelsenable = detectors[0]->enableGapPixels(-1) > 0;
|
||||
}
|
||||
if (getNumberofUDPInterfaces() == 2) {
|
||||
nY *= 2;
|
||||
@ -3251,7 +3251,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
bool runningList[zmqSocket.size()], connectList[zmqSocket.size()];
|
||||
int numRunning = 0;
|
||||
for (size_t i = 0; i < zmqSocket.size(); ++i) {
|
||||
if (!zmqSocket[i]->Connect()) {
|
||||
if (zmqSocket[i]->Connect() == 0) {
|
||||
connectList[i] = true;
|
||||
runningList[i] = true;
|
||||
++numRunning;
|
||||
@ -3300,8 +3300,8 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
// HEADER
|
||||
{
|
||||
rapidjson::Document doc;
|
||||
if (!zmqSocket[isocket]->ReceiveHeader(isocket, doc,
|
||||
SLS_DETECTOR_JSON_HEADER_VERSION)) {
|
||||
if (zmqSocket[isocket]->ReceiveHeader(isocket, doc,
|
||||
SLS_DETECTOR_JSON_HEADER_VERSION) == 0) {
|
||||
// parse error, version error or end of acquisition for
|
||||
// socket
|
||||
runningList[isocket] = false;
|
||||
@ -3372,7 +3372,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
<< "\n\tsingledetrowoffset: " << singledetrowoffset
|
||||
<< "\n\trowoffset: " << rowoffset;
|
||||
|
||||
if (eiger && flippedDataX) {
|
||||
if (eiger && (flippedDataX != 0u)) {
|
||||
for (uint32_t i = 0; i < nPixelsY; ++i) {
|
||||
memcpy(((char *)multiframe) +
|
||||
((yoffset + (nPixelsY - 1 - i)) * rowoffset) + xoffset,
|
||||
@ -3412,7 +3412,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
}
|
||||
|
||||
// all done
|
||||
if (!numRunning) {
|
||||
if (numRunning == 0) {
|
||||
// let main thread know that all dummy packets have been received
|
||||
//(also from external process),
|
||||
// main thread can now proceed to measurement finished call back
|
||||
@ -3475,7 +3475,7 @@ int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage) {
|
||||
memcpy(dst, src, b1chipx);
|
||||
src += b1chipx;
|
||||
dst += b1chipx;
|
||||
if ((col + 1) % 4) {
|
||||
if (((col + 1) % 4) != 0) {
|
||||
++dst;
|
||||
}
|
||||
}
|
||||
@ -3495,7 +3495,7 @@ int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage) {
|
||||
dst += b1chipx;
|
||||
mod = (col + 1) % 4;
|
||||
// copy gap pixel(chip 0, 1, 2)
|
||||
if (mod) {
|
||||
if (mod != 0) {
|
||||
// neighbouring gap pixels to left
|
||||
temp = (*((uint8_t *)(dst - 1)));
|
||||
g1 = ((temp & 0xF) / 2);
|
||||
@ -3569,7 +3569,7 @@ int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage) {
|
||||
|
||||
int multiSlsDetector::setFileWrite(bool value, int detPos) {
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setFileWrite(value);
|
||||
return static_cast<int>(detectors[detPos]->setFileWrite(value));
|
||||
}
|
||||
auto r = parallelCall(&slsDetector::setFileWrite, value);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
@ -3577,7 +3577,7 @@ int multiSlsDetector::setFileWrite(bool value, int detPos) {
|
||||
|
||||
int multiSlsDetector::getFileWrite(int detPos) const{
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getFileWrite();
|
||||
return static_cast<int>(detectors[detPos]->getFileWrite());
|
||||
}
|
||||
auto r = parallelCall(&slsDetector::getFileWrite);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
@ -3585,7 +3585,7 @@ int multiSlsDetector::getFileWrite(int detPos) const{
|
||||
|
||||
int multiSlsDetector::setMasterFileWrite(bool value, int detPos) {
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setMasterFileWrite(value);
|
||||
return static_cast<int>(detectors[detPos]->setMasterFileWrite(value));
|
||||
}
|
||||
auto r = parallelCall(&slsDetector::setMasterFileWrite, value);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
@ -3593,7 +3593,7 @@ int multiSlsDetector::setMasterFileWrite(bool value, int detPos) {
|
||||
|
||||
int multiSlsDetector::getMasterFileWrite(int detPos) const{
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getMasterFileWrite();
|
||||
return static_cast<int>(detectors[detPos]->getMasterFileWrite());
|
||||
}
|
||||
auto r = parallelCall(&slsDetector::getMasterFileWrite);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
@ -3601,7 +3601,7 @@ int multiSlsDetector::getMasterFileWrite(int detPos) const{
|
||||
|
||||
int multiSlsDetector::setFileOverWrite(bool enable, int detPos) {
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setFileOverWrite(enable);
|
||||
return static_cast<int>(detectors[detPos]->setFileOverWrite(enable));
|
||||
}
|
||||
auto r = parallelCall(&slsDetector::setFileOverWrite, enable);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
@ -3609,7 +3609,7 @@ int multiSlsDetector::setFileOverWrite(bool enable, int detPos) {
|
||||
|
||||
int multiSlsDetector::getFileOverWrite(int detPos) const {
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getFileOverWrite();
|
||||
return static_cast<int>(detectors[detPos]->getFileOverWrite());
|
||||
}
|
||||
auto r = parallelCall(&slsDetector::getFileOverWrite);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
@ -3640,7 +3640,7 @@ int multiSlsDetector::setReceiverStreamingTimer(int time_in_ms, int detPos) {
|
||||
int multiSlsDetector::enableDataStreamingToClient(int enable) {
|
||||
if (enable >= 0) {
|
||||
// destroy data threads
|
||||
if (!enable) {
|
||||
if (enable == 0) {
|
||||
createReceivingDataSockets(true);
|
||||
// create data threads
|
||||
} else {
|
||||
@ -3649,13 +3649,13 @@ int multiSlsDetector::enableDataStreamingToClient(int enable) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return client_downstream;
|
||||
return static_cast<int>(client_downstream);
|
||||
}
|
||||
|
||||
int multiSlsDetector::enableDataStreamingFromReceiver(int enable, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->enableDataStreamingFromReceiver(enable);
|
||||
return static_cast<int>(detectors[detPos]->enableDataStreamingFromReceiver(enable));
|
||||
}
|
||||
|
||||
// multi
|
||||
@ -3688,7 +3688,7 @@ int multiSlsDetector::setReceiverFifoDepth(int i, int detPos) {
|
||||
int multiSlsDetector::setReceiverSilentMode(int i, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setReceiverSilentMode(i);
|
||||
return static_cast<int>(detectors[detPos]->setReceiverSilentMode(i));
|
||||
}
|
||||
|
||||
// multi
|
||||
@ -3707,7 +3707,7 @@ int multiSlsDetector::setPattern(const std::string &fname, int detPos) {
|
||||
} else {
|
||||
int addr{0};
|
||||
uint64_t word{0};
|
||||
while (fread(&word, sizeof(word), 1, fd)) {
|
||||
while (fread(&word, sizeof(word), 1, fd) != 0u) {
|
||||
serialCall(&slsDetector::setPatternWord, addr, word);
|
||||
++addr;
|
||||
}
|
||||
@ -4072,7 +4072,7 @@ void multiSlsDetector::registerDataCallback(int (*userCallback)(detectorData *,
|
||||
int multiSlsDetector::setTotalProgress() {
|
||||
int nf = 1, nc = 1, ns = 1, nm = 1;
|
||||
|
||||
if (multi_shm()->timerValue[FRAME_NUMBER]) {
|
||||
if (multi_shm()->timerValue[FRAME_NUMBER] != 0) {
|
||||
nf = multi_shm()->timerValue[FRAME_NUMBER];
|
||||
}
|
||||
|
||||
@ -4118,7 +4118,7 @@ void multiSlsDetector::setCurrentProgress(int i) {
|
||||
|
||||
int multiSlsDetector::acquire() {
|
||||
// ensure acquire isnt started multiple times by same client
|
||||
if (isAcquireReady() == FAIL) {
|
||||
if (static_cast<int>(isAcquireReady()) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@ -4165,7 +4165,7 @@ int multiSlsDetector::acquire() {
|
||||
|
||||
// loop through measurements
|
||||
for (int im = 0; im < nm; ++im) {
|
||||
if (multi_shm()->stoppedFlag) {
|
||||
if (multi_shm()->stoppedFlag != 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4190,7 +4190,7 @@ int multiSlsDetector::acquire() {
|
||||
if (stopReceiver() == FAIL) {
|
||||
multi_shm()->stoppedFlag = 1;
|
||||
} else {
|
||||
if (dataReady) {
|
||||
if (dataReady != nullptr) {
|
||||
sem_wait(&sem_endRTAcquisition); // waits for receiver's
|
||||
}
|
||||
// external process to be
|
||||
@ -4200,10 +4200,10 @@ int multiSlsDetector::acquire() {
|
||||
int findex = 0;
|
||||
findex = incrementFileIndex();
|
||||
|
||||
if (measurement_finished) {
|
||||
if (measurement_finished != nullptr) {
|
||||
measurement_finished(im, findex, measFinished_p);
|
||||
}
|
||||
if (multi_shm()->stoppedFlag) {
|
||||
if (multi_shm()->stoppedFlag != 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4214,11 +4214,11 @@ int multiSlsDetector::acquire() {
|
||||
sem_post(&sem_newRTAcquisition);
|
||||
dataProcessingThread.join();
|
||||
|
||||
if (progress_call) {
|
||||
if (progress_call != nullptr) {
|
||||
progress_call(getCurrentProgress(), pProgressCallArg);
|
||||
}
|
||||
|
||||
if (acquisition_finished) {
|
||||
if (acquisition_finished != nullptr) {
|
||||
acquisition_finished(getCurrentProgress(), getRunStatus(), acqFinished_p);
|
||||
}
|
||||
|
||||
@ -4246,7 +4246,7 @@ void multiSlsDetector::processData() {
|
||||
if (setReceiverOnline() == OFFLINE_FLAG) {
|
||||
return;
|
||||
} else {
|
||||
if (dataReady) {
|
||||
if (dataReady != nullptr) {
|
||||
readFrameFromReceiver();
|
||||
}
|
||||
// only update progress
|
||||
@ -4278,7 +4278,6 @@ void multiSlsDetector::processData() {
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
bool multiSlsDetector::getJoinThreadFlag() const {
|
||||
@ -4310,7 +4309,7 @@ std::vector<char> multiSlsDetector::readPofFile(const std::string &fname) {
|
||||
// check if it exists
|
||||
|
||||
struct stat st;
|
||||
if (stat(fname.c_str(), &st)) {
|
||||
if (stat(fname.c_str(), &st) != 0) {
|
||||
throw RuntimeError("Program FPGA: Programming file does not exist");
|
||||
}
|
||||
|
||||
@ -4364,10 +4363,10 @@ std::vector<char> multiSlsDetector::readPofFile(const std::string &fname) {
|
||||
throw RuntimeError("Could not convert programming file. EOF before end of flash");
|
||||
}
|
||||
}
|
||||
if (fclose(src)) {
|
||||
if (fclose(src) != 0) {
|
||||
throw RuntimeError("Program FPGA: Could not close source file");
|
||||
}
|
||||
if (close(dst)) {
|
||||
if (close(dst) != 0) {
|
||||
throw RuntimeError("Program FPGA: Could not close destination file");
|
||||
}
|
||||
FILE_LOG(logDEBUG1) << "File has been converted to " << destfname;
|
||||
@ -4377,7 +4376,7 @@ std::vector<char> multiSlsDetector::readPofFile(const std::string &fname) {
|
||||
if (fp == nullptr) {
|
||||
throw RuntimeError("Program FPGA: Could not open rawbin file");
|
||||
}
|
||||
if (fseek(fp, 0, SEEK_END)) {
|
||||
if (fseek(fp, 0, SEEK_END) != 0) {
|
||||
throw RuntimeError("Program FPGA: Seek error in rawbin file");
|
||||
}
|
||||
filesize = ftell(fp);
|
||||
@ -4391,7 +4390,7 @@ std::vector<char> multiSlsDetector::readPofFile(const std::string &fname) {
|
||||
throw RuntimeError("Program FPGA: Could not read rawbin file");
|
||||
}
|
||||
|
||||
if (fclose(fp)) {
|
||||
if (fclose(fp) != 0) {
|
||||
throw RuntimeError("Program FPGA: Could not close destination file after converting");
|
||||
}
|
||||
unlink(destfname); // delete temporary file
|
||||
|
@ -590,13 +590,13 @@ void slsDetector::updateTotalNumberOfChannels() {
|
||||
int adatabytes = 0, ddatabytes = 0;
|
||||
// analog channels (normal, analog/digital readout)
|
||||
if (shm()->roFlags == slsDetectorDefs::NORMAL_READOUT ||
|
||||
shm()->roFlags & slsDetectorDefs::ANALOG_AND_DIGITAL) {
|
||||
((shm()->roFlags & slsDetectorDefs::ANALOG_AND_DIGITAL) != 0)) {
|
||||
uint32_t mask = shm()->adcEnableMask;
|
||||
if (mask == BIT32_MASK) {
|
||||
nachans = 32;
|
||||
} else {
|
||||
for (int ich = 0; ich < 32; ++ich) {
|
||||
if (mask & (1 << ich))
|
||||
if ((mask & (1 << ich)) != 0u)
|
||||
++nachans;
|
||||
}
|
||||
}
|
||||
@ -608,7 +608,7 @@ void slsDetector::updateTotalNumberOfChannels() {
|
||||
|
||||
// digital channels (ctb only, digital, analog/digital readout)
|
||||
if (shm()->myDetectorType == CHIPTESTBOARD &&
|
||||
((shm()->roFlags & DIGITAL_ONLY) || (shm()->roFlags & ANALOG_AND_DIGITAL))) {
|
||||
(((shm()->roFlags & DIGITAL_ONLY) != 0) || ((shm()->roFlags & ANALOG_AND_DIGITAL) != 0))) {
|
||||
ndchans = 64;
|
||||
ddatabytes = (sizeof(uint64_t) * shm()->timerValue[DIGITAL_SAMPLES]);
|
||||
FILE_LOG(logDEBUG1) << "#Digital Channels:" << ndchans
|
||||
@ -1481,10 +1481,10 @@ int slsDetector::configureMAC() {
|
||||
ret = client.sendCommandThenRead(fnum, args, sizeof(args), retvals,
|
||||
sizeof(retvals));
|
||||
|
||||
//TODO!(Erik) Send as int already from detector
|
||||
uint64_t detector_mac = 0;
|
||||
uint32_t detector_ip = 0;
|
||||
sscanf(retvals[0], "%lx",
|
||||
&detector_mac); // TODO! (Erik) send mac and ip as int
|
||||
sscanf(retvals[0], "%lx", &detector_mac);
|
||||
sscanf(retvals[1], "%x", &detector_ip);
|
||||
detector_ip = __builtin_bswap32(detector_ip);
|
||||
|
||||
@ -3114,7 +3114,7 @@ int slsDetector::resetFPGA() {
|
||||
|
||||
int slsDetector::copyDetectorServer(const std::string &fname,
|
||||
const std::string &hostname) {
|
||||
char args[][MAX_STR_LENGTH]{};
|
||||
char args[2][MAX_STR_LENGTH]{};
|
||||
sls::strcpy_safe(args[0], fname.c_str());
|
||||
sls::strcpy_safe(args[1], hostname.c_str());
|
||||
FILE_LOG(logINFO) << "Sending detector server " << args[0] << " from host "
|
||||
|
@ -10,7 +10,8 @@
|
||||
#include <iomanip>
|
||||
|
||||
|
||||
/*! \mainpage Introduction
|
||||
/*! \page CLI Command line interface
|
||||
|
||||
|
||||
This program is intended to control the SLS detectors via command line interface.
|
||||
This is the only way to access all possible functionality of the detectors, however it is often recommendable to avoid changing the most advanced settings, rather leaving the task to configuration files, as when using the GUI or the API provided.
|
||||
@ -55,16 +56,16 @@ the same multi detector id for both detectors as they have a different shared me
|
||||
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:
|
||||
- \ref acquisition "Acquisition": commands to start/stop the acquisition and retrieve data
|
||||
- \ref config "Configuration": commands to configure the detector
|
||||
- \ref timing "Timing": commands to configure the detector timing
|
||||
- \ref data "Data postprocessing": commands to process the data
|
||||
- \ref settings "Settings": commands to define detector settings/threshold.
|
||||
- \ref output "Output": commands to define output file destination and format
|
||||
- \ref network "Network": commands to setup the network between client, detector and receiver
|
||||
- \ref receiver "Receiver": commands to configure the receiver
|
||||
- \ref prototype "Chip Test Board / Moench": commands specific for the chiptest board or moench
|
||||
- \ref test "Developer": commands to be used only for software debugging. Avoid using them!
|
||||
- \subpage acquisition "Acquisition": commands to start/stop the acquisition and retrieve data
|
||||
- \subpage config "Configuration": commands to configure the detector
|
||||
- \subpage timing "Timing": commands to configure the detector timing
|
||||
- \subpage data "Data postprocessing": commands to process the data
|
||||
- \subpage settings "Settings": commands to define detector settings/threshold.
|
||||
- \subpage output "Output": commands to define output file destination and format
|
||||
- \subpage network "Network": commands to setup the network between client, detector and receiver
|
||||
- \subpage receiver "Receiver": commands to configure the receiver
|
||||
- \subpage prototype "Chip Test Board / Moench": commands specific for the chiptest board or moench
|
||||
- \subpage test "Developer": commands to be used only for software debugging. Avoid using them!
|
||||
|
||||
*/
|
||||
|
||||
@ -2159,11 +2160,6 @@ std::string slsDetectorCommand::executeLine(int narg, char *args[], int action,
|
||||
return cmdUnknown(narg, args, action, detPos);
|
||||
}
|
||||
|
||||
/*! \page advanced Advanced Usage
|
||||
This page is for advanced users.
|
||||
Make sure you have first read \ref intro "the introduction".
|
||||
*/
|
||||
|
||||
std::string slsDetectorCommand::cmdUnknown(int narg, char *args[], int action, int detPos) {
|
||||
return std::string("Unknown command ") + std::string(args[0]) + std::string("\n") + helpLine(0, args, action, detPos);
|
||||
}
|
||||
|
@ -57,7 +57,6 @@ SCENARIO("Multi detector operation", "[detector]") {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m.freeSharedMemory();
|
||||
}
|
||||
}
|
||||
@ -71,13 +70,13 @@ TEST_CASE("Set and get partialFramesPadding", "[detector][somenewtag]"){
|
||||
m.addSlsDetector(sls::make_unique<slsDetector>(
|
||||
slsDetectorDefs::detectorType::EIGER, 20, 1));
|
||||
|
||||
m.setPartialFramesPadding(0);
|
||||
m.setPartialFramesPadding(false);
|
||||
CHECK(m.getPartialFramesPadding() == 0);
|
||||
|
||||
m.setPartialFramesPadding(1);
|
||||
m.setPartialFramesPadding(true);
|
||||
CHECK(m.getPartialFramesPadding() == 1);
|
||||
|
||||
m.setPartialFramesPadding(0, 0);
|
||||
m.setPartialFramesPadding(false, 0);
|
||||
CHECK(m.getPartialFramesPadding() == -1);
|
||||
|
||||
m.freeSharedMemory();
|
||||
|
Loading…
x
Reference in New Issue
Block a user