Skip to content

Commit bb3a0a5

Browse files
committed
swap occupancy and lifetime axes for backward compatibility
1 parent 8d6e98c commit bb3a0a5

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

PWGHF/D2H/Tasks/taskLc.cxx

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -354,18 +354,17 @@ struct HfTaskLc {
354354
axesWithBdt = {thnAxisMass, thnAxisPt, thnAxisCentrality, thnAxisBdtScoreLcBkg, thnAxisBdtScoreLcPrompt, thnAxisBdtScoreLcNonPrompt, thnAxisTracklets, thnAxisPtB, thnAxisCanType};
355355
}
356356

357-
if (storeProperLifetime) {
358-
for (const auto& axes : std::array<std::vector<AxisSpec>*, 2>{&axesGen, &axesWithBdt}) {
357+
if (storeOccupancy) {
358+
for (const auto& axes : std::array<std::vector<AxisSpec>*, 3>{&axesWithBdt, &axesStd, &axesGen}) {
359359
if (!axes->empty()) {
360-
axes->push_back(thnAxisProperLifetime);
360+
axes->push_back(thnAxisOccupancy);
361361
}
362362
}
363363
}
364-
365-
if (storeOccupancy) {
366-
for (const auto& axes : std::array<std::vector<AxisSpec>*, 3>{&axesWithBdt, &axesStd, &axesGen}) {
364+
if (storeProperLifetime) {
365+
for (const auto& axes : std::array<std::vector<AxisSpec>*, 2>{&axesGen, &axesWithBdt}) {
367366
if (!axes->empty()) {
368-
axes->push_back(thnAxisOccupancy);
367+
axes->push_back(thnAxisProperLifetime);
369368
}
370369
}
371370
}
@@ -574,12 +573,12 @@ struct HfTaskLc {
574573
}
575574
/// Fill the ML outputScores and variables of candidate
576575
std::vector<double> valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast<double>(numPvContributors), ptRecB, static_cast<double>(originType)};
577-
if (storeProperLifetime) {
578-
valuesToFill.push_back(properLifetime);
579-
}
580576
if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
581577
valuesToFill.push_back(occ);
582578
}
579+
if (storeProperLifetime) {
580+
valuesToFill.push_back(properLifetime);
581+
}
583582
registry.get<THnSparse>(HIST("hnLcVarsWithBdt"))->Fill(valuesToFill.data());
584583
} else {
585584
std::vector<double> valuesToFill{massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast<double>(numPvContributors), ptRecB, static_cast<double>(originType)};
@@ -600,12 +599,12 @@ struct HfTaskLc {
600599
}
601600
/// Fill the ML outputScores and variables of candidate (todo: add multiplicity)
602601
std::vector<double> valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast<double>(numPvContributors), ptRecB, static_cast<double>(originType)};
603-
if (storeProperLifetime) {
604-
valuesToFill.push_back(properLifetime);
605-
}
606602
if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
607603
valuesToFill.push_back(occ);
608604
}
605+
if (storeProperLifetime) {
606+
valuesToFill.push_back(properLifetime);
607+
}
609608
registry.get<THnSparse>(HIST("hnLcVarsWithBdt"))->Fill(valuesToFill.data());
610609
} else {
611610
std::vector<double> valuesToFill{massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast<double>(numPvContributors), ptRecB, static_cast<double>(originType)};
@@ -662,12 +661,12 @@ struct HfTaskLc {
662661
if (particle.originMcGen() == RecoDecay::OriginType::Prompt) {
663662
if (fillTHn) {
664663
std::vector<double> valuesToFill{ptGen, cent, yGen, static_cast<double>(numPvContributors), ptGenB, static_cast<double>(originType)};
665-
if (storeProperLifetime) {
666-
valuesToFill.push_back(properLifetime);
667-
}
668664
if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
669665
valuesToFill.push_back(occ);
670666
}
667+
if (storeProperLifetime) {
668+
valuesToFill.push_back(properLifetime);
669+
}
671670
registry.get<THnSparse>(HIST("hnLcVarsGen"))->Fill(valuesToFill.data());
672671
}
673672
registry.fill(HIST("MC/generated/prompt/hPtGenPrompt"), ptGen);
@@ -682,12 +681,12 @@ struct HfTaskLc {
682681
ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt();
683682
if (fillTHn) {
684683
std::vector<double> valuesToFill{ptGen, cent, yGen, static_cast<double>(numPvContributors), ptGenB, static_cast<double>(originType)};
685-
if (storeProperLifetime) {
686-
valuesToFill.push_back(properLifetime);
687-
}
688684
if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
689685
valuesToFill.push_back(occ);
690686
}
687+
if (storeProperLifetime) {
688+
valuesToFill.push_back(properLifetime);
689+
}
691690
registry.get<THnSparse>(HIST("hnLcVarsGen"))->Fill(valuesToFill.data());
692691
}
693692
registry.fill(HIST("MC/generated/nonprompt/hPtGenNonPrompt"), ptGen);
@@ -791,12 +790,12 @@ struct HfTaskLc {
791790
}
792791
/// Fill the ML outputScores and variables of candidate
793792
std::vector<double> valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast<double>(numPvContributors)};
794-
if (storeProperLifetime) {
795-
valuesToFill.push_back(properLifetime);
796-
}
797793
if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
798794
valuesToFill.push_back(occ);
799795
}
796+
if (storeProperLifetime) {
797+
valuesToFill.push_back(properLifetime);
798+
}
800799
registry.get<THnSparse>(HIST("hnLcVarsWithBdt"))->Fill(valuesToFill.data());
801800
} else {
802801
std::vector<double> valuesToFill{massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast<double>(numPvContributors)};
@@ -817,12 +816,12 @@ struct HfTaskLc {
817816
}
818817
/// Fill the ML outputScores and variables of candidate
819818
std::vector<double> valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast<double>(numPvContributors)};
820-
if (storeProperLifetime) {
821-
valuesToFill.push_back(properLifetime);
822-
}
823819
if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
824820
valuesToFill.push_back(occ);
825821
}
822+
if (storeProperLifetime) {
823+
valuesToFill.push_back(properLifetime);
824+
}
826825
registry.get<THnSparse>(HIST("hnLcVarsWithBdt"))->Fill(valuesToFill.data());
827826
} else {
828827
std::vector<double> valuesToFill{massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast<double>(numPvContributors)};

0 commit comments

Comments
 (0)