From 454e834a04e3017058e90e1089020de28bc9004a Mon Sep 17 00:00:00 2001 From: Jens Georg <jens.georg@desy.de> Date: Thu, 3 Jun 2021 11:59:30 +0200 Subject: [PATCH] Fix sending out 0 event ids on data_matching none Also, for the "trivial" datatypes such as scalar, array, IFFF enable attaching a macropulse number on incoming variables so we can send out updates from e.g. JDDD panels out via ZMQ --- include/DoocsProcessArray.h | 9 +++++++-- include/DoocsProcessScalar.h | 10 ++++++++-- src/DoocsIfff.cc | 14 ++++++-------- src/DoocsSpectrum.cc | 6 +++++- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/include/DoocsProcessArray.h b/include/DoocsProcessArray.h index 377c5a9..7094047 100644 --- a/include/DoocsProcessArray.h +++ b/include/DoocsProcessArray.h @@ -171,7 +171,6 @@ namespace ChimeraTK { void publishZeroMQ() { publishZMQ = true; } void setMacroPulseNumberSource(boost::shared_ptr<ChimeraTK::NDRegisterAccessor<int64_t>> macroPulseNumberSource) { - if(_processArray->isReadable()) { _macroPulseNumberSource = macroPulseNumberSource; if(_consistencyGroup.getMatchingMode() != DataConsistencyGroup::MatchingMode::none) { _consistencyGroup.add(macroPulseNumberSource); @@ -179,7 +178,13 @@ namespace ChimeraTK { std::bind(&DoocsProcessArray<DOOCS_T, DOOCS_PRIMITIVE_T>::updateDoocsBuffer, this, macroPulseNumberSource->getId())); } - } + else { + // We don't need to match up anything with it when it changes, but we have to register this at least once + // so the macropulse number will be included in the readAnyGroup in the updater if + // <data_matching> is none everywhere + _doocsUpdater.addVariable( + ChimeraTK::ScalarRegisterAccessor<int64_t>(macroPulseNumberSource), _eqFct, []() {}); + } } boost::shared_ptr<ChimeraTK::NDRegisterAccessor<DOOCS_PRIMITIVE_T>> _processArray; diff --git a/include/DoocsProcessScalar.h b/include/DoocsProcessScalar.h index ff59a61..bbfadeb 100644 --- a/include/DoocsProcessScalar.h +++ b/include/DoocsProcessScalar.h @@ -175,6 +175,7 @@ namespace ChimeraTK { info.sec = seconds; info.usec = microseconds; if(_macroPulseNumberSource != nullptr) { + this->set_mpnum(_macroPulseNumberSource->accessData(0)); info.ident = _macroPulseNumberSource->accessData(0); } else { @@ -206,14 +207,19 @@ namespace ChimeraTK { void publishZeroMQ() { _publishZMQ = true; } void setMacroPulseNumberSource(boost::shared_ptr<ChimeraTK::NDRegisterAccessor<int64_t>> macroPulseNumberSource) { - if(_processScalar->isReadable()) { _macroPulseNumberSource = macroPulseNumberSource; if(_consistencyGroup.getMatchingMode() != DataConsistencyGroup::MatchingMode::none) { _consistencyGroup.add(macroPulseNumberSource); _doocsUpdater.addVariable(ChimeraTK::ScalarRegisterAccessor<int64_t>(macroPulseNumberSource), _eqFct, std::bind(&DoocsProcessScalar<T, DOOCS_T>::updateDoocsBuffer, this, macroPulseNumberSource->getId())); } - } + else { + // We don't need to match up anything with it when it changes, but we have to register this at least once + // so the macropulse number will be included in the readAnyGroup in the updater if + // <data_matching> is none everywhere + _doocsUpdater.addVariable( + ChimeraTK::ScalarRegisterAccessor<int64_t>(macroPulseNumberSource), _eqFct, []() {}); + } } boost::shared_ptr<ChimeraTK::NDRegisterAccessor<T>> _processScalar; diff --git a/src/DoocsIfff.cc b/src/DoocsIfff.cc index b5385f2..2feec99 100644 --- a/src/DoocsIfff.cc +++ b/src/DoocsIfff.cc @@ -187,18 +187,16 @@ namespace ChimeraTK { void DoocsIfff::setMacroPulseNumberSource( boost::shared_ptr<ChimeraTK::NDRegisterAccessor<int64_t>> macroPulseNumberSource) { - // FIXME: Assuming macroPulseNumberSource is relavent only when all 4 - // components are readable; correct behavior later if this assumption - // does not hold. - bool isIfffReadable = - (_i1Value->isReadable() && _f1Value->isReadable() && _f2Value->isReadable() && _f3Value->isReadable()); - if(not isIfffReadable) { - return; - } _macroPulseNumberSource = macroPulseNumberSource; if(_consistencyGroup.getMatchingMode() != DataConsistencyGroup::MatchingMode::none) { registerVariable(ChimeraTK::ScalarRegisterAccessor<int64_t>(_macroPulseNumberSource)); } + else { + // We don't need to match up anything with it when it changes, but we have to register this at least once + // so the macropulse number will be included in the readAnyGroup in the updater if + // <data_matching> is none everywhere + _updater.addVariable(ChimeraTK::ScalarRegisterAccessor<int64_t>(macroPulseNumberSource), _eqFct, []() {}); + } } void DoocsIfff::registerVariable(const ChimeraTK::TransferElementAbstractor& var) { diff --git a/src/DoocsSpectrum.cc b/src/DoocsSpectrum.cc index 99baf0e..05fa215 100644 --- a/src/DoocsSpectrum.cc +++ b/src/DoocsSpectrum.cc @@ -222,13 +222,17 @@ namespace ChimeraTK { void DoocsSpectrum::setMacroPulseNumberSource( boost::shared_ptr<ChimeraTK::NDRegisterAccessor<int64_t>> macroPulseNumberSource) { - if(_processArray->isReadable()) { _macroPulseNumberSource = macroPulseNumberSource; if(_consistencyGroup.getMatchingMode() != DataConsistencyGroup::MatchingMode::none) { _consistencyGroup.add(macroPulseNumberSource); _doocsUpdater.addVariable(ChimeraTK::ScalarRegisterAccessor<int64_t>(macroPulseNumberSource), _eqFct, std::bind(&DoocsSpectrum::updateDoocsBuffer, this, macroPulseNumberSource->getId())); } + else { + // We don't need to match up anything with it when it changes, but we have to register this at least once + // so the macropulse number will be included in the readAnyGroup in the updater if + // <data_matching> is none everywhere + _doocsUpdater.addVariable(ChimeraTK::ScalarRegisterAccessor<int64_t>(macroPulseNumberSource), _eqFct, []() {}); } } -- GitLab