Merge branch 'jungfrau1.1' into j5resetdacs

This commit is contained in:
maliakal_d 2021-07-29 18:10:40 +02:00
commit 6c15f5216d
4 changed files with 33 additions and 26 deletions

View File

@ -1795,11 +1795,6 @@ class Detector {
std::vector<int> getPortNumbers(int start_port); std::vector<int> getPortNumbers(int start_port);
void updateRxRateCorrections(); void updateRxRateCorrections();
void setNumberofUDPInterfaces_(int n, Positions pos); void setNumberofUDPInterfaces_(int n, Positions pos);
Result<int> getNumberofUDPInterfaces_(Positions pos) const;
Result<int> getDefaultDac_(defs::dacIndex index,
defs::detectorSettings sett, Positions pos = {});
void setDefaultDac_(defs::dacIndex index, int defaultValue,
defs::detectorSettings sett, Positions pos = {});
}; };
} // namespace sls } // namespace sls

View File

@ -621,12 +621,12 @@ std::vector<defs::dacIndex> Detector::getDacList() const {
} }
Result<int> Detector::getDefaultDac(defs::dacIndex index, Positions pos) { Result<int> Detector::getDefaultDac(defs::dacIndex index, Positions pos) {
return getDefaultDac_(index, defs::UNDEFINED, pos); return pimpl->getDefaultDac(index, defs::UNDEFINED, pos);
} }
void Detector::setDefaultDac(defs::dacIndex index, int defaultValue, void Detector::setDefaultDac(defs::dacIndex index, int defaultValue,
Positions pos) { Positions pos) {
setDefaultDac_(index, defaultValue, defs::UNDEFINED, pos); pimpl->setDefaultDac(index, defaultValue, defs::UNDEFINED, pos);
} }
Result<int> Detector::getDefaultDac(defs::dacIndex index, Result<int> Detector::getDefaultDac(defs::dacIndex index,
@ -635,7 +635,7 @@ Result<int> Detector::getDefaultDac(defs::dacIndex index,
if (sett == defs::UNDEFINED) { if (sett == defs::UNDEFINED) {
throw RuntimeError("Invalid settings given for default dac"); throw RuntimeError("Invalid settings given for default dac");
} }
return getDefaultDac_(index, sett, pos); return pimpl->getDefaultDac(index, sett, pos);
} }
void Detector::setDefaultDac(defs::dacIndex index, int defaultValue, void Detector::setDefaultDac(defs::dacIndex index, int defaultValue,
@ -643,19 +643,12 @@ void Detector::setDefaultDac(defs::dacIndex index, int defaultValue,
if (sett == defs::UNDEFINED) { if (sett == defs::UNDEFINED) {
throw RuntimeError("Invalid settings given for default dac"); throw RuntimeError("Invalid settings given for default dac");
} }
setDefaultDac_(index, defaultValue, sett, pos); pimpl->setDefaultDac(index, defaultValue, sett, pos);
} }
Result<int> Detector::getDefaultDac_(defs::dacIndex index,
defs::detectorSettings sett,
Positions pos) {
return pimpl->Parallel(&Module::getDefaultDac, pos, index, sett);
}
void Detector::setDefaultDac_(defs::dacIndex index, int defaultValue,
defs::detectorSettings sett, Positions pos) {
pimpl->Parallel(&Module::setDefaultDac, pos, index, defaultValue, sett);
}
void Detector::resetToDefaultDacs(const bool hardReset, Positions pos) { void Detector::resetToDefaultDacs(const bool hardReset, Positions pos) {
pimpl->Parallel(&Module::resetToDefaultDacs, pos, hardReset); pimpl->Parallel(&Module::resetToDefaultDacs, pos, hardReset);
@ -790,7 +783,7 @@ Result<int> Detector::getNumberofUDPInterfaces(Positions pos) const {
"Cannot set number of udp interfaces for this detector."); "Cannot set number of udp interfaces for this detector.");
} }
// also called by vetostream (for gotthard2) // also called by vetostream (for gotthard2)
return getNumberofUDPInterfaces_(pos); return pimpl->getNumberofUDPInterfaces(pos);
} }
void Detector::setNumberofUDPInterfaces(int n, Positions pos) { void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
@ -802,10 +795,6 @@ void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
setNumberofUDPInterfaces_(n, pos); setNumberofUDPInterfaces_(n, pos);
} }
Result<int> Detector::getNumberofUDPInterfaces_(Positions pos) const {
return pimpl->Parallel(&Module::getNumberofUDPInterfaces, pos);
}
void Detector::setNumberofUDPInterfaces_(int n, Positions pos) { void Detector::setNumberofUDPInterfaces_(int n, Positions pos) {
bool previouslyClientStreaming = pimpl->getDataStreamingToClient(); bool previouslyClientStreaming = pimpl->getDataStreamingToClient();
bool useReceiver = getUseReceiverFlag().squash(false); bool useReceiver = getUseReceiverFlag().squash(false);
@ -1621,7 +1610,7 @@ Result<defs::ethernetInterface> Detector::getVetoStream(Positions pos) const {
// 3gbe // 3gbe
auto r3 = pimpl->Parallel(&Module::getVetoStream, pos); auto r3 = pimpl->Parallel(&Module::getVetoStream, pos);
// 10gbe (debugging interface) opens 2nd udp interface in receiver // 10gbe (debugging interface) opens 2nd udp interface in receiver
auto r10 = getNumberofUDPInterfaces_(pos); auto r10 = pimpl->getNumberofUDPInterfaces(pos);
Result<defs::ethernetInterface> res(r3.size()); Result<defs::ethernetInterface> res(r3.size());
for (unsigned int i = 0; i < res.size(); ++i) { for (unsigned int i = 0; i < res.size(); ++i) {
@ -1641,7 +1630,7 @@ void Detector::setVetoStream(defs::ethernetInterface interface, Positions pos) {
pimpl->Parallel(&Module::setVetoStream, pos, i3gbe); pimpl->Parallel(&Module::setVetoStream, pos, i3gbe);
// 10gbe (debugging interface) opens 2nd udp interface in receiver // 10gbe (debugging interface) opens 2nd udp interface in receiver
int old_numinterfaces = getNumberofUDPInterfaces_(pos).tsquash( int old_numinterfaces = pimpl->getNumberofUDPInterfaces(pos).tsquash(
"retrieved inconsistent number of udp interfaces"); "retrieved inconsistent number of udp interfaces");
int numinterfaces = (((interface & defs::ethernetInterface::I10GBE) == int numinterfaces = (((interface & defs::ethernetInterface::I10GBE) ==
defs::ethernetInterface::I10GBE) defs::ethernetInterface::I10GBE)
@ -2206,7 +2195,7 @@ std::vector<int> Detector::getPortNumbers(int start_port) {
break; break;
case defs::JUNGFRAU: case defs::JUNGFRAU:
case defs::GOTTHARD2: case defs::GOTTHARD2:
if (getNumberofUDPInterfaces_({}).squash() == 2) { if (pimpl->getNumberofUDPInterfaces({}).squash() == 2) {
num_sockets_per_detector *= 2; num_sockets_per_detector *= 2;
} }
break; break;

View File

@ -1369,4 +1369,19 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
return buffer; return buffer;
} }
sls::Result<int> DetectorImpl::getNumberofUDPInterfaces(Positions pos) const {
return Parallel(&Module::getNumberofUDPInterfaces, pos);
}
sls::Result<int> DetectorImpl::getDefaultDac(defs::dacIndex index,
defs::detectorSettings sett,
Positions pos) {
return Parallel(&Module::getDefaultDac, pos, index, sett);
}
void DetectorImpl::setDefaultDac(defs::dacIndex index, int defaultValue,
defs::detectorSettings sett, Positions pos) {
Parallel(&Module::setDefaultDac, pos, index, defaultValue, sett);
}
} // namespace sls } // namespace sls

View File

@ -291,6 +291,14 @@ class DetectorImpl : public virtual slsDetectorDefs {
*/ */
std::vector<char> readProgrammingFile(const std::string &fname); std::vector<char> readProgrammingFile(const std::string &fname);
sls::Result<int> getNumberofUDPInterfaces(Positions pos) const;
void setNumberofUDPInterfaces(int n, Positions pos);
sls::Result<int> getDefaultDac(defs::dacIndex index,
defs::detectorSettings sett,
Positions pos = {});
void setDefaultDac(defs::dacIndex index, int defaultValue,
defs::detectorSettings sett, Positions pos);
private: private:
/** /**
* Creates/open shared memory, initializes detector structure and members * Creates/open shared memory, initializes detector structure and members