diff --git a/Framework/Core/include/Framework/ASoA.h b/Framework/Core/include/Framework/ASoA.h index 0fce19e0c6371..0dc29df1a69d2 100644 --- a/Framework/Core/include/Framework/ASoA.h +++ b/Framework/Core/include/Framework/ASoA.h @@ -2270,6 +2270,7 @@ std::tuple getRowData(arrow::Table* table, T rowIterator, namespace o2::soa { + template struct Join : JoinBase { Join(std::vector>&& tables, uint64_t offset = 0); @@ -2317,6 +2318,22 @@ struct Join : JoinBase { static_assert(o2::framework::always_static_assert_v, "Wrong Preslice<> entry used: incompatible type"); } } + + template + static constexpr bool contains() + { + if constexpr (is_type_with_originals_v) { + return contains(typename T::originals{}); + } else { + return framework::has_type_v; + } + } + + template + static constexpr bool contains(framework::pack) + { + return (contains() || ...); + } }; template diff --git a/Framework/Core/test/test_ASoA.cxx b/Framework/Core/test/test_ASoA.cxx index 125fd7994cbf8..217928bff01d1 100644 --- a/Framework/Core/test/test_ASoA.cxx +++ b/Framework/Core/test/test_ASoA.cxx @@ -275,7 +275,16 @@ BOOST_AUTO_TEST_CASE(TestJoinedTables) using TestZ = o2::soa::Table; using Test = Join; + BOOST_CHECK(Test::contains()); + BOOST_CHECK(Test::contains()); + BOOST_CHECK(!Test::contains()); + Test tests{0, tableX, tableY}; + + BOOST_CHECK(tests.contains()); + BOOST_CHECK(tests.contains()); + BOOST_CHECK(!tests.contains()); + for (auto& test : tests) { BOOST_CHECK_EQUAL(7, test.x() + test.y()); } diff --git a/Framework/Core/test/test_AnalysisDataModel.cxx b/Framework/Core/test/test_AnalysisDataModel.cxx index 8fed7bfd85f44..da54f33339ac8 100644 --- a/Framework/Core/test/test_AnalysisDataModel.cxx +++ b/Framework/Core/test/test_AnalysisDataModel.cxx @@ -40,8 +40,8 @@ DECLARE_SOA_TABLE(ZD, "AOD", "ZD", col::Z, col::D); BOOST_AUTO_TEST_CASE(TestJoinedTables) { TableBuilder XYBuilder; - //FIXME: using full tracks, instead of stored because of unbound dynamic - // column (normalized phi) + // FIXME: using full tracks, instead of stored because of unbound dynamic + // column (normalized phi) auto xyWriter = XYBuilder.cursor(); xyWriter(0, 0, 0); auto tXY = XYBuilder.finalize(); @@ -60,4 +60,8 @@ BOOST_AUTO_TEST_CASE(TestJoinedTables) auto tests2 = join(XY{tXY}, ZD{tZD}); static_assert(std::is_same_v, "Joined tables should have the same type, regardless how we construct them"); + + using FullTracks = o2::soa::Join; + BOOST_CHECK(FullTracks::contains()); + BOOST_CHECK(!FullTracks::contains()); }