Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix outdated sliceBy usage #261

Merged
merged 3 commits into from
Jul 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions docs/tutorials/indexTables.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Related information can be contained in different tables. And in order to associ

<a name="ProduceEtaPhi"></a>

### 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.

Expand All @@ -30,7 +30,7 @@ DECLARE_SOA_INDEX_TABLE_USER(HMPIDTracksIndex, Tracks, "HMPIDTRKIDX", indices::T

<a name="consumecolextra"></a>

### 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
Expand Down Expand Up @@ -63,17 +63,24 @@ struct ConsumeColExtra {

<a name="partitioncolextra"></a>

### 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.
## 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.
```cpp
auto groupedTracks = tracks.sliceBy(aod::track::collisionId, col.globalIndex());
struct Task {
Preslice<aod::Tracks> 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());
}
}
}
```

<a name="hmpidtask"></a>

### BuildHmpidIndex and ConsumeHmpidIndex
## BuildHmpidIndex and ConsumeHmpidIndex

Builds&lt;T&gt; 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
Expand Down
Loading