From a750f5fd067df93ff75327ebf34fdf8740954637 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Fri, 27 Mar 2026 01:18:08 -0400 Subject: [PATCH 01/24] Update CMakeLists.txt --- PWGJE/Tasks/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index 55ec23b2c44..2f716dc76c0 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -403,4 +403,10 @@ if(FastJet_FOUND) SOURCES bjetCentMult.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + + o2physics_add_dpl_workflow(qg-tree-creator + SOURCES qgTreeCreator.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + endif() From bf392dd22e7f2f96e04d2db2525c0366070b31a0 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 00:32:00 -0400 Subject: [PATCH 02/24] Update CMakeLists.txt --- PWGJE/Tasks/CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index 2f716dc76c0..f25cb0bbfdb 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -404,9 +404,13 @@ if(FastJet_FOUND) PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(qg-tree-creator +o2physics_add_dpl_workflow(qg-tree-creator SOURCES qgTreeCreator.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore - COMPONENT_NAME Analysis) + PUBLIC_LINK_LIBRARIES + O2::Framework + O2Physics::AnalysisCore + O2Physics::PWGJECore + COMPONENT_NAME Analysis +) endif() From d4b81eb122221b71e9e0836671d96c6394888cca Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 00:33:58 -0400 Subject: [PATCH 03/24] Create qgTreeCreator.cxx --- PWGJE/qgTreeCreator.cxx | 199 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 PWGJE/qgTreeCreator.cxx diff --git a/PWGJE/qgTreeCreator.cxx b/PWGJE/qgTreeCreator.cxx new file mode 100644 index 00000000000..a72d50863f2 --- /dev/null +++ b/PWGJE/qgTreeCreator.cxx @@ -0,0 +1,199 @@ +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/Configurable.h" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetMatching.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/MCTruthContainer.h" + +#include + +using namespace o2; +using namespace o2::framework; + +namespace o2::aod +{ +DECLARE_SOA_COLUMN(JetPt, jetPt, float); +DECLARE_SOA_COLUMN(JetEta, jetEta, float); +DECLARE_SOA_COLUMN(JetPhi, jetPhi, float); +DECLARE_SOA_COLUMN(NConst, nConst, int); +DECLARE_SOA_COLUMN(Girth, girth, float); +DECLARE_SOA_COLUMN(PTD, pTD, float); +DECLARE_SOA_COLUMN(MatchDeltaR, matchDeltaR, float); +DECLARE_SOA_COLUMN(PtResponse, ptResponse, float); +DECLARE_SOA_COLUMN(QGLabel, qgLabel, int); + +DECLARE_SOA_TABLE(QGJetTable, "AOD", "QGJET", + JetPt, + JetEta, + JetPhi, + NConst, + Girth, + PTD, + MatchDeltaR, + PtResponse, + QGLabel); +} + +//------------------------------------------------ +// helper functions +//------------------------------------------------ +float deltaPhi(float phi1, float phi2) +{ + return std::remainder(phi1 - phi2, 2.f * static_cast(M_PI)); +} + +float deltaR(float eta1, float phi1, float eta2, float phi2) +{ + float deta = eta1 - eta2; + float dphi = deltaPhi(phi1, phi2); + return std::sqrt(deta * deta + dphi * dphi); +} + +//------------------------------------------------ +// find initiating parton by ancestry +//------------------------------------------------ +int getInitiatingParton(auto const& particle, + aod::McParticles const& mcParticles) +{ + auto p = particle; + int pdg = p.pdgCode(); + + while (p.has_mothers()) { + auto mothers = p.mothers_as(); + if (mothers.size() == 0) { + break; + } + + auto mom = mothers.iteratorAt(0); + int mpdg = mom.pdgCode(); + + // stop at quark or gluon + if (std::abs(mpdg) == 21 || (std::abs(mpdg) >= 1 && std::abs(mpdg) <= 6)) { + pdg = mpdg; + } + + p = mom; + } + + return pdg; +} + +//------------------------------------------------ +// main task +//------------------------------------------------ +struct QGTreeCreator { + + Configurable jetPtMin{"jetPtMin",10.f}; + Configurable maxMatchDeltaR{"maxMatchDeltaR",0.3f}; + + Produces qgjets; + + void process(aod::ChargedMCDetectorLevelJets const& recoJets, + aod::ChargedMCParticleLevelJets const& truthJets, + aod::ChargedMCDetectorLevelJetsMatchedToChargedMCParticleLevelJets const& matches, + aod::McParticles const& mcParticles) + { + for (auto const& jet : recoJets) { + + if (jet.pt() < jetPtMin) + continue; + + //---------------------------------- + // compute jet observables + //---------------------------------- + int nconst = 0; + float sumPt = 0; + float sumPt2 = 0; + float sumPtDr = 0; + + for (auto const& c : jet.tracks_as()) { + float pt = c.pt(); + float dr = deltaR(c.eta(), c.phi(), jet.eta(), jet.phi()); + + nconst++; + sumPt += pt; + sumPt2 += pt*pt; + sumPtDr += pt*dr; + } + + float girth = sumPt>0 ? sumPtDr/sumPt : -1; + float ptd = sumPt>0 ? std::sqrt(sumPt2)/sumPt : -1; + + //---------------------------------- + // matching block + //---------------------------------- + float matchDr = -1; + float ptResp = -1; + int qg = -1; + + for (auto const& match : matches) { + + if (match.chargedMCDetectorLevelJetId() != jet.globalIndex()) + continue; + + auto truthJet = truthJets.iteratorAt( + match.chargedMCParticleLevelJetId()); + + matchDr = deltaR(jet.eta(), jet.phi(), + truthJet.eta(), truthJet.phi()); + + if (matchDr > maxMatchDeltaR) + continue; + + ptResp = jet.pt() / truthJet.pt(); + + //---------------------------------- + // find initiating parton + //---------------------------------- + float maxPt = -1; + int pdg = 0; + + for (auto const& tc : + truthJet.tracks_as()) + { + if (!tc.has_mcParticle()) + continue; + + auto mc = tc.mcParticle(); + + if (tc.pt() > maxPt) { + maxPt = tc.pt(); + pdg = getInitiatingParton(mc, mcParticles); + } + } + + //---------------------------------- + // assign q/g label + //---------------------------------- + if (std::abs(pdg) == 21) + qg = 1; // gluon + else if (std::abs(pdg) >= 1 && std::abs(pdg) <= 6) + qg = 0; // quark + + break; + } + + //---------------------------------- + // store + //---------------------------------- + qgjets(jet.pt(), + jet.eta(), + jet.phi(), + nconst, + girth, + ptd, + matchDr, + ptResp, + qg); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From da5612f239a19efcdc88423aa44e128104a7bd36 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 00:35:14 -0400 Subject: [PATCH 04/24] Delete PWGJE/qgTreeCreator.cxx --- PWGJE/qgTreeCreator.cxx | 199 ---------------------------------------- 1 file changed, 199 deletions(-) delete mode 100644 PWGJE/qgTreeCreator.cxx diff --git a/PWGJE/qgTreeCreator.cxx b/PWGJE/qgTreeCreator.cxx deleted file mode 100644 index a72d50863f2..00000000000 --- a/PWGJE/qgTreeCreator.cxx +++ /dev/null @@ -1,199 +0,0 @@ -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/Configurable.h" - -#include "PWGJE/DataModel/Jet.h" -#include "PWGJE/DataModel/JetMatching.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/MCTruthContainer.h" - -#include - -using namespace o2; -using namespace o2::framework; - -namespace o2::aod -{ -DECLARE_SOA_COLUMN(JetPt, jetPt, float); -DECLARE_SOA_COLUMN(JetEta, jetEta, float); -DECLARE_SOA_COLUMN(JetPhi, jetPhi, float); -DECLARE_SOA_COLUMN(NConst, nConst, int); -DECLARE_SOA_COLUMN(Girth, girth, float); -DECLARE_SOA_COLUMN(PTD, pTD, float); -DECLARE_SOA_COLUMN(MatchDeltaR, matchDeltaR, float); -DECLARE_SOA_COLUMN(PtResponse, ptResponse, float); -DECLARE_SOA_COLUMN(QGLabel, qgLabel, int); - -DECLARE_SOA_TABLE(QGJetTable, "AOD", "QGJET", - JetPt, - JetEta, - JetPhi, - NConst, - Girth, - PTD, - MatchDeltaR, - PtResponse, - QGLabel); -} - -//------------------------------------------------ -// helper functions -//------------------------------------------------ -float deltaPhi(float phi1, float phi2) -{ - return std::remainder(phi1 - phi2, 2.f * static_cast(M_PI)); -} - -float deltaR(float eta1, float phi1, float eta2, float phi2) -{ - float deta = eta1 - eta2; - float dphi = deltaPhi(phi1, phi2); - return std::sqrt(deta * deta + dphi * dphi); -} - -//------------------------------------------------ -// find initiating parton by ancestry -//------------------------------------------------ -int getInitiatingParton(auto const& particle, - aod::McParticles const& mcParticles) -{ - auto p = particle; - int pdg = p.pdgCode(); - - while (p.has_mothers()) { - auto mothers = p.mothers_as(); - if (mothers.size() == 0) { - break; - } - - auto mom = mothers.iteratorAt(0); - int mpdg = mom.pdgCode(); - - // stop at quark or gluon - if (std::abs(mpdg) == 21 || (std::abs(mpdg) >= 1 && std::abs(mpdg) <= 6)) { - pdg = mpdg; - } - - p = mom; - } - - return pdg; -} - -//------------------------------------------------ -// main task -//------------------------------------------------ -struct QGTreeCreator { - - Configurable jetPtMin{"jetPtMin",10.f}; - Configurable maxMatchDeltaR{"maxMatchDeltaR",0.3f}; - - Produces qgjets; - - void process(aod::ChargedMCDetectorLevelJets const& recoJets, - aod::ChargedMCParticleLevelJets const& truthJets, - aod::ChargedMCDetectorLevelJetsMatchedToChargedMCParticleLevelJets const& matches, - aod::McParticles const& mcParticles) - { - for (auto const& jet : recoJets) { - - if (jet.pt() < jetPtMin) - continue; - - //---------------------------------- - // compute jet observables - //---------------------------------- - int nconst = 0; - float sumPt = 0; - float sumPt2 = 0; - float sumPtDr = 0; - - for (auto const& c : jet.tracks_as()) { - float pt = c.pt(); - float dr = deltaR(c.eta(), c.phi(), jet.eta(), jet.phi()); - - nconst++; - sumPt += pt; - sumPt2 += pt*pt; - sumPtDr += pt*dr; - } - - float girth = sumPt>0 ? sumPtDr/sumPt : -1; - float ptd = sumPt>0 ? std::sqrt(sumPt2)/sumPt : -1; - - //---------------------------------- - // matching block - //---------------------------------- - float matchDr = -1; - float ptResp = -1; - int qg = -1; - - for (auto const& match : matches) { - - if (match.chargedMCDetectorLevelJetId() != jet.globalIndex()) - continue; - - auto truthJet = truthJets.iteratorAt( - match.chargedMCParticleLevelJetId()); - - matchDr = deltaR(jet.eta(), jet.phi(), - truthJet.eta(), truthJet.phi()); - - if (matchDr > maxMatchDeltaR) - continue; - - ptResp = jet.pt() / truthJet.pt(); - - //---------------------------------- - // find initiating parton - //---------------------------------- - float maxPt = -1; - int pdg = 0; - - for (auto const& tc : - truthJet.tracks_as()) - { - if (!tc.has_mcParticle()) - continue; - - auto mc = tc.mcParticle(); - - if (tc.pt() > maxPt) { - maxPt = tc.pt(); - pdg = getInitiatingParton(mc, mcParticles); - } - } - - //---------------------------------- - // assign q/g label - //---------------------------------- - if (std::abs(pdg) == 21) - qg = 1; // gluon - else if (std::abs(pdg) >= 1 && std::abs(pdg) <= 6) - qg = 0; // quark - - break; - } - - //---------------------------------- - // store - //---------------------------------- - qgjets(jet.pt(), - jet.eta(), - jet.phi(), - nconst, - girth, - ptd, - matchDr, - ptResp, - qg); - } - } -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; -} From 8cc4971ae96e488eba8a0c448f3b461682530ae5 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 00:36:50 -0400 Subject: [PATCH 05/24] Create qgTreeCreator.cxx --- PWGJE/Tasks/qgTreeCreator.cxx | 199 ++++++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 PWGJE/Tasks/qgTreeCreator.cxx diff --git a/PWGJE/Tasks/qgTreeCreator.cxx b/PWGJE/Tasks/qgTreeCreator.cxx new file mode 100644 index 00000000000..642f86fc1d4 --- /dev/null +++ b/PWGJE/Tasks/qgTreeCreator.cxx @@ -0,0 +1,199 @@ +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/Configurable.h" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetMatching.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/MCTruthContainer.h" + +#include + +using namespace o2; +using namespace o2::framework; + +namespace o2::aod +{ +DECLARE_SOA_COLUMN(JetPt, jetPt, float); +DECLARE_SOA_COLUMN(JetEta, jetEta, float); +DECLARE_SOA_COLUMN(JetPhi, jetPhi, float); +DECLARE_SOA_COLUMN(NConst, nConst, int); +DECLARE_SOA_COLUMN(Girth, girth, float); +DECLARE_SOA_COLUMN(PTD, pTD, float); +DECLARE_SOA_COLUMN(MatchDeltaR, matchDeltaR, float); +DECLARE_SOA_COLUMN(PtResponse, ptResponse, float); +DECLARE_SOA_COLUMN(QGLabel, qgLabel, int); + +DECLARE_SOA_TABLE(QGJetTable, "AOD", "QGJET", + JetPt, + JetEta, + JetPhi, + NConst, + Girth, + PTD, + MatchDeltaR, + PtResponse, + QGLabel); +} + +//------------------------------------------------ +// helper functions +//------------------------------------------------ +float deltaPhi(float phi1, float phi2) +{ + return std::remainder(phi1 - phi2, 2.f * static_cast(M_PI)); +} + +float deltaR(float eta1, float phi1, float eta2, float phi2) +{ + float deta = eta1 - eta2; + float dphi = deltaPhi(phi1, phi2); + return std::sqrt(deta * deta + dphi * dphi); +} + +//------------------------------------------------ +// find initiating parton by ancestry +//------------------------------------------------ +int getInitiatingParton(auto const& particle, + aod::McParticles const& mcParticles) +{ + auto p = particle; + int pdg = p.pdgCode(); + + while (p.has_mothers()) { + auto mothers = p.mothers_as(); + if (mothers.size() == 0) { + break; + } + + auto mom = mothers.iteratorAt(0); + int mpdg = mom.pdgCode(); + + // stop at quark or gluon + if (std::abs(mpdg) == 21 || (std::abs(mpdg) >= 1 && std::abs(mpdg) <= 6)) { + pdg = mpdg; + } + + p = mom; + } + + return pdg; +} + +//------------------------------------------------ +// main task +//------------------------------------------------ +struct QGTreeCreator { + + Configurable jetPtMin{"jetPtMin",10.f}; + Configurable maxMatchDeltaR{"maxMatchDeltaR",0.3f}; + + Produces qgjets; + + void process(aod::ChargedMCDetectorLevelJets const& recoJets, + aod::ChargedMCParticleLevelJets const& truthJets, + aod::ChargedMCDetectorLevelJetsMatchedToChargedMCParticleLevelJets const& matches, + aod::McParticles const& mcParticles) + { + for (auto const& jet : recoJets) { + + if (jet.pt() < jetPtMin) + continue; + + //---------------------------------- + // compute jet observables + //---------------------------------- + int nconst = 0; + float sumPt = 0; + float sumPt2 = 0; + float sumPtDr = 0; + + for (auto const& c : jet.tracks_as()) { + float pt = c.pt(); + float dr = deltaR(c.eta(), c.phi(), jet.eta(), jet.phi()); + + nconst++; + sumPt += pt; + sumPt2 += pt*pt; + sumPtDr += pt*dr; + } + + float girth = sumPt>0 ? sumPtDr/sumPt : -1; + float ptd = sumPt>0 ? std::sqrt(sumPt2)/sumPt : -1; + + //---------------------------------- + // matching block + //---------------------------------- + float matchDr = -1; + float ptResp = -1; + int qg = -1; + + for (auto const& match : matches) { + + if (match.chargedMCDetectorLevelJetId() != jet.globalIndex()) + continue; + + auto truthJet = truthJets.iteratorAt( + match.chargedMCParticleLevelJetId()); + + matchDr = deltaR(jet.eta(), jet.phi(), + truthJet.eta(), truthJet.phi()); + + if (matchDr > maxMatchDeltaR) + continue; + + ptResp = jet.pt() / truthJet.pt(); + + //---------------------------------- + // find initiating parton + //---------------------------------- + float maxPt = -1; + int pdg = 0; + + for (auto const& tc : + truthJet.tracks_as()) + { + if (!tc.has_mcParticle()) + continue; + + auto mc = tc.mcParticle(); + + if (tc.pt() > maxPt) { + maxPt = tc.pt(); + pdg = getInitiatingParton(mc, mcParticles); + } + } + + //---------------------------------- + // assign q/g label + //---------------------------------- + if (std::abs(pdg) == 21) + qg = 1; // gluon + else if (std::abs(pdg) >= 1 && std::abs(pdg) <= 6) + qg = 0; // quark + + break; + } + + //---------------------------------- + // store + //---------------------------------- + qgjets(jet.pt(), + jet.eta(), + jet.phi(), + nconst, + girth, + ptd, + matchDr, + ptResp, + qg); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"qg-tree-creator"})}; +} From 65d1d22d59b56be8fd6f974be676255f77132b20 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 00:50:59 -0400 Subject: [PATCH 06/24] Update qgTreeCreator.cxx --- PWGJE/Tasks/qgTreeCreator.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/PWGJE/Tasks/qgTreeCreator.cxx b/PWGJE/Tasks/qgTreeCreator.cxx index 642f86fc1d4..2c5ced718f3 100644 --- a/PWGJE/Tasks/qgTreeCreator.cxx +++ b/PWGJE/Tasks/qgTreeCreator.cxx @@ -1,3 +1,14 @@ +// Copyright 2019-2026 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" From 874b7755e66361ba04d99827e6333283aed21b99 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 00:52:37 -0400 Subject: [PATCH 07/24] Update CMakeLists.txt --- PWGJE/Tasks/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index f25cb0bbfdb..31eff6cbe7e 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -410,7 +410,6 @@ o2physics_add_dpl_workflow(qg-tree-creator O2::Framework O2Physics::AnalysisCore O2Physics::PWGJECore - COMPONENT_NAME Analysis -) + COMPONENT_NAME Analysis) endif() From 7f83f2684044df00324927f59b189a52c260ee50 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 00:52:57 -0400 Subject: [PATCH 08/24] Update CMakeLists.txt From 9bbf97f2d0b9c406b6ee479235da1babbbd29d5a Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 17:02:32 -0400 Subject: [PATCH 09/24] Update CMakeLists.txt From 6747b9be40a83be169b7fdd0708759177a28d78a Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 18:43:33 -0400 Subject: [PATCH 10/24] Update qgTreeCreator.cxx --- PWGJE/Tasks/qgTreeCreator.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/PWGJE/Tasks/qgTreeCreator.cxx b/PWGJE/Tasks/qgTreeCreator.cxx index 2c5ced718f3..b00b0f121eb 100644 --- a/PWGJE/Tasks/qgTreeCreator.cxx +++ b/PWGJE/Tasks/qgTreeCreator.cxx @@ -46,7 +46,7 @@ DECLARE_SOA_TABLE(QGJetTable, "AOD", "QGJET", MatchDeltaR, PtResponse, QGLabel); -} +} // namespace o2::aod //------------------------------------------------ // helper functions @@ -97,8 +97,8 @@ int getInitiatingParton(auto const& particle, //------------------------------------------------ struct QGTreeCreator { - Configurable jetPtMin{"jetPtMin",10.f}; - Configurable maxMatchDeltaR{"maxMatchDeltaR",0.3f}; + Configurable jetPtMin{"jetPtMin", 10.f}; + Configurable maxMatchDeltaR{"maxMatchDeltaR", 0.3f}; Produces qgjets; @@ -126,13 +126,13 @@ struct QGTreeCreator { nconst++; sumPt += pt; - sumPt2 += pt*pt; - sumPtDr += pt*dr; + sumPt2 += pt * pt; + sumPtDr += pt * dr; } - float girth = sumPt>0 ? sumPtDr/sumPt : -1; - float ptd = sumPt>0 ? std::sqrt(sumPt2)/sumPt : -1; - + float girth = sumPt > 0 ? sumPtDr / sumPt : -1; + float ptd = sumPt > 0 ? std::sqrt(sumPt2) / sumPt : -1; + //---------------------------------- // matching block //---------------------------------- @@ -174,7 +174,7 @@ struct QGTreeCreator { maxPt = tc.pt(); pdg = getInitiatingParton(mc, mcParticles); } - } + } //---------------------------------- // assign q/g label From 391e1c72316095ab330dd4448a34cb89b826d828 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 18:47:22 -0400 Subject: [PATCH 11/24] Update qgTreeCreator.cxx --- PWGJE/Tasks/qgTreeCreator.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/PWGJE/Tasks/qgTreeCreator.cxx b/PWGJE/Tasks/qgTreeCreator.cxx index b00b0f121eb..8c62158308e 100644 --- a/PWGJE/Tasks/qgTreeCreator.cxx +++ b/PWGJE/Tasks/qgTreeCreator.cxx @@ -132,7 +132,6 @@ struct QGTreeCreator { float girth = sumPt > 0 ? sumPtDr / sumPt : -1; float ptd = sumPt > 0 ? std::sqrt(sumPt2) / sumPt : -1; - //---------------------------------- // matching block //---------------------------------- @@ -174,8 +173,7 @@ struct QGTreeCreator { maxPt = tc.pt(); pdg = getInitiatingParton(mc, mcParticles); } - } - + } //---------------------------------- // assign q/g label //---------------------------------- From 836aba46388071e35e1888d3185641236b9a3918 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 18:47:44 -0400 Subject: [PATCH 12/24] Update CMakeLists.txt --- PWGJE/Tasks/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index 31eff6cbe7e..ae1eec60453 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -411,5 +411,4 @@ o2physics_add_dpl_workflow(qg-tree-creator O2Physics::AnalysisCore O2Physics::PWGJECore COMPONENT_NAME Analysis) - endif() From 9420cc2bd765d059c478e9cfefcbc6179e978a05 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 18:52:49 -0400 Subject: [PATCH 13/24] Update CMakeLists.txt --- PWGJE/Tasks/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index ae1eec60453..3863362ede6 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -411,4 +411,5 @@ o2physics_add_dpl_workflow(qg-tree-creator O2Physics::AnalysisCore O2Physics::PWGJECore COMPONENT_NAME Analysis) + endif() From 6f9c4721bb0c900154dadff4a027e47dc60b8ec4 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 19:01:48 -0400 Subject: [PATCH 14/24] Update o2-linter.yml --- .github/workflows/o2-linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/o2-linter.yml b/.github/workflows/o2-linter.yml index 0ab7211d487..b2cc7a92052 100644 --- a/.github/workflows/o2-linter.yml +++ b/.github/workflows/o2-linter.yml @@ -2,7 +2,7 @@ # Find issues in O2 code name: O2 linter -#"on": [pull_request_target, push] +on: [pull_request_target, push] permissions: {} env: BRANCH_MAIN: master From b6545dec539a0ffb953cfc1f42f36d94e3596f71 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 19:04:44 -0400 Subject: [PATCH 15/24] Update qgTreeCreator.cxx --- PWGJE/Tasks/qgTreeCreator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGJE/Tasks/qgTreeCreator.cxx b/PWGJE/Tasks/qgTreeCreator.cxx index 8c62158308e..942918f1bac 100644 --- a/PWGJE/Tasks/qgTreeCreator.cxx +++ b/PWGJE/Tasks/qgTreeCreator.cxx @@ -46,7 +46,7 @@ DECLARE_SOA_TABLE(QGJetTable, "AOD", "QGJET", MatchDeltaR, PtResponse, QGLabel); -} // namespace o2::aod +} // namespace o2::aod //------------------------------------------------ // helper functions From 10f48422687e253aa49afdeccae25ef804ea04a1 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 19:10:42 -0400 Subject: [PATCH 16/24] Update o2-linter.yml --- .github/workflows/o2-linter.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/o2-linter.yml b/.github/workflows/o2-linter.yml index b2cc7a92052..753013f77e9 100644 --- a/.github/workflows/o2-linter.yml +++ b/.github/workflows/o2-linter.yml @@ -2,7 +2,9 @@ # Find issues in O2 code name: O2 linter -on: [pull_request_target, push] +#"on": [pull_request_target, push] +on: + pull_request_target: permissions: {} env: BRANCH_MAIN: master From 5226b1686350718979e40695b60df8286b3e1d48 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 19:13:21 -0400 Subject: [PATCH 17/24] Update qgTreeCreator.cxx From 040af1330c1815c1733229762f6f33f98b1e7d18 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 19:13:37 -0400 Subject: [PATCH 18/24] Update CMakeLists.txt From 6d008b923e2999a3bd8481774ab335bb33088762 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 19:20:25 -0400 Subject: [PATCH 19/24] Update qgTreeCreator.cxx --- PWGJE/Tasks/qgTreeCreator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGJE/Tasks/qgTreeCreator.cxx b/PWGJE/Tasks/qgTreeCreator.cxx index 942918f1bac..b5923535dbb 100644 --- a/PWGJE/Tasks/qgTreeCreator.cxx +++ b/PWGJE/Tasks/qgTreeCreator.cxx @@ -46,7 +46,7 @@ DECLARE_SOA_TABLE(QGJetTable, "AOD", "QGJET", MatchDeltaR, PtResponse, QGLabel); -} // namespace o2::aod +} //namespace o2::aod //------------------------------------------------ // helper functions From 60aeffbc23d24677c4b085a00fa6e030708e3f93 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 19:42:36 -0400 Subject: [PATCH 20/24] Update qgTreeCreator.cxx --- PWGJE/Tasks/qgTreeCreator.cxx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/PWGJE/Tasks/qgTreeCreator.cxx b/PWGJE/Tasks/qgTreeCreator.cxx index b5923535dbb..45ccabe2492 100644 --- a/PWGJE/Tasks/qgTreeCreator.cxx +++ b/PWGJE/Tasks/qgTreeCreator.cxx @@ -46,7 +46,7 @@ DECLARE_SOA_TABLE(QGJetTable, "AOD", "QGJET", MatchDeltaR, PtResponse, QGLabel); -} //namespace o2::aod +} // namespace o2::aod //------------------------------------------------ // helper functions @@ -131,7 +131,7 @@ struct QGTreeCreator { } float girth = sumPt > 0 ? sumPtDr / sumPt : -1; - float ptd = sumPt > 0 ? std::sqrt(sumPt2) / sumPt : -1; + float ptd = sumPt > 0 ? std::sqrt(sumPt2) / sumPt : -1; //---------------------------------- // matching block //---------------------------------- @@ -143,9 +143,9 @@ struct QGTreeCreator { if (match.chargedMCDetectorLevelJetId() != jet.globalIndex()) continue; - + auto truthJet = truthJets.iteratorAt( - match.chargedMCParticleLevelJetId()); + match.chargedMCParticleLevelJetId()); matchDr = deltaR(jet.eta(), jet.phi(), truthJet.eta(), truthJet.phi()); @@ -160,10 +160,8 @@ struct QGTreeCreator { //---------------------------------- float maxPt = -1; int pdg = 0; - - for (auto const& tc : - truthJet.tracks_as()) - { + for (auto const& tc :truthJet.tracks_as()){ + if (!tc.has_mcParticle()) continue; From c4ef95500097d86eecefc5f3f2ec92c900492e22 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 19:43:55 -0400 Subject: [PATCH 21/24] Update qgTreeCreator.cxx --- PWGJE/Tasks/qgTreeCreator.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGJE/Tasks/qgTreeCreator.cxx b/PWGJE/Tasks/qgTreeCreator.cxx index 45ccabe2492..f7b26b30fb9 100644 --- a/PWGJE/Tasks/qgTreeCreator.cxx +++ b/PWGJE/Tasks/qgTreeCreator.cxx @@ -161,7 +161,6 @@ struct QGTreeCreator { float maxPt = -1; int pdg = 0; for (auto const& tc :truthJet.tracks_as()){ - if (!tc.has_mcParticle()) continue; From 6db536008020b01dc25100d5dfc95343604ba6af Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 19:52:10 -0400 Subject: [PATCH 22/24] Update qgTreeCreator.cxx --- PWGJE/Tasks/qgTreeCreator.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/PWGJE/Tasks/qgTreeCreator.cxx b/PWGJE/Tasks/qgTreeCreator.cxx index f7b26b30fb9..78d85f6f460 100644 --- a/PWGJE/Tasks/qgTreeCreator.cxx +++ b/PWGJE/Tasks/qgTreeCreator.cxx @@ -131,7 +131,7 @@ struct QGTreeCreator { } float girth = sumPt > 0 ? sumPtDr / sumPt : -1; - float ptd = sumPt > 0 ? std::sqrt(sumPt2) / sumPt : -1; + float ptd = sumPt > 0 ? std::sqrt(sumPt2) / sumPt : -1; //---------------------------------- // matching block //---------------------------------- @@ -141,10 +141,11 @@ struct QGTreeCreator { for (auto const& match : matches) { - if (match.chargedMCDetectorLevelJetId() != jet.globalIndex()) + + if (match.chargedMCDetectorLevelJetId() != jet.globalIndex()) continue; - - auto truthJet = truthJets.iteratorAt( + + auto truthJet = truthJets.iteratorAt( match.chargedMCParticleLevelJetId()); matchDr = deltaR(jet.eta(), jet.phi(), @@ -160,7 +161,10 @@ struct QGTreeCreator { //---------------------------------- float maxPt = -1; int pdg = 0; - for (auto const& tc :truthJet.tracks_as()){ + + for (auto const& tc : + truthJet.tracks_as()) { + if (!tc.has_mcParticle()) continue; From 5ae5f732cafa3ac8e79d4a1eab799a49a4eba2a6 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sat, 28 Mar 2026 21:56:24 -0400 Subject: [PATCH 23/24] Update qgTreeCreator.cxx --- PWGJE/Tasks/qgTreeCreator.cxx | 44 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/PWGJE/Tasks/qgTreeCreator.cxx b/PWGJE/Tasks/qgTreeCreator.cxx index 78d85f6f460..c77ebcd1014 100644 --- a/PWGJE/Tasks/qgTreeCreator.cxx +++ b/PWGJE/Tasks/qgTreeCreator.cxx @@ -9,15 +9,16 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/Configurable.h" - #include "PWGJE/DataModel/Jet.h" #include "PWGJE/DataModel/JetMatching.h" -#include "Common/DataModel/TrackSelectionTables.h" + #include "Common/DataModel/MCTruthContainer.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" #include @@ -96,7 +97,6 @@ int getInitiatingParton(auto const& particle, // main task //------------------------------------------------ struct QGTreeCreator { - Configurable jetPtMin{"jetPtMin", 10.f}; Configurable maxMatchDeltaR{"maxMatchDeltaR", 0.3f}; @@ -108,9 +108,9 @@ struct QGTreeCreator { aod::McParticles const& mcParticles) { for (auto const& jet : recoJets) { - - if (jet.pt() < jetPtMin) + if (jet.pt() < jetPtMin) { continue; + } //---------------------------------- // compute jet observables @@ -132,6 +132,7 @@ struct QGTreeCreator { float girth = sumPt > 0 ? sumPtDr / sumPt : -1; float ptd = sumPt > 0 ? std::sqrt(sumPt2) / sumPt : -1; + //---------------------------------- // matching block //---------------------------------- @@ -140,19 +141,19 @@ struct QGTreeCreator { int qg = -1; for (auto const& match : matches) { - - - if (match.chargedMCDetectorLevelJetId() != jet.globalIndex()) + if (match.chargedMCDetectorLevelJetId() != jet.globalIndex()) { continue; + } - auto truthJet = truthJets.iteratorAt( + auto truthJet = truthJets.iteratorAt( match.chargedMCParticleLevelJetId()); matchDr = deltaR(jet.eta(), jet.phi(), truthJet.eta(), truthJet.phi()); - if (matchDr > maxMatchDeltaR) + if (matchDr > maxMatchDeltaR) { continue; + } ptResp = jet.pt() / truthJet.pt(); @@ -163,10 +164,10 @@ struct QGTreeCreator { int pdg = 0; for (auto const& tc : - truthJet.tracks_as()) { - - if (!tc.has_mcParticle()) + truthJet.tracks_as()) { + if (!tc.has_mcParticle()) { continue; + } auto mc = tc.mcParticle(); @@ -175,20 +176,19 @@ struct QGTreeCreator { pdg = getInitiatingParton(mc, mcParticles); } } + //---------------------------------- // assign q/g label //---------------------------------- - if (std::abs(pdg) == 21) + if (std::abs(pdg) == 21) { qg = 1; // gluon - else if (std::abs(pdg) >= 1 && std::abs(pdg) <= 6) + } else if (std::abs(pdg) >= 1 && std::abs(pdg) <= 6) { qg = 0; // quark + } break; } - //---------------------------------- - // store - //---------------------------------- qgjets(jet.pt(), jet.eta(), jet.phi(), From 47a86563be69bbeb38c031f2e2c04c8e577c77b9 Mon Sep 17 00:00:00 2001 From: Physicistdana Date: Sun, 29 Mar 2026 01:40:02 -0400 Subject: [PATCH 24/24] Update qgTreeCreator.cxx --- PWGJE/Tasks/qgTreeCreator.cxx | 56 ++++++++++++++++------------------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/PWGJE/Tasks/qgTreeCreator.cxx b/PWGJE/Tasks/qgTreeCreator.cxx index c77ebcd1014..e43a8195a57 100644 --- a/PWGJE/Tasks/qgTreeCreator.cxx +++ b/PWGJE/Tasks/qgTreeCreator.cxx @@ -8,10 +8,10 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. - #include "PWGJE/DataModel/Jet.h" #include "PWGJE/DataModel/JetMatching.h" +#include "Common/Core/RecoDecay.h" #include "Common/DataModel/MCTruthContainer.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -25,6 +25,19 @@ using namespace o2; using namespace o2::framework; +namespace +{ +constexpr int kGluon = 21; +constexpr int kQuarkMin = 1; +constexpr int kQuarkMax = 6; + +float deltaR(float eta1, float phi1, float eta2, float phi2) +{ + const float deta = eta1 - eta2; + const float dphi = RecoDecay::constrainAngle(phi1 - phi2); + return std::sqrt(deta * deta + dphi * dphi); +} +} // namespace namespace o2::aod { DECLARE_SOA_COLUMN(JetPt, jetPt, float); @@ -48,22 +61,6 @@ DECLARE_SOA_TABLE(QGJetTable, "AOD", "QGJET", PtResponse, QGLabel); } // namespace o2::aod - -//------------------------------------------------ -// helper functions -//------------------------------------------------ -float deltaPhi(float phi1, float phi2) -{ - return std::remainder(phi1 - phi2, 2.f * static_cast(M_PI)); -} - -float deltaR(float eta1, float phi1, float eta2, float phi2) -{ - float deta = eta1 - eta2; - float dphi = deltaPhi(phi1, phi2); - return std::sqrt(deta * deta + dphi * dphi); -} - //------------------------------------------------ // find initiating parton by ancestry //------------------------------------------------ @@ -80,10 +77,10 @@ int getInitiatingParton(auto const& particle, } auto mom = mothers.iteratorAt(0); - int mpdg = mom.pdgCode(); + const int mpdg = mom.pdgCode(); - // stop at quark or gluon - if (std::abs(mpdg) == 21 || (std::abs(mpdg) >= 1 && std::abs(mpdg) <= 6)) { + if (std::abs(mpdg) == kGluon || + (std::abs(mpdg) >= kQuarkMin && std::abs(mpdg) <= kQuarkMax)) { pdg = mpdg; } @@ -92,7 +89,6 @@ int getInitiatingParton(auto const& particle, return pdg; } - //------------------------------------------------ // main task //------------------------------------------------ @@ -133,9 +129,9 @@ struct QGTreeCreator { float girth = sumPt > 0 ? sumPtDr / sumPt : -1; float ptd = sumPt > 0 ? std::sqrt(sumPt2) / sumPt : -1; - //---------------------------------- - // matching block - //---------------------------------- + //------------------------------------------------ + // matching + //------------------------------------------------ float matchDr = -1; float ptResp = -1; int qg = -1; @@ -180,11 +176,11 @@ struct QGTreeCreator { //---------------------------------- // assign q/g label //---------------------------------- - if (std::abs(pdg) == 21) { - qg = 1; // gluon - } else if (std::abs(pdg) >= 1 && std::abs(pdg) <= 6) { - qg = 0; // quark - } + if (std::abs(pdg) == kGluon) { + qg = 1; + } else if (std::abs(pdg) >= kQuarkMin && std::abs(pdg) <= kQuarkMax) { + qg = 0; + } break; } @@ -205,5 +201,5 @@ struct QGTreeCreator { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"qg-tree-creator"})}; + adaptAnalysisTask(cfgc)}; }