mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-18 07:47:12 +02:00
Merge branch 'apidhanya' of github.com:slsdetectorgroup/slsDetectorPackage into apidhanya
This commit is contained in:
@ -558,6 +558,146 @@ void Detector::setDBITPipeline(int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setSpeed, pos, defs::DBIT_PIPELINE, value, 0);
|
||||
}
|
||||
|
||||
Result<int> Detector::getDynamicRange(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setDynamicRange, pos, -1);
|
||||
}
|
||||
|
||||
void Detector::setDynamicRange(int value) { pimpl->setDynamicRange(value); }
|
||||
|
||||
Result<int> Detector::getHighVoltage(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setDAC, pos, -1, defs::HIGH_VOLTAGE,
|
||||
0);
|
||||
}
|
||||
|
||||
void Detector::setHighVoltage(int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setDAC, pos, value, defs::HIGH_VOLTAGE, 0);
|
||||
}
|
||||
|
||||
Result<int> Detector::getIODelay(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setDAC, pos, -1, defs::IO_DELAY, 0);
|
||||
}
|
||||
|
||||
void Detector::setIODelay(int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setDAC, pos, value, defs::IO_DELAY, 0);
|
||||
}
|
||||
|
||||
Result<int> Detector::getTemp(defs::dacIndex index, Positions pos) const {
|
||||
switch (index) {
|
||||
case defs::TEMPERATURE_ADC:
|
||||
case defs::TEMPERATURE_FPGA:
|
||||
case defs::TEMPERATURE_FPGAEXT:
|
||||
case defs::TEMPERATURE_10GE:
|
||||
case defs::TEMPERATURE_DCDC:
|
||||
case defs::TEMPERATURE_SODL:
|
||||
case defs::TEMPERATURE_SODR:
|
||||
case defs::TEMPERATURE_FPGA2:
|
||||
case defs::TEMPERATURE_FPGA3:
|
||||
case defs::SLOW_ADC_TEMP:
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Unknown Temperature Index");
|
||||
}
|
||||
auto res = pimpl->Parallel(&slsDetector::getADC, pos, index);
|
||||
switch (getDetectorType()) {
|
||||
case defs::EIGER:
|
||||
case defs::JUNGFRAU:
|
||||
for (auto it : pos) {
|
||||
it /= 1000;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Result<int> Detector::getVrefVoltage(bool mV, Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setDAC, pos, -1, defs::ADC_VPP, mV);
|
||||
}
|
||||
|
||||
void Detector::setVrefVoltage(int value, bool mV, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setDAC, pos, value, defs::ADC_VPP, mV);
|
||||
}
|
||||
|
||||
Result<int> Detector::getVoltage(defs::dacIndex index, Positions pos) const {
|
||||
switch (index) {
|
||||
case defs::V_LIMIT:
|
||||
case defs::V_POWER_A:
|
||||
case defs::V_POWER_B:
|
||||
case defs::V_POWER_C:
|
||||
case defs::V_POWER_D:
|
||||
case defs::V_POWER_IO:
|
||||
case defs::V_POWER_CHIP:
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Unknown Voltage Index");
|
||||
}
|
||||
return pimpl->Parallel(&slsDetector::setDAC, pos, -1, index, 1);
|
||||
}
|
||||
|
||||
void Detector::setVoltage(int value, defs::dacIndex index, Positions pos) {
|
||||
switch (index) {
|
||||
case defs::V_LIMIT:
|
||||
case defs::V_POWER_A:
|
||||
case defs::V_POWER_B:
|
||||
case defs::V_POWER_C:
|
||||
case defs::V_POWER_D:
|
||||
case defs::V_POWER_IO:
|
||||
case defs::V_POWER_CHIP:
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Unknown Voltage Index");
|
||||
}
|
||||
pimpl->Parallel(&slsDetector::setDAC, pos, value, index, 1);
|
||||
}
|
||||
|
||||
Result<int> Detector::getMeasuredVoltage(defs::dacIndex index,
|
||||
Positions pos) const {
|
||||
switch (index) {
|
||||
case defs::V_POWER_A:
|
||||
case defs::V_POWER_B:
|
||||
case defs::V_POWER_C:
|
||||
case defs::V_POWER_D:
|
||||
case defs::V_POWER_IO:
|
||||
case defs::V_POWER_CHIP:
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Unknown Voltage Index");
|
||||
}
|
||||
return pimpl->Parallel(&slsDetector::getADC, pos, index);
|
||||
}
|
||||
|
||||
Result<int> Detector::getMeasuredCurrent(defs::dacIndex index,
|
||||
Positions pos) const {
|
||||
switch (index) {
|
||||
case defs::I_POWER_A:
|
||||
case defs::I_POWER_B:
|
||||
case defs::I_POWER_C:
|
||||
case defs::I_POWER_D:
|
||||
case defs::I_POWER_IO:
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Unknown Current Index");
|
||||
}
|
||||
return pimpl->Parallel(&slsDetector::getADC, pos, index);
|
||||
}
|
||||
|
||||
Result<int> Detector::getSlowADC(defs::dacIndex index, Positions pos) const {
|
||||
if (index < defs::SLOW_ADC0 || index > defs::SLOW_ADC7) {
|
||||
throw RuntimeError("Unknown Slow ADC Index");
|
||||
}
|
||||
return pimpl->Parallel(&slsDetector::getADC, pos, index);
|
||||
}
|
||||
|
||||
Result<int> Detector::getDAC(defs::dacIndex index, bool mV,
|
||||
Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setDAC, pos, -1, index, mV);
|
||||
}
|
||||
|
||||
void Detector::setDAC(int value, defs::dacIndex index, bool mV, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setDAC, pos, value, index, mV);
|
||||
}
|
||||
|
||||
// Erik
|
||||
Result<int> Detector::getFramesCaughtByReceiver(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getFramesCaughtByReceiver, pos);
|
||||
|
@ -278,8 +278,6 @@ void multiSlsDetector::initializeDetectorStructure() {
|
||||
multi_shm()->multiDetectorType = GENERIC;
|
||||
multi_shm()->numberOfDetector[X] = 0;
|
||||
multi_shm()->numberOfDetector[Y] = 0;
|
||||
multi_shm()->dataBytes = 0;
|
||||
multi_shm()->dataBytesInclGapPixels = 0;
|
||||
multi_shm()->numberOfChannels = 0;
|
||||
multi_shm()->numberOfChannel[X] = 0;
|
||||
multi_shm()->numberOfChannel[Y] = 0;
|
||||
@ -624,9 +622,6 @@ void multiSlsDetector::addSlsDetector(const std::string &hostname) {
|
||||
detectors.push_back(
|
||||
sls::make_unique<slsDetector>(type, multiId, pos, false));
|
||||
multi_shm()->numberOfDetectors = detectors.size();
|
||||
multi_shm()->dataBytes += detectors[pos]->getDataBytes();
|
||||
multi_shm()->dataBytesInclGapPixels +=
|
||||
detectors[pos]->getDataBytesInclGapPixels();
|
||||
multi_shm()->numberOfChannels += detectors[pos]->getTotalNumberOfChannels();
|
||||
|
||||
detectors[pos]->setHostname(hostname);
|
||||
@ -1264,22 +1259,18 @@ int multiSlsDetector::setDynamicRange(int dr, int detPos) {
|
||||
}
|
||||
|
||||
// multi
|
||||
int prevValue = -1;
|
||||
auto temp = Parallel(&slsDetector::getDynamicRangeFromShm, {});
|
||||
if (temp.equal()) {
|
||||
prevValue = temp.squash();
|
||||
}
|
||||
|
||||
auto r = parallelCall(&slsDetector::setDynamicRange, dr);
|
||||
int ret = sls::minusOneIfDifferent(r);
|
||||
|
||||
// update shm
|
||||
int prevValue = multi_shm()->dataBytes;
|
||||
int prevGValue = multi_shm()->dataBytesInclGapPixels;
|
||||
multi_shm()->dataBytes = 0;
|
||||
multi_shm()->dataBytesInclGapPixels = 0;
|
||||
for (auto &d : detectors) {
|
||||
multi_shm()->dataBytes += d->getDataBytes();
|
||||
multi_shm()->dataBytesInclGapPixels += d->getDataBytesInclGapPixels();
|
||||
}
|
||||
|
||||
// if there was a change FIXME:add dr to sls shm and check that instead
|
||||
if ((prevValue != multi_shm()->dataBytes) ||
|
||||
(prevGValue != multi_shm()->dataBytesInclGapPixels)) {
|
||||
|
||||
// change in dr
|
||||
if (dr != -1 && dr != prevValue) {
|
||||
|
||||
updateOffsets();
|
||||
|
||||
@ -1312,17 +1303,6 @@ int multiSlsDetector::setDynamicRange(int dr, int detPos) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int multiSlsDetector::getDataBytes(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getDataBytes();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::getDataBytes);
|
||||
return sls::sum(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::setDAC(int val, dacIndex index, int mV, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
@ -2700,12 +2680,7 @@ int multiSlsDetector::enableGapPixels(int val, int detPos) {
|
||||
auto r = parallelCall(&slsDetector::enableGapPixels, val);
|
||||
int ret = sls::minusOneIfDifferent(r);
|
||||
|
||||
// update data bytes incl gap pixels
|
||||
if (val != -1) {
|
||||
auto r2 = serialCall(&slsDetector::getDataBytesInclGapPixels);
|
||||
multi_shm()->dataBytesInclGapPixels = sls::sum(r2);
|
||||
|
||||
// update
|
||||
updateOffsets();
|
||||
}
|
||||
return ret;
|
||||
@ -2714,11 +2689,7 @@ int multiSlsDetector::enableGapPixels(int val, int detPos) {
|
||||
void multiSlsDetector::setGapPixelsEnable(bool enable, Positions pos){
|
||||
Parallel(&slsDetector::enableGapPixels, pos, static_cast<int>(enable));
|
||||
|
||||
// update data bytes incl gap pixels
|
||||
auto r2 = serialCall(&slsDetector::getDataBytesInclGapPixels);
|
||||
multi_shm()->dataBytesInclGapPixels = sls::sum(r2);
|
||||
updateOffsets();
|
||||
|
||||
}
|
||||
|
||||
int multiSlsDetector::setTrimEn(std::vector<int> energies, int detPos) {
|
||||
|
@ -1539,6 +1539,10 @@ int slsDetector::setDynamicRange(int n) {
|
||||
return shm()->dynamicRange;
|
||||
}
|
||||
|
||||
int slsDetector::getDynamicRangeFromShm() {
|
||||
return shm()->dynamicRange;
|
||||
}
|
||||
|
||||
int slsDetector::getDataBytes() { return shm()->dataBytes; }
|
||||
|
||||
int slsDetector::getDataBytesInclGapPixels() {
|
||||
|
Reference in New Issue
Block a user