Skip to content

Commit 91614c7

Browse files
committed
DPL Analysis: make Attach preserve the filtered status of the table
1 parent a73c085 commit 91614c7

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

Framework/Core/include/Framework/ASoA.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,6 +2283,10 @@ O2ORIGIN("CONC");
22832283
O2HASH("CONC/0");
22842284
O2ORIGIN("TEST");
22852285
O2HASH("TEST/0");
2286+
O2HASH("ATT/0");
2287+
O2ORIGIN("ATT");
2288+
O2HASH("EXT/0");
2289+
O2ORIGIN("EXT");
22862290
} // namespace o2::aod
22872291

22882292
#define DECLARE_EQUIVALENT_FOR_INDEX(_Base_, _Equiv_) \

Framework/Core/include/Framework/AnalysisHelpers.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,18 +698,29 @@ namespace o2::soa
698698
template <soa::is_table T, soa::is_spawnable_column... Cs>
699699
auto Extend(T const& table)
700700
{
701-
using output_t = Join<T, soa::Table<o2::aod::Hash<"JOIN"_h>, o2::aod::Hash<"JOIN/0"_h>, o2::aod::Hash<"JOIN"_h>, Cs...>>;
701+
using output_t = Join<T, soa::Table<o2::aod::Hash<"EXT"_h>, o2::aod::Hash<"EXT/0"_h>, o2::aod::Hash<"EXT"_h>, Cs...>>;
702702
return output_t{{o2::framework::spawner(framework::pack<Cs...>{}, {table.asArrowTable()}, "dynamicExtension"), table.asArrowTable()}, 0};
703703
}
704704

705705
/// Template function to attach dynamic columns on-the-fly (e.g. inside
706706
/// process() function). Dynamic columns need to be compatible with the table.
707707
template <soa::is_table T, soa::is_dynamic_column... Cs>
708+
requires(!soa::is_filtered_table<T>)
708709
auto Attach(T const& table)
709710
{
710-
using output_t = Join<T, o2::soa::Table<o2::aod::Hash<"JOIN"_h>, o2::aod::Hash<"JOIN/0"_h>, o2::aod::Hash<"JOIN"_h>, Cs...>>;
711+
using output_t = Join<T, o2::soa::Table<o2::aod::Hash<"ATT"_h>, o2::aod::Hash<"ATT/0"_h>, o2::aod::Hash<"ATT"_h>, Cs...>>;
711712
return output_t{{table.asArrowTable()}, table.offset()};
712713
}
714+
715+
template <soa::is_filtered_table T, soa::is_dynamic_column... Cs>
716+
auto Attach(T const& table)
717+
{
718+
using output_t = soa::Filtered<soa::Join<typename T::table_t, o2::soa::Table<o2::aod::Hash<"ATT"_h>, o2::aod::Hash<"ATT/0"_h>, o2::aod::Hash<"ATT"_h>, Cs...>>>;
719+
SelectionVector selection;
720+
selection.reserve(table->getSelectedRows().size());
721+
std::copy(table->getSelectedRows().begin(), table->getSelectedRows().end(), std::back_inserter(selection));
722+
return output_t{{table.asArrowTable()}, std::move(selection), table.offset()};
723+
}
713724
} // namespace o2::soa
714725

715726
#endif // o2_framework_AnalysisHelpers_H_DEFINED

0 commit comments

Comments
 (0)