Skip to content

Commit 4f59aa7

Browse files
committed
[PWGJE] Apply jetDsSpectrumAndSubstructure clang-format and fix whitespace
1 parent e5c480b commit 4f59aa7

File tree

1 file changed

+146
-156
lines changed

1 file changed

+146
-156
lines changed

PWGJE/Tasks/jetDsSpectrumAndSubstructure.cxx

Lines changed: 146 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,30 @@
1717
/// \author Monalisa Melo <monalisa.melo@cern.ch>
1818
//
1919

20-
21-
#include "PWGJE/DataModel/Jet.h"
22-
#include "PWGJE/DataModel/JetSubtraction.h"
23-
#include "PWGJE/DataModel/JetReducedData.h"
24-
20+
#include "PWGHF/Core/DecayChannels.h"
2521
#include "PWGJE/Core/JetDerivedDataUtilities.h"
2622
#include "PWGJE/Core/JetUtilities.h"
27-
#include "PWGHF/Core/DecayChannels.h"
23+
#include "PWGJE/DataModel/Jet.h"
24+
#include "PWGJE/DataModel/JetReducedData.h"
25+
#include "PWGJE/DataModel/JetSubtraction.h"
2826

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

3230
#include "Framework/ASoA.h"
3331
#include "Framework/AnalysisDataModel.h"
34-
#include <Framework/AnalysisTask.h>
3532
#include "Framework/HistogramRegistry.h"
3633
#include <CommonConstants/MathConstants.h>
34+
#include <Framework/AnalysisTask.h>
35+
#include <Framework/ConfigContext.h>
3736
#include <Framework/Configurable.h>
37+
#include <Framework/DataProcessorSpec.h>
3838
#include <Framework/HistogramSpec.h>
3939
#include <Framework/InitContext.h>
40-
#include <Framework/ConfigContext.h>
41-
#include <Framework/DataProcessorSpec.h>
4240
#include <Framework/runDataProcessing.h>
4341

44-
45-
4642
#include "TVector3.h"
43+
4744
#include <cmath>
4845
#include <cstdlib>
4946
#include <string>
@@ -73,156 +70,149 @@ DECLARE_SOA_COLUMN(HfMlScore2, hfMlScore2, float);
7370
} // namespace jet_distance
7471

7572
DECLARE_SOA_TABLE(JetDistanceTable, "AOD", "JETDISTTABLE",
76-
jet_distance::JetHfDist,
77-
jet_distance::JetPt,
78-
jet_distance::JetEta,
79-
jet_distance::JetPhi,
80-
jet_distance::JetNConst,
81-
jet_distance::HfPt,
82-
jet_distance::HfEta,
83-
jet_distance::HfPhi,
84-
jet_distance::HfMass,
85-
jet_distance::HfY,
86-
jet_distance::HfMlScore0,
87-
jet_distance::HfMlScore1,
88-
jet_distance::HfMlScore2);
89-
}
73+
jet_distance::JetHfDist,
74+
jet_distance::JetPt,
75+
jet_distance::JetEta,
76+
jet_distance::JetPhi,
77+
jet_distance::JetNConst,
78+
jet_distance::HfPt,
79+
jet_distance::HfEta,
80+
jet_distance::HfPhi,
81+
jet_distance::HfMass,
82+
jet_distance::HfY,
83+
jet_distance::HfMlScore0,
84+
jet_distance::HfMlScore1,
85+
jet_distance::HfMlScore2);
86+
} // namespace o2::aod
9087

9188
struct JetDsSpecSubs {
92-
HistogramRegistry registry{"registry",
93-
{{"h_collisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}},
94-
{"h_track_pt", "track pT;#it{p}_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}},
95-
{"h_track_eta", "track #eta;#eta_{track};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}},
96-
{"h_track_phi", "track #varphi;#varphi_{track};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}},
97-
{"h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}},
98-
{"h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}},
99-
{"h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}},
100-
{"h_collision_counter", "# of collisions;", {HistType::kTH1F, {{200, 0., 200.}}}},
101-
{"h_jet_counter", ";# of D_{S} jets;", {HistType::kTH1F, {{6, 0., 3.0}}}},
102-
{"h_ds_jet_projection", ";z^{D_{S},jet}_{||};dN/dz^{D_{S},jet}_{||}", {HistType::kTH1F, {{1000, 0., 10.}}}},
103-
{"h_ds_jet_distance_vs_projection", ";#DeltaR_{D_{S},jet};z^{D_{S},jet}_{||}", {HistType::kTH2F, {{1000, 0., 10.}, {1000, 0., 10.}}}},
104-
{"h_ds_jet_distance", ";#DeltaR_{D_{S},jet};dN/d(#DeltaR)", {HistType::kTH1F, {{1000, 0., 10.}}}},
105-
{"h_ds_jet_pt", ";p_{T,D_{S} jet};dN/dp_{T,D_{S} jet}", {HistType::kTH1F, {{200, 0., 10.}}}},
106-
{"h_ds_jet_eta", ";#eta_{T,D_{S} jet};dN/d#eta_{D_{S} jet}", {HistType::kTH1F, {{250, -5., 5.}}}},
107-
{"h_ds_jet_phi", ";#phi_{T,D_{S} jet};dN/d#phi_{D_{S} jet}", {HistType::kTH1F, {{250, -10., 10.}}}},
108-
{"h_ds_mass", ";m_{D_{S}} (GeV/c^{2});dN/dm_{D_{S}}", {HistType::kTH1F, {{1000, 0., 10.}}}},
109-
{"h_ds_eta", ";#eta_{D_{S}} (GeV/c^{2});dN/d#eta_{D_{S}}", {HistType::kTH1F, {{250, -5., 5.}}}},
110-
{"h_ds_phi", ";#phi_{D_{S}} (GeV/c^{2});dN/d#phi_{D_{S}}", {HistType::kTH1F, {{250, -10., 10.}}}}}
111-
};
112-
113-
Configurable<float> vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"};
114-
115-
Configurable<float> jetPtMin{"jetPtMin", 5.0, "minimum jet pT cut"};
116-
Configurable<float> jetR{"jetR", 0.4, "jet resolution parameter"};
117-
118-
Configurable<std::string> eventSelections{"eventSelections", "sel8", "choose event selection"};
119-
Configurable<std::string> trackSelections{"trackSelections", "globalTracks", "set track selections"};
120-
121-
std::vector<int> eventSelectionBits;
122-
int trackSelection = -1;
123-
124-
Produces<aod::JetDistanceTable> distJetTable;
125-
126-
127-
void init(o2::framework::InitContext&)
128-
{
129-
eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast<std::string>(eventSelections));
130-
trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast<std::string>(trackSelections));
89+
HistogramRegistry registry{"registry",
90+
{{"h_collisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}},
91+
{"h_track_pt", "track pT;#it{p}_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}},
92+
{"h_track_eta", "track #eta;#eta_{track};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}},
93+
{"h_track_phi", "track #varphi;#varphi_{track};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}},
94+
{"h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}},
95+
{"h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}},
96+
{"h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}},
97+
{"h_collision_counter", "# of collisions;", {HistType::kTH1F, {{200, 0., 200.}}}},
98+
{"h_jet_counter", ";# of D_{S} jets;", {HistType::kTH1F, {{6, 0., 3.0}}}},
99+
{"h_ds_jet_projection", ";z^{D_{S},jet}_{||};dN/dz^{D_{S},jet}_{||}", {HistType::kTH1F, {{1000, 0., 10.}}}},
100+
{"h_ds_jet_distance_vs_projection", ";#DeltaR_{D_{S},jet};z^{D_{S},jet}_{||}", {HistType::kTH2F, {{1000, 0., 10.}, {1000, 0., 10.}}}},
101+
{"h_ds_jet_distance", ";#DeltaR_{D_{S},jet};dN/d(#DeltaR)", {HistType::kTH1F, {{1000, 0., 10.}}}},
102+
{"h_ds_jet_pt", ";p_{T,D_{S} jet};dN/dp_{T,D_{S} jet}", {HistType::kTH1F, {{200, 0., 10.}}}},
103+
{"h_ds_jet_eta", ";#eta_{T,D_{S} jet};dN/d#eta_{D_{S} jet}", {HistType::kTH1F, {{250, -5., 5.}}}},
104+
{"h_ds_jet_phi", ";#phi_{T,D_{S} jet};dN/d#phi_{D_{S} jet}", {HistType::kTH1F, {{250, -10., 10.}}}},
105+
{"h_ds_mass", ";m_{D_{S}} (GeV/c^{2});dN/dm_{D_{S}}", {HistType::kTH1F, {{1000, 0., 10.}}}},
106+
{"h_ds_eta", ";#eta_{D_{S}} (GeV/c^{2});dN/d#eta_{D_{S}}", {HistType::kTH1F, {{250, -5., 5.}}}},
107+
{"h_ds_phi", ";#phi_{D_{S}} (GeV/c^{2});dN/d#phi_{D_{S}}", {HistType::kTH1F, {{250, -10., 10.}}}}}};
108+
109+
Configurable<float> vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"};
110+
111+
Configurable<float> jetPtMin{"jetPtMin", 5.0, "minimum jet pT cut"};
112+
Configurable<float> jetR{"jetR", 0.4, "jet resolution parameter"};
113+
114+
Configurable<std::string> eventSelections{"eventSelections", "sel8", "choose event selection"};
115+
Configurable<std::string> trackSelections{"trackSelections", "globalTracks", "set track selections"};
116+
117+
std::vector<int> eventSelectionBits;
118+
int trackSelection = -1;
119+
120+
Produces<aod::JetDistanceTable> distJetTable;
121+
122+
void init(o2::framework::InitContext&)
123+
{
124+
eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast<std::string>(eventSelections));
125+
trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast<std::string>(trackSelections));
126+
}
127+
128+
Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f);
129+
Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut;
130+
131+
void processCollisions(aod::JetCollision const& collision, aod::JetTracks const& tracks)
132+
{
133+
134+
registry.fill(HIST("h_collisions"), 0.5);
135+
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) {
136+
return;
131137
}
138+
registry.fill(HIST("h_collisions"), 1.5);
139+
for (auto const& track : tracks) {
140+
if (!jetderiveddatautilities::selectTrack(track, trackSelection)) {
141+
continue;
142+
}
143+
registry.fill(HIST("h_track_pt"), track.pt());
144+
registry.fill(HIST("h_track_eta"), track.eta());
145+
registry.fill(HIST("h_track_phi"), track.phi());
146+
}
147+
}
148+
PROCESS_SWITCH(JetDsSpecSubs, processCollisions, "process JE collisions", false);
132149

133-
134-
Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f);
135-
Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut;
136-
137-
138-
void processCollisions(aod::JetCollision const& collision, aod::JetTracks const& tracks)
139-
{
140-
141-
registry.fill(HIST("h_collisions"), 0.5);
142-
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) {
143-
return;
144-
}
145-
registry.fill(HIST("h_collisions"), 1.5);
146-
for (auto const& track : tracks) {
147-
if (!jetderiveddatautilities::selectTrack(track, trackSelection)) {
148-
continue;
149-
}
150-
registry.fill(HIST("h_track_pt"), track.pt());
151-
registry.fill(HIST("h_track_eta"), track.eta());
152-
registry.fill(HIST("h_track_phi"), track.phi());
153-
}
150+
void processDataCharged(soa::Filtered<aod::JetCollisions>::iterator const& collision, soa::Filtered<aod::ChargedJets> const& jets)
151+
{
152+
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) {
153+
return;
154154
}
155-
PROCESS_SWITCH(JetDsSpecSubs, processCollisions, "process JE collisions", false);
156-
157-
void processDataCharged(soa::Filtered<aod::JetCollisions>::iterator const& collision, soa::Filtered<aod::ChargedJets> const& jets)
158-
{
159-
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) {
160-
return;
161-
}
162-
//jets -> charged jet
163-
for (auto& jet : jets) {
164-
registry.fill(HIST("h_jet_pt"), jet.pt());
165-
registry.fill(HIST("h_jet_eta"), jet.eta());
166-
registry.fill(HIST("h_jet_phi"), jet.phi());
167-
}
155+
// jets -> charged jet
156+
for (auto& jet : jets) {
157+
registry.fill(HIST("h_jet_pt"), jet.pt());
158+
registry.fill(HIST("h_jet_eta"), jet.eta());
159+
registry.fill(HIST("h_jet_phi"), jet.phi());
168160
}
169-
PROCESS_SWITCH(JetDsSpecSubs, processDataCharged, "charged jets in data", false);
170-
171-
void processDataChargedSubstructure(aod::JetCollision const& collision,
172-
soa::Join<aod::DsChargedJets, aod::DsChargedJetConstituents> const& jets,
173-
aod::CandidatesDsData const&,
174-
aod::JetTracks const&)
175-
{
176-
// apply event selection and fill histograms for sanity check
177-
registry.fill(HIST("h_collision_counter"), 2.0);
178-
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || !(std::abs(collision.posZ()) < vertexZCut)) {
179-
return;
180-
}
181-
registry.fill(HIST("h_collision_counter"), 3.0);
182-
// jets -> charged jet with Ds
183-
for (const auto& jet : jets) {
184-
//number of charged jets with Ds
185-
registry.fill(HIST("h_jet_counter"), 0.5);
186-
// obtaining jet 3-vector
187-
TVector3 jetVector(jet.px(), jet.py(), jet.pz());
188-
189-
for (const auto& dsCandidate : jet.candidates_as<aod::CandidatesDsData>()) {
190-
191-
// obtaining jet 3-vector
192-
TVector3 dsVector(dsCandidate.px(), dsCandidate.py(), dsCandidate.pz());
193-
194-
// calculating fraction of the jet momentum carried by the Ds along the direction of the jet axis
195-
double zParallel = (jetVector * dsVector) / (jetVector * jetVector);
196-
197-
// calculating angular distance in eta-phi plane
198-
double axisDistance = jetutilities::deltaR(jet, dsCandidate);
199-
200-
// filling histograms
201-
registry.fill(HIST("h_ds_jet_projection"), zParallel);
202-
registry.fill(HIST("h_ds_jet_distance_vs_projection"), axisDistance, zParallel);
203-
registry.fill(HIST("h_ds_jet_distance"), axisDistance);
204-
registry.fill(HIST("h_ds_jet_pt"), jet.pt());
205-
registry.fill(HIST("h_ds_jet_eta"), jet.eta());
206-
registry.fill(HIST("h_ds_jet_phi"), jet.phi());
207-
registry.fill(HIST("h_ds_mass"), dsCandidate.m());
208-
registry.fill(HIST("h_ds_eta"), dsCandidate.eta());
209-
registry.fill(HIST("h_ds_phi"), dsCandidate.phi());
210-
211-
// filling table
212-
distJetTable(axisDistance,
213-
jet.pt(), jet.eta(), jet.phi(), jet.tracks_as<aod::JetTracks>().size(),
214-
dsCandidate.pt(), dsCandidate.eta(), dsCandidate.phi(), dsCandidate.m(), dsCandidate.y(), dsCandidate.mlScores()[0], dsCandidate.mlScores()[1], dsCandidate.mlScores()[2]);
215-
216-
break; // get out of candidates' loop after first HF particle is found in jet
217-
} // end of DS candidates loop
218-
219-
} // end of jets loop
220-
221-
} // end of process function
222-
PROCESS_SWITCH(JetDsSpecSubs, processDataChargedSubstructure, "charged HF jet substructure", false);
223-
224-
225-
161+
}
162+
PROCESS_SWITCH(JetDsSpecSubs, processDataCharged, "charged jets in data", false);
163+
164+
void processDataChargedSubstructure(aod::JetCollision const& collision,
165+
soa::Join<aod::DsChargedJets, aod::DsChargedJetConstituents> const& jets,
166+
aod::CandidatesDsData const&,
167+
aod::JetTracks const&)
168+
{
169+
// apply event selection and fill histograms for sanity check
170+
registry.fill(HIST("h_collision_counter"), 2.0);
171+
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || !(std::abs(collision.posZ()) < vertexZCut)) {
172+
return;
173+
}
174+
registry.fill(HIST("h_collision_counter"), 3.0);
175+
// jets -> charged jet with Ds
176+
for (const auto& jet : jets) {
177+
// number of charged jets with Ds
178+
registry.fill(HIST("h_jet_counter"), 0.5);
179+
// obtaining jet 3-vector
180+
TVector3 jetVector(jet.px(), jet.py(), jet.pz());
181+
182+
for (const auto& dsCandidate : jet.candidates_as<aod::CandidatesDsData>()) {
183+
184+
// obtaining jet 3-vector
185+
TVector3 dsVector(dsCandidate.px(), dsCandidate.py(), dsCandidate.pz());
186+
187+
// calculating fraction of the jet momentum carried by the Ds along the direction of the jet axis
188+
double zParallel = (jetVector * dsVector) / (jetVector * jetVector);
189+
190+
// calculating angular distance in eta-phi plane
191+
double axisDistance = jetutilities::deltaR(jet, dsCandidate);
192+
193+
// filling histograms
194+
registry.fill(HIST("h_ds_jet_projection"), zParallel);
195+
registry.fill(HIST("h_ds_jet_distance_vs_projection"), axisDistance, zParallel);
196+
registry.fill(HIST("h_ds_jet_distance"), axisDistance);
197+
registry.fill(HIST("h_ds_jet_pt"), jet.pt());
198+
registry.fill(HIST("h_ds_jet_eta"), jet.eta());
199+
registry.fill(HIST("h_ds_jet_phi"), jet.phi());
200+
registry.fill(HIST("h_ds_mass"), dsCandidate.m());
201+
registry.fill(HIST("h_ds_eta"), dsCandidate.eta());
202+
registry.fill(HIST("h_ds_phi"), dsCandidate.phi());
203+
204+
// filling table
205+
distJetTable(axisDistance,
206+
jet.pt(), jet.eta(), jet.phi(), jet.tracks_as<aod::JetTracks>().size(),
207+
dsCandidate.pt(), dsCandidate.eta(), dsCandidate.phi(), dsCandidate.m(), dsCandidate.y(), dsCandidate.mlScores()[0], dsCandidate.mlScores()[1], dsCandidate.mlScores()[2]);
208+
209+
break; // get out of candidates' loop after first HF particle is found in jet
210+
} // end of DS candidates loop
211+
212+
} // end of jets loop
213+
214+
} // end of process function
215+
PROCESS_SWITCH(JetDsSpecSubs, processDataChargedSubstructure, "charged HF jet substructure", false);
226216
};
227217

228-
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<JetDsSpecSubs>(cfgc, TaskName{"jet-ds-spectrum-subs"})}; }
218+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<JetDsSpecSubs>(cfgc, TaskName{"jet-ds-spectrum-subs"})}; }

0 commit comments

Comments
 (0)