[DPL Analysis] [Event mixing] Introducing Binning Policy for block combinations#8299
[DPL Analysis] [Event mixing] Introducing Binning Policy for block combinations#8299ktf merged 12 commits intoAliceO2Group:devfrom
Conversation
…r templated groupTable()
|
Hi @jgrosseo, in the next PR I will adjust event mixing interface. With the changes introduced here, event mixing will look like this: "pair binning" means "calculate bins based on 2 columns". Similarly, there is SingleBinning and TripleBinning. We can think about a better naming, if it is confusing. What do you think about this approach? |
| auto binningColumns = binningPolicy.getColumns(); | ||
| auto arrowColumns = o2::framework::binning_helpers::getArrowColumns(arrowTable, binningColumns); | ||
| auto chunksCount = arrowColumns[0]->num_chunks(); | ||
| // TODO: Are such checks needed or can we safely assume chunks are always the same? |
There was a problem hiding this comment.
@ktf?
If I don't need to check the alignments, then I can get rid of getArrowColumns() and getChunks() altogether.
There was a problem hiding this comment.
For sure arrow arrows mixing chunks sizes / number of chunks. I would not assume they are necessarily the same (although it might be in our case so far).
| template <typename... Cs> | ||
| std::array<arrow::ChunkedArray*, sizeof...(Cs)> getArrowColumns(arrow::Table* table, pack<Cs...>) | ||
| { | ||
| static_assert(std::conjunction_v<typename Cs::persistent...>, "BinningPolicy: only persistent columns accepted (not dynamic and not index ones"); |
There was a problem hiding this comment.
An important point: one cannot do event mixing / block combinations based on values in dynamic columns. Simply because they do not exist as real columns.
|
Thanks for this work! The interface looks good to me. I let @ktf comment on the technicalities. About the naming. So we cannot have just |
|
It breaks the compilation of O2Physics so we would need to force merge both in parallel. Is there an easy trick to avoid this? |
BinningPolicyBase has a variable number of template arguments. I created Single, Pair, Triple policies so as to override On the other hand, are there many (any?) use cases of mixing based on 4 or more event properties? |
No, 1-3 is sufficient. |
Ah, right. I changed the selfCombinations parameters. I can write a temporary binning class for backward compatibility but perhaps this is not worthy the effort? I see it is used in 4 places, in connection with event mixing. With my next PR that will need to change anyways. |
|
I added the backward compability.
I implemented a single binning class. But I am curious whether this code looks good (wrt performance) to @ktf ? Or whether old implementation with multiple classes was better? I also commented lines that caused the problem in macOS, as I am not sure we will need them at the end (see my review comments above, ASoAHelpers.h:88). |
| { | ||
| template <typename T> | ||
| struct is_string { | ||
| static const bool value = false; | ||
| }; | ||
|
|
||
| template <class T, class Traits, class Alloc> | ||
| struct is_string<std::basic_string<T, Traits, Alloc>> { | ||
| static const bool value = true; | ||
| }; | ||
|
|
||
| template <std::size_t N> | ||
| struct is_string<char[N]> { | ||
| static const bool value = true; | ||
| }; | ||
| } // namespace old_interface | ||
|
|
There was a problem hiding this comment.
I think you could just use is_specialization, no?
|
|
||
| #include "Framework/ASoA.h" | ||
| #include "Framework/BinningPolicy.h" | ||
| #include "Framework/Logger.h" |
| uint64_t ind = 0; | ||
| uint64_t selInd = 0; | ||
| gsl::span<int64_t const> selectedRows; | ||
| std::vector<std::pair<uint64_t, uint64_t>> groupedIndices; |
There was a problem hiding this comment.
I would use a struct rather than a pair.
ktf
left a comment
There was a problem hiding this comment.
I am afraid the changes are too large for me to review them thoroughly, but the idea looks fine, apart from a few nitpicks that can be fixed later (please make sure you drop Logger.h, in particular). Assuming you tested them and in particular you made sure grouping still works, I am fine with them.
Ciao @ktf,
The BinningPolicy classes replace the special hash task / table for block combinations.
Sorry for a huge PR, but I needed to modify in tests all lines that call block combinations, otherwise it won't compile.
The core changes are: new BinningPolicy.h and rewritten
groupTable()in ASoAHelpers.h.