Skip to content

Commit 39cb717

Browse files
Converted data process function to templated version. It allows the processing of D0 and Lc jets.
1 parent 56509af commit 39cb717

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

PWGJE/Tasks/hfFragmentationFunction.cxx

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ struct HfFragmentationFunction {
192192

193193
Configurable<float> vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"};
194194
Configurable<std::string> eventSelections{"eventSelections", "sel8", "choose event selection"};
195+
Configurable<std::string> chosenHadron{"chosenHadron", "D0", "choose hadron for analysis: D0 or Lc"};
195196

196197
std::vector<int> eventSelectionBits;
197198

@@ -231,10 +232,11 @@ struct HfFragmentationFunction {
231232
void processDummy(aod::TracksIU const&) {}
232233
PROCESS_SWITCH(HfFragmentationFunction, processDummy, "Dummy process function turned on by default", true);
233234

234-
void processDataChargedSubstructure(aod::JetCollision const& collision,
235-
soa::Join<aod::D0ChargedJets, aod::D0ChargedJetConstituents> const& jets,
236-
aod::CandidatesD0Data const&,
237-
aod::JetTracks const&)
235+
template <typename TJets, typename TCandidates>
236+
void analyzeData(aod::JetCollision const& collision,
237+
TJets const& jets,
238+
TCandidates const&,
239+
aod::JetTracks const&)
238240
{
239241
// apply event selection and fill histograms for sanity check
240242
registry.fill(HIST("h_collision_counter"), 2.0);
@@ -249,16 +251,16 @@ struct HfFragmentationFunction {
249251
// obtaining jet 3-vector
250252
TVector3 jetVector(jet.px(), jet.py(), jet.pz());
251253

252-
for (const auto& d0Candidate : jet.candidates_as<aod::CandidatesD0Data>()) {
254+
for (const auto& candidate : jet.template candidates_as<TCandidates>()) {
253255

254256
// obtaining jet 3-vector
255-
TVector3 d0Vector(d0Candidate.px(), d0Candidate.py(), d0Candidate.pz());
257+
TVector3 hadronMomentum(candidate.px(), candidate.py(), candidate.pz());
256258

257-
// calculating fraction of the jet momentum carried by the D0 along the direction of the jet axis
258-
double zParallel = (jetVector * d0Vector) / (jetVector * jetVector);
259+
// calculating fraction of the jet momentum carried by the HF hadron along the direction of the jet axis
260+
double zParallel = (jetVector * hadronMomentum) / (jetVector * jetVector);
259261

260262
// calculating angular distance in eta-phi plane
261-
double axisDistance = jetutilities::deltaR(jet, d0Candidate);
263+
double axisDistance = jetutilities::deltaR(jet, candidate);
262264

263265
// filling histograms
264266
registry.fill(HIST("h_d0_jet_projection"), zParallel);
@@ -267,22 +269,36 @@ struct HfFragmentationFunction {
267269
registry.fill(HIST("h_d0_jet_pt"), jet.pt());
268270
registry.fill(HIST("h_d0_jet_eta"), jet.eta());
269271
registry.fill(HIST("h_d0_jet_phi"), jet.phi());
270-
registry.fill(HIST("h_d0_mass"), d0Candidate.m());
271-
registry.fill(HIST("h_d0_eta"), d0Candidate.eta());
272-
registry.fill(HIST("h_d0_phi"), d0Candidate.phi());
272+
registry.fill(HIST("h_d0_mass"), candidate.m());
273+
registry.fill(HIST("h_d0_eta"), candidate.eta());
274+
registry.fill(HIST("h_d0_phi"), candidate.phi());
273275

274276
// filling table
275277
distJetTable(axisDistance,
276-
jet.pt(), jet.eta(), jet.phi(), jet.tracks_as<aod::JetTracks>().size(),
277-
d0Candidate.pt(), d0Candidate.eta(), d0Candidate.phi(), d0Candidate.m(), d0Candidate.y(), d0Candidate.mlScores()[0], d0Candidate.mlScores()[1], d0Candidate.mlScores()[2]);
278+
jet.pt(), jet.eta(), jet.phi(), jet.template tracks_as<aod::JetTracks>().size(),
279+
candidate.pt(), candidate.eta(), candidate.phi(), candidate.m(), candidate.y(), candidate.mlScores()[0], candidate.mlScores()[1], candidate.mlScores()[2]);
278280

279281
break; // get out of candidates' loop after first HF particle is found in jet
280-
} // end of D0 candidates loop
282+
} // end of HF hadron candidates loop
281283

282284
} // end of jets loop
283285

284286
} // end of process function
285-
PROCESS_SWITCH(HfFragmentationFunction, processDataChargedSubstructure, "charged HF jet substructure", false);
287+
void processD0DataChargedSubstructure(aod::JetCollision const& collision,
288+
soa::Join<aod::D0ChargedJets, aod::D0ChargedJetConstituents> const& jets,
289+
aod::CandidatesD0Data const& candidates,
290+
aod::JetTracks const& jettracks) {
291+
analyzeData<soa::Join<aod::D0ChargedJets, aod::D0ChargedJetConstituents>, aod::CandidatesD0Data>(collision, jets, candidates, jettracks);
292+
}
293+
PROCESS_SWITCH(HfFragmentationFunction, processD0DataChargedSubstructure, "charged D0 jet subtructure", false);
294+
295+
void processLcDataChargedSubstructure(aod::JetCollision const& collision,
296+
soa::Join<aod::LcChargedJets, aod::LcChargedJetConstituents> const& jets,
297+
aod::CandidatesLcData const& candidates,
298+
aod::JetTracks const& jettracks) {
299+
analyzeData<soa::Join<aod::LcChargedJets, aod::LcChargedJetConstituents>, aod::CandidatesLcData>(collision, jets, candidates, jettracks);
300+
}
301+
PROCESS_SWITCH(HfFragmentationFunction, processLcDataChargedSubstructure, "charged Lc jet subtructure", false);
286302

287303
void processMcEfficiency(aod::JetMcCollisions const& mccollisions,
288304
aod::JetCollisionsMCD const& collisions,

0 commit comments

Comments
 (0)