From 8cbf7ae33ce8a3f89ca8a32dfb7e585d26dbc795 Mon Sep 17 00:00:00 2001 From: Anton Alkin Date: Tue, 9 Jul 2024 12:21:44 +0200 Subject: [PATCH 1/3] Fix outdated sliceBy usage --- docs/tutorials/indexTables.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/tutorials/indexTables.md b/docs/tutorials/indexTables.md index cd86e696..041385f6 100644 --- a/docs/tutorials/indexTables.md +++ b/docs/tutorials/indexTables.md @@ -65,10 +65,17 @@ struct ConsumeColExtra { ### PartitionColExtra -Index columns allow to easily select e.g. all tracks belonging to a given collision using the sliceBy() method (see also [DECLARE_SOA_TABLE](creatingTables.md#declareTables)). groupedTracks contains only tracks which belong to Collision col. - +Index columns allow to easily select e.g. all tracks belonging to a given collision using the `sliceBy()` method (see also [DECLARE_SOA_TABLE](creatingTables.md#declareTables)). groupedTracks contains only tracks which belong to Collision col. +The slicing needs to be pre-declared using `Preslice` (or `PresliceUnsorted` if the index is not sorted) so that the framework can prepare and add it to the internal cache. ```cpp -auto groupedTracks = tracks.sliceBy(aod::track::collisionId, col.globalIndex()); +struct Task { + Preslice perCol = aod::track::collisionId; + void proces(aod::Collisions const & cols, aod::Tracks const& tracks) { + for (auto& col : cols) { + auto groupedTracks = tracks.sliceBy(perCol, col.globalIndex()); + } + } +} ``` From 55743de5449743d36309950d1dcc831b21d3c7ca Mon Sep 17 00:00:00 2001 From: Anton Alkin Date: Tue, 9 Jul 2024 12:23:55 +0200 Subject: [PATCH 2/3] Update indexTables.md --- docs/tutorials/indexTables.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/tutorials/indexTables.md b/docs/tutorials/indexTables.md index 041385f6..982971bb 100644 --- a/docs/tutorials/indexTables.md +++ b/docs/tutorials/indexTables.md @@ -71,9 +71,9 @@ The slicing needs to be pre-declared using `Preslice` (or `PresliceUnsorted` if struct Task { Preslice perCol = aod::track::collisionId; void proces(aod::Collisions const & cols, aod::Tracks const& tracks) { - for (auto& col : cols) { - auto groupedTracks = tracks.sliceBy(perCol, col.globalIndex()); - } + for (auto& col : cols) { + auto groupedTracks = tracks.sliceBy(perCol, col.globalIndex()); + } } } ``` From 64a8480308e6efbb5177b2d36d758df756f62cfb Mon Sep 17 00:00:00 2001 From: Anton Alkin Date: Tue, 9 Jul 2024 12:30:04 +0200 Subject: [PATCH 3/3] linter fix --- docs/tutorials/indexTables.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/tutorials/indexTables.md b/docs/tutorials/indexTables.md index 982971bb..ca76dacf 100644 --- a/docs/tutorials/indexTables.md +++ b/docs/tutorials/indexTables.md @@ -18,7 +18,7 @@ Related information can be contained in different tables. And in order to associ -### ProduceEtaPhi, ProduceColExtra, and ConsumeEtaPhi +## ProduceEtaPhi, ProduceColExtra, and ConsumeEtaPhi The tutorial example starts with the declaration and production of three tables, EtaPhi and CollisionsExtra, which are normal tables, and HMPIDTracksIndex, an index table. @@ -30,7 +30,7 @@ DECLARE_SOA_INDEX_TABLE_USER(HMPIDTracksIndex, Tracks, "HMPIDTRKIDX", indices::T -### ConsumeColExtra +## ConsumeColExtra In task ConsumeColExtra the basic usage of indices is demonstrated. Tracks are associated to collisions via the index column o2::aod::track::CollisionId (see @@ -63,7 +63,7 @@ struct ConsumeColExtra { -### PartitionColExtra +## PartitionColExtra Index columns allow to easily select e.g. all tracks belonging to a given collision using the `sliceBy()` method (see also [DECLARE_SOA_TABLE](creatingTables.md#declareTables)). groupedTracks contains only tracks which belong to Collision col. The slicing needs to be pre-declared using `Preslice` (or `PresliceUnsorted` if the index is not sorted) so that the framework can prepare and add it to the internal cache. @@ -80,7 +80,7 @@ struct Task { -### BuildHmpidIndex and ConsumeHmpidIndex +## BuildHmpidIndex and ConsumeHmpidIndex Builds<T> is used to prepare an index column of type T. This has to be performed before the index table can be used. Note the declaration of the init() function