Skip to content
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
17 changes: 12 additions & 5 deletions Tutorials/src/extendedColumns.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,20 @@ using namespace o2;
using namespace o2::framework;

struct ExtendTable {
void process(aod::Collision const&, aod::Tracks const& tracks)
void process(aod::Collisions const& collisions, aod::Tracks const& tracks)
{
// note that this needs to be done only once, as it is done for the whole table
// the extension is temporary and is lost when the variable it is assigned to
// goes out of scope
auto table_extension = soa::Extend<aod::Tracks, aod::extension::P2>(tracks);
for (auto& row : table_extension) {
if (row.trackType() != 3) {
if (row.index() % 100 == 0) {
LOGF(info, "P^2 = %.3f", row.p2());
for (auto& collision : collisions) {
auto trackSlice = table_extension.sliceBy(aod::track::collisionId, collision.globalIndex());
LOGP(info, "Collision {}", collision.globalIndex());
for (auto& row : trackSlice) {
if (row.trackType() != 3) {
if (row.index() % 100 == 0) {
LOGP(info, "P^2 = {}", row.p2());
}
}
}
}
Expand Down