From c15014ce2b72e5f4e40c79e8acc0c80cf6ef7fae Mon Sep 17 00:00:00 2001 From: Anton Alkin Date: Thu, 5 Dec 2024 19:51:28 +0100 Subject: [PATCH] DPL Analysis: fix for iterator not setting the originals correctly (#13771) --- Framework/Core/include/Framework/ASoA.h | 39 +++++++++++------------- Framework/Core/test/test_GroupSlicer.cxx | 9 ++++++ 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/Framework/Core/include/Framework/ASoA.h b/Framework/Core/include/Framework/ASoA.h index 25e64daefeba7..84c6e3ae705fb 100644 --- a/Framework/Core/include/Framework/ASoA.h +++ b/Framework/Core/include/Framework/ASoA.h @@ -1451,12 +1451,7 @@ using PresliceOptional = PresliceBase; namespace o2::soa { -template -class FilteredBase; -template -class Filtered; - -template +template class FilteredBase; template class Filtered; @@ -1728,7 +1723,8 @@ class Table using columns_t = typename Parent::columns_t; using external_index_columns_t = typename Parent::external_index_columns_t; using bindings_pack_t = decltype([](framework::pack) -> framework::pack {}(external_index_columns_t{})); - static constexpr const std::array originals{T::ref...}; + // static constexpr const std::array originals{T::ref...}; + static constexpr auto originals = Parent::originals; using policy_t = IP; using parent_t = Parent; @@ -1741,7 +1737,7 @@ class Table template TableIteratorBase& operator=(TableIteratorBase other) - requires(P::ref::signature == Parent::ref::signature) + requires(P::ref.desc_hash == Parent::ref.desc_hash) { static_cast&>(*this) = static_cast>(other); return *this; @@ -1762,16 +1758,16 @@ class Table return *this; } - template - TableIteratorBase(TableIteratorBase const& other) - requires(P::ref::signature == Parent::ref::signature) + template + TableIteratorBase(TableIteratorBase const& other) + requires(P::ref.desc_hash == Parent::ref.desc_hash) { *this = other; } - template - TableIteratorBase(TableIteratorBase&& other) noexcept - requires(P::ref::signature == Parent::ref::signature) + template + TableIteratorBase(TableIteratorBase&& other) noexcept + requires(P::ref.desc_hash == Parent::ref.desc_hash) { *this = other; } @@ -2503,7 +2499,7 @@ consteval auto getIndexTargets() for (auto const& i : *mColumnIterator) { \ auto pos = mBinding.get()->isInSelectedRows(i); \ if (pos > 0) { \ - result.push_back(mBinding.get()->iteratorAt(pos)); \ + result.emplace_back(mBinding.get()->iteratorAt(pos)); \ } \ } \ return result; \ @@ -3061,9 +3057,6 @@ consteval auto getIndexTargets() namespace o2::soa { -// template -// class FilteredBase; - template struct JoinFull : Table, D, o2::aod::Hash<"JOIN"_h>, Ts...> { using base = Table, D, o2::aod::Hash<"JOIN"_h>, Ts...>; @@ -3201,7 +3194,7 @@ constexpr auto concat(Ts const&... t) return Concat{t...}; } -template +template class FilteredBase : public T { public: @@ -3473,7 +3466,8 @@ class Filtered : public FilteredBase public: using base_t = T; using self_t = Filtered; - using table_t = typename FilteredBase::table_t; + using table_t = typename T::table_t; + using columns_t = typename T::columns_t; using iterator = T::template iterator_template_o; using unfiltered_iterator = T::template iterator_template_o; @@ -3633,9 +3627,10 @@ class Filtered> : public FilteredBase using self_t = Filtered>; using base_t = T; using table_t = typename FilteredBase::table_t; + using columns_t = typename T::columns_t; - using iterator = FilteredBase::iterator; - using unfiltered_iterator = FilteredBase::unfiltered_iterator; + using iterator = typename T::template iterator_template_o; + using unfiltered_iterator = typename T::template iterator_template_o; using const_iterator = iterator; iterator begin() diff --git a/Framework/Core/test/test_GroupSlicer.cxx b/Framework/Core/test/test_GroupSlicer.cxx index 8ce5170e89cb7..161939141e790 100644 --- a/Framework/Core/test/test_GroupSlicer.cxx +++ b/Framework/Core/test/test_GroupSlicer.cxx @@ -10,10 +10,12 @@ // or submit itself to any jurisdiction. #include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" #include "Framework/TableBuilder.h" #include "Framework/GroupSlicer.h" #include "Framework/ArrowTableSlicingCache.h" #include +#include #include @@ -85,6 +87,13 @@ DECLARE_SOA_COLUMN(Lst, lst, std::vector); DECLARE_SOA_TABLE(EventExtra, "AOD", "EVTSXTRA", test::Arr, test::Boo, test::Lst); } // namespace o2::aod +TEST_CASE("RelatedByIndex") +{ + using Trks = soa::Join; + CHECK(soa::relatedByIndex() == true); + CHECK(soa::relatedByIndex() == true); +} + TEST_CASE("GroupSlicerOneAssociated") { TableBuilder builderE;