Skip to content

Commit 22cfed3

Browse files
[PWGHF] Fix a potential bug for filling the ThnSparse of MC Generated (AliceO2Group#9336)
1 parent cb9e3e9 commit 22cfed3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

PWGHF/D2H/Tasks/taskLc.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,9 @@ struct HfTaskLc {
551551
registry.fill(HIST("MC/generated/signal/hPhiVsPtGenSig"), particle.phi(), ptGen);
552552

553553
if (particle.originMcGen() == RecoDecay::OriginType::Prompt) {
554-
registry.get<THnSparse>(HIST("hnLcVarsGen"))->Fill(ptGen, yGen, numPvContributors, ptGenB, originType);
554+
if (fillTHn) {
555+
registry.get<THnSparse>(HIST("hnLcVarsGen"))->Fill(ptGen, yGen, numPvContributors, ptGenB, originType);
556+
}
555557
registry.fill(HIST("MC/generated/prompt/hPtGenPrompt"), ptGen);
556558
registry.fill(HIST("MC/generated/prompt/hEtaGenPrompt"), particle.eta());
557559
registry.fill(HIST("MC/generated/prompt/hYGenPrompt"), yGen);
@@ -562,7 +564,9 @@ struct HfTaskLc {
562564
}
563565
if (particle.originMcGen() == RecoDecay::OriginType::NonPrompt) {
564566
ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt();
565-
registry.get<THnSparse>(HIST("hnLcVarsGen"))->Fill(ptGen, yGen, numPvContributors, ptGenB, originType);
567+
if (fillTHn) {
568+
registry.get<THnSparse>(HIST("hnLcVarsGen"))->Fill(ptGen, yGen, numPvContributors, ptGenB, originType);
569+
}
566570
registry.fill(HIST("MC/generated/nonprompt/hPtGenNonPrompt"), ptGen);
567571
registry.fill(HIST("MC/generated/nonprompt/hEtaGenNonPrompt"), particle.eta());
568572
registry.fill(HIST("MC/generated/nonprompt/hYGenNonPrompt"), yGen);

0 commit comments

Comments
 (0)