diff --git a/Database/AthenaPOOL/EventSelectorAthenaPool/src/DoubleEventSelectorAthenaPool.cxx b/Database/AthenaPOOL/EventSelectorAthenaPool/src/DoubleEventSelectorAthenaPool.cxx index ca22de7b5cf74b0e2481fbb56ee58fcf71aab641..139a5a3154fad2cfe30bafc130fea90977195ccd 100644 --- a/Database/AthenaPOOL/EventSelectorAthenaPool/src/DoubleEventSelectorAthenaPool.cxx +++ b/Database/AthenaPOOL/EventSelectorAthenaPool/src/DoubleEventSelectorAthenaPool.cxx @@ -39,6 +39,9 @@ StatusCode DoubleEventSelectorAthenaPool::initialize() ATH_CHECK(EventSelectorAthenaPool::initialize()); ATH_CHECK(m_secondarySelector.retrieve()); + if (dynamic_cast<EventSelectorAthenaPool *>(&*(m_secondarySelector)) == nullptr) { + m_secondaryByteStream = true; + } return StatusCode::SUCCESS; } @@ -175,12 +178,22 @@ StatusCode DoubleEventSelectorAthenaPool::recordAttributeList() const ATH_MSG_DEBUG("AttributeList size " << attrList.size()); auto athAttrList = std::make_unique<AthenaAttributeList>(attrList); - // Fill the new attribute list from the primary file - ATH_CHECK(fillAttributeList(athAttrList.get(), "", false)); - - // Fill the new attribute list from the secondary file - ATH_MSG_DEBUG("Append secondary attribute list properties to the primary one with a suffix: " << m_secondaryAttrListSuffix.value()); - ATH_CHECK(m_secondarySelector->fillAttributeList(athAttrList.get(), "_" + m_secondaryAttrListSuffix.value(), true)); + // Decide what to do based on the type of secondary file + if (m_secondaryByteStream) { + // Always add ByteStream as primary input + ATH_CHECK(m_secondarySelector->fillAttributeList(athAttrList.get(), "", false)); + + // Then fill the new attribute list from the primary file + ATH_MSG_DEBUG("Append primary attribute list properties to the secondary one with a suffix: " << m_secondaryAttrListSuffix.value()); + ATH_CHECK(fillAttributeList(athAttrList.get(), "_" + m_secondaryAttrListSuffix.value(), true)); + } else { + // Fill the new attribute list from the primary file + ATH_CHECK(fillAttributeList(athAttrList.get(), "", false)); + + // Fill the new attribute list from the secondary file + ATH_MSG_DEBUG("Append secondary attribute list properties to the primary one with a suffix: " << m_secondaryAttrListSuffix.value()); + ATH_CHECK(m_secondarySelector->fillAttributeList(athAttrList.get(), "_" + m_secondaryAttrListSuffix.value(), true)); + } // Add info about secondary input athAttrList->extend("hasSecondaryInput", "bool"); @@ -235,6 +248,11 @@ void DoubleEventSelectorAthenaPool::handle(const Incident& inc) msg(MSG::DEBUG) << "SourceID: " << source.first << " active events: " << source.second << endmsg; } + // Nothing to do if secondary event selector is ByteStream + if (m_secondaryByteStream) { + return; + } + // Secondary guid SG::SourceID fid2; SG::DataProxy* dp2 = sg->proxy(ClassID_traits<DataHeader>::ID(), "SecondaryEventSelector", true); diff --git a/Database/AthenaPOOL/EventSelectorAthenaPool/src/DoubleEventSelectorAthenaPool.h b/Database/AthenaPOOL/EventSelectorAthenaPool/src/DoubleEventSelectorAthenaPool.h index 0c379ae3ecfe73cae0641374b944246247cf6180..2213ce0b629deca614e0fa442ef923c40fadc0af 100644 --- a/Database/AthenaPOOL/EventSelectorAthenaPool/src/DoubleEventSelectorAthenaPool.h +++ b/Database/AthenaPOOL/EventSelectorAthenaPool/src/DoubleEventSelectorAthenaPool.h @@ -64,6 +64,9 @@ private: ServiceHandle<ISecondaryEventSelector> m_secondarySelector{this, "SecondaryEventSelector", "SecondaryEventSelector", ""}; Gaudi::Property<std::string> m_secondaryAttrListSuffix{this, "SecondaryAttrListSuffix", "secondary", ""}; + + // Cache if secondary selector is ByteStream + bool m_secondaryByteStream{}; }; #endif diff --git a/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx b/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx index 10f3d60b410b8472d3c5cea1efa84ae2ab303644..29be28acd0d43c82442ad5ecbf0d141b6d70d132 100644 --- a/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx +++ b/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx @@ -1000,9 +1000,14 @@ StatusCode EventSelectorAthenaPool::fillAttributeList(coral::AttributeList *attr (*attrList)[iter.tokenName() + suffix].data<std::string>() = iter->toString(); ATH_MSG_DEBUG("record AthenaAttribute, name = " << iter.tokenName() + suffix << " = " << iter->toString() << "."); } - attrList->extend("eventRef" + suffix, "string"); - (*attrList)["eventRef" + suffix].data<std::string>() = m_headerIterator->eventRef().toString(); - ATH_MSG_DEBUG("record AthenaAttribute, name = eventRef" + suffix + " = " << m_headerIterator->eventRef().toString() << "."); + + std::string eventRef = "eventRef"; + if (m_isSecondary.value()) { + eventRef.append(suffix); + } + attrList->extend(eventRef, "string"); + (*attrList)[eventRef].data<std::string>() = m_headerIterator->eventRef().toString(); + ATH_MSG_DEBUG("record AthenaAttribute, name = " + eventRef + " = " << m_headerIterator->eventRef().toString() << "."); if (copySource) { const coral::AttributeList& sourceAttrList = m_headerIterator->currentRow().attributeList();