Skip to content

Commit d8ef586

Browse files
committed
[PWGHF] Add centrality branch to Lc candidate tree
1 parent 934a334 commit d8ef586

1 file changed

Lines changed: 26 additions & 12 deletions

File tree

PWGHF/TableProducer/treeCreatorLcToPKPi.cxx

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ DECLARE_SOA_TABLE(HfCandLcLites, "AOD", "HFCANDLCLITE",
262262
full::MassKPi,
263263
full::MlScoreFirstClass,
264264
full::MlScoreSecondClass,
265-
full::MlScoreThirdClass);
265+
full::MlScoreThirdClass,
266+
full::CentFT0C);
266267

267268
DECLARE_SOA_TABLE(HfCollIdLCLite, "AOD", "HFCOLLIDLCLITE",
268269
full::CollisionId);
@@ -343,7 +344,8 @@ DECLARE_SOA_TABLE(HfCandLcFulls, "AOD", "HFCANDLCFULL",
343344
full::MassKPi,
344345
full::MlScoreFirstClass,
345346
full::MlScoreSecondClass,
346-
full::MlScoreThirdClass);
347+
full::MlScoreThirdClass,
348+
full::CentFT0C);
347349

348350
DECLARE_SOA_TABLE(HfCandLcFullEvs, "AOD", "HFCANDLCFULLEV",
349351
full::CollisionId,
@@ -607,8 +609,8 @@ struct HfTreeCreatorLcToPKPi {
607609
/// \param candidate candidate instance
608610
/// \param candidateMlScore instance of handler of vectors with ML scores associated with the current candidate
609611
/// \param candFlag flag indicating if PKPi (0) or PiKP (1) hypothesis is used
610-
template <bool IsMc, typename CandType>
611-
void fillLiteTable(CandType const& candidate, aod::HfMlLcToPKPi::iterator const& candidateMlScore, int candFlag)
612+
template <bool UseCentrality, bool IsMc, typename CandType, typename CollType>
613+
void fillLiteTable(CandType const& candidate, CollType const& collision, aod::HfMlLcToPKPi::iterator const& candidateMlScore, int candFlag)
612614
{
613615
auto [functionInvMass, functionInvMassKPi] = evaluateInvariantMassesDCAFitter(candidate, candFlag);
614616
const float functionCt = HfHelper::ctLc(candidate);
@@ -633,6 +635,11 @@ struct HfTreeCreatorLcToPKPi {
633635
if (applyMl) {
634636
assignMlScores(candidateMlScore, mlScoreFirstClass, mlScoreSecondClass, mlScoreThirdClass, candFlag);
635637
}
638+
639+
float centFT0C = -1.f;
640+
if constexpr (UseCentrality) {
641+
centFT0C = collision.centFT0C();
642+
}
636643

637644
rowCandidateLite(
638645
candidate.posX(),
@@ -681,7 +688,8 @@ struct HfTreeCreatorLcToPKPi {
681688
functionInvMassKPi,
682689
mlScoreFirstClass,
683690
mlScoreSecondClass,
684-
mlScoreThirdClass);
691+
mlScoreThirdClass,
692+
centFT0C);
685693

686694
if (fillCollIdTable) {
687695
/// save also candidate collision indices
@@ -693,8 +701,8 @@ struct HfTreeCreatorLcToPKPi {
693701
/// \param candidate candidate instance
694702
/// \param candidateMlScore instance of handler of vectors with ML scores associated with the current candidate
695703
/// \param candFlag flag indicating if PKPi (0) or PiKP (1) hypothesis is used
696-
template <bool IsMc, typename CandType>
697-
void fillFullTable(CandType const& candidate, aod::HfMlLcToPKPi::iterator const& candidateMlScore, int candFlag)
704+
template <bool UseCentrality, bool IsMc, typename CandType, typename CollType>
705+
void fillFullTable(CandType const& candidate, CollType const& collision, aod::HfMlLcToPKPi::iterator const& candidateMlScore, int candFlag)
698706
{
699707
auto [functionInvMass, functionInvMassKPi] = evaluateInvariantMassesDCAFitter(candidate, candFlag);
700708
const float functionCt = HfHelper::ctLc(candidate);
@@ -720,6 +728,11 @@ struct HfTreeCreatorLcToPKPi {
720728
if (applyMl) {
721729
assignMlScores(candidateMlScore, mlScoreFirstClass, mlScoreSecondClass, mlScoreThirdClass, candFlag);
722730
}
731+
732+
float centFT0C = -1.f;
733+
if constexpr (UseCentrality) {
734+
centFT0C = collision.centFT0C();
735+
}
723736

724737
rowCandidateFull(
725738
candidate.collisionId(),
@@ -797,7 +810,8 @@ struct HfTreeCreatorLcToPKPi {
797810
functionInvMassKPi,
798811
mlScoreFirstClass,
799812
mlScoreSecondClass,
800-
mlScoreThirdClass);
813+
mlScoreThirdClass,
814+
centFT0C);
801815
}
802816

803817
/// \brief function to fill lite table
@@ -944,9 +958,9 @@ struct HfTreeCreatorLcToPKPi {
944958
const bool notSkippedBkg = isMcCandidateSignal || candidate.pt() > downSampleBkgPtMax || pseudoRndm < downSampleBkgFactor;
945959
if (passSelection && notSkippedBkg && (keepAll || (keepSignalMc && isMcCandidateSignal) || (keepBkgMc && !isMcCandidateSignal) || (keepCorrBkgMC && isCorrBkg))) {
946960
if (fillCandidateLiteTable) {
947-
fillLiteTable<IsMc>(candidate, candidateMlScore, candFlag);
961+
fillLiteTable<UseCentrality, IsMc>(candidate, collision, candidateMlScore, candFlag);
948962
} else {
949-
fillFullTable<IsMc>(candidate, candidateMlScore, candFlag);
963+
fillFullTable<UseCentrality, IsMc>(candidate, collision, candidateMlScore, candFlag);
950964
}
951965

952966
if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) {
@@ -1126,9 +1140,9 @@ struct HfTreeCreatorLcToPKPi {
11261140
const int functionSelection = candFlag == 0 ? candidate.isSelLcToPKPi() : candidate.isSelLcToPiKP();
11271141
if (functionSelection >= selectionFlagLc && (candidate.pt() > downSampleBkgPtMax || (pseudoRndm < downSampleBkgFactor && candidate.pt() < downSampleBkgPtMax))) {
11281142
if (fillCandidateLiteTable) {
1129-
fillLiteTable<IsMc>(candidate, candidateMlScore, candFlag);
1143+
fillLiteTable<UseCentrality, IsMc>(candidate, collision, candidateMlScore, candFlag);
11301144
} else {
1131-
fillFullTable<IsMc>(candidate, candidateMlScore, candFlag);
1145+
fillFullTable<UseCentrality, IsMc>(candidate, collision, candidateMlScore, candFlag);
11321146
}
11331147

11341148
if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) {

0 commit comments

Comments
 (0)