Skip to content

Commit 89724d5

Browse files
committed
Please consider the following formatting changes
1 parent 92931f4 commit 89724d5

File tree

1 file changed

+158
-165
lines changed

1 file changed

+158
-165
lines changed

PWGJE/Tasks/jetD0Substructure.cxx

Lines changed: 158 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,30 @@
1616
// \inherited from D0 fragmentation and Ds
1717
// \P. Dhankher
1818

19-
20-
#include "PWGJE/DataModel/Jet.h"
21-
#include "PWGJE/DataModel/JetSubtraction.h"
22-
#include "PWGJE/DataModel/JetReducedData.h"
23-
19+
#include "PWGHF/Core/DecayChannels.h"
2420
#include "PWGJE/Core/JetDerivedDataUtilities.h"
2521
#include "PWGJE/Core/JetUtilities.h"
26-
#include "PWGHF/Core/DecayChannels.h"
22+
#include "PWGJE/DataModel/Jet.h"
23+
#include "PWGJE/DataModel/JetReducedData.h"
24+
#include "PWGJE/DataModel/JetSubtraction.h"
2725

2826
#include "Common/Core/RecoDecay.h"
2927
#include "Common/DataModel/TrackSelectionTables.h"
3028

3129
#include "Framework/ASoA.h"
3230
#include "Framework/AnalysisDataModel.h"
33-
#include <Framework/AnalysisTask.h>
3431
#include "Framework/HistogramRegistry.h"
3532
#include <CommonConstants/MathConstants.h>
33+
#include <Framework/AnalysisTask.h>
34+
#include <Framework/ConfigContext.h>
3635
#include <Framework/Configurable.h>
36+
#include <Framework/DataProcessorSpec.h>
3737
#include <Framework/HistogramSpec.h>
3838
#include <Framework/InitContext.h>
39-
#include <Framework/ConfigContext.h>
40-
#include <Framework/DataProcessorSpec.h>
4139
#include <Framework/runDataProcessing.h>
4240

43-
4441
#include "TVector3.h"
42+
4543
#include <cmath>
4644
#include <cstdlib>
4745
#include <string>
@@ -76,191 +74,186 @@ DECLARE_SOA_COLUMN(HfMlScore2, hfMlScore2, float);
7674
} // namespace jet_obj
7775
// AOD table definition
7876
DECLARE_SOA_TABLE(JetObjTable, "AOD", "JETOBJTABLE",
79-
jet_obj::JetHfDist,
80-
jet_obj::JetPt,
81-
jet_obj::JetEta,
82-
jet_obj::JetPhi,
83-
jet_obj::JetNConst,
84-
jet_obj::JetAng,
85-
jet_obj::HfPt,
86-
jet_obj::HfEta,
87-
jet_obj::HfPhi,
88-
jet_obj::HfMass,
89-
jet_obj::HfY,
90-
jet_obj::HfMlScore0,
91-
jet_obj::HfMlScore1,
92-
jet_obj::HfMlScore2);
93-
}
77+
jet_obj::JetHfDist,
78+
jet_obj::JetPt,
79+
jet_obj::JetEta,
80+
jet_obj::JetPhi,
81+
jet_obj::JetNConst,
82+
jet_obj::JetAng,
83+
jet_obj::HfPt,
84+
jet_obj::HfEta,
85+
jet_obj::HfPhi,
86+
jet_obj::HfMass,
87+
jet_obj::HfY,
88+
jet_obj::HfMlScore0,
89+
jet_obj::HfMlScore1,
90+
jet_obj::HfMlScore2);
91+
} // namespace o2::aod
9492
struct JetD0Substructure {
95-
/**
93+
/**
9694
* Histogram registry
9795
*
9896
* Contains:
9997
* - Event and track histograms
10098
* - Jet kinematic distributions
10199
* - D0–jet substructure observables
102100
*/
103-
HistogramRegistry registry{"registry",
104-
{{"h_collisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}},
105-
{"h_track_pt", "track pT;#it{p}_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}},
106-
{"h_track_eta", "track #eta;#eta_{track};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}},
107-
{"h_track_phi", "track #varphi;#varphi_{track};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}},
108-
{"h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}},
109-
{"h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}},
110-
{"h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}},
111-
{"h_collision_counter", "# of collisions;", {HistType::kTH1F, {{2, 0., 2.}}}},
112-
{"h_jet_counter", ";# of D^{0} jets;", {HistType::kTH1F, {{6, 0., 3.0}}}},
113-
{"h_d0_jet_projection", ";z^{D^{0},jet}_{||};dN/dz^{D^{0},jet}_{||}", {HistType::kTH1F, {{1000, 0., 10.}}}},
114-
{"h_d0_jet_distance_vs_projection", ";#DeltaR_{D^{0},jet};z^{D^{0},jet}_{||}", {HistType::kTH2F, {{1000, 0., 10.}, {1000, 0., 10.}}}},
115-
{"h_d0_jet_distance", ";#DeltaR_{D^{0},jet};dN/d(#DeltaR)", {HistType::kTH1F, {{1000, 0., 10.}}}},
116-
{"h_d0_jet_pt", ";p_{T,D^{0} jet};dN/dp_{T,D^{0} jet}", {HistType::kTH1F, {{200, 0., 10.}}}},
117-
{"h_d0_jet_eta", ";#eta_{T,D^{0} jet};dN/d#eta_{D^{0} jet}", {HistType::kTH1F, {{250, -5., 5.}}}},
118-
{"h_d0_jet_phi", ";#phi_{T,D^{0} jet};dN/d#phi_{D^{0} jet}", {HistType::kTH1F, {{250, -10., 10.}}}},
119-
{"h_d0_mass", ";m_{D^{0}} (GeV/c^{2});dN/dm_{D^{0}}", {HistType::kTH1F, {{1000, 0., 10.}}}},
120-
{"h_d0_eta", ";#eta_{D^{0}} (GeV/c^{2});dN/d#eta_{D_{}}", {HistType::kTH1F, {{250, -5., 5.}}}},
121-
{"h_d0_phi", ";#phi_{D^{0}} (GeV/c^{2});dN/d#phi_{D^{0}}", {HistType::kTH1F, {{250, -10., 10.}}}},
122-
{"h_d0_ang", ";#lambda_{#kappa}^{#alpha};counts", {HistType::kTH1F, {{100, 0., 1.}}}}}
123-
};
124-
125-
// Configurables
126-
Configurable<float> vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"};
101+
HistogramRegistry registry{"registry",
102+
{{"h_collisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}},
103+
{"h_track_pt", "track pT;#it{p}_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}},
104+
{"h_track_eta", "track #eta;#eta_{track};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}},
105+
{"h_track_phi", "track #varphi;#varphi_{track};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}},
106+
{"h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}},
107+
{"h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}},
108+
{"h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}},
109+
{"h_collision_counter", "# of collisions;", {HistType::kTH1F, {{2, 0., 2.}}}},
110+
{"h_jet_counter", ";# of D^{0} jets;", {HistType::kTH1F, {{6, 0., 3.0}}}},
111+
{"h_d0_jet_projection", ";z^{D^{0},jet}_{||};dN/dz^{D^{0},jet}_{||}", {HistType::kTH1F, {{1000, 0., 10.}}}},
112+
{"h_d0_jet_distance_vs_projection", ";#DeltaR_{D^{0},jet};z^{D^{0},jet}_{||}", {HistType::kTH2F, {{1000, 0., 10.}, {1000, 0., 10.}}}},
113+
{"h_d0_jet_distance", ";#DeltaR_{D^{0},jet};dN/d(#DeltaR)", {HistType::kTH1F, {{1000, 0., 10.}}}},
114+
{"h_d0_jet_pt", ";p_{T,D^{0} jet};dN/dp_{T,D^{0} jet}", {HistType::kTH1F, {{200, 0., 10.}}}},
115+
{"h_d0_jet_eta", ";#eta_{T,D^{0} jet};dN/d#eta_{D^{0} jet}", {HistType::kTH1F, {{250, -5., 5.}}}},
116+
{"h_d0_jet_phi", ";#phi_{T,D^{0} jet};dN/d#phi_{D^{0} jet}", {HistType::kTH1F, {{250, -10., 10.}}}},
117+
{"h_d0_mass", ";m_{D^{0}} (GeV/c^{2});dN/dm_{D^{0}}", {HistType::kTH1F, {{1000, 0., 10.}}}},
118+
{"h_d0_eta", ";#eta_{D^{0}} (GeV/c^{2});dN/d#eta_{D_{}}", {HistType::kTH1F, {{250, -5., 5.}}}},
119+
{"h_d0_phi", ";#phi_{D^{0}} (GeV/c^{2});dN/d#phi_{D^{0}}", {HistType::kTH1F, {{250, -10., 10.}}}},
120+
{"h_d0_ang", ";#lambda_{#kappa}^{#alpha};counts", {HistType::kTH1F, {{100, 0., 1.}}}}}};
127121

128-
Configurable<float> jetPtMin{"jetPtMin", 5.0, "minimum jet pT cut"};
129-
Configurable<float> jetR{"jetR", 0.4, "jet resolution parameter"};
122+
// Configurables
123+
Configurable<float> vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"};
130124

131-
Configurable<std::string> eventSelections{"eventSelections", "sel8", "choose event selection"};
132-
Configurable<std::string> trackSelections{"trackSelections", "globalTracks", "set track selections"};
133-
Configurable<float> kappa{"kappa", 1.0, "angularity kappa"}; //to do: configurable from json
134-
Configurable<float> alpha{"alpha", 1.0, "angularity alpha"};
135-
136-
std::vector<int> eventSelectionBits;
137-
int trackSelection = -1;
125+
Configurable<float> jetPtMin{"jetPtMin", 5.0, "minimum jet pT cut"};
126+
Configurable<float> jetR{"jetR", 0.4, "jet resolution parameter"};
138127

139-
// Output table producer
140-
Produces<aod::JetObjTable> ObjJetTable;
141-
142-
float angularity;
143-
float leadingConstituentPt;
144-
145-
void init(o2::framework::InitContext&)
146-
{
147-
eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast<std::string>(eventSelections));
148-
trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast<std::string>(trackSelections));
149-
}
150-
151-
Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f);
152-
Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut;
128+
Configurable<std::string> eventSelections{"eventSelections", "sel8", "choose event selection"};
129+
Configurable<std::string> trackSelections{"trackSelections", "globalTracks", "set track selections"};
130+
Configurable<float> kappa{"kappa", 1.0, "angularity kappa"}; // to do: configurable from json
131+
Configurable<float> alpha{"alpha", 1.0, "angularity alpha"};
132+
133+
std::vector<int> eventSelectionBits;
134+
int trackSelection = -1;
135+
136+
// Output table producer
137+
Produces<aod::JetObjTable> ObjJetTable;
153138

154-
template <typename T, typename U>
155-
void jetCalculateAngularity(T const& jet, U const& /*tracks*/)
156-
{
157-
angularity = 0.0;
158-
leadingConstituentPt = 0.0;
159-
for (auto& constituent : jet.template tracks_as<U>()) {
160-
if (constituent.pt() >= leadingConstituentPt) {
161-
leadingConstituentPt = constituent.pt();
162-
}
163-
angularity += std::pow(constituent.pt(), kappa) * std::pow(jetutilities::deltaR(jet, constituent), alpha);
164-
}
165-
angularity /= (jet.pt() * (jet.r() / 100.f));
139+
float angularity;
140+
float leadingConstituentPt;
141+
142+
void init(o2::framework::InitContext&)
143+
{
144+
eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast<std::string>(eventSelections));
145+
trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast<std::string>(trackSelections));
146+
}
147+
148+
Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f);
149+
Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut;
150+
151+
template <typename T, typename U>
152+
void jetCalculateAngularity(T const& jet, U const& /*tracks*/)
153+
{
154+
angularity = 0.0;
155+
leadingConstituentPt = 0.0;
156+
for (auto& constituent : jet.template tracks_as<U>()) {
157+
if (constituent.pt() >= leadingConstituentPt) {
158+
leadingConstituentPt = constituent.pt();
159+
}
160+
angularity += std::pow(constituent.pt(), kappa) * std::pow(jetutilities::deltaR(jet, constituent), alpha);
166161
}
167-
// Collision-level and for Tracks QA
168-
void processCollisions(aod::JetCollision const& collision, aod::JetTracks const& tracks)
169-
{
162+
angularity /= (jet.pt() * (jet.r() / 100.f));
163+
}
164+
// Collision-level and for Tracks QA
165+
void processCollisions(aod::JetCollision const& collision, aod::JetTracks const& tracks)
166+
{
170167

171-
registry.fill(HIST("h_collisions"), 0.5);
172-
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) {
173-
return;
174-
}
175-
registry.fill(HIST("h_collisions"), 1.5);
168+
registry.fill(HIST("h_collisions"), 0.5);
169+
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) {
170+
return;
171+
}
172+
registry.fill(HIST("h_collisions"), 1.5);
176173

177-
// Loop over tracks and apply track selection
178-
for (auto const& track : tracks) {
179-
if (!jetderiveddatautilities::selectTrack(track, trackSelection)) {
180-
continue;
181-
}
182-
registry.fill(HIST("h_track_pt"), track.pt());
183-
registry.fill(HIST("h_track_eta"), track.eta());
184-
registry.fill(HIST("h_track_phi"), track.phi());
185-
}
174+
// Loop over tracks and apply track selection
175+
for (auto const& track : tracks) {
176+
if (!jetderiveddatautilities::selectTrack(track, trackSelection)) {
177+
continue;
178+
}
179+
registry.fill(HIST("h_track_pt"), track.pt());
180+
registry.fill(HIST("h_track_eta"), track.eta());
181+
registry.fill(HIST("h_track_phi"), track.phi());
186182
}
187-
PROCESS_SWITCH(JetD0Substructure, processCollisions, "process JE collisions", false);
183+
}
184+
PROCESS_SWITCH(JetD0Substructure, processCollisions, "process JE collisions", false);
188185

189-
// Charged jet processing (no HF requirement)
190-
void processDataCharged(soa::Filtered<aod::JetCollisions>::iterator const& collision, soa::Filtered<aod::ChargedJets> const& jets)
191-
{
192-
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) {
193-
return;
194-
}
195-
//jets -> charged jet
196-
for (auto& jet : jets) {
197-
registry.fill(HIST("h_jet_pt"), jet.pt());
198-
registry.fill(HIST("h_jet_eta"), jet.eta());
199-
registry.fill(HIST("h_jet_phi"), jet.phi());
200-
}
186+
// Charged jet processing (no HF requirement)
187+
void processDataCharged(soa::Filtered<aod::JetCollisions>::iterator const& collision, soa::Filtered<aod::ChargedJets> const& jets)
188+
{
189+
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) {
190+
return;
191+
}
192+
// jets -> charged jet
193+
for (auto& jet : jets) {
194+
registry.fill(HIST("h_jet_pt"), jet.pt());
195+
registry.fill(HIST("h_jet_eta"), jet.eta());
196+
registry.fill(HIST("h_jet_phi"), jet.phi());
201197
}
202-
PROCESS_SWITCH(JetD0Substructure, processDataCharged, "charged jets in data", false);
198+
}
199+
PROCESS_SWITCH(JetD0Substructure, processDataCharged, "charged jets in data", false);
203200

204-
void processDataChargedSubstructure(aod::JetCollision const& collision,
205-
soa::Join<aod::D0ChargedJets, aod::D0ChargedJetConstituents> const& jets,
206-
aod::CandidatesD0Data const&, aod::JetTracks const& tracks)
207-
{
208-
// apply event selection and fill histograms for sanity check
209-
registry.fill(HIST("h_collision_counter"), 0.5);
201+
void processDataChargedSubstructure(aod::JetCollision const& collision,
202+
soa::Join<aod::D0ChargedJets, aod::D0ChargedJetConstituents> const& jets,
203+
aod::CandidatesD0Data const&, aod::JetTracks const& tracks)
204+
{
205+
// apply event selection and fill histograms for sanity check
206+
registry.fill(HIST("h_collision_counter"), 0.5);
210207

211-
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || !(std::abs(collision.posZ()) < vertexZCut)) {
212-
return;
213-
}
214-
registry.fill(HIST("h_collision_counter"), 1.5);
208+
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || !(std::abs(collision.posZ()) < vertexZCut)) {
209+
return;
210+
}
211+
registry.fill(HIST("h_collision_counter"), 1.5);
215212

216-
// Loop over jets containing D0 candidates
217-
for (const auto& jet : jets) {
218-
//number of charged jets with D0
219-
registry.fill(HIST("h_jet_counter"), 0.5);
220-
// obtaining jet 3-vector
221-
TVector3 jetVector(jet.px(), jet.py(), jet.pz());
213+
// Loop over jets containing D0 candidates
214+
for (const auto& jet : jets) {
215+
// number of charged jets with D0
216+
registry.fill(HIST("h_jet_counter"), 0.5);
217+
// obtaining jet 3-vector
218+
TVector3 jetVector(jet.px(), jet.py(), jet.pz());
222219

223-
//Loop over D0 candidates associated to the jet
224-
for (const auto& d0Candidate : jet.candidates_as<aod::CandidatesD0Data>()) {
225-
// obtaining jet 3-vector
226-
TVector3 d0Vector(d0Candidate.px(), d0Candidate.py(), d0Candidate.pz());
220+
// Loop over D0 candidates associated to the jet
221+
for (const auto& d0Candidate : jet.candidates_as<aod::CandidatesD0Data>()) {
222+
// obtaining jet 3-vector
223+
TVector3 d0Vector(d0Candidate.px(), d0Candidate.py(), d0Candidate.pz());
227224

228-
// calculating fraction of the jet momentum carried by the D0 along the direction of the jet axis
229-
double zParallel = (jetVector * d0Vector) / (jetVector * jetVector);
225+
// calculating fraction of the jet momentum carried by the D0 along the direction of the jet axis
226+
double zParallel = (jetVector * d0Vector) / (jetVector * jetVector);
230227

231-
// calculating angular distance in eta-phi plane
232-
double axisDistance = jetutilities::deltaR(jet, d0Candidate);
233-
234-
jetCalculateAngularity(jet,tracks);
235-
236-
// filling histograms
237-
registry.fill(HIST("h_d0_jet_projection"), zParallel);
238-
registry.fill(HIST("h_d0_jet_distance_vs_projection"), axisDistance, zParallel);
239-
registry.fill(HIST("h_d0_jet_distance"), axisDistance);
240-
registry.fill(HIST("h_d0_jet_pt"), jet.pt());
241-
registry.fill(HIST("h_d0_jet_eta"), jet.eta());
242-
registry.fill(HIST("h_d0_jet_phi"), jet.phi());
243-
registry.fill(HIST("h_d0_mass"), d0Candidate.m());
244-
registry.fill(HIST("h_d0_eta"), d0Candidate.eta());
245-
registry.fill(HIST("h_d0_phi"), d0Candidate.phi());
246-
registry.fill(HIST("h_d0_ang"), angularity); // add more axis
247-
228+
// calculating angular distance in eta-phi plane
229+
double axisDistance = jetutilities::deltaR(jet, d0Candidate);
248230

249-
// filling table
250-
ObjJetTable(axisDistance,
251-
jet.pt(), jet.eta(), jet.phi(), jet.tracks_as<aod::JetTracks>().size(), angularity,
252-
d0Candidate.pt(), d0Candidate.eta(), d0Candidate.phi(), d0Candidate.m(), d0Candidate.y(), d0Candidate.mlScores()[0], d0Candidate.mlScores()[1], d0Candidate.mlScores()[2]);
253-
254-
break; // get out of candidates' loop after first HF particle is found in jet
255-
} // end of D0 candidates loop
231+
jetCalculateAngularity(jet, tracks);
256232

257-
} // end of jets loop
233+
// filling histograms
234+
registry.fill(HIST("h_d0_jet_projection"), zParallel);
235+
registry.fill(HIST("h_d0_jet_distance_vs_projection"), axisDistance, zParallel);
236+
registry.fill(HIST("h_d0_jet_distance"), axisDistance);
237+
registry.fill(HIST("h_d0_jet_pt"), jet.pt());
238+
registry.fill(HIST("h_d0_jet_eta"), jet.eta());
239+
registry.fill(HIST("h_d0_jet_phi"), jet.phi());
240+
registry.fill(HIST("h_d0_mass"), d0Candidate.m());
241+
registry.fill(HIST("h_d0_eta"), d0Candidate.eta());
242+
registry.fill(HIST("h_d0_phi"), d0Candidate.phi());
243+
registry.fill(HIST("h_d0_ang"), angularity); // add more axis
258244

259-
} // end of process function
260-
PROCESS_SWITCH(JetD0Substructure, processDataChargedSubstructure, "charged HF jet substructure", false);
245+
// filling table
246+
ObjJetTable(axisDistance,
247+
jet.pt(), jet.eta(), jet.phi(), jet.tracks_as<aod::JetTracks>().size(), angularity,
248+
d0Candidate.pt(), d0Candidate.eta(), d0Candidate.phi(), d0Candidate.m(), d0Candidate.y(), d0Candidate.mlScores()[0], d0Candidate.mlScores()[1], d0Candidate.mlScores()[2]);
261249

250+
break; // get out of candidates' loop after first HF particle is found in jet
251+
} // end of D0 candidates loop
262252

253+
} // end of jets loop
263254

255+
} // end of process function
256+
PROCESS_SWITCH(JetD0Substructure, processDataChargedSubstructure, "charged HF jet substructure", false);
264257
};
265258
// Workflow definition
266259
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<JetD0Substructure>(cfgc, TaskName{"jet-d0-substructure"})}; }

0 commit comments

Comments
 (0)