mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-02-01 07:14:57 +01:00
Counters (#71)
* mythen3: adding counters mask, firmware still takes only number of counters for now * mythen3: checking if module attached before powering on chip * bug fix: loop inital declaration not allowed in c * fix scope eiger test * mythen3: renamed setCounters to setCounterMask and getCounterMask in API * mythen3 replacing counting bits with popcount Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
This commit is contained in:
committed by
Erik Fröjdh
parent
70c54f4315
commit
de53747ddd
@@ -1720,36 +1720,6 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
|
||||
shm()->useReceiverFlag = true;
|
||||
checkReceiverVersionCompatibility();
|
||||
|
||||
FILE_LOG(logDEBUG)
|
||||
<< "detector type:"
|
||||
<< (ToString(shm()->myDetectorType))
|
||||
<< "\ndetector id:" << detId
|
||||
<< "\ndetector hostname:" << shm()->hostname
|
||||
<< "\nfile path:" << shm()->rxFilePath
|
||||
<< "\nfile name:" << shm()->rxFileName
|
||||
<< "\nfile index:" << shm()->rxFileIndex
|
||||
<< "\nfile format:" << shm()->rxFileFormat
|
||||
<< "\nr_framesperfile:" << shm()->rxFramesPerFile
|
||||
<< "\nr_discardpolicy:" << shm()->rxFrameDiscardMode
|
||||
<< "\nr_padding:" << shm()->rxFramePadding
|
||||
<< "\nwrite enable:" << shm()->rxFileWrite
|
||||
<< "\nmaster write enable:" << shm()->rxMasterFileWrite
|
||||
<< "\noverwrite enable:" << shm()->rxFileOverWrite
|
||||
<< "\ndynamic range:" << shm()->dynamicRange
|
||||
<< "\nflippeddatax:" << (shm()->flippedDataX)
|
||||
<< "\nactivated: " << shm()->activated
|
||||
<< "\nreceiver deactivated padding: " << shm()->rxPadDeactivatedModules
|
||||
<< "\nsilent Mode:" << shm()->rxSilentMode
|
||||
<< "\n10GbE:" << shm()->tenGigaEnable
|
||||
<< "\nGap pixels: " << shm()->gappixels
|
||||
<< "\nr_readfreq:" << shm()->rxReadFreq
|
||||
<< "\nrx streaming port:" << shm()->rxZmqport
|
||||
<< "\nrx streaming source ip:" << shm()->rxZmqip
|
||||
<< "\nrx additional json header:" << shm()->rxAdditionalJsonHeader
|
||||
<< "\nrx_datastream:" << enableDataStreamingFromReceiver(-1)
|
||||
<< "\nrx_dbitlistsize:" << shm()->rxDbitList.size()
|
||||
<< "\nrx_DbitOffset:" << shm()->rxDbitOffset << std::endl;
|
||||
|
||||
if (setDetectorType(shm()->myDetectorType) != GENERIC) {
|
||||
sendMultiDetectorSize();
|
||||
setDetectorId();
|
||||
@@ -1821,6 +1791,10 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
|
||||
sendROItoReceiver();
|
||||
break;
|
||||
|
||||
case MYTHEN3:
|
||||
sendNumberofCounterstoReceiver(getCounterMask());
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -3531,6 +3505,9 @@ std::vector<uint64_t> slsDetector::getNumMissingPackets() const {
|
||||
throw RuntimeError("Receiver " + std::to_string(detId) +
|
||||
" returned error: " + std::string(mess));
|
||||
} else {
|
||||
if (ret == FORCE_UPDATE) {
|
||||
updateCachedReceiverVariables();
|
||||
}
|
||||
int nports = -1;
|
||||
client.Receive(&nports, sizeof(nports));
|
||||
uint64_t mp[nports];
|
||||
@@ -3888,6 +3865,27 @@ void slsDetector::setPipeline(int clkIndex, int value) {
|
||||
sendToDetector(F_SET_PIPELINE, args, nullptr);
|
||||
}
|
||||
|
||||
void slsDetector::setCounterMask(uint32_t countermask) {
|
||||
FILE_LOG(logDEBUG1) << "Setting Counter mask to " << countermask;
|
||||
sendToDetector(F_SET_COUNTER_MASK, countermask, nullptr);
|
||||
sendNumberofCounterstoReceiver(countermask);
|
||||
}
|
||||
|
||||
void slsDetector::sendNumberofCounterstoReceiver(uint32_t countermask) {
|
||||
if (shm()->useReceiverFlag) {
|
||||
int ncounters = __builtin_popcount(countermask);
|
||||
FILE_LOG(logDEBUG1) << "Sending Reciver #counters: " << ncounters;
|
||||
sendToReceiver(F_RECEIVER_SET_NUM_COUNTERS, ncounters, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t slsDetector::getCounterMask() {
|
||||
uint32_t retval = 0;
|
||||
sendToDetector(F_GET_COUNTER_MASK, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Received counter mask: " << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
sls_detector_module slsDetector::interpolateTrim(sls_detector_module *a,
|
||||
sls_detector_module *b,
|
||||
|
||||
Reference in New Issue
Block a user