mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
merge conflict resolved
This commit is contained in:
@ -1264,36 +1264,46 @@ int multiSlsDetector::setDynamicRange(int dr, int detPos) {
|
||||
int prevGValue = multi_shm()->dataBytesInclGapPixels;
|
||||
multi_shm()->dataBytes = 0;
|
||||
multi_shm()->dataBytesInclGapPixels = 0;
|
||||
multi_shm()->numberOfChannels = 0;
|
||||
for (auto &d : detectors) {
|
||||
multi_shm()->dataBytes += d->getDataBytes();
|
||||
multi_shm()->dataBytesInclGapPixels += d->getDataBytesInclGapPixels();
|
||||
multi_shm()->numberOfChannels += d->getTotalNumberOfChannels();
|
||||
}
|
||||
|
||||
// for usability
|
||||
if (getDetectorTypeAsEnum() == EIGER) {
|
||||
switch (dr) {
|
||||
case 32:
|
||||
FILE_LOG(logINFO) << "Setting Clock to Quarter Speed to cope with "
|
||||
"Dynamic Range of 32";
|
||||
setSpeed(CLOCK_DIVIDER, 2);
|
||||
break;
|
||||
case 16:
|
||||
FILE_LOG(logINFO) << "Setting Clock to Half Speed for Dynamic Range of 16";
|
||||
setSpeed(CLOCK_DIVIDER, 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
// if there was a change FIXME:add dr to sls shm and check that instead
|
||||
if ((prevValue != multi_shm()->dataBytes) ||
|
||||
(prevGValue != multi_shm()->dataBytesInclGapPixels)) {
|
||||
|
||||
updateOffsets();
|
||||
|
||||
// update speed, check ratecorrection
|
||||
if (getDetectorTypeAsEnum() == EIGER) {
|
||||
|
||||
// rate correction before speed for consistency
|
||||
// (else exception at speed makes ratecorr inconsistent)
|
||||
parallelCall(&slsDetector::updateRateCorrection);
|
||||
|
||||
// speed(usability)
|
||||
switch (dr) {
|
||||
case 32:
|
||||
FILE_LOG(logINFO)
|
||||
<< "Setting Clock to Quarter Speed to cope with "
|
||||
"Dynamic Range of 32";
|
||||
setSpeed(CLOCK_DIVIDER, 2);
|
||||
break;
|
||||
case 16:
|
||||
FILE_LOG(logINFO)
|
||||
<< "Setting Clock to Half Speed for Dynamic Range of 16";
|
||||
setSpeed(CLOCK_DIVIDER, 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update offsets if there was a change FIXME:add dr to sls shm and check
|
||||
// that instead
|
||||
if ((prevValue != multi_shm()->dataBytes) ||
|
||||
(prevGValue != multi_shm()->dataBytesInclGapPixels)) {
|
||||
updateOffsets();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -322,6 +322,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
detector_shm()->timerValue[SUBFRAME_ACQUISITION_TIME] = 0;
|
||||
detector_shm()->timerValue[STORAGE_CELL_NUMBER] = 0;
|
||||
detector_shm()->timerValue[SUBFRAME_DEADTIME] = 0;
|
||||
detector_shm()->deadTime = 0;
|
||||
sls::strcpy_safe(detector_shm()->receiver_hostname, "none");
|
||||
detector_shm()->receiverTCPPort = DEFAULT_PORTNO + 2;
|
||||
detector_shm()->receiverUDPPort = DEFAULT_UDP_PORTNO;
|
||||
@ -1951,7 +1952,7 @@ int slsDetector::setDynamicRange(int n) {
|
||||
client.close();
|
||||
ret = updateDetector();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// only for eiger
|
||||
// setting dr consequences on databytes shm
|
||||
@ -3810,6 +3811,7 @@ int slsDetector::setRateCorrection(int64_t t) {
|
||||
auto client = DetectorSocket(detector_shm()->hostname,
|
||||
detector_shm()->controlPort);
|
||||
ret = client.sendCommandThenRead(fnum, &arg, sizeof(arg), nullptr, 0);
|
||||
detector_shm()->deadTime = t;
|
||||
}
|
||||
if (ret == FORCE_UPDATE) {
|
||||
ret = updateDetector();
|
||||
@ -3828,6 +3830,7 @@ int64_t slsDetector::getRateCorrection() {
|
||||
detector_shm()->controlPort);
|
||||
ret = client.sendCommandThenRead(fnum, nullptr, 0, &retval,
|
||||
sizeof(retval));
|
||||
detector_shm()->deadTime = retval;
|
||||
FILE_LOG(logDEBUG1) << "Rate correction: " << retval;
|
||||
}
|
||||
if (ret == FORCE_UPDATE) {
|
||||
@ -3836,6 +3839,24 @@ int64_t slsDetector::getRateCorrection() {
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::updateRateCorrection() {
|
||||
// rate correction is enabled
|
||||
if (detector_shm()->deadTime != 0) {
|
||||
switch (detector_shm()->dynamicRange) {
|
||||
// rate correction is allowed
|
||||
case 16:
|
||||
case 32:
|
||||
setRateCorrection(detector_shm()->deadTime);
|
||||
break;
|
||||
// not allowed
|
||||
default:
|
||||
setRateCorrection(0);
|
||||
throw sls::NonCriticalError(
|
||||
"Rate correction Deactivated, must be in 32 or 16 bit mode");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void slsDetector::printReceiverConfiguration(TLogLevel level) {
|
||||
FILE_LOG(level) << "#Detector " << detId << ":\n Receiver Hostname:\t"
|
||||
<< getReceiverHostname()
|
||||
|
Reference in New Issue
Block a user