From 3f4e4010e3b3c1a530d17d32c9b50d71ab3f68c1 Mon Sep 17 00:00:00 2001 From: MattOckleton Date: Mon, 13 Apr 2026 14:47:26 +0200 Subject: [PATCH 1/8] column name fixes jetCorrelationD0 --- PWGJE/Tasks/jetCorrelationD0.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/PWGJE/Tasks/jetCorrelationD0.cxx b/PWGJE/Tasks/jetCorrelationD0.cxx index bba4f0273aa..15b3cf7322f 100644 --- a/PWGJE/Tasks/jetCorrelationD0.cxx +++ b/PWGJE/Tasks/jetCorrelationD0.cxx @@ -81,7 +81,7 @@ DECLARE_SOA_COLUMN(D0PhiD, d0PhiD, float); DECLARE_SOA_COLUMN(D0Reflection, d0Reflection, int); } // namespace d0Info -DECLARE_SOA_TABLE(D0DataTables, "AOD", "D0TABLE", +DECLARE_SOA_TABLE(D0Tables, "AOD", "D0TABLE", o2::soa::Index<>, collisionInfo::CollisionTableId, d0Info::D0PromptBDT, @@ -105,8 +105,8 @@ DECLARE_SOA_TABLE(D0McPTables, "AOD", "D0MCPTABLE", namespace jetInfo { // D0 tables -DECLARE_SOA_INDEX_COLUMN(D0DataTable, d0DataTable); -DECLARE_SOA_INDEX_COLUMN(D0McPTable, d0McPTable); +DECLARE_SOA_INDEX_COLUMN_CUSTOM(D0Table, d0Table, "D0TABLE"); +DECLARE_SOA_INDEX_COLUMN_CUSTOM(D0McPTable, d0McPTable, "D0MCPTABLE"); // Jet DECLARE_SOA_COLUMN(JetPt, jetPt, float); DECLARE_SOA_COLUMN(JetEta, jetEta, float); @@ -119,10 +119,10 @@ DECLARE_SOA_COLUMN(D0JetDeltaPhi, d0JetDeltaPhi, float); DECLARE_SOA_COLUMN(D0JetDeltaPhiP, d0JetDeltaPhiP, float); } // namespace jetInfo -DECLARE_SOA_TABLE_STAGED(JetDataTables, "JETTABLE", +DECLARE_SOA_TABLE_STAGED(JetTables, "JETTABLE", o2::soa::Index<>, collisionInfo::CollisionTableId, - jetInfo::D0DataTableId, + jetInfo::D0TableId, jetInfo::JetPt, jetInfo::JetEta, jetInfo::JetPhi, @@ -156,9 +156,9 @@ struct JetCorrelationD0 { Produces tableCollision; Produces tableMatchedCollision; Produces tableMcCollision; - Produces tableD0; + Produces tableD0; Produces tableD0McParticle; - Produces tableJet; + Produces tableJet; Produces tableJetMcParticle; Produces tableJetMatched; From 25f36179df8939a8d7dbf779907d3dc906aeb8ee Mon Sep 17 00:00:00 2001 From: MattOckleton Date: Mon, 13 Apr 2026 15:21:31 +0200 Subject: [PATCH 2/8] removing custom index columns --- PWGJE/Tasks/jetCorrelationD0.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGJE/Tasks/jetCorrelationD0.cxx b/PWGJE/Tasks/jetCorrelationD0.cxx index 15b3cf7322f..31b3bfcb944 100644 --- a/PWGJE/Tasks/jetCorrelationD0.cxx +++ b/PWGJE/Tasks/jetCorrelationD0.cxx @@ -105,8 +105,8 @@ DECLARE_SOA_TABLE(D0McPTables, "AOD", "D0MCPTABLE", namespace jetInfo { // D0 tables -DECLARE_SOA_INDEX_COLUMN_CUSTOM(D0Table, d0Table, "D0TABLE"); -DECLARE_SOA_INDEX_COLUMN_CUSTOM(D0McPTable, d0McPTable, "D0MCPTABLE"); +DECLARE_SOA_INDEX_COLUMN(D0Table, d0Table); +DECLARE_SOA_INDEX_COLUMN(D0McPTable, d0McPTable); // Jet DECLARE_SOA_COLUMN(JetPt, jetPt, float); DECLARE_SOA_COLUMN(JetEta, jetEta, float); From 3f7b78e33aa208d1d418061b0994265225ada995 Mon Sep 17 00:00:00 2001 From: MattOckleton Date: Tue, 12 May 2026 12:31:31 +0200 Subject: [PATCH 3/8] Adding reflections to jetCorrelationD0 task --- PWGJE/Tasks/jetCorrelationD0.cxx | 69 ++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 21 deletions(-) diff --git a/PWGJE/Tasks/jetCorrelationD0.cxx b/PWGJE/Tasks/jetCorrelationD0.cxx index 0196aec6d5b..16ec4ec2481 100644 --- a/PWGJE/Tasks/jetCorrelationD0.cxx +++ b/PWGJE/Tasks/jetCorrelationD0.cxx @@ -20,20 +20,14 @@ #include "Common/Core/RecoDecay.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/Logger.h" +#include "Framework/runDataProcessing.h" + #include +#include #include #include @@ -84,7 +78,8 @@ DECLARE_SOA_COLUMN(D0MD, d0MD, float); DECLARE_SOA_COLUMN(D0PtD, d0PtD, float); DECLARE_SOA_COLUMN(D0EtaD, d0EtaD, float); DECLARE_SOA_COLUMN(D0PhiD, d0PhiD, float); -DECLARE_SOA_COLUMN(D0Reflection, d0Reflection, int); +DECLARE_SOA_COLUMN(D0MatchedFrom, d0MatchedFrom, int); +DECLARE_SOA_COLUMN(D0SelectedAs, d0SelectedAs, int); } // namespace d0Info DECLARE_SOA_TABLE(D0Tables, "AOD", "D0TABLE", @@ -99,6 +94,20 @@ DECLARE_SOA_TABLE(D0Tables, "AOD", "D0TABLE", d0Info::D0Phi, d0Info::D0Y); +DECLARE_SOA_TABLE(D0McDTables, "AOD", "D0MCDTABLE", + o2::soa::Index<>, + collisionInfo::CollisionTableId, + d0Info::D0PromptBDT, + d0Info::D0NonPromptBDT, + d0Info::D0BkgBDT, + d0Info::D0M, + d0Info::D0Pt, + d0Info::D0Eta, + d0Info::D0Phi, + d0Info::D0Y, + d0Info::D0MatchedFrom, + d0Info::D0SelectedAs); + DECLARE_SOA_TABLE(D0McPTables, "AOD", "D0MCPTABLE", o2::soa::Index<>, collisionInfo::McCollisionTableId, @@ -160,9 +169,10 @@ DECLARE_SOA_TABLE_STAGED(JetMatchedTables, "JETMATCHEDTABLE", struct JetCorrelationD0 { // Define new table Produces tableCollision; - Produces tableMatchedCollision; Produces tableMcCollision; + Produces tableMatchedCollision; Produces tableD0; + Produces tableD0McDetector; Produces tableD0McParticle; Produces tableJet; Produces tableJetMcParticle; @@ -318,7 +328,25 @@ struct JetCorrelationD0 { } const auto scores = d0Candidate.mlScores(); fillD0Histograms(d0Candidate, scores); - tableD0(tableCollision.lastIndex(), // might want to add some more detector level D0 quantities like prompt or non prompt info + + int matchedFrom = 0; + int decayChannel = o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK; + int selectedAs = 0; + + if (d0Candidate.flagMcMatchRec() == decayChannel) { // matched to D0 on truth level + matchedFrom = 1; + } + else if (d0Candidate.flagMcMatchRec() == -decayChannel) { // matched to D0bar on truth level + matchedFrom = -1; + } + if (d0Candidate.candidateSelFlag() & BIT(0)) { // CandidateSelFlag == BIT(0) -> selected as D0 + selectedAs = 1; + } + else if (d0Candidate.candidateSelFlag() & BIT(1)) { // CandidateSelFlag == BIT(1) -> selected as D0bar + selectedAs = -1; + } + + tableD0McDetector(tableCollision.lastIndex(), // might want to add some more detector level D0 quantities like prompt or non prompt info scores[2], scores[1], scores[0], @@ -326,7 +354,9 @@ struct JetCorrelationD0 { d0Candidate.pt(), d0Candidate.eta(), d0Candidate.phi(), - d0Candidate.y()); + d0Candidate.y(), + matchedFrom, + selectedAs); for (const auto& jet : jets) { if (jet.pt() < jetPtCutMin) { continue; @@ -337,7 +367,7 @@ struct JetCorrelationD0 { } fillJetHistograms(jet, dPhi); tableJet(tableCollision.lastIndex(), - tableD0.lastIndex(), + tableD0McDetector.lastIndex(), jet.pt(), jet.eta(), jet.phi(), @@ -417,9 +447,6 @@ struct JetCorrelationD0 { if (McDJet.has_matchedJetGeo()) { // geometric matching for (auto const& McPJet : McDJet.template matchedJetGeo_as()) { float dPhiP = RecoDecay::constrainAngle(McPJet.phi() - d0Particle.phi(), -o2::constants::math::PI); - // if (std::abs(dPhiP - o2::constants::math::PI) > (o2::constants::math::PI / 2)) { - // continue; - // } tableJetMatched(tableMatchedCollision.lastIndex(), McDJet.pt(), McDJet.eta(), From ee99bb313ff2e83904d45edba7d3c223099cde59 Mon Sep 17 00:00:00 2001 From: MattOckleton Date: Thu, 25 Jun 2026 13:50:42 +0200 Subject: [PATCH 4/8] Fixes for MC --- PWGJE/Tasks/jetCorrelationD0.cxx | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/PWGJE/Tasks/jetCorrelationD0.cxx b/PWGJE/Tasks/jetCorrelationD0.cxx index 16ec4ec2481..e1696019915 100644 --- a/PWGJE/Tasks/jetCorrelationD0.cxx +++ b/PWGJE/Tasks/jetCorrelationD0.cxx @@ -96,7 +96,7 @@ DECLARE_SOA_TABLE(D0Tables, "AOD", "D0TABLE", DECLARE_SOA_TABLE(D0McDTables, "AOD", "D0MCDTABLE", o2::soa::Index<>, - collisionInfo::CollisionTableId, + collisionInfo::McCollisionTableId, d0Info::D0PromptBDT, d0Info::D0NonPromptBDT, d0Info::D0BkgBDT, @@ -121,6 +121,7 @@ namespace jetInfo { // D0 tables DECLARE_SOA_INDEX_COLUMN(D0Table, d0Table); +DECLARE_SOA_INDEX_COLUMN(D0McDTable, d0McDTable); DECLARE_SOA_INDEX_COLUMN(D0McPTable, d0McPTable); // Jet DECLARE_SOA_COLUMN(JetPt, jetPt, float); @@ -143,6 +144,15 @@ DECLARE_SOA_TABLE_STAGED(JetTables, "JETTABLE", jetInfo::JetPhi, jetInfo::D0JetDeltaPhi); +DECLARE_SOA_TABLE_STAGED(JetMcDTables, "JETMCDTABLE", + o2::soa::Index<>, + collisionInfo::CollisionTableId, + jetInfo::D0McDTableId, + jetInfo::JetPt, + jetInfo::JetEta, + jetInfo::JetPhi, + jetInfo::D0JetDeltaPhi); + DECLARE_SOA_TABLE_STAGED(JetMcPTables, "JETMCPTABLE", o2::soa::Index<>, collisionInfo::McCollisionTableId, @@ -175,13 +185,14 @@ struct JetCorrelationD0 { Produces tableD0McDetector; Produces tableD0McParticle; Produces tableJet; + Produces tableJetMcDetector; Produces tableJetMcParticle; Produces tableJetMatched; // Configurables Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; Configurable skipMBGapEvents{"skipMBGapEvents", false, "decide to run over MB gap events or not"}; - Configurable applyRCTSelections{"applyRCTSelections", true, "decide to apply RCT selections"}; + Configurable applyRCTSelections{"applyRCTSelections", false, "decide to apply RCT selections"}; Configurable jetPtCutMin{"jetPtCutMin", 5.0, "minimum value of jet pt"}; Configurable d0PtCutMin{"d0PtCutMin", 1.0, "minimum value of d0 pt"}; Configurable jetMcPtCutMin{"jetMcPtCutMin", 3.0, "minimum value of jet pt particle level"}; @@ -366,12 +377,12 @@ struct JetCorrelationD0 { continue; } fillJetHistograms(jet, dPhi); - tableJet(tableCollision.lastIndex(), - tableD0McDetector.lastIndex(), - jet.pt(), - jet.eta(), - jet.phi(), - dPhi); + tableJetMcDetector(tableCollision.lastIndex(), + tableD0McDetector.lastIndex(), + jet.pt(), + jet.eta(), + jet.phi(), + dPhi); } } } From dfae714acffd53d50684c52409e2a8f45d403d3d Mon Sep 17 00:00:00 2001 From: MattOckleton Date: Thu, 25 Jun 2026 14:09:42 +0200 Subject: [PATCH 5/8] removing whitespace --- PWGJE/Tasks/jetCorrelationD0.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGJE/Tasks/jetCorrelationD0.cxx b/PWGJE/Tasks/jetCorrelationD0.cxx index e1696019915..e37011dcd47 100644 --- a/PWGJE/Tasks/jetCorrelationD0.cxx +++ b/PWGJE/Tasks/jetCorrelationD0.cxx @@ -346,13 +346,13 @@ struct JetCorrelationD0 { if (d0Candidate.flagMcMatchRec() == decayChannel) { // matched to D0 on truth level matchedFrom = 1; - } + } else if (d0Candidate.flagMcMatchRec() == -decayChannel) { // matched to D0bar on truth level matchedFrom = -1; } if (d0Candidate.candidateSelFlag() & BIT(0)) { // CandidateSelFlag == BIT(0) -> selected as D0 selectedAs = 1; - } + } else if (d0Candidate.candidateSelFlag() & BIT(1)) { // CandidateSelFlag == BIT(1) -> selected as D0bar selectedAs = -1; } From faf4e90d314d4aa95178c79f848605227c71c1bc Mon Sep 17 00:00:00 2001 From: MattOckleton Date: Thu, 25 Jun 2026 14:11:54 +0200 Subject: [PATCH 6/8] clang-format --- PWGJE/Tasks/jetCorrelationD0.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/PWGJE/Tasks/jetCorrelationD0.cxx b/PWGJE/Tasks/jetCorrelationD0.cxx index e37011dcd47..fb2f6b64815 100644 --- a/PWGJE/Tasks/jetCorrelationD0.cxx +++ b/PWGJE/Tasks/jetCorrelationD0.cxx @@ -346,14 +346,12 @@ struct JetCorrelationD0 { if (d0Candidate.flagMcMatchRec() == decayChannel) { // matched to D0 on truth level matchedFrom = 1; - } - else if (d0Candidate.flagMcMatchRec() == -decayChannel) { // matched to D0bar on truth level + } else if (d0Candidate.flagMcMatchRec() == -decayChannel) { // matched to D0bar on truth level matchedFrom = -1; } if (d0Candidate.candidateSelFlag() & BIT(0)) { // CandidateSelFlag == BIT(0) -> selected as D0 selectedAs = 1; - } - else if (d0Candidate.candidateSelFlag() & BIT(1)) { // CandidateSelFlag == BIT(1) -> selected as D0bar + } else if (d0Candidate.candidateSelFlag() & BIT(1)) { // CandidateSelFlag == BIT(1) -> selected as D0bar selectedAs = -1; } From c7c69af2c6f289fda60987fa82fa585ee086d8f5 Mon Sep 17 00:00:00 2001 From: MattOckleton Date: Thu, 25 Jun 2026 14:18:15 +0200 Subject: [PATCH 7/8] formatting tableD0McDetector --- PWGJE/Tasks/jetCorrelationD0.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/PWGJE/Tasks/jetCorrelationD0.cxx b/PWGJE/Tasks/jetCorrelationD0.cxx index fb2f6b64815..0dc6b25cb41 100644 --- a/PWGJE/Tasks/jetCorrelationD0.cxx +++ b/PWGJE/Tasks/jetCorrelationD0.cxx @@ -356,16 +356,16 @@ struct JetCorrelationD0 { } tableD0McDetector(tableCollision.lastIndex(), // might want to add some more detector level D0 quantities like prompt or non prompt info - scores[2], - scores[1], - scores[0], - d0Candidate.m(), - d0Candidate.pt(), - d0Candidate.eta(), - d0Candidate.phi(), - d0Candidate.y(), - matchedFrom, - selectedAs); + scores[2], + scores[1], + scores[0], + d0Candidate.m(), + d0Candidate.pt(), + d0Candidate.eta(), + d0Candidate.phi(), + d0Candidate.y(), + matchedFrom, + selectedAs); for (const auto& jet : jets) { if (jet.pt() < jetPtCutMin) { continue; From e33800b59fd4a4118f63f1190aa6ab20cef04a3e Mon Sep 17 00:00:00 2001 From: MattOckleton Date: Thu, 25 Jun 2026 14:21:44 +0200 Subject: [PATCH 8/8] formatting headers --- PWGJE/Tasks/jetCorrelationD0.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PWGJE/Tasks/jetCorrelationD0.cxx b/PWGJE/Tasks/jetCorrelationD0.cxx index 0dc6b25cb41..d7503c19d86 100644 --- a/PWGJE/Tasks/jetCorrelationD0.cxx +++ b/PWGJE/Tasks/jetCorrelationD0.cxx @@ -20,11 +20,11 @@ #include "Common/Core/RecoDecay.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/Logger.h" -#include "Framework/runDataProcessing.h" +#include +#include +#include +#include +#include #include #include