still updating slsdetector.cpp

This commit is contained in:
2018-10-26 17:40:18 +02:00
parent cf87b6ca83
commit 33ac63d14a
16 changed files with 1501 additions and 2523 deletions

View File

@ -2196,14 +2196,7 @@ int multiSlsDetector::writeAdcRegister(int addr, int val, int detPos) {
// multi
auto r = parallelCall(&slsDetector::writeAdcRegister, addr, val);
if (sls::allEqual(r))
return r.front();
// can't have different values
FILE_LOG(logERROR) << "Error: Different Values for function writeAdcRegister "
"(write 0x" << std::hex << val << " to addr 0x" << std::hex << addr << std::dec << ")";
setErrorMask(getErrorMask() | MULTI_HAVE_DIFFERENT_VALUES);
return -1;
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
}
@ -2458,33 +2451,22 @@ int multiSlsDetector::setAutoComparatorDisableMode(int ival, int detPos) {
}
int multiSlsDetector::getChanRegs(double* retval, bool fromDetector, int detPos) {
int multiSlsDetector::getChanRegs(double* retval, int detPos) {
int offset = 0;
std::vector<int> r;
for (auto& d : detectors) {
int nch = d->getTotalNumberOfChannels();
double result[nch];
r.push_back(d->getChanRegs(result, fromDetector));
r.push_back(d->getChanRegs(result));
memcpy(retval + offset, result, nch * sizeof(double));
}
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::calibratePedestal(int frames, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->calibratePedestal(frames);
}
// multi
auto r = parallelCall(&slsDetector::calibratePedestal, frames);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::setRateCorrection(int t, int detPos) {
int multiSlsDetector::setRateCorrection(int64_t t, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setRateCorrection(t);
@ -2496,7 +2478,7 @@ int multiSlsDetector::setRateCorrection(int t, int detPos) {
}
int multiSlsDetector::getRateCorrection(int detPos) {
int64_t multiSlsDetector::getRateCorrection(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getRateCorrection();
@ -2508,15 +2490,14 @@ int multiSlsDetector::getRateCorrection(int detPos) {
}
int multiSlsDetector::printReceiverConfiguration(int detPos) {
void multiSlsDetector::printReceiverConfiguration(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->printReceiverConfiguration();
}
// multi
auto r = parallelCall(&slsDetector::printReceiverConfiguration);
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
parallelCall(&slsDetector::printReceiverConfiguration);
}

View File

@ -1153,21 +1153,10 @@ public:
/**
* Returns the trimbits from the detector's shared memmory (Mythen, Eiger)
* @param retval is the array with the trimbits
* @param fromDetector is true if the trimbits shared memory have to be
* uploaded from detector
* @param detPos -1 for all detectors in list or specific detector position
* @returns total number of channels for the detector
*/
int getChanRegs(double* retval,bool fromDetector, int detPos = -1);
/**
* Calibrate Pedestal (ChipTestBoard)
* Starts acquisition, calibrates pedestal and writes to fpga
* @param frames number of frames
* @param detPos -1 for all detectors in list or specific detector position
* @returns number of frames
*/
int calibratePedestal(int frames = 0, int detPos = -1);
int getChanRegs(double* retval, int detPos = -1);
/**
* Set Rate correction ( Eiger)
@ -1177,21 +1166,20 @@ public:
* @param detPos -1 for all detectors in list or specific detector position
* @returns 0 if rate correction disabled, >0 otherwise
*/
int setRateCorrection(int t=0, int detPos = -1);
int setRateCorrection(int64_t t = 0, int detPos = -1);
/**
* Get rate correction ( Eiger)
* @param detPos -1 for all detectors in list or specific detector position
* @returns 0 if rate correction disabled, > 0 otherwise (ns)
*/
int getRateCorrection(int detPos = -1);
int64_t getRateCorrection(int detPos = -1);
/**
* Prints receiver configuration
* @param detPos -1 for all detectors in list or specific detector position
* @returns OK or FAIL
*/
int printReceiverConfiguration(int detPos = -1);
void printReceiverConfiguration(int detPos = -1);
/**
* Sets up receiver socket if online and sets the flag