Skip to content

Commit 23f0755

Browse files
committed
PWGJE: detailed QA for ch-jet spectra in pp
1 parent 5880c77 commit 23f0755

File tree

2 files changed

+241
-1
lines changed

2 files changed

+241
-1
lines changed

PWGJE/Tasks/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ o2physics_add_dpl_workflow(jet-substructure-bplus
216216
SOURCES statPromptPhoton.cxx
217217
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore
218218
COMPONENT_NAME Analysis)
219+
o2physics_add_dpl_workflow(ch-jet-spectra-pp
220+
SOURCES chJetSpectraPP.cxx
221+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore
222+
COMPONENT_NAME Analysis)
219223
o2physics_add_dpl_workflow(full-jet-spectra-pp
220224
SOURCES fullJetSpectraPP.cxx
221225
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore
@@ -233,4 +237,4 @@ o2physics_add_dpl_workflow(jet-substructure-bplus
233237
PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::PWGJECore O2Physics::AnalysisCore
234238
COMPONENT_NAME Analysis)
235239

236-
endif()
240+
endif()

PWGJE/Tasks/chJetSpectraPP.cxx

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
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+
// ch-jet spectrum analysis task
13+
//
14+
/// \author Joonsuk Bae <[email protected]>
15+
16+
#include <cmath>
17+
#include <TRandom3.h>
18+
19+
#include "Framework/ASoA.h"
20+
#include "Framework/AnalysisDataModel.h"
21+
#include "Framework/AnalysisTask.h"
22+
#include "Framework/O2DatabasePDGPlugin.h"
23+
#include "Framework/HistogramRegistry.h"
24+
#include "Framework/runDataProcessing.h"
25+
26+
#include "Common/Core/TrackSelection.h"
27+
#include "Common/Core/TrackSelectionDefaults.h"
28+
29+
#include "Common/DataModel/EventSelection.h"
30+
#include "Common/DataModel/TrackSelectionTables.h"
31+
32+
#include "PWGJE/Core/FastJetUtilities.h"
33+
#include "PWGJE/Core/JetFinder.h"
34+
#include "PWGJE/Core/JetFindingUtilities.h"
35+
#include "PWGJE/DataModel/Jet.h"
36+
37+
#include "PWGJE/Core/JetDerivedDataUtilities.h"
38+
39+
#include "EventFiltering/filterTables.h"
40+
41+
using namespace o2;
42+
using namespace o2::framework;
43+
using namespace o2::framework::expressions;
44+
45+
struct ChJetSpectraPP {
46+
47+
HistogramRegistry registry;
48+
49+
Configurable<float> selectedJetsRadius{"selectedJetsRadius", 0.4, "resolution parameter for histograms without radius"};
50+
Configurable<std::string> eventSelections{"eventSelections", "sel8", "choose event selection"};
51+
Configurable<float> vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"};
52+
Configurable<float> centralityMin{"centralityMin", -999.0, "minimum centrality"};
53+
Configurable<float> centralityMax{"centralityMax", 999.0, "maximum centrality"};
54+
Configurable<std::vector<double>> jetRadii{"jetRadii", std::vector<double>{0.4}, "jet resolution parameters"};
55+
Configurable<float> trackEtaMin{"trackEtaMin", -0.9, "minimum eta acceptance for tracks"};
56+
Configurable<float> trackEtaMax{"trackEtaMax", 0.9, "maximum eta acceptance for tracks"};
57+
Configurable<float> trackPtMin{"trackPtMin", 0.15, "minimum pT acceptance for tracks"};
58+
Configurable<float> trackPtMax{"trackPtMax", 100.0, "maximum pT acceptance for tracks"};
59+
Configurable<std::string> trackSelections{"trackSelections", "globalTracks", "set track selections"};
60+
Configurable<float> pTHatMaxMCD{"pTHatMaxMCD", 999.0, "maximum fraction of hard scattering for jet acceptance in detector MC"};
61+
Configurable<float> pTHatMaxMCP{"pTHatMaxMCP", 999.0, "maximum fraction of hard scattering for jet acceptance in particle MC"};
62+
Configurable<float> pTHatExponent{"pTHatExponent", 6.0, "exponent of the event weight for the calculation of pTHat"};
63+
Configurable<double> jetPtMax{"jetPtMax", 200., "set jet pT bin max"};
64+
Configurable<float> jetEtaMin{"jetEtaMin", -99.0, "minimum jet pseudorapidity"};
65+
Configurable<float> jetEtaMax{"jetEtaMax", 99.0, "maximum jet pseudorapidity"};
66+
Configurable<int> nBinsEta{"nBinsEta", 200, "number of bins for eta axes"};
67+
Configurable<float> jetAreaFractionMin{"jetAreaFractionMin", -99.0, "used to make a cut on the jet areas"};
68+
Configurable<float> leadingConstituentPtMin{"leadingConstituentPtMin", -99.0, "minimum pT selection on jet constituent"};
69+
Configurable<float> leadingConstituentPtMax{"leadingConstituentPtMax", 9999.0, "maximum pT selection on jet constituent"};
70+
Configurable<int> trackOccupancyInTimeRangeMax{"trackOccupancyInTimeRangeMax", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"};
71+
Configurable<int> trackOccupancyInTimeRangeMin{"trackOccupancyInTimeRangeMin", -999999, "minimum occupancy of tracks in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"};
72+
73+
std::vector<bool> filledJetR_Both;
74+
std::vector<bool> filledJetR_Low;
75+
std::vector<bool> filledJetR_High;
76+
std::vector<double> jetRadiiValues;
77+
78+
int eventSelection = -1;
79+
int trackSelection = -1;
80+
81+
std::vector<double> jetPtBins;
82+
std::vector<double> jetPtBinsRhoAreaSub;
83+
84+
void init(o2::framework::InitContext&)
85+
{
86+
eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast<std::string>(eventSelections));
87+
trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast<std::string>(trackSelections));
88+
jetRadiiValues = (std::vector<double>)jetRadii;
89+
90+
for (std::size_t iJetRadius = 0; iJetRadius < jetRadiiValues.size(); iJetRadius++) {
91+
filledJetR_Both.push_back(0.0);
92+
filledJetR_Low.push_back(0.0);
93+
filledJetR_High.push_back(0.0);
94+
}
95+
auto jetRadiiBins = (std::vector<double>)jetRadii;
96+
if (jetRadiiBins.size() > 1) {
97+
jetRadiiBins.push_back(jetRadiiBins[jetRadiiBins.size() - 1] + (TMath::Abs(jetRadiiBins[jetRadiiBins.size() - 1] - jetRadiiBins[jetRadiiBins.size() - 2])));
98+
} else {
99+
jetRadiiBins.push_back(jetRadiiBins[jetRadiiBins.size() - 1] + 0.1);
100+
}
101+
102+
auto jetPtTemp = 0.0;
103+
jetPtBins.push_back(jetPtTemp);
104+
jetPtBinsRhoAreaSub.push_back(jetPtTemp);
105+
while (jetPtTemp < jetPtMax) {
106+
if (jetPtTemp < 100.0) {
107+
jetPtTemp += 1.0;
108+
jetPtBins.push_back(jetPtTemp);
109+
jetPtBinsRhoAreaSub.push_back(jetPtTemp);
110+
jetPtBinsRhoAreaSub.push_back(-jetPtTemp);
111+
} else if (jetPtTemp < 200.0) {
112+
jetPtTemp += 5.0;
113+
jetPtBins.push_back(jetPtTemp);
114+
jetPtBinsRhoAreaSub.push_back(jetPtTemp);
115+
jetPtBinsRhoAreaSub.push_back(-jetPtTemp);
116+
} else {
117+
jetPtTemp += 10.0;
118+
jetPtBins.push_back(jetPtTemp);
119+
jetPtBinsRhoAreaSub.push_back(jetPtTemp);
120+
jetPtBinsRhoAreaSub.push_back(-jetPtTemp);
121+
}
122+
}
123+
std::sort(jetPtBinsRhoAreaSub.begin(), jetPtBinsRhoAreaSub.end());
124+
125+
AxisSpec jetPtAxis = {jetPtBins, "#it{p}_{T} (GeV/#it{c})"};
126+
AxisSpec jetPtAxisRhoAreaSub = {jetPtBinsRhoAreaSub, "#it{p}_{T} (GeV/#it{c})"};
127+
128+
AxisSpec jetEtaAxis = {nBinsEta, jetEtaMin, jetEtaMax, "#eta"};
129+
AxisSpec trackEtaAxis = {nBinsEta, trackEtaMin, trackEtaMax, "#eta"};
130+
131+
if (doprocessJetsRhoAreaSubData || doprocessJetsRhoAreaSubMCD) {
132+
registry.add("h3_centrality_leadingjet_pt_rho", "centrality; #it{p}_{T,jet} (GeV/#it{c}); #rho (GeV/#it{c})", {HistType::kTH3F, {{1200, -10.0, 110.0}, jetPtAxis, {1000, 0.0, 10.0}}});
133+
}
134+
}
135+
136+
Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax);
137+
Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax);
138+
PresliceUnsorted<soa::Filtered<aod::JetCollisionsMCD>> CollisionsPerMCPCollision = aod::jmccollisionlb::mcCollisionId;
139+
140+
template <typename T, typename U>
141+
bool isAcceptedJet(U const& jet)
142+
{
143+
144+
if (jetAreaFractionMin > -98.0) {
145+
if (jet.area() < jetAreaFractionMin * M_PI * (jet.r() / 100.0) * (jet.r() / 100.0)) {
146+
return false;
147+
}
148+
}
149+
bool checkConstituentPt = true;
150+
bool checkConstituentMinPt = (leadingConstituentPtMin > -98.0);
151+
bool checkConstituentMaxPt = (leadingConstituentPtMax < 9998.0);
152+
if (!checkConstituentMinPt && !checkConstituentMaxPt) {
153+
checkConstituentPt = false;
154+
}
155+
156+
if (checkConstituentPt) {
157+
bool isMinLeadingConstituent = !checkConstituentMinPt;
158+
bool isMaxLeadingConstituent = true;
159+
160+
for (const auto& constituent : jet.template tracks_as<T>()) {
161+
double pt = constituent.pt();
162+
163+
if (checkConstituentMinPt && pt >= leadingConstituentPtMin) {
164+
isMinLeadingConstituent = true;
165+
}
166+
if (checkConstituentMaxPt && pt > leadingConstituentPtMax) {
167+
isMaxLeadingConstituent = false;
168+
}
169+
}
170+
return isMinLeadingConstituent && isMaxLeadingConstituent;
171+
}
172+
173+
return true;
174+
}
175+
176+
template <typename T, typename U>
177+
bool trackIsInJet(T const& track, U const& jet)
178+
{
179+
for (auto const& constituentId : jet.tracksIds()) {
180+
if (constituentId == track.globalIndex()) {
181+
return true;
182+
}
183+
}
184+
return false;
185+
}
186+
187+
void processJetsRhoAreaSubData(soa::Filtered<soa::Join<aod::JetCollisions, aod::BkgChargedRhos>>::iterator const& collision,
188+
soa::Join<aod::ChargedJets, aod::ChargedJetConstituents> const& jets,
189+
aod::JetTracks const&)
190+
{
191+
if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) {
192+
return;
193+
}
194+
bool leadingJetFilled = false;
195+
for (auto jet : jets) {
196+
if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) {
197+
continue;
198+
}
199+
if (!isAcceptedJet<aod::JetTracks>(jet)) {
200+
continue;
201+
}
202+
if (!leadingJetFilled) {
203+
registry.fill(HIST("h3_centrality_leadingjet_pt_rho"), collision.centrality(), jet.pt(), collision.rho());
204+
leadingJetFilled = true;
205+
}
206+
// fillRhoAreaSubtractedHistograms(jet, collision.centrality(), collision.trackOccupancyInTimeRange(), collision.rho());
207+
}
208+
}
209+
PROCESS_SWITCH(ChJetSpectraPP, processJetsRhoAreaSubData, "jet finder QA for rho-area subtracted jets", false);
210+
211+
void processJetsRhoAreaSubMCD(soa::Filtered<soa::Join<aod::JetCollisions, aod::BkgChargedRhos>>::iterator const& collision,
212+
soa::Join<aod::ChargedMCDetectorLevelJets, aod::ChargedMCDetectorLevelJetConstituents> const& jets,
213+
aod::JetTracks const&)
214+
{
215+
if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) {
216+
return;
217+
}
218+
bool leadingJetFilled = false;
219+
for (auto jet : jets) {
220+
if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) {
221+
continue;
222+
}
223+
if (!isAcceptedJet<aod::JetTracks>(jet)) {
224+
continue;
225+
}
226+
if (!leadingJetFilled) {
227+
registry.fill(HIST("h3_centrality_leadingjet_pt_rho"), collision.centrality(), jet.pt(), collision.rho());
228+
leadingJetFilled = true;
229+
}
230+
// fillRhoAreaSubtractedHistograms(jet, collision.centrality(), collision.trackOccupancyInTimeRange(), collision.rho());
231+
}
232+
}
233+
PROCESS_SWITCH(ChJetSpectraPP, processJetsRhoAreaSubMCD, "jet finder QA for rho-area subtracted mcd jets", false);
234+
};
235+
236+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<ChJetSpectraPP>(cfgc, TaskName{"ch-jet-spectra-pp"})}; }

0 commit comments

Comments
 (0)