Skip to content

Commit 6c404bd

Browse files
nzardoshNima Zardoshti
andauthored
PWGJE: adding jet tutorial skeleton Task (AliceO2Group#2493)
Co-authored-by: Nima Zardoshti <nzardosh@alicecerno2.cern.ch>
1 parent 330e0ff commit 6c404bd

4 files changed

Lines changed: 160 additions & 6 deletions

File tree

PWGJE/TableProducer/jetfinder.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ struct JetFinderTask {
111111
if (!selectCollision(collision)) {
112112
return;
113113
}
114-
115114
inputParticles.clear();
116115
analyseTracks<JetTracks, JetTracks::iterator>(inputParticles, tracks, trackSelection);
117116
findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable, constituentsSubTable, DoConstSub);

PWGJE/Tasks/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,8 @@ if(FastJet_FOUND)
6464
SOURCES jetTutorial.cxx
6565
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore
6666
COMPONENT_NAME Analysis)
67+
o2physics_add_dpl_workflow(jet-tutorial-skeleton
68+
SOURCES jetTutorialSkeleton.cxx
69+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore
70+
COMPONENT_NAME Analysis)
6771
endif()

PWGJE/Tasks/jetTutorial.cxx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ struct JetTutorialTask {
9494
}
9595
PROCESS_SWITCH(JetTutorialTask, processMCParticleLevel, "jets on particle level MC", false);
9696

97+
void processMCParticleLevelFull(soa::Filtered<aod::FullMCParticleLevelJets>::iterator const& jet)
98+
{
99+
// add aditional selection on jet eta
100+
registry.fill(HIST("h_part_jet_pt"), jet.pt());
101+
registry.fill(HIST("h_part_jet_eta"), jet.eta());
102+
registry.fill(HIST("h_part_jet_phi"), jet.phi());
103+
}
104+
PROCESS_SWITCH(JetTutorialTask, processMCParticleLevelFull, "full jets on particle level MC", false);
105+
97106
void processMCCharged(aod::Collisions const& collision, soa::Filtered<aod::ChargedMCDetectorLevelJets> const& MCDjets, soa::Filtered<aod::ChargedMCParticleLevelJets> const& MCPjets)
98107
{
99108
for (auto& MCDjet : MCDjets) {
@@ -155,24 +164,29 @@ struct JetTutorialTask {
155164
}
156165
PROCESS_SWITCH(JetTutorialTask, processMCParticleSubstructure, "jet substructure particle level full jets", false);
157166

158-
void processDataRecoil(aod::Collision const& collision, soa::Filtered<aod::ChargedJets> const& jets, aod::Tracks const& tracks)
167+
void processDataRecoil(soa::Join<aod::Collisions, aod::EvSels>::iterator const& collision, soa::Filtered<aod::ChargedJets> const& jets, soa::Join<aod::Tracks, aod::TracksExtra> const& tracks)
159168
{
169+
if (!collision.sel8()) {
170+
return;
171+
}
160172
double leadingTrackpT = 0.0;
161-
aod::Tracks::iterator leadingTrack;
173+
double leadingTrackPhi = 0.0;
162174
for (auto& track : tracks) {
163175
if (track.pt() > 6.0 && track.pt() < 10.0) {
164176
if (track.pt() > leadingTrackpT) {
165177
leadingTrackpT = track.pt();
166-
leadingTrack = track;
178+
leadingTrackPhi = track.phi();
167179
}
168180
}
169181
}
182+
if (leadingTrackpT == 0.0)
183+
return;
170184
for (auto& jet : jets) {
171-
if (jet.phi() - leadingTrack.phi() > 0.6) {
185+
if (jet.phi() - leadingTrackPhi > 0.6) {
172186
registry.fill(HIST("h_recoil_jet_pt"), jet.pt());
173187
registry.fill(HIST("h_recoil_jet_eta"), jet.eta());
174188
registry.fill(HIST("h_recoil_jet_phi"), jet.phi());
175-
registry.fill(HIST("h_recoil_jet_dphi"), jet.phi() - leadingTrack.phi());
189+
registry.fill(HIST("h_recoil_jet_dphi"), jet.phi() - leadingTrackPhi);
176190
}
177191
}
178192
}
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
// jet tutorial task for hands on tutorial session (27/04/2023)
13+
//
14+
// Author: Nima Zardoshti
15+
//
16+
17+
#include "Framework/ASoA.h"
18+
#include "Framework/AnalysisDataModel.h"
19+
#include "Framework/AnalysisTask.h"
20+
#include "Framework/HistogramRegistry.h"
21+
22+
#include "Common/Core/TrackSelection.h"
23+
#include "Common/Core/TrackSelectionDefaults.h"
24+
#include "Common/DataModel/EventSelection.h"
25+
#include "Common/DataModel/TrackSelectionTables.h"
26+
27+
#include "Common/Core/RecoDecay.h"
28+
29+
#include "PWGJE/Core/FastJetUtilities.h"
30+
#include "PWGJE/DataModel/Jet.h"
31+
32+
using namespace o2;
33+
using namespace o2::framework;
34+
using namespace o2::framework::expressions;
35+
36+
#include "Framework/runDataProcessing.h"
37+
38+
struct JetTutorialSkeletonTask {
39+
HistogramRegistry registry{"registry",
40+
{{"h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 50.}}}},
41+
{"h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{30, -1.5, 1.5}}}},
42+
{"h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{140, -7.0, 7.}}}},
43+
{"h_part_jet_pt", "particle level jet pT;#it{p}_{T,jet part} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 50.}}}},
44+
{"h_part_jet_eta", "particle level jet #eta;#eta_{jet part};entries", {HistType::kTH1F, {{30, -1.5, 1.5}}}},
45+
{"h_part_jet_phi", "particle level jet #phi;#phi_{jet part};entries", {HistType::kTH1F, {{140, -7.0, 7.}}}},
46+
{"h_jet_ntracks", "jet N tracks;N_{jet tracks};entries", {HistType::kTH1F, {{40, -0.5, 39.5}}}},
47+
{"h_jet_angularity", "jet angularity ;#lambda_{1};entries", {HistType::kTH1F, {{5, 0.0, 0.5}}}},
48+
{"h_full_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 50.}}}},
49+
{"h_full_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{30, -1.5, 1.5}}}},
50+
{"h_full_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{140, -7.0, 7.}}}},
51+
{"h_full_jet_ntracks", "jet N tracks;N_{jet tracks};entries", {HistType::kTH1F, {{40, -0.5, 39.5}}}},
52+
{"h_full_jet_nclusters", "jet N clusters;N_{jet clusters};entries", {HistType::kTH1F, {{40, -0.5, 39.5}}}},
53+
{"h_full_jet_angularity", "jet angularity ;#lambda_{1};entries", {HistType::kTH1F, {{5, 0.0, 0.5}}}},
54+
{"h_part_jet_angularity", "jet angularity ;#lambda_{1};entries", {HistType::kTH1F, {{5, 0.0, 0.5}}}},
55+
{"h_recoil_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 50.}}}},
56+
{"h_recoil_full_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{30, -1.5, 1.5}}}},
57+
{"h_recoil_full_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{140, -7.0, 7.}}}},
58+
{"h_recoil_jet_dphi", "hadron-jet #Delta#phi;#Delta#phi_{jet,trigger hadron};entries", {HistType::kTH1F, {{40, -2.0, 2.0}}}},
59+
{"h_matched_jets_pt", "#it{p}_{T,jet part}; #it{p}_{T,jet det}", {HistType::kTH2F, {{100, 0., 20.}, {100, 0., 20.0}}}},
60+
{"h_matched_jets_eta", "#eta_{jet part}; #eta_{jet det}", {HistType::kTH2F, {{30, -1.5, 1.5}, {30, -1.5, 1.5}}}},
61+
{"h_matched_jets_phi", "#phi_{jet part}; #phi_{jet det}", {HistType::kTH2F, {{140, -7.0, 7.}, {140, -7.0, 7.}}}}}};
62+
63+
Configurable<float> jetPtMin{"jetPtMin", 5.0, "minimum jet pT cut"};
64+
Configurable<float> jetR{"jetR", 0.4, "jet resolution parameter"};
65+
66+
void init(InitContext const&) {}
67+
68+
Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f);
69+
70+
void processDataCharged(soa::Filtered<aod::ChargedJets>::iterator const& jet)
71+
{
72+
// registry.fill(HIST("h_jet_pt"), jet.pt());
73+
}
74+
PROCESS_SWITCH(JetTutorialSkeletonTask, processDataCharged, "jets data", true);
75+
76+
void processMCDetectorLevelCharged(soa::Filtered<aod::ChargedMCDetectorLevelJets>::iterator const& jet)
77+
{
78+
}
79+
PROCESS_SWITCH(JetTutorialSkeletonTask, processMCDetectorLevelCharged, "jets on detector level MC", false);
80+
81+
void processMCParticleLevel(soa::Filtered<aod::ChargedMCParticleLevelJets>::iterator const& jet)
82+
{
83+
}
84+
PROCESS_SWITCH(JetTutorialSkeletonTask, processMCParticleLevel, "jets on particle level MC", false);
85+
86+
void processMCParticleLevelFull(soa::Filtered<aod::FullMCParticleLevelJets>::iterator const& jet)
87+
{
88+
}
89+
PROCESS_SWITCH(JetTutorialSkeletonTask, processMCParticleLevelFull, "full jets on particle level MC", false);
90+
91+
void processMCCharged(aod::Collisions const& collision, soa::Filtered<aod::ChargedMCDetectorLevelJets> const& MCDjets, soa::Filtered<aod::ChargedMCParticleLevelJets> const& MCPjets)
92+
{
93+
// for (auto& MCDjet : MCDjets) {
94+
// registry.fill(HIST("h_jet_pt"), MCDjet.pt());
95+
// }
96+
}
97+
PROCESS_SWITCH(JetTutorialSkeletonTask, processMCCharged, "jets on detector and particle level MC", false);
98+
99+
void processDataChargedSubstructure(soa::Filtered<soa::Join<aod::ChargedJets, aod::ChargedJetConstituents>>::iterator const& jet, aod::Tracks const& tracks)
100+
{
101+
// for (auto& jetConstituent : jet.tracks_as<aod::Tracks>()) {
102+
// }
103+
}
104+
PROCESS_SWITCH(JetTutorialSkeletonTask, processDataChargedSubstructure, "jet substructure charged jets", false);
105+
106+
void processDataFullSubstructure(soa::Filtered<soa::Join<aod::FullJets, aod::FullJetConstituents>>::iterator const& jet, aod::Tracks const& tracks, aod::EMCALClusters const& clusters)
107+
{
108+
}
109+
PROCESS_SWITCH(JetTutorialSkeletonTask, processDataFullSubstructure, "jet substructure full jets", false);
110+
111+
void processMCParticleSubstructure(soa::Filtered<soa::Join<aod::FullMCParticleLevelJets, aod::FullMCParticleLevelJetConstituents>>::iterator const& jet, aod::McParticles const& particles)
112+
{
113+
}
114+
PROCESS_SWITCH(JetTutorialSkeletonTask, processMCParticleSubstructure, "jet substructure particle level full jets", false);
115+
116+
void processDataRecoil(soa::Join<aod::Collisions, aod::EvSels>::iterator const& collision, soa::Filtered<aod::ChargedJets> const& jets, soa::Join<aod::Tracks, aod::TracksExtra> const& tracks)
117+
{
118+
// if (!collision.sel8()) {
119+
// return;
120+
//}
121+
}
122+
PROCESS_SWITCH(JetTutorialSkeletonTask, processDataRecoil, "hadron-recoil jets", false);
123+
124+
using MCDJetTable = soa::Filtered<soa::Join<aod::ChargedMCDetectorLevelJets, aod::ChargedMCDetectorLevelJetConstituents, aod::ChargedMCDetectorLevelJetsMatchedToChargedMCParticleLevelJets>>;
125+
using MCPJetTable = soa::Filtered<soa::Join<aod::ChargedMCParticleLevelJets, aod::ChargedMCParticleLevelJetConstituents, aod::ChargedMCParticleLevelJetsMatchedToChargedMCDetectorLevelJets>>;
126+
void processMCMatched(aod::Collision const& collision, MCDJetTable const& MCDjets, MCPJetTable const& MCPjets)
127+
{
128+
/* for (const auto& MCDjet : MCDjets) {
129+
if (MCDjet.has_matchedJetGeo() && MCDjet.matchedJetGeoId() >= 0) {
130+
const auto& MCPjet = MCDjet.matchedJetGeo_as<MCPJetTable>();
131+
}
132+
}*/
133+
}
134+
PROCESS_SWITCH(JetTutorialSkeletonTask, processMCMatched, "jets matched on detector and particle level MC", false);
135+
};
136+
137+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<JetTutorialSkeletonTask>(cfgc, TaskName{"jet-tutorial"})}; }

0 commit comments

Comments
 (0)