Skip to content

Commit 5de43d5

Browse files
committed
Added config option to histogram creation as well
1 parent a7110bf commit 5de43d5

File tree

1 file changed

+44
-35
lines changed

1 file changed

+44
-35
lines changed

PWGDQ/Tasks/qaMatching.cxx

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ struct qaMatching {
317317
o2::framework::HistPtr eta_pdg_den;
318318

319319
EfficiencyPlotter(std::string path, std::string title,
320-
HistogramRegistry& registry)
320+
HistogramRegistry& registry, bool createPdgMomHistograms)
321321
{
322322
AxisSpec pAxis = {100, 0, 100, "p (GeV/c)"};
323323
AxisSpec pTAxis = {100, 0, 10, "p_{T} (GeV/c)"};
@@ -337,13 +337,15 @@ struct qaMatching {
337337
histTitle = title + " vs. p - den";
338338
p_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {pAxis}});
339339

340-
histName = path + "p_pdg_num";
341-
histTitle = title + " vs. p vs pdg ID - num";
342-
p_pdg_num = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {pAxis, motherPDGAxis}});
340+
if (createPdgMomHistograms) {
341+
histName = path + "p_pdg_num";
342+
histTitle = title + " vs. p vs pdg ID - num";
343+
p_pdg_num = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {pAxis, motherPDGAxis}});
343344

344-
histName = path + "p_pdg_den";
345-
histTitle = title + " vs. p vs pdg ID - den";
346-
p_pdg_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {pAxis, motherPDGAxis}});
345+
histName = path + "p_pdg_den";
346+
histTitle = title + " vs. p vs pdg ID - den";
347+
p_pdg_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {pAxis, motherPDGAxis}});
348+
}
347349

348350
// pT dependence
349351
histName = path + "pt_num";
@@ -354,13 +356,16 @@ struct qaMatching {
354356
histTitle = title + " vs. p_{T} - den";
355357
pt_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {pTAxis}});
356358

357-
histName = path + "pt_pdg_num";
358-
histTitle = title + " vs. p_{T} vs pdg ID - num";
359-
pt_pdg_num = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {pTAxis, motherPDGAxis}});
359+
if (createPdgMomHistograms) {
360+
histName = path + "pt_pdg_num";
361+
histTitle = title + " vs. p_{T} vs pdg ID - num";
362+
pt_pdg_num = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {pTAxis, motherPDGAxis}});
363+
360364

361-
histName = path + "pt_pdg_den";
362-
histTitle = title + " vs. p_{T} vs pdg ID - den";
363-
pt_pdg_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {pTAxis, motherPDGAxis}});
365+
histName = path + "pt_pdg_den";
366+
histTitle = title + " vs. p_{T} vs pdg ID - den";
367+
pt_pdg_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {pTAxis, motherPDGAxis}});
368+
}
364369

365370
// eta dependence
366371
histName = path + "eta_num";
@@ -371,13 +376,15 @@ struct qaMatching {
371376
histTitle = title + " vs. #eta - den";
372377
eta_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {etaAxis}});
373378

374-
histName = path + "eta_pdg_num";
375-
histTitle = title + " vs. #eta vs pdg ID - num";
376-
eta_pdg_num = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {etaAxis, motherPDGAxis}});
379+
if (createPdgMomHistograms) {
380+
histName = path + "eta_pdg_num";
381+
histTitle = title + " vs. #eta vs pdg ID - num";
382+
eta_pdg_num = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {etaAxis, motherPDGAxis}});
377383

378-
histName = path + "eta_pdg_den";
379-
histTitle = title + " vs. #eta vs pdg ID - den";
380-
eta_pdg_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {etaAxis, motherPDGAxis}});
384+
histName = path + "eta_pdg_den";
385+
histTitle = title + " vs. #eta vs pdg ID - den";
386+
eta_pdg_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {etaAxis, motherPDGAxis}});
387+
}
381388

382389
// phi dependence
383390
histName = path + "phi_num";
@@ -388,13 +395,15 @@ struct qaMatching {
388395
histTitle = title + " vs. #phi - den";
389396
phi_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {phiAxis}});
390397

391-
histName = path + "phi_pdg_num";
392-
histTitle = title + " vs. #phi vs pdg ID - num";
393-
phi_pdg_num = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {phiAxis, motherPDGAxis}});
398+
if (createPdgMomHistograms) {
399+
histName = path + "phi_pdg_num";
400+
histTitle = title + " vs. #phi vs pdg ID - num";
401+
phi_pdg_num = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {phiAxis, motherPDGAxis}});
394402

395-
histName = path + "phi_pdg_den";
396-
histTitle = title + " vs. #phi vs pdg ID - den";
397-
phi_pdg_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {phiAxis, motherPDGAxis}});
403+
histName = path + "phi_pdg_den";
404+
histTitle = title + " vs. #phi vs pdg ID - den";
405+
phi_pdg_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {phiAxis, motherPDGAxis}});
406+
}
398407
}
399408

400409
template <class T>
@@ -521,11 +530,11 @@ struct qaMatching {
521530
HistogramRegistry* registry;
522531

523532
MatchingPlotter(std::string path,
524-
HistogramRegistry* reg)
525-
: fMatchingPurityPlotter(path + "matching-purity/", "Matching purity", *reg),
526-
fPairingEfficiencyPlotter(path + "pairing-efficiency/", "Pairing efficiency", *reg),
527-
fMatchingEfficiencyPlotter(path + "matching-efficiency/", "Matching efficiency", *reg),
528-
fFakeMatchingEfficiencyPlotter(path + "fake-matching-efficiency/", "Fake matching efficiency", *reg)
533+
HistogramRegistry* reg, bool createPdgMomHistograms)
534+
: fMatchingPurityPlotter(path + "matching-purity/", "Matching purity", *reg, createPdgMomHistograms),
535+
fPairingEfficiencyPlotter(path + "pairing-efficiency/", "Pairing efficiency", *reg, createPdgMomHistograms),
536+
fMatchingEfficiencyPlotter(path + "matching-efficiency/", "Matching efficiency", *reg, createPdgMomHistograms),
537+
fFakeMatchingEfficiencyPlotter(path + "fake-matching-efficiency/", "Fake matching efficiency", *reg, createPdgMomHistograms)
529538
{
530539
registry = reg;
531540
AxisSpec pAxis = {100, 0, 100, "p (GeV/c)"};
@@ -751,19 +760,19 @@ struct qaMatching {
751760
registry.add((histPath + "selectedMCHTracksAtMFTTrue").c_str(), "Selected MCH tracks position at MFT end - true", {HistType::kTH2F, {trackPositionXAtMFTAxis, trackPositionYAtMFTAxis}});
752761
registry.add((histPath + "selectedMCHTracksAtMFTFake").c_str(), "Selected MCH tracks position at MFT end - fake", {HistType::kTH2F, {trackPositionXAtMFTAxis, trackPositionYAtMFTAxis}});
753762

754-
fChi2MatchingPlotter = std::make_unique<MatchingPlotter>(histPath + "Prod/", &registryMatching);
763+
fChi2MatchingPlotter = std::make_unique<MatchingPlotter>(histPath + "Prod/", &registryMatching, fConfigQAs.fCreatePdgMomHistograms);
755764
int registryIndex = 0;
756765
for (const auto& [label, func] : matchingChi2Functions) {
757-
fMatchingPlotters[label] = std::make_unique<MatchingPlotter>(histPath + label + "/", registryMatchingVec[registryIndex]);
766+
fMatchingPlotters[label] = std::make_unique<MatchingPlotter>(histPath + label + "/", registryMatchingVec[registryIndex], fConfigQAs.fCreatePdgMomHistograms);
758767
registryIndex += 1;
759768
}
760769
for (const auto& [label, response] : matchingMlResponses) {
761-
fMatchingPlotters[label] = std::make_unique<MatchingPlotter>(histPath + label + "/", (registryMatchingVec[registryIndex]));
770+
fMatchingPlotters[label] = std::make_unique<MatchingPlotter>(histPath + label + "/", (registryMatchingVec[registryIndex]), fConfigQAs.fCreatePdgMomHistograms);
762771
registryIndex += 1;
763772
}
764773

765-
fTaggedMuonsMatchingPlotter = std::make_unique<MatchingPlotter>(histPath + "Tagged/", &registryMatching);
766-
fSelectedMuonsMatchingPlotter = std::make_unique<MatchingPlotter>(histPath + "Selected/", &registryMatching);
774+
fTaggedMuonsMatchingPlotter = std::make_unique<MatchingPlotter>(histPath + "Tagged/", &registryMatching, fConfigQAs.fCreatePdgMomHistograms);
775+
fSelectedMuonsMatchingPlotter = std::make_unique<MatchingPlotter>(histPath + "Selected/", &registryMatching, fConfigQAs.fCreatePdgMomHistograms);
767776
}
768777

769778
void CreateDimuonHistos()

0 commit comments

Comments
 (0)