Skip to content

Commit 1e05327

Browse files
PWGHF: add output THnSparse for non-ML D0 analysis (#7343)
* PWGHF: add output THnSparse for non-ML D0 analysis Remove BDT score axis in the THnSparse if ML is not applied, set MC gen output THnSparse as default. * fix format issue
1 parent 0b10919 commit 1e05327

1 file changed

Lines changed: 32 additions & 17 deletions

File tree

PWGHF/D2H/Tasks/taskD0.cxx

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -211,23 +211,27 @@ struct HfTaskD0 {
211211
registry.add("hDecLengthVsPtSig", "2-prong candidates;decay length (cm) vs #it{p}_{T} for signal;entries", {HistType::kTH2F, {{800, 0., 4.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
212212
registry.add("hDecLengthxyVsPtSig", "2-prong candidates;decay length xy (cm) vs #it{p}_{T} for signal;entries", {HistType::kTH2F, {{800, 0., 4.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}});
213213

214+
const AxisSpec thnAxisMass{thnConfigAxisMass, "inv. mass (#pi K) (GeV/#it{c}^{2})"};
215+
const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T} (GeV/#it{c})"};
216+
const AxisSpec thnAxisPtB{thnConfigAxisPtB, "#it{p}_{T}^{B} (GeV/#it{c})"};
217+
const AxisSpec thnAxisY{thnConfigAxisY, "y"};
218+
const AxisSpec thnAxisOrigin{thnConfigAxisOrigin, "Origin"};
219+
const AxisSpec thnAxisCandType{thnConfigAxisCandType, "D0 type"};
220+
const AxisSpec thnAxisGenPtD{thnConfigAxisGenPtD, "#it{p}_{T} (GeV/#it{c})"};
221+
const AxisSpec thnAxisGenPtB{thnConfigAxisGenPtB, "#it{p}_{T}^{B} (GeV/#it{c})"};
222+
223+
registry.add("hSparseAcc", "Thn for generated D0 from charm and beauty", HistType::kTHnSparseD, {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin});
224+
registry.get<THnSparse>(HIST("hSparseAcc"))->Sumw2();
225+
214226
if (applyMl) {
215227
const AxisSpec thnAxisBkgScore{thnConfigAxisBkgScore, "BDT score bkg."};
216228
const AxisSpec thnAxisNonPromptScore{thnConfigAxisNonPromptScore, "BDT score non-prompt."};
217-
const AxisSpec thnAxisMass{thnConfigAxisMass, "inv. mass (#pi K) (GeV/#it{c}^{2})"};
218-
const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T} (GeV/#it{c})"};
219-
const AxisSpec thnAxisPtB{thnConfigAxisPtB, "#it{p}_{T}^{B} (GeV/#it{c})"};
220-
const AxisSpec thnAxisY{thnConfigAxisY, "y"};
221-
const AxisSpec thnAxisOrigin{thnConfigAxisOrigin, "Origin"};
222-
const AxisSpec thnAxisCandType{thnConfigAxisCandType, "D0 type"};
223-
const AxisSpec thnAxisGenPtD{thnConfigAxisGenPtD, "#it{p}_{T} (GeV/#it{c})"};
224-
const AxisSpec thnAxisGenPtB{thnConfigAxisGenPtB, "#it{p}_{T}^{B} (GeV/#it{c})"};
225-
226-
registry.add("hSparseAcc", "Thn for generated D0 from charm and beauty", HistType::kTHnSparseD, {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin});
227-
registry.get<THnSparse>(HIST("hSparseAcc"))->Sumw2();
228229

229230
registry.add("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates with BDT scores", HistType::kTHnSparseD, {thnAxisBkgScore, thnAxisNonPromptScore, thnAxisMass, thnAxisPt, thnAxisPtB, thnAxisY, thnAxisOrigin, thnAxisCandType});
230231
registry.get<THnSparse>(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"))->Sumw2();
232+
} else {
233+
registry.add("hMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates without BDT scores", HistType::kTHnSparseD, {thnAxisMass, thnAxisPt, thnAxisPtB, thnAxisY, thnAxisOrigin, thnAxisCandType});
234+
registry.get<THnSparse>(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"))->Sumw2();
231235
}
232236
}
233237

@@ -298,6 +302,13 @@ struct HfTaskD0 {
298302
if (candidate.isSelD0bar() >= selectionFlagD0bar) {
299303
registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], massD0bar, ptCandidate, -1, hfHelper.yD0(candidate), 0, SigD0bar);
300304
}
305+
} else {
306+
if (candidate.isSelD0() >= selectionFlagD0) {
307+
registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, -1, hfHelper.yD0(candidate), 0, SigD0);
308+
}
309+
if (candidate.isSelD0bar() >= selectionFlagD0bar) {
310+
registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, -1, hfHelper.yD0(candidate), 0, SigD0bar);
311+
}
301312
}
302313
}
303314
}
@@ -464,6 +475,8 @@ struct HfTaskD0 {
464475
registry.fill(HIST("hMassSigD0"), massD0, ptCandidate, rapidityCandidate);
465476
if constexpr (applyMl) {
466477
registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], massD0, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), SigD0);
478+
} else {
479+
registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), SigD0);
467480
}
468481
} else {
469482
registry.fill(HIST("hPtProng0Bkg"), ptProng0, rapidityCandidate);
@@ -484,6 +497,8 @@ struct HfTaskD0 {
484497
registry.fill(HIST("hMassReflBkgD0"), massD0, ptCandidate, rapidityCandidate);
485498
if constexpr (applyMl) {
486499
registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], massD0, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), ReflectedD0);
500+
} else {
501+
registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), ReflectedD0);
487502
}
488503
}
489504
}
@@ -494,13 +509,17 @@ struct HfTaskD0 {
494509
registry.fill(HIST("hMassSigD0bar"), massD0bar, ptCandidate, rapidityCandidate);
495510
if constexpr (applyMl) {
496511
registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], massD0bar, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), SigD0bar);
512+
} else {
513+
registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), SigD0bar);
497514
}
498515
} else {
499516
registry.fill(HIST("hMassBkgD0bar"), massD0bar, ptCandidate, rapidityCandidate);
500517
if (candidate.flagMcMatchRec() == (1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) {
501518
registry.fill(HIST("hMassReflBkgD0bar"), massD0bar, ptCandidate, rapidityCandidate);
502519
if constexpr (applyMl) {
503520
registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], massD0bar, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), ReflectedD0bar);
521+
} else {
522+
registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), ReflectedD0bar);
504523
}
505524
}
506525
}
@@ -522,17 +541,13 @@ struct HfTaskD0 {
522541
registry.fill(HIST("hPtGenPrompt"), ptGen);
523542
registry.fill(HIST("hYGenPrompt"), yGen);
524543
registry.fill(HIST("hPtVsYGenPrompt"), ptGen, yGen);
525-
if constexpr (applyMl) {
526-
registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 1);
527-
}
544+
registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 1);
528545
} else {
529546
ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt();
530547
registry.fill(HIST("hPtGenNonPrompt"), ptGen);
531548
registry.fill(HIST("hYGenNonPrompt"), yGen);
532549
registry.fill(HIST("hPtVsYGenNonPrompt"), ptGen, yGen);
533-
if constexpr (applyMl) {
534-
registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 2);
535-
}
550+
registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 2);
536551
}
537552
registry.fill(HIST("hEtaGen"), particle.eta());
538553
}

0 commit comments

Comments
 (0)