From b11c2f1fea2805d4960e3424dd85f1b22e57e6a8 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sun, 2 Jun 2024 15:52:18 +0200 Subject: [PATCH 1/3] PWGLF: adjust non-associated V0 findable study code --- .../Strangeness/strangederivedbuilder.cxx | 77 ++++++++++++++----- 1 file changed, 58 insertions(+), 19 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 8e2de425ca9..28b6f169780 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -292,6 +292,12 @@ struct strangederivedbuilder { void processCollisions(soa::Join const& collisions, aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, aod::BCsWithTimestamps const&) { + // create collision indices beforehand + std::vector V0CollIndices(V0s.size(), -1); // index -1: no collision + std::vector CascadeCollIndices(Cascades.size(), -1); // index -1: no collision + std::vector KFCascadeCollIndices(KFCascades.size(), -1); // index -1: no collision + std::vector TraCascadeCollIndices(TraCascades.size(), -1); // index -1: no collision + for (const auto& collision : collisions) { const uint64_t collIdx = collision.globalIndex(); @@ -337,19 +343,38 @@ struct strangederivedbuilder { collision.trackOccupancyInTimeRange()); } } - for (int i = 0; i < V0Table_thisColl.size(); i++) - v0collref(strangeColl.lastIndex()); - for (int i = 0; i < CascTable_thisColl.size(); i++) - casccollref(strangeColl.lastIndex()); - for (int i = 0; i < KFCascTable_thisColl.size(); i++) - kfcasccollref(strangeColl.lastIndex()); - for (int i = 0; i < TraCascTable_thisColl.size(); i++) - tracasccollref(strangeColl.lastIndex()); - } + + for (const auto& v0 : V0Table_thisColl) + V0CollIndices[v0.globalIndex()] = strangeColl.lastIndex(); + for (const auto& casc : CascTable_thisColl) + CascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); + for (const auto& casc : KFCascTable_thisColl) + KFCascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); + for (const auto& casc : TraCascTable_thisColl) + TraCascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); + } + + // populate references, including those that might not be assigned + for (const auto& v0 : V0s) + v0collref(V0CollIndices[v0.globalIndex()]); + for (const auto& casc : Cascades) + casccollref(CascadeCollIndices[casc.globalIndex()]); + for (const auto& casc : KFCascades) + kfcasccollref(KFCascadeCollIndices[casc.globalIndex()]); + for (const auto& casc : KFCascades) + tracasccollref(TraCascadeCollIndices[casc.globalIndex()]); } void processCollisionsMC(soa::Join const& collisions, soa::Join const& V0s, soa::Join const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, aod::BCsWithTimestamps const&, soa::Join const& mcCollisions, aod::McParticles const&) { + // create collision indices beforehand + std::vector V0CollIndices(V0s.size(), -1); // index -1: no collision + std::vector V0MCCollIndices(V0s.size(), -1); // index -1: no collision + std::vector CascadeCollIndices(Cascades.size(), -1); // index -1: no collision + std::vector CascadeMCCollIndices(Cascades.size(), -1); // index -1: no collision + std::vector KFCascadeCollIndices(KFCascades.size(), -1); // index -1: no collision + std::vector TraCascadeCollIndices(TraCascades.size(), -1); // index -1: no collision + // ______________________________________________ // fill all MC collisions, correlate via index later on for (const auto& mccollision : mcCollisions) { @@ -407,14 +432,14 @@ struct strangederivedbuilder { collision.trackOccupancyInTimeRange()); } } - for (int i = 0; i < V0Table_thisColl.size(); i++) - v0collref(strangeColl.lastIndex()); - for (int i = 0; i < CascTable_thisColl.size(); i++) - casccollref(strangeColl.lastIndex()); - for (int i = 0; i < KFCascTable_thisColl.size(); i++) - kfcasccollref(strangeColl.lastIndex()); - for (int i = 0; i < TraCascTable_thisColl.size(); i++) - tracasccollref(strangeColl.lastIndex()); + for (const auto& v0 : V0Table_thisColl) + V0CollIndices[v0.globalIndex()] = strangeColl.lastIndex(); + for (const auto& casc : CascTable_thisColl) + CascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); + for (const auto& casc : KFCascTable_thisColl) + KFCascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); + for (const auto& casc : TraCascTable_thisColl) + TraCascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); // populate MC collision references for (const auto& v0 : V0Table_thisColl) { @@ -425,7 +450,7 @@ struct strangederivedbuilder { indMCColl = mcParticle.mcCollisionId(); } } - v0mccollref(indMCColl); + V0MCCollIndices[v0.globalIndex()] = indMCColl; } for (const auto& casc : CascTable_thisColl) { uint32_t indMCColl = -1; @@ -435,9 +460,23 @@ struct strangederivedbuilder { indMCColl = mcParticle.mcCollisionId(); } } - cascmccollref(indMCColl); + CascadeMCCollIndices[casc.globalIndex()] = indMCColl; } } + + // populate references, including those that might not be assigned + for (const auto& v0 : V0s){ + v0collref(V0CollIndices[v0.globalIndex()]); + v0mccollref(V0MCCollIndices[v0.globalIndex()]); + } + for (const auto& casc : Cascades){ + casccollref(CascadeCollIndices[casc.globalIndex()]); + cascmccollref(CascadeMCCollIndices[casc.globalIndex()]); + } + for (const auto& casc : KFCascades) + kfcasccollref(KFCascadeCollIndices[casc.globalIndex()]); + for (const auto& casc : KFCascades) + tracasccollref(TraCascadeCollIndices[casc.globalIndex()]); } void processTrackExtrasV0sOnly(aod::V0Datas const& V0s, TracksWithExtra const& tracksExtra) From 82238ef584d452921de7496b70b7294706ebffdf Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Sun, 2 Jun 2024 15:53:24 +0200 Subject: [PATCH 2/3] Please consider the following formatting changes (#304) --- .../Strangeness/strangederivedbuilder.cxx | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 28b6f169780..359a40b8389 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -293,9 +293,9 @@ struct strangederivedbuilder { void processCollisions(soa::Join const& collisions, aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, aod::BCsWithTimestamps const&) { // create collision indices beforehand - std::vector V0CollIndices(V0s.size(), -1); // index -1: no collision - std::vector CascadeCollIndices(Cascades.size(), -1); // index -1: no collision - std::vector KFCascadeCollIndices(KFCascades.size(), -1); // index -1: no collision + std::vector V0CollIndices(V0s.size(), -1); // index -1: no collision + std::vector CascadeCollIndices(Cascades.size(), -1); // index -1: no collision + std::vector KFCascadeCollIndices(KFCascades.size(), -1); // index -1: no collision std::vector TraCascadeCollIndices(TraCascades.size(), -1); // index -1: no collision for (const auto& collision : collisions) { @@ -344,13 +344,13 @@ struct strangederivedbuilder { } } - for (const auto& v0 : V0Table_thisColl) + for (const auto& v0 : V0Table_thisColl) V0CollIndices[v0.globalIndex()] = strangeColl.lastIndex(); - for (const auto& casc : CascTable_thisColl) + for (const auto& casc : CascTable_thisColl) CascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); - for (const auto& casc : KFCascTable_thisColl) + for (const auto& casc : KFCascTable_thisColl) KFCascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); - for (const auto& casc : TraCascTable_thisColl) + for (const auto& casc : TraCascTable_thisColl) TraCascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); } @@ -368,11 +368,11 @@ struct strangederivedbuilder { void processCollisionsMC(soa::Join const& collisions, soa::Join const& V0s, soa::Join const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, aod::BCsWithTimestamps const&, soa::Join const& mcCollisions, aod::McParticles const&) { // create collision indices beforehand - std::vector V0CollIndices(V0s.size(), -1); // index -1: no collision - std::vector V0MCCollIndices(V0s.size(), -1); // index -1: no collision - std::vector CascadeCollIndices(Cascades.size(), -1); // index -1: no collision - std::vector CascadeMCCollIndices(Cascades.size(), -1); // index -1: no collision - std::vector KFCascadeCollIndices(KFCascades.size(), -1); // index -1: no collision + std::vector V0CollIndices(V0s.size(), -1); // index -1: no collision + std::vector V0MCCollIndices(V0s.size(), -1); // index -1: no collision + std::vector CascadeCollIndices(Cascades.size(), -1); // index -1: no collision + std::vector CascadeMCCollIndices(Cascades.size(), -1); // index -1: no collision + std::vector KFCascadeCollIndices(KFCascades.size(), -1); // index -1: no collision std::vector TraCascadeCollIndices(TraCascades.size(), -1); // index -1: no collision // ______________________________________________ @@ -432,13 +432,13 @@ struct strangederivedbuilder { collision.trackOccupancyInTimeRange()); } } - for (const auto& v0 : V0Table_thisColl) + for (const auto& v0 : V0Table_thisColl) V0CollIndices[v0.globalIndex()] = strangeColl.lastIndex(); - for (const auto& casc : CascTable_thisColl) + for (const auto& casc : CascTable_thisColl) CascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); - for (const auto& casc : KFCascTable_thisColl) + for (const auto& casc : KFCascTable_thisColl) KFCascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); - for (const auto& casc : TraCascTable_thisColl) + for (const auto& casc : TraCascTable_thisColl) TraCascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); // populate MC collision references @@ -463,13 +463,13 @@ struct strangederivedbuilder { CascadeMCCollIndices[casc.globalIndex()] = indMCColl; } } - + // populate references, including those that might not be assigned - for (const auto& v0 : V0s){ + for (const auto& v0 : V0s) { v0collref(V0CollIndices[v0.globalIndex()]); v0mccollref(V0MCCollIndices[v0.globalIndex()]); } - for (const auto& casc : Cascades){ + for (const auto& casc : Cascades) { casccollref(CascadeCollIndices[casc.globalIndex()]); cascmccollref(CascadeMCCollIndices[casc.globalIndex()]); } From fdbb17c665ca91984eefb337ea552fe2ae5ffeeb Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Mon, 3 Jun 2024 17:49:03 +0200 Subject: [PATCH 3/3] Update strangederivedbuilder.cxx --- PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 359a40b8389..990b600972d 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -59,7 +59,7 @@ using TracksCompleteIUMC = soa::Join; using FullCollisions = soa::Join; -// simple checkers +// simple bit checkers #define bitset(var, nbit) ((var) |= (1 << (nbit))) #define bitcheck(var, nbit) ((var) & (1 << (nbit)))