This commit is contained in:
Erik Frojdh 2018-10-30 14:57:30 +01:00
parent af550b4c70
commit 3d40d5d058
3 changed files with 38 additions and 41 deletions

View File

@ -6,7 +6,7 @@ option (USE_HDF5 "HDF5 File format" OFF)
option (USE_TEXTCLIENT "Text Client" OFF) option (USE_TEXTCLIENT "Text Client" OFF)
option (USE_RECEIVER "Receiver" OFF) option (USE_RECEIVER "Receiver" OFF)
option (USE_GUI "GUI" OFF) option (USE_GUI "GUI" OFF)
option (USE_TESTS "TESTS" ON) option (USE_TESTS "TESTS" OFF)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -Wno-misleading-indentation") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -Wno-misleading-indentation")

View File

@ -8,8 +8,6 @@
#include "slsDetector.h" #include "slsDetector.h"
#include "sls_detector_exceptions.h" #include "sls_detector_exceptions.h"
#include "utilities.h" #include "utilities.h"
#include "detectorData.h"
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
@ -2109,9 +2107,9 @@ int multiSlsDetector::writeAdcRegister(int addr, int val, int detPos) {
return detectors[detPos]->writeAdcRegister(addr, val); return detectors[detPos]->writeAdcRegister(addr, val);
} }
// multi // multi
auto r = parallelCall(&slsDetector::writeAdcRegister, addr, val); auto r = parallelCall(&slsDetector::writeAdcRegister, addr, val);
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL; return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
} }
int multiSlsDetector::activate(int const enable, int detPos) { int multiSlsDetector::activate(int const enable, int detPos) {
@ -2348,24 +2346,24 @@ int multiSlsDetector::setAutoComparatorDisableMode(int ival, int detPos) {
return sls::minusOneIfDifferent(r); return sls::minusOneIfDifferent(r);
} }
int multiSlsDetector::getChanRegs(double* retval, int detPos) { int multiSlsDetector::getChanRegs(double *retval, int detPos) {
int offset = 0; int offset = 0;
std::vector<int> r; std::vector<int> r;
for (auto& d : detectors) { for (auto &d : detectors) {
int nch = d->getTotalNumberOfChannels(); int nch = d->getTotalNumberOfChannels();
double result[nch]; double result[nch];
r.push_back(d->getChanRegs(result)); r.push_back(d->getChanRegs(result));
memcpy(retval + offset, result, nch * sizeof(double)); memcpy(retval + offset, result, nch * sizeof(double));
} }
return sls::minusOneIfDifferent(r); return sls::minusOneIfDifferent(r);
} }
int multiSlsDetector::setRateCorrection(int64_t t, int detPos) { int multiSlsDetector::setRateCorrection(int64_t t, int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->setRateCorrection(t); return detectors[detPos]->setRateCorrection(t);
} }
// multi // multi
auto r = parallelCall(&slsDetector::setRateCorrection, t); auto r = parallelCall(&slsDetector::setRateCorrection, t);
@ -2373,10 +2371,10 @@ int multiSlsDetector::setRateCorrection(int64_t t, int detPos) {
} }
int64_t multiSlsDetector::getRateCorrection(int detPos) { int64_t multiSlsDetector::getRateCorrection(int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->getRateCorrection(); return detectors[detPos]->getRateCorrection();
} }
// multi // multi
auto r = parallelCall(&slsDetector::getRateCorrection); auto r = parallelCall(&slsDetector::getRateCorrection);
@ -2384,14 +2382,14 @@ int64_t multiSlsDetector::getRateCorrection(int detPos) {
} }
void multiSlsDetector::printReceiverConfiguration(int detPos) { void multiSlsDetector::printReceiverConfiguration(int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->printReceiverConfiguration(); return detectors[detPos]->printReceiverConfiguration();
} }
// multi // multi
for (auto& d : detectors) for (auto &d : detectors)
d->printReceiverConfiguration(); d->printReceiverConfiguration();
} }
int multiSlsDetector::setReceiverOnline(int off, int detPos) { int multiSlsDetector::setReceiverOnline(int off, int detPos) {

View File

@ -7,10 +7,9 @@
* @short This is the base class for multi detector system functionalities * @short This is the base class for multi detector system functionalities
* @author Anna Bergamaschi * @author Anna Bergamaschi
*/ */
#include "sls_detector_defs.h"
#include "error_defs.h" #include "error_defs.h"
#include "logger.h" #include "logger.h"
#include "sls_detector_defs.h"
class slsDetector; class slsDetector;
class SharedMemory; class SharedMemory;
@ -1178,15 +1177,15 @@ class multiSlsDetector : public virtual slsDetectorDefs,
*/ */
int setAutoComparatorDisableMode(int ival = -1, int detPos = -1); int setAutoComparatorDisableMode(int ival = -1, int detPos = -1);
/** /**
* Returns the trimbits from the detector's shared memmory (Mythen, Eiger) * Returns the trimbits from the detector's shared memmory (Mythen, Eiger)
* @param retval is the array with the trimbits * @param retval is the array with the trimbits
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns total number of channels for the detector * @returns total number of channels for the detector
*/ */
int getChanRegs(double* retval, int detPos = -1); int getChanRegs(double *retval, int detPos = -1);
/** /**
* Set Rate correction ( Eiger) * Set Rate correction ( Eiger)
* @param t dead time in ns - if 0 disable correction, * @param t dead time in ns - if 0 disable correction,
* if >0 set dead time to t, if < 0 set deadtime to default dead time * if >0 set dead time to t, if < 0 set deadtime to default dead time
@ -1194,20 +1193,20 @@ class multiSlsDetector : public virtual slsDetectorDefs,
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns 0 if rate correction disabled, >0 otherwise * @returns 0 if rate correction disabled, >0 otherwise
*/ */
int setRateCorrection(int64_t t = 0, int detPos = -1); int setRateCorrection(int64_t t = 0, int detPos = -1);
/** /**
* Get rate correction ( Eiger) * Get rate correction ( Eiger)
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns 0 if rate correction disabled, > 0 otherwise (ns) * @returns 0 if rate correction disabled, > 0 otherwise (ns)
*/ */
int64_t getRateCorrection(int detPos = -1); int64_t getRateCorrection(int detPos = -1);
/** /**
* Prints receiver configuration * Prints receiver configuration
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void printReceiverConfiguration(int detPos = -1); void printReceiverConfiguration(int detPos = -1);
/** /**
* Sets up receiver socket if online and sets the flag * Sets up receiver socket if online and sets the flag