From 92931f48e2f394113ac699b6e456ac93bb0fb4c3 Mon Sep 17 00:00:00 2001 From: Preeti Dhankher Date: Mon, 9 Mar 2026 13:26:54 +0100 Subject: [PATCH 1/4] Add new D0 substructure task --- PWGJE/Tasks/CMakeLists.txt | 4 + PWGJE/Tasks/jetD0Substructure.cxx | 266 ++++++++++++++++++++++++++++++ 2 files changed, 270 insertions(+) create mode 100644 PWGJE/Tasks/jetD0Substructure.cxx diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index f05c735ef21..d78d84fbafb 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -389,6 +389,10 @@ if(FastJet_FOUND) SOURCES jetDsSpectrumAndSubstructure.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-d0-substructure + SOURCES jetD0Substructure.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(bjet-cent-mult SOURCES bjetCentMult.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore diff --git a/PWGJE/Tasks/jetD0Substructure.cxx b/PWGJE/Tasks/jetD0Substructure.cxx new file mode 100644 index 00000000000..18d2dbd6328 --- /dev/null +++ b/PWGJE/Tasks/jetD0Substructure.cxx @@ -0,0 +1,266 @@ +// Copyright 2019-2020 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. +// +// \file jetD0Substructure.cxx +// +// \brief Analysis task for the reconstruction and study of charged jets +// containing D_0 mesons in pp collisions. +// \inherited from D0 fragmentation and Ds +// \P. Dhankher + + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetSubtraction.h" +#include "PWGJE/DataModel/JetReducedData.h" + +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/Core/JetUtilities.h" +#include "PWGHF/Core/DecayChannels.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include +#include "Framework/HistogramRegistry.h" +#include +#include +#include +#include +#include +#include +#include + + +#include "TVector3.h" +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// Definition of a custom AOD table to store jet–D0 quantities +namespace o2::aod +{ +namespace jet_obj +{ +// Jet-related quantities +DECLARE_SOA_COLUMN(JetHfDist, jetHfDist, float); +DECLARE_SOA_COLUMN(JetPt, jetPt, float); +DECLARE_SOA_COLUMN(JetEta, jetEta, float); +DECLARE_SOA_COLUMN(JetPhi, jetPhi, float); +DECLARE_SOA_COLUMN(JetNConst, jetNConst, int); +DECLARE_SOA_COLUMN(JetAng, jetAng, float); +// D0 candidate quantities +DECLARE_SOA_COLUMN(HfPt, hfPt, float); +DECLARE_SOA_COLUMN(HfEta, hfEta, float); +DECLARE_SOA_COLUMN(HfPhi, hfPhi, float); +DECLARE_SOA_COLUMN(HfMass, hfMass, float); +DECLARE_SOA_COLUMN(HfY, hfY, float); +// ML scores +DECLARE_SOA_COLUMN(HfMlScore0, hfMlScore0, float); +DECLARE_SOA_COLUMN(HfMlScore1, hfMlScore1, float); +DECLARE_SOA_COLUMN(HfMlScore2, hfMlScore2, float); +} // namespace jet_obj +// AOD table definition +DECLARE_SOA_TABLE(JetObjTable, "AOD", "JETOBJTABLE", + jet_obj::JetHfDist, + jet_obj::JetPt, + jet_obj::JetEta, + jet_obj::JetPhi, + jet_obj::JetNConst, + jet_obj::JetAng, + jet_obj::HfPt, + jet_obj::HfEta, + jet_obj::HfPhi, + jet_obj::HfMass, + jet_obj::HfY, + jet_obj::HfMlScore0, + jet_obj::HfMlScore1, + jet_obj::HfMlScore2); +} +struct JetD0Substructure { + /** + * Histogram registry + * + * Contains: + * - Event and track histograms + * - Jet kinematic distributions + * - D0–jet substructure observables + */ + HistogramRegistry registry{"registry", + {{"h_collisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}}, + {"h_track_pt", "track pT;#it{p}_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, + {"h_track_eta", "track #eta;#eta_{track};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, + {"h_track_phi", "track #varphi;#varphi_{track};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, + {"h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, + {"h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, + {"h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, + {"h_collision_counter", "# of collisions;", {HistType::kTH1F, {{2, 0., 2.}}}}, + {"h_jet_counter", ";# of D^{0} jets;", {HistType::kTH1F, {{6, 0., 3.0}}}}, + {"h_d0_jet_projection", ";z^{D^{0},jet}_{||};dN/dz^{D^{0},jet}_{||}", {HistType::kTH1F, {{1000, 0., 10.}}}}, + {"h_d0_jet_distance_vs_projection", ";#DeltaR_{D^{0},jet};z^{D^{0},jet}_{||}", {HistType::kTH2F, {{1000, 0., 10.}, {1000, 0., 10.}}}}, + {"h_d0_jet_distance", ";#DeltaR_{D^{0},jet};dN/d(#DeltaR)", {HistType::kTH1F, {{1000, 0., 10.}}}}, + {"h_d0_jet_pt", ";p_{T,D^{0} jet};dN/dp_{T,D^{0} jet}", {HistType::kTH1F, {{200, 0., 10.}}}}, + {"h_d0_jet_eta", ";#eta_{T,D^{0} jet};dN/d#eta_{D^{0} jet}", {HistType::kTH1F, {{250, -5., 5.}}}}, + {"h_d0_jet_phi", ";#phi_{T,D^{0} jet};dN/d#phi_{D^{0} jet}", {HistType::kTH1F, {{250, -10., 10.}}}}, + {"h_d0_mass", ";m_{D^{0}} (GeV/c^{2});dN/dm_{D^{0}}", {HistType::kTH1F, {{1000, 0., 10.}}}}, + {"h_d0_eta", ";#eta_{D^{0}} (GeV/c^{2});dN/d#eta_{D_{}}", {HistType::kTH1F, {{250, -5., 5.}}}}, + {"h_d0_phi", ";#phi_{D^{0}} (GeV/c^{2});dN/d#phi_{D^{0}}", {HistType::kTH1F, {{250, -10., 10.}}}}, + {"h_d0_ang", ";#lambda_{#kappa}^{#alpha};counts", {HistType::kTH1F, {{100, 0., 1.}}}}} + }; + + // Configurables + Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; + + Configurable jetPtMin{"jetPtMin", 5.0, "minimum jet pT cut"}; + Configurable jetR{"jetR", 0.4, "jet resolution parameter"}; + + Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; + Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; + Configurable kappa{"kappa", 1.0, "angularity kappa"}; //to do: configurable from json + Configurable alpha{"alpha", 1.0, "angularity alpha"}; + + std::vector eventSelectionBits; + int trackSelection = -1; + + // Output table producer + Produces ObjJetTable; + + float angularity; + float leadingConstituentPt; + + void init(o2::framework::InitContext&) + { + eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + } + + Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f); + Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; + + template + void jetCalculateAngularity(T const& jet, U const& /*tracks*/) + { + angularity = 0.0; + leadingConstituentPt = 0.0; + for (auto& constituent : jet.template tracks_as()) { + if (constituent.pt() >= leadingConstituentPt) { + leadingConstituentPt = constituent.pt(); + } + angularity += std::pow(constituent.pt(), kappa) * std::pow(jetutilities::deltaR(jet, constituent), alpha); + } + angularity /= (jet.pt() * (jet.r() / 100.f)); + } + // Collision-level and for Tracks QA + void processCollisions(aod::JetCollision const& collision, aod::JetTracks const& tracks) + { + + registry.fill(HIST("h_collisions"), 0.5); + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + return; + } + registry.fill(HIST("h_collisions"), 1.5); + + // Loop over tracks and apply track selection + for (auto const& track : tracks) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { + continue; + } + registry.fill(HIST("h_track_pt"), track.pt()); + registry.fill(HIST("h_track_eta"), track.eta()); + registry.fill(HIST("h_track_phi"), track.phi()); + } + } + PROCESS_SWITCH(JetD0Substructure, processCollisions, "process JE collisions", false); + + // Charged jet processing (no HF requirement) + void processDataCharged(soa::Filtered::iterator const& collision, soa::Filtered const& jets) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + return; + } + //jets -> charged jet + for (auto& jet : jets) { + registry.fill(HIST("h_jet_pt"), jet.pt()); + registry.fill(HIST("h_jet_eta"), jet.eta()); + registry.fill(HIST("h_jet_phi"), jet.phi()); + } + } + PROCESS_SWITCH(JetD0Substructure, processDataCharged, "charged jets in data", false); + + void processDataChargedSubstructure(aod::JetCollision const& collision, + soa::Join const& jets, + aod::CandidatesD0Data const&, aod::JetTracks const& tracks) + { + // apply event selection and fill histograms for sanity check + registry.fill(HIST("h_collision_counter"), 0.5); + + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || !(std::abs(collision.posZ()) < vertexZCut)) { + return; + } + registry.fill(HIST("h_collision_counter"), 1.5); + + // Loop over jets containing D0 candidates + for (const auto& jet : jets) { + //number of charged jets with D0 + registry.fill(HIST("h_jet_counter"), 0.5); + // obtaining jet 3-vector + TVector3 jetVector(jet.px(), jet.py(), jet.pz()); + + //Loop over D0 candidates associated to the jet + for (const auto& d0Candidate : jet.candidates_as()) { + // obtaining jet 3-vector + TVector3 d0Vector(d0Candidate.px(), d0Candidate.py(), d0Candidate.pz()); + + // calculating fraction of the jet momentum carried by the D0 along the direction of the jet axis + double zParallel = (jetVector * d0Vector) / (jetVector * jetVector); + + // calculating angular distance in eta-phi plane + double axisDistance = jetutilities::deltaR(jet, d0Candidate); + + jetCalculateAngularity(jet,tracks); + + // filling histograms + registry.fill(HIST("h_d0_jet_projection"), zParallel); + registry.fill(HIST("h_d0_jet_distance_vs_projection"), axisDistance, zParallel); + registry.fill(HIST("h_d0_jet_distance"), axisDistance); + registry.fill(HIST("h_d0_jet_pt"), jet.pt()); + registry.fill(HIST("h_d0_jet_eta"), jet.eta()); + registry.fill(HIST("h_d0_jet_phi"), jet.phi()); + registry.fill(HIST("h_d0_mass"), d0Candidate.m()); + registry.fill(HIST("h_d0_eta"), d0Candidate.eta()); + registry.fill(HIST("h_d0_phi"), d0Candidate.phi()); + registry.fill(HIST("h_d0_ang"), angularity); // add more axis + + + // filling table + ObjJetTable(axisDistance, + jet.pt(), jet.eta(), jet.phi(), jet.tracks_as().size(), angularity, + d0Candidate.pt(), d0Candidate.eta(), d0Candidate.phi(), d0Candidate.m(), d0Candidate.y(), d0Candidate.mlScores()[0], d0Candidate.mlScores()[1], d0Candidate.mlScores()[2]); + + break; // get out of candidates' loop after first HF particle is found in jet + } // end of D0 candidates loop + + } // end of jets loop + + } // end of process function + PROCESS_SWITCH(JetD0Substructure, processDataChargedSubstructure, "charged HF jet substructure", false); + + + +}; +// Workflow definition +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"jet-d0-substructure"})}; } From 89724d5c45ac0fe3b54c11befc8747200afd190f Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Mon, 9 Mar 2026 12:36:48 +0000 Subject: [PATCH 2/4] Please consider the following formatting changes --- PWGJE/Tasks/jetD0Substructure.cxx | 323 +++++++++++++++--------------- 1 file changed, 158 insertions(+), 165 deletions(-) diff --git a/PWGJE/Tasks/jetD0Substructure.cxx b/PWGJE/Tasks/jetD0Substructure.cxx index 18d2dbd6328..b1309d2e64f 100644 --- a/PWGJE/Tasks/jetD0Substructure.cxx +++ b/PWGJE/Tasks/jetD0Substructure.cxx @@ -16,32 +16,30 @@ // \inherited from D0 fragmentation and Ds // \P. Dhankher - -#include "PWGJE/DataModel/Jet.h" -#include "PWGJE/DataModel/JetSubtraction.h" -#include "PWGJE/DataModel/JetReducedData.h" - +#include "PWGHF/Core/DecayChannels.h" #include "PWGJE/Core/JetDerivedDataUtilities.h" #include "PWGJE/Core/JetUtilities.h" -#include "PWGHF/Core/DecayChannels.h" +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetReducedData.h" +#include "PWGJE/DataModel/JetSubtraction.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" -#include #include "Framework/HistogramRegistry.h" #include +#include +#include #include +#include #include #include -#include -#include #include - #include "TVector3.h" + #include #include #include @@ -76,23 +74,23 @@ DECLARE_SOA_COLUMN(HfMlScore2, hfMlScore2, float); } // namespace jet_obj // AOD table definition DECLARE_SOA_TABLE(JetObjTable, "AOD", "JETOBJTABLE", - jet_obj::JetHfDist, - jet_obj::JetPt, - jet_obj::JetEta, - jet_obj::JetPhi, - jet_obj::JetNConst, - jet_obj::JetAng, - jet_obj::HfPt, - jet_obj::HfEta, - jet_obj::HfPhi, - jet_obj::HfMass, - jet_obj::HfY, - jet_obj::HfMlScore0, - jet_obj::HfMlScore1, - jet_obj::HfMlScore2); -} + jet_obj::JetHfDist, + jet_obj::JetPt, + jet_obj::JetEta, + jet_obj::JetPhi, + jet_obj::JetNConst, + jet_obj::JetAng, + jet_obj::HfPt, + jet_obj::HfEta, + jet_obj::HfPhi, + jet_obj::HfMass, + jet_obj::HfY, + jet_obj::HfMlScore0, + jet_obj::HfMlScore1, + jet_obj::HfMlScore2); +} // namespace o2::aod struct JetD0Substructure { - /** + /** * Histogram registry * * Contains: @@ -100,167 +98,162 @@ struct JetD0Substructure { * - Jet kinematic distributions * - D0–jet substructure observables */ - HistogramRegistry registry{"registry", - {{"h_collisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}}, - {"h_track_pt", "track pT;#it{p}_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, - {"h_track_eta", "track #eta;#eta_{track};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, - {"h_track_phi", "track #varphi;#varphi_{track};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, - {"h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, - {"h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, - {"h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, - {"h_collision_counter", "# of collisions;", {HistType::kTH1F, {{2, 0., 2.}}}}, - {"h_jet_counter", ";# of D^{0} jets;", {HistType::kTH1F, {{6, 0., 3.0}}}}, - {"h_d0_jet_projection", ";z^{D^{0},jet}_{||};dN/dz^{D^{0},jet}_{||}", {HistType::kTH1F, {{1000, 0., 10.}}}}, - {"h_d0_jet_distance_vs_projection", ";#DeltaR_{D^{0},jet};z^{D^{0},jet}_{||}", {HistType::kTH2F, {{1000, 0., 10.}, {1000, 0., 10.}}}}, - {"h_d0_jet_distance", ";#DeltaR_{D^{0},jet};dN/d(#DeltaR)", {HistType::kTH1F, {{1000, 0., 10.}}}}, - {"h_d0_jet_pt", ";p_{T,D^{0} jet};dN/dp_{T,D^{0} jet}", {HistType::kTH1F, {{200, 0., 10.}}}}, - {"h_d0_jet_eta", ";#eta_{T,D^{0} jet};dN/d#eta_{D^{0} jet}", {HistType::kTH1F, {{250, -5., 5.}}}}, - {"h_d0_jet_phi", ";#phi_{T,D^{0} jet};dN/d#phi_{D^{0} jet}", {HistType::kTH1F, {{250, -10., 10.}}}}, - {"h_d0_mass", ";m_{D^{0}} (GeV/c^{2});dN/dm_{D^{0}}", {HistType::kTH1F, {{1000, 0., 10.}}}}, - {"h_d0_eta", ";#eta_{D^{0}} (GeV/c^{2});dN/d#eta_{D_{}}", {HistType::kTH1F, {{250, -5., 5.}}}}, - {"h_d0_phi", ";#phi_{D^{0}} (GeV/c^{2});dN/d#phi_{D^{0}}", {HistType::kTH1F, {{250, -10., 10.}}}}, - {"h_d0_ang", ";#lambda_{#kappa}^{#alpha};counts", {HistType::kTH1F, {{100, 0., 1.}}}}} - }; - - // Configurables - Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; + HistogramRegistry registry{"registry", + {{"h_collisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}}, + {"h_track_pt", "track pT;#it{p}_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, + {"h_track_eta", "track #eta;#eta_{track};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, + {"h_track_phi", "track #varphi;#varphi_{track};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, + {"h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, + {"h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, + {"h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, + {"h_collision_counter", "# of collisions;", {HistType::kTH1F, {{2, 0., 2.}}}}, + {"h_jet_counter", ";# of D^{0} jets;", {HistType::kTH1F, {{6, 0., 3.0}}}}, + {"h_d0_jet_projection", ";z^{D^{0},jet}_{||};dN/dz^{D^{0},jet}_{||}", {HistType::kTH1F, {{1000, 0., 10.}}}}, + {"h_d0_jet_distance_vs_projection", ";#DeltaR_{D^{0},jet};z^{D^{0},jet}_{||}", {HistType::kTH2F, {{1000, 0., 10.}, {1000, 0., 10.}}}}, + {"h_d0_jet_distance", ";#DeltaR_{D^{0},jet};dN/d(#DeltaR)", {HistType::kTH1F, {{1000, 0., 10.}}}}, + {"h_d0_jet_pt", ";p_{T,D^{0} jet};dN/dp_{T,D^{0} jet}", {HistType::kTH1F, {{200, 0., 10.}}}}, + {"h_d0_jet_eta", ";#eta_{T,D^{0} jet};dN/d#eta_{D^{0} jet}", {HistType::kTH1F, {{250, -5., 5.}}}}, + {"h_d0_jet_phi", ";#phi_{T,D^{0} jet};dN/d#phi_{D^{0} jet}", {HistType::kTH1F, {{250, -10., 10.}}}}, + {"h_d0_mass", ";m_{D^{0}} (GeV/c^{2});dN/dm_{D^{0}}", {HistType::kTH1F, {{1000, 0., 10.}}}}, + {"h_d0_eta", ";#eta_{D^{0}} (GeV/c^{2});dN/d#eta_{D_{}}", {HistType::kTH1F, {{250, -5., 5.}}}}, + {"h_d0_phi", ";#phi_{D^{0}} (GeV/c^{2});dN/d#phi_{D^{0}}", {HistType::kTH1F, {{250, -10., 10.}}}}, + {"h_d0_ang", ";#lambda_{#kappa}^{#alpha};counts", {HistType::kTH1F, {{100, 0., 1.}}}}}}; - Configurable jetPtMin{"jetPtMin", 5.0, "minimum jet pT cut"}; - Configurable jetR{"jetR", 0.4, "jet resolution parameter"}; + // Configurables + Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; - Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; - Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; - Configurable kappa{"kappa", 1.0, "angularity kappa"}; //to do: configurable from json - Configurable alpha{"alpha", 1.0, "angularity alpha"}; - - std::vector eventSelectionBits; - int trackSelection = -1; + Configurable jetPtMin{"jetPtMin", 5.0, "minimum jet pT cut"}; + Configurable jetR{"jetR", 0.4, "jet resolution parameter"}; - // Output table producer - Produces ObjJetTable; - - float angularity; - float leadingConstituentPt; - - void init(o2::framework::InitContext&) - { - eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelections)); - trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); - } - - Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f); - Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; + Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; + Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; + Configurable kappa{"kappa", 1.0, "angularity kappa"}; // to do: configurable from json + Configurable alpha{"alpha", 1.0, "angularity alpha"}; + + std::vector eventSelectionBits; + int trackSelection = -1; + + // Output table producer + Produces ObjJetTable; - template - void jetCalculateAngularity(T const& jet, U const& /*tracks*/) - { - angularity = 0.0; - leadingConstituentPt = 0.0; - for (auto& constituent : jet.template tracks_as()) { - if (constituent.pt() >= leadingConstituentPt) { - leadingConstituentPt = constituent.pt(); - } - angularity += std::pow(constituent.pt(), kappa) * std::pow(jetutilities::deltaR(jet, constituent), alpha); - } - angularity /= (jet.pt() * (jet.r() / 100.f)); + float angularity; + float leadingConstituentPt; + + void init(o2::framework::InitContext&) + { + eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + } + + Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f); + Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; + + template + void jetCalculateAngularity(T const& jet, U const& /*tracks*/) + { + angularity = 0.0; + leadingConstituentPt = 0.0; + for (auto& constituent : jet.template tracks_as()) { + if (constituent.pt() >= leadingConstituentPt) { + leadingConstituentPt = constituent.pt(); + } + angularity += std::pow(constituent.pt(), kappa) * std::pow(jetutilities::deltaR(jet, constituent), alpha); } - // Collision-level and for Tracks QA - void processCollisions(aod::JetCollision const& collision, aod::JetTracks const& tracks) - { + angularity /= (jet.pt() * (jet.r() / 100.f)); + } + // Collision-level and for Tracks QA + void processCollisions(aod::JetCollision const& collision, aod::JetTracks const& tracks) + { - registry.fill(HIST("h_collisions"), 0.5); - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { - return; - } - registry.fill(HIST("h_collisions"), 1.5); + registry.fill(HIST("h_collisions"), 0.5); + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + return; + } + registry.fill(HIST("h_collisions"), 1.5); - // Loop over tracks and apply track selection - for (auto const& track : tracks) { - if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { - continue; - } - registry.fill(HIST("h_track_pt"), track.pt()); - registry.fill(HIST("h_track_eta"), track.eta()); - registry.fill(HIST("h_track_phi"), track.phi()); - } + // Loop over tracks and apply track selection + for (auto const& track : tracks) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { + continue; + } + registry.fill(HIST("h_track_pt"), track.pt()); + registry.fill(HIST("h_track_eta"), track.eta()); + registry.fill(HIST("h_track_phi"), track.phi()); } - PROCESS_SWITCH(JetD0Substructure, processCollisions, "process JE collisions", false); + } + PROCESS_SWITCH(JetD0Substructure, processCollisions, "process JE collisions", false); - // Charged jet processing (no HF requirement) - void processDataCharged(soa::Filtered::iterator const& collision, soa::Filtered const& jets) - { - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { - return; - } - //jets -> charged jet - for (auto& jet : jets) { - registry.fill(HIST("h_jet_pt"), jet.pt()); - registry.fill(HIST("h_jet_eta"), jet.eta()); - registry.fill(HIST("h_jet_phi"), jet.phi()); - } + // Charged jet processing (no HF requirement) + void processDataCharged(soa::Filtered::iterator const& collision, soa::Filtered const& jets) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + return; + } + // jets -> charged jet + for (auto& jet : jets) { + registry.fill(HIST("h_jet_pt"), jet.pt()); + registry.fill(HIST("h_jet_eta"), jet.eta()); + registry.fill(HIST("h_jet_phi"), jet.phi()); } - PROCESS_SWITCH(JetD0Substructure, processDataCharged, "charged jets in data", false); + } + PROCESS_SWITCH(JetD0Substructure, processDataCharged, "charged jets in data", false); - void processDataChargedSubstructure(aod::JetCollision const& collision, - soa::Join const& jets, - aod::CandidatesD0Data const&, aod::JetTracks const& tracks) - { - // apply event selection and fill histograms for sanity check - registry.fill(HIST("h_collision_counter"), 0.5); + void processDataChargedSubstructure(aod::JetCollision const& collision, + soa::Join const& jets, + aod::CandidatesD0Data const&, aod::JetTracks const& tracks) + { + // apply event selection and fill histograms for sanity check + registry.fill(HIST("h_collision_counter"), 0.5); - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || !(std::abs(collision.posZ()) < vertexZCut)) { - return; - } - registry.fill(HIST("h_collision_counter"), 1.5); + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || !(std::abs(collision.posZ()) < vertexZCut)) { + return; + } + registry.fill(HIST("h_collision_counter"), 1.5); - // Loop over jets containing D0 candidates - for (const auto& jet : jets) { - //number of charged jets with D0 - registry.fill(HIST("h_jet_counter"), 0.5); - // obtaining jet 3-vector - TVector3 jetVector(jet.px(), jet.py(), jet.pz()); + // Loop over jets containing D0 candidates + for (const auto& jet : jets) { + // number of charged jets with D0 + registry.fill(HIST("h_jet_counter"), 0.5); + // obtaining jet 3-vector + TVector3 jetVector(jet.px(), jet.py(), jet.pz()); - //Loop over D0 candidates associated to the jet - for (const auto& d0Candidate : jet.candidates_as()) { - // obtaining jet 3-vector - TVector3 d0Vector(d0Candidate.px(), d0Candidate.py(), d0Candidate.pz()); + // Loop over D0 candidates associated to the jet + for (const auto& d0Candidate : jet.candidates_as()) { + // obtaining jet 3-vector + TVector3 d0Vector(d0Candidate.px(), d0Candidate.py(), d0Candidate.pz()); - // calculating fraction of the jet momentum carried by the D0 along the direction of the jet axis - double zParallel = (jetVector * d0Vector) / (jetVector * jetVector); + // calculating fraction of the jet momentum carried by the D0 along the direction of the jet axis + double zParallel = (jetVector * d0Vector) / (jetVector * jetVector); - // calculating angular distance in eta-phi plane - double axisDistance = jetutilities::deltaR(jet, d0Candidate); - - jetCalculateAngularity(jet,tracks); - - // filling histograms - registry.fill(HIST("h_d0_jet_projection"), zParallel); - registry.fill(HIST("h_d0_jet_distance_vs_projection"), axisDistance, zParallel); - registry.fill(HIST("h_d0_jet_distance"), axisDistance); - registry.fill(HIST("h_d0_jet_pt"), jet.pt()); - registry.fill(HIST("h_d0_jet_eta"), jet.eta()); - registry.fill(HIST("h_d0_jet_phi"), jet.phi()); - registry.fill(HIST("h_d0_mass"), d0Candidate.m()); - registry.fill(HIST("h_d0_eta"), d0Candidate.eta()); - registry.fill(HIST("h_d0_phi"), d0Candidate.phi()); - registry.fill(HIST("h_d0_ang"), angularity); // add more axis - + // calculating angular distance in eta-phi plane + double axisDistance = jetutilities::deltaR(jet, d0Candidate); - // filling table - ObjJetTable(axisDistance, - jet.pt(), jet.eta(), jet.phi(), jet.tracks_as().size(), angularity, - d0Candidate.pt(), d0Candidate.eta(), d0Candidate.phi(), d0Candidate.m(), d0Candidate.y(), d0Candidate.mlScores()[0], d0Candidate.mlScores()[1], d0Candidate.mlScores()[2]); - - break; // get out of candidates' loop after first HF particle is found in jet - } // end of D0 candidates loop + jetCalculateAngularity(jet, tracks); - } // end of jets loop + // filling histograms + registry.fill(HIST("h_d0_jet_projection"), zParallel); + registry.fill(HIST("h_d0_jet_distance_vs_projection"), axisDistance, zParallel); + registry.fill(HIST("h_d0_jet_distance"), axisDistance); + registry.fill(HIST("h_d0_jet_pt"), jet.pt()); + registry.fill(HIST("h_d0_jet_eta"), jet.eta()); + registry.fill(HIST("h_d0_jet_phi"), jet.phi()); + registry.fill(HIST("h_d0_mass"), d0Candidate.m()); + registry.fill(HIST("h_d0_eta"), d0Candidate.eta()); + registry.fill(HIST("h_d0_phi"), d0Candidate.phi()); + registry.fill(HIST("h_d0_ang"), angularity); // add more axis - } // end of process function - PROCESS_SWITCH(JetD0Substructure, processDataChargedSubstructure, "charged HF jet substructure", false); + // filling table + ObjJetTable(axisDistance, + jet.pt(), jet.eta(), jet.phi(), jet.tracks_as().size(), angularity, + d0Candidate.pt(), d0Candidate.eta(), d0Candidate.phi(), d0Candidate.m(), d0Candidate.y(), d0Candidate.mlScores()[0], d0Candidate.mlScores()[1], d0Candidate.mlScores()[2]); + break; // get out of candidates' loop after first HF particle is found in jet + } // end of D0 candidates loop + } // end of jets loop + } // end of process function + PROCESS_SWITCH(JetD0Substructure, processDataChargedSubstructure, "charged HF jet substructure", false); }; // Workflow definition WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"jet-d0-substructure"})}; } From 64f6f89e0691a1298711aceb6a75b92bf6cd5a6a Mon Sep 17 00:00:00 2001 From: Preeti Dhankher Date: Tue, 10 Mar 2026 16:45:36 +0100 Subject: [PATCH 3/4] Renaming the task to avoid confusion with other task with similar name --- PWGJE/Tasks/CMakeLists.txt | 4 +- ...structure.cxx => jetD0AngSubstructure.cxx} | 72 +++---------------- 2 files changed, 13 insertions(+), 63 deletions(-) rename PWGJE/Tasks/{jetD0Substructure.cxx => jetD0AngSubstructure.cxx} (71%) diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index d78d84fbafb..e338093a33c 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -389,8 +389,8 @@ if(FastJet_FOUND) SOURCES jetDsSpectrumAndSubstructure.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(jet-d0-substructure - SOURCES jetD0Substructure.cxx + o2physics_add_dpl_workflow(jet-d0-ang-substructure + SOURCES jetD0AngSubstructure.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(bjet-cent-mult diff --git a/PWGJE/Tasks/jetD0Substructure.cxx b/PWGJE/Tasks/jetD0AngSubstructure.cxx similarity index 71% rename from PWGJE/Tasks/jetD0Substructure.cxx rename to PWGJE/Tasks/jetD0AngSubstructure.cxx index b1309d2e64f..b8a9fc3fea0 100644 --- a/PWGJE/Tasks/jetD0Substructure.cxx +++ b/PWGJE/Tasks/jetD0AngSubstructure.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// \file jetD0Substructure.cxx +// \file JetD0AngSubstructure.cxx // // \brief Analysis task for the reconstruction and study of charged jets // containing D_0 mesons in pp collisions. @@ -89,7 +89,7 @@ DECLARE_SOA_TABLE(JetObjTable, "AOD", "JETOBJTABLE", jet_obj::HfMlScore1, jet_obj::HfMlScore2); } // namespace o2::aod -struct JetD0Substructure { +struct JetD0AngSubstructure { /** * Histogram registry * @@ -99,14 +99,7 @@ struct JetD0Substructure { * - D0–jet substructure observables */ HistogramRegistry registry{"registry", - {{"h_collisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}}, - {"h_track_pt", "track pT;#it{p}_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, - {"h_track_eta", "track #eta;#eta_{track};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, - {"h_track_phi", "track #varphi;#varphi_{track};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, - {"h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, - {"h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, - {"h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, - {"h_collision_counter", "# of collisions;", {HistType::kTH1F, {{2, 0., 2.}}}}, + {{"h_collision_counter", "# of collisions;", {HistType::kTH1F, {{2, 0., 2.}}}}, {"h_jet_counter", ";# of D^{0} jets;", {HistType::kTH1F, {{6, 0., 3.0}}}}, {"h_d0_jet_projection", ";z^{D^{0},jet}_{||};dN/dz^{D^{0},jet}_{||}", {HistType::kTH1F, {{1000, 0., 10.}}}}, {"h_d0_jet_distance_vs_projection", ";#DeltaR_{D^{0},jet};z^{D^{0},jet}_{||}", {HistType::kTH2F, {{1000, 0., 10.}, {1000, 0., 10.}}}}, @@ -114,9 +107,9 @@ struct JetD0Substructure { {"h_d0_jet_pt", ";p_{T,D^{0} jet};dN/dp_{T,D^{0} jet}", {HistType::kTH1F, {{200, 0., 10.}}}}, {"h_d0_jet_eta", ";#eta_{T,D^{0} jet};dN/d#eta_{D^{0} jet}", {HistType::kTH1F, {{250, -5., 5.}}}}, {"h_d0_jet_phi", ";#phi_{T,D^{0} jet};dN/d#phi_{D^{0} jet}", {HistType::kTH1F, {{250, -10., 10.}}}}, - {"h_d0_mass", ";m_{D^{0}} (GeV/c^{2});dN/dm_{D^{0}}", {HistType::kTH1F, {{1000, 0., 10.}}}}, - {"h_d0_eta", ";#eta_{D^{0}} (GeV/c^{2});dN/d#eta_{D_{}}", {HistType::kTH1F, {{250, -5., 5.}}}}, - {"h_d0_phi", ";#phi_{D^{0}} (GeV/c^{2});dN/d#phi_{D^{0}}", {HistType::kTH1F, {{250, -10., 10.}}}}, + {"h_d0_mass", ";m_{D^{0}});dN/dm_{D^{0}}", {HistType::kTH1F, {{1000, 0., 10.}}}}, + {"h_d0_eta", ";#eta_{D^{0}});dN/d#eta_{D_{}}", {HistType::kTH1F, {{250, -5., 5.}}}}, + {"h_d0_phi", ";#phi_{D^{0}});dN/d#phi_{D^{0}}", {HistType::kTH1F, {{250, -10., 10.}}}}, {"h_d0_ang", ";#lambda_{#kappa}^{#alpha};counts", {HistType::kTH1F, {{100, 0., 1.}}}}}}; // Configurables @@ -137,7 +130,6 @@ struct JetD0Substructure { Produces ObjJetTable; float angularity; - float leadingConstituentPt; void init(o2::framework::InitContext&) { @@ -145,58 +137,15 @@ struct JetD0Substructure { trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); } - Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f); - Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; - template void jetCalculateAngularity(T const& jet, U const& /*tracks*/) { angularity = 0.0; - leadingConstituentPt = 0.0; for (auto& constituent : jet.template tracks_as()) { - if (constituent.pt() >= leadingConstituentPt) { - leadingConstituentPt = constituent.pt(); - } - angularity += std::pow(constituent.pt(), kappa) * std::pow(jetutilities::deltaR(jet, constituent), alpha); - } - angularity /= (jet.pt() * (jet.r() / 100.f)); - } - // Collision-level and for Tracks QA - void processCollisions(aod::JetCollision const& collision, aod::JetTracks const& tracks) - { - - registry.fill(HIST("h_collisions"), 0.5); - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { - return; - } - registry.fill(HIST("h_collisions"), 1.5); - - // Loop over tracks and apply track selection - for (auto const& track : tracks) { - if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { - continue; - } - registry.fill(HIST("h_track_pt"), track.pt()); - registry.fill(HIST("h_track_eta"), track.eta()); - registry.fill(HIST("h_track_phi"), track.phi()); + angularity += std::pow(constituent.pt(), kappa) * std::pow(jetutilities::deltaR(jet, constituent)/(jet.r() / 100.f), alpha); } + angularity /= std::pow(jet.pt(), kappa); } - PROCESS_SWITCH(JetD0Substructure, processCollisions, "process JE collisions", false); - - // Charged jet processing (no HF requirement) - void processDataCharged(soa::Filtered::iterator const& collision, soa::Filtered const& jets) - { - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { - return; - } - // jets -> charged jet - for (auto& jet : jets) { - registry.fill(HIST("h_jet_pt"), jet.pt()); - registry.fill(HIST("h_jet_eta"), jet.eta()); - registry.fill(HIST("h_jet_phi"), jet.phi()); - } - } - PROCESS_SWITCH(JetD0Substructure, processDataCharged, "charged jets in data", false); void processDataChargedSubstructure(aod::JetCollision const& collision, soa::Join const& jets, @@ -253,7 +202,8 @@ struct JetD0Substructure { } // end of jets loop } // end of process function - PROCESS_SWITCH(JetD0Substructure, processDataChargedSubstructure, "charged HF jet substructure", false); + PROCESS_SWITCH(JetD0AngSubstructure, processDataChargedSubstructure, "charged HF jet substructure", false); }; // Workflow definition -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"jet-d0-substructure"})}; } +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"jet-d0-ang-substructure"})}; } + From a0bd868f5b567c5551fffff19aeb74e27ec04fea Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 10 Mar 2026 15:47:23 +0000 Subject: [PATCH 4/4] Please consider the following formatting changes --- PWGJE/Tasks/jetD0AngSubstructure.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PWGJE/Tasks/jetD0AngSubstructure.cxx b/PWGJE/Tasks/jetD0AngSubstructure.cxx index b8a9fc3fea0..05c1923dd96 100644 --- a/PWGJE/Tasks/jetD0AngSubstructure.cxx +++ b/PWGJE/Tasks/jetD0AngSubstructure.cxx @@ -142,7 +142,7 @@ struct JetD0AngSubstructure { { angularity = 0.0; for (auto& constituent : jet.template tracks_as()) { - angularity += std::pow(constituent.pt(), kappa) * std::pow(jetutilities::deltaR(jet, constituent)/(jet.r() / 100.f), alpha); + angularity += std::pow(constituent.pt(), kappa) * std::pow(jetutilities::deltaR(jet, constituent) / (jet.r() / 100.f), alpha); } angularity /= std::pow(jet.pt(), kappa); } @@ -206,4 +206,3 @@ struct JetD0AngSubstructure { }; // Workflow definition WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"jet-d0-ang-substructure"})}; } -