Skip to content

Commit cd861be

Browse files
aalkinktf
authored andcommitted
DPL Analysis: add test for filtered grouping
1 parent 405307c commit cd861be

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

‎Framework/Core/test/test_GroupSlicer.cxx‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,52 @@ BOOST_AUTO_TEST_CASE(GroupSlicerMismatchedGroups)
229229
++count;
230230
}
231231
}
232+
233+
BOOST_AUTO_TEST_CASE(GroupSlicerMismatchedFilteredGroups)
234+
{
235+
TableBuilder builderE;
236+
auto evtsWriter = builderE.cursor<aod::Events>();
237+
for (auto i = 0; i < 20; ++i) {
238+
evtsWriter(0, 0.5f * i, 2.f * i, 3.f * i);
239+
}
240+
auto evtTable = builderE.finalize();
241+
242+
TableBuilder builderT;
243+
auto trksWriter = builderT.cursor<aod::TrksX>();
244+
for (auto i = 0; i < 20; ++i) {
245+
if (i == 3 || i == 10 || i == 12 || i == 16) {
246+
continue;
247+
}
248+
for (auto j = 0.f; j < 5; j += 0.5f) {
249+
trksWriter(0, i, 0.5f * j);
250+
}
251+
}
252+
auto trkTable = builderT.finalize();
253+
using FilteredEvents = soa::Filtered<aod::Events>;
254+
soa::SelectionVector rows{2, 4, 10, 9, 15};
255+
FilteredEvents e{{evtTable}, {2, 4, 10, 9, 15}};
256+
aod::TrksX t{trkTable};
257+
BOOST_CHECK_EQUAL(e.size(), 5);
258+
BOOST_CHECK_EQUAL(t.size(), 10 * (20 - 4));
259+
260+
auto tt = std::make_tuple(t);
261+
o2::framework::AnalysisDataProcessorBuilder::GroupSlicer g(e, tt);
262+
263+
unsigned int count = 0;
264+
265+
for (auto& slice : g) {
266+
auto as = slice.associatedTables();
267+
auto gg = slice.groupingElement();
268+
BOOST_CHECK_EQUAL(gg.globalIndex(), rows[count]);
269+
auto trks = std::get<aod::TrksX>(as);
270+
if (rows[count] == 3 || rows[count] == 10 || rows[count] == 12 || rows[count] == 16) {
271+
BOOST_CHECK_EQUAL(trks.size(), 0);
272+
} else {
273+
BOOST_CHECK_EQUAL(trks.size(), 10);
274+
}
275+
for (auto& trk : trks) {
276+
BOOST_CHECK_EQUAL(trk.eventId(), rows[count]);
277+
}
278+
++count;
279+
}
280+
}

0 commit comments

Comments
 (0)