diff --git a/PWGJE/TableProducer/jetfinder.cxx b/PWGJE/TableProducer/jetfinder.cxx index 9efc31af308..69a3fa7d4a6 100644 --- a/PWGJE/TableProducer/jetfinder.cxx +++ b/PWGJE/TableProducer/jetfinder.cxx @@ -111,7 +111,6 @@ struct JetFinderTask { if (!selectCollision(collision)) { return; } - inputParticles.clear(); analyseTracks(inputParticles, tracks, trackSelection); findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable, constituentsSubTable, DoConstSub); diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index 9622576daaa..01610427696 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -64,4 +64,8 @@ if(FastJet_FOUND) SOURCES jetTutorial.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-tutorial-skeleton + SOURCES jetTutorialSkeleton.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) endif() diff --git a/PWGJE/Tasks/jetTutorial.cxx b/PWGJE/Tasks/jetTutorial.cxx index 63e531e8d19..42d491e4d91 100644 --- a/PWGJE/Tasks/jetTutorial.cxx +++ b/PWGJE/Tasks/jetTutorial.cxx @@ -94,6 +94,15 @@ struct JetTutorialTask { } PROCESS_SWITCH(JetTutorialTask, processMCParticleLevel, "jets on particle level MC", false); + void processMCParticleLevelFull(soa::Filtered::iterator const& jet) + { + // add aditional selection on jet eta + registry.fill(HIST("h_part_jet_pt"), jet.pt()); + registry.fill(HIST("h_part_jet_eta"), jet.eta()); + registry.fill(HIST("h_part_jet_phi"), jet.phi()); + } + PROCESS_SWITCH(JetTutorialTask, processMCParticleLevelFull, "full jets on particle level MC", false); + void processMCCharged(aod::Collisions const& collision, soa::Filtered const& MCDjets, soa::Filtered const& MCPjets) { for (auto& MCDjet : MCDjets) { @@ -155,24 +164,29 @@ struct JetTutorialTask { } PROCESS_SWITCH(JetTutorialTask, processMCParticleSubstructure, "jet substructure particle level full jets", false); - void processDataRecoil(aod::Collision const& collision, soa::Filtered const& jets, aod::Tracks const& tracks) + void processDataRecoil(soa::Join::iterator const& collision, soa::Filtered const& jets, soa::Join const& tracks) { + if (!collision.sel8()) { + return; + } double leadingTrackpT = 0.0; - aod::Tracks::iterator leadingTrack; + double leadingTrackPhi = 0.0; for (auto& track : tracks) { if (track.pt() > 6.0 && track.pt() < 10.0) { if (track.pt() > leadingTrackpT) { leadingTrackpT = track.pt(); - leadingTrack = track; + leadingTrackPhi = track.phi(); } } } + if (leadingTrackpT == 0.0) + return; for (auto& jet : jets) { - if (jet.phi() - leadingTrack.phi() > 0.6) { + if (jet.phi() - leadingTrackPhi > 0.6) { registry.fill(HIST("h_recoil_jet_pt"), jet.pt()); registry.fill(HIST("h_recoil_jet_eta"), jet.eta()); registry.fill(HIST("h_recoil_jet_phi"), jet.phi()); - registry.fill(HIST("h_recoil_jet_dphi"), jet.phi() - leadingTrack.phi()); + registry.fill(HIST("h_recoil_jet_dphi"), jet.phi() - leadingTrackPhi); } } } diff --git a/PWGJE/Tasks/jetTutorialSkeleton.cxx b/PWGJE/Tasks/jetTutorialSkeleton.cxx new file mode 100644 index 00000000000..6dd87a0509f --- /dev/null +++ b/PWGJE/Tasks/jetTutorialSkeleton.cxx @@ -0,0 +1,137 @@ +// 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. + +// jet tutorial task for hands on tutorial session (27/04/2023) +// +// Author: Nima Zardoshti +// + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" + +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Common/Core/RecoDecay.h" + +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/DataModel/Jet.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +#include "Framework/runDataProcessing.h" + +struct JetTutorialSkeletonTask { + HistogramRegistry registry{"registry", + {{"h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 50.}}}}, + {"h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{30, -1.5, 1.5}}}}, + {"h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{140, -7.0, 7.}}}}, + {"h_part_jet_pt", "particle level jet pT;#it{p}_{T,jet part} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 50.}}}}, + {"h_part_jet_eta", "particle level jet #eta;#eta_{jet part};entries", {HistType::kTH1F, {{30, -1.5, 1.5}}}}, + {"h_part_jet_phi", "particle level jet #phi;#phi_{jet part};entries", {HistType::kTH1F, {{140, -7.0, 7.}}}}, + {"h_jet_ntracks", "jet N tracks;N_{jet tracks};entries", {HistType::kTH1F, {{40, -0.5, 39.5}}}}, + {"h_jet_angularity", "jet angularity ;#lambda_{1};entries", {HistType::kTH1F, {{5, 0.0, 0.5}}}}, + {"h_full_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 50.}}}}, + {"h_full_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{30, -1.5, 1.5}}}}, + {"h_full_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{140, -7.0, 7.}}}}, + {"h_full_jet_ntracks", "jet N tracks;N_{jet tracks};entries", {HistType::kTH1F, {{40, -0.5, 39.5}}}}, + {"h_full_jet_nclusters", "jet N clusters;N_{jet clusters};entries", {HistType::kTH1F, {{40, -0.5, 39.5}}}}, + {"h_full_jet_angularity", "jet angularity ;#lambda_{1};entries", {HistType::kTH1F, {{5, 0.0, 0.5}}}}, + {"h_part_jet_angularity", "jet angularity ;#lambda_{1};entries", {HistType::kTH1F, {{5, 0.0, 0.5}}}}, + {"h_recoil_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 50.}}}}, + {"h_recoil_full_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{30, -1.5, 1.5}}}}, + {"h_recoil_full_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{140, -7.0, 7.}}}}, + {"h_recoil_jet_dphi", "hadron-jet #Delta#phi;#Delta#phi_{jet,trigger hadron};entries", {HistType::kTH1F, {{40, -2.0, 2.0}}}}, + {"h_matched_jets_pt", "#it{p}_{T,jet part}; #it{p}_{T,jet det}", {HistType::kTH2F, {{100, 0., 20.}, {100, 0., 20.0}}}}, + {"h_matched_jets_eta", "#eta_{jet part}; #eta_{jet det}", {HistType::kTH2F, {{30, -1.5, 1.5}, {30, -1.5, 1.5}}}}, + {"h_matched_jets_phi", "#phi_{jet part}; #phi_{jet det}", {HistType::kTH2F, {{140, -7.0, 7.}, {140, -7.0, 7.}}}}}}; + + Configurable jetPtMin{"jetPtMin", 5.0, "minimum jet pT cut"}; + Configurable jetR{"jetR", 0.4, "jet resolution parameter"}; + + void init(InitContext const&) {} + + Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f); + + void processDataCharged(soa::Filtered::iterator const& jet) + { + // registry.fill(HIST("h_jet_pt"), jet.pt()); + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processDataCharged, "jets data", true); + + void processMCDetectorLevelCharged(soa::Filtered::iterator const& jet) + { + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processMCDetectorLevelCharged, "jets on detector level MC", false); + + void processMCParticleLevel(soa::Filtered::iterator const& jet) + { + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processMCParticleLevel, "jets on particle level MC", false); + + void processMCParticleLevelFull(soa::Filtered::iterator const& jet) + { + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processMCParticleLevelFull, "full jets on particle level MC", false); + + void processMCCharged(aod::Collisions const& collision, soa::Filtered const& MCDjets, soa::Filtered const& MCPjets) + { + // for (auto& MCDjet : MCDjets) { + // registry.fill(HIST("h_jet_pt"), MCDjet.pt()); + // } + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processMCCharged, "jets on detector and particle level MC", false); + + void processDataChargedSubstructure(soa::Filtered>::iterator const& jet, aod::Tracks const& tracks) + { + // for (auto& jetConstituent : jet.tracks_as()) { + // } + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processDataChargedSubstructure, "jet substructure charged jets", false); + + void processDataFullSubstructure(soa::Filtered>::iterator const& jet, aod::Tracks const& tracks, aod::EMCALClusters const& clusters) + { + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processDataFullSubstructure, "jet substructure full jets", false); + + void processMCParticleSubstructure(soa::Filtered>::iterator const& jet, aod::McParticles const& particles) + { + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processMCParticleSubstructure, "jet substructure particle level full jets", false); + + void processDataRecoil(soa::Join::iterator const& collision, soa::Filtered const& jets, soa::Join const& tracks) + { + // if (!collision.sel8()) { + // return; + //} + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processDataRecoil, "hadron-recoil jets", false); + + using MCDJetTable = soa::Filtered>; + using MCPJetTable = soa::Filtered>; + void processMCMatched(aod::Collision const& collision, MCDJetTable const& MCDjets, MCPJetTable const& MCPjets) + { + /* for (const auto& MCDjet : MCDjets) { + if (MCDjet.has_matchedJetGeo() && MCDjet.matchedJetGeoId() >= 0) { + const auto& MCPjet = MCDjet.matchedJetGeo_as(); + } + }*/ + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processMCMatched, "jets matched on detector and particle level MC", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"jet-tutorial"})}; }