Skip to content

Commit 0fd546b

Browse files
Add HypothesisMask and CandidateGlobalIndex columns
1 parent 7b07cdd commit 0fd546b

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

PWGHF/D2H/Tasks/taskCd.cxx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ DECLARE_SOA_COLUMN(CandidateSelFlag, candidateSelFlag, int8_t); //! Candidat
117117
DECLARE_SOA_COLUMN(CandidateSign, candidateSign, int8_t); //! Candidates sign
118118
DECLARE_SOA_COLUMN(FlagMc, flagMc, int8_t); //! Main MC decay-channel flag; 0 for unmatched candidates
119119
DECLARE_SOA_COLUMN(IsCandidateSwapped, isCandidateSwapped, int8_t); //! MC-matched prong permutation; -1 for data
120+
DECLARE_SOA_COLUMN(HypothesisMask, hypothesisMask, uint8_t); //! Bit 0: DeKPi selected; bit 1: PiKDe selected
121+
DECLARE_SOA_COLUMN(CandidateGlobalIndex, candidateGlobalIndex, int64_t); //! Input candidate index, shared by rows from the same candidate
120122
DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); //! MC origin for reconstructed candidates
121123
DECLARE_SOA_COLUMN(FlagMcDecayChanRec, flagMcDecayChanRec, int8_t); //! Resonant MC decay channel for reconstructed candidates
122124
DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); //! MC origin for generated particles
@@ -158,6 +160,9 @@ DECLARE_SOA_TABLE(HfCandCdLite, "AOD", "HFCANDCDLITE",
158160
full::CandidateSelFlag,
159161
full::CandidateSign,
160162
full::FlagMc,
163+
full::IsCandidateSwapped,
164+
full::HypothesisMask,
165+
full::CandidateGlobalIndex,
161166
full::OriginMcRec,
162167
full::FlagMcDecayChanRec,
163168
full::CtGen,
@@ -196,6 +201,8 @@ DECLARE_SOA_TABLE(HfCandCdFull, "AOD", "HFCANDCDFULL",
196201
full::CandidateSign,
197202
full::FlagMc,
198203
full::IsCandidateSwapped,
204+
full::HypothesisMask,
205+
full::CandidateGlobalIndex,
199206
full::OriginMcRec,
200207
full::FlagMcDecayChanRec,
201208
full::CtGen,
@@ -535,18 +542,25 @@ struct HfTaskCd {
535542

536543
float ctGen{-1.f}, ptGen{-1.f};
537544
int pdgCodeProng0{0};
545+
int8_t isCandidateSwapped{-1};
538546
if (isTrueCd) {
539547
const auto& mcParticleProng0 = candidate.template prong0_as<HFTracksMc>().template mcParticle_as<CandCdMcGen>();
540548
pdgCodeProng0 = std::abs(mcParticleProng0.pdgCode());
549+
isCandidateSwapped = static_cast<int8_t>(pdgCodeProng0 == kPiPlus);
541550
const auto indexMother = RecoDecay::getMother(mcParticles, mcParticleProng0, o2::constants::physics::Pdg::kCDeuteron, true);
542551
const auto particleMother = mcParticles.rawIteratorAt(indexMother);
543552
ctGen = RecoDecay::ct(std::array{particleMother.px(), particleMother.py(), particleMother.pz()}, RecoDecay::distance(std::array{particleMother.vx(), particleMother.vy(), particleMother.vz()}, std::array{mcParticleProng0.vx(), mcParticleProng0.vy(), mcParticleProng0.vz()}), o2::constants::physics::MassCDeuteron) * CmToMum;
544553
ptGen = particleMother.pt();
554+
} else if (absFlagMc != 0) {
555+
isCandidateSwapped = candidate.isCandidateSwapped();
545556
}
546557

547558
if (fillCandLiteTree || fillCandFullTree) {
548559
const bool selDeKPi = (candidate.isSelCdToDeKPi() >= selectionFlagCd);
549560
const bool selPiKDe = (candidate.isSelCdToPiKDe() >= selectionFlagCd);
561+
const uint8_t hypothesisMask = static_cast<uint8_t>((selDeKPi ? 0x1 : 0x0) |
562+
(selPiKDe ? 0x2 : 0x0));
563+
const int64_t candidateGlobalIndex = candidate.globalIndex();
550564
auto prong0 = candidate.template prong0_as<HFTracksMc>();
551565
auto prong1 = candidate.template prong1_as<HFTracksMc>();
552566
auto prong2 = candidate.template prong2_as<HFTracksMc>();
@@ -593,7 +607,7 @@ struct HfTaskCd {
593607
nSigmaTpcDe, nSigmaTpcPr, nSigmaItsDe, nSigmaTofDe,
594608
tofBetaDe, tpcInnerParamDe, tofExpMomDe,
595609
candidate.ct(o2::constants::physics::MassCDeuteron) * CmToMum,
596-
candFlag, candSign, candidate.flagMcMatchRec(), candidate.originMcRec(),
610+
candFlag, candSign, candidate.flagMcMatchRec(), isCandidateSwapped, hypothesisMask, candidateGlobalIndex, candidate.originMcRec(),
597611
candidate.flagMcDecayChanRec(), ctGen, o2::hf_centrality::getCentralityColl(collision));
598612
}
599613

@@ -608,7 +622,7 @@ struct HfTaskCd {
608622
tofBetaDe, tpcInnerParamDe, tofExpMomDe,
609623
nSigmaTpcPi, nSigmaTofPi, nSigmaTpcKa, nSigmaTofKa,
610624
candidate.ct(o2::constants::physics::MassCDeuteron) * CmToMum,
611-
candFlag, candSign, candidate.flagMcMatchRec(), candidate.isCandidateSwapped(), candidate.originMcRec(),
625+
candFlag, candSign, candidate.flagMcMatchRec(), isCandidateSwapped, hypothesisMask, candidateGlobalIndex, candidate.originMcRec(),
612626
candidate.flagMcDecayChanRec(), ctGen, collision.numContrib(), o2::hf_centrality::getCentralityColl(collision),
613627
collision.posZ(), collision.globalIndex(), timeStamp);
614628
}
@@ -813,6 +827,9 @@ struct HfTaskCd {
813827
if (fillCandLiteTree || fillCandFullTree) {
814828
const bool selDeKPi = (candidate.isSelCdToDeKPi() >= selectionFlagCd);
815829
const bool selPiKDe = (candidate.isSelCdToPiKDe() >= selectionFlagCd);
830+
const uint8_t hypothesisMask = static_cast<uint8_t>((selDeKPi ? 0x1 : 0x0) |
831+
(selPiKDe ? 0x2 : 0x0));
832+
const int64_t candidateGlobalIndex = candidate.globalIndex();
816833
auto prong0 = candidate.template prong0_as<TrackType>();
817834
auto prong1 = candidate.template prong1_as<TrackType>();
818835
auto prong2 = candidate.template prong2_as<TrackType>();
@@ -874,7 +891,7 @@ struct HfTaskCd {
874891
decayLength, cpa, chi2PCA, nSigmaTpcDe, nSigmaTpcPr, nSigmaItsDe, nSigmaTofDe,
875892
tofBetaDe, tpcInnerParamDe, tofExpMomDe,
876893
candidate.ct(o2::constants::physics::MassCDeuteron),
877-
candFlag, candSign, 0, 0, -1, -1.f, cent);
894+
candFlag, candSign, 0, -1, hypothesisMask, candidateGlobalIndex, 0, -1, -1.f, cent);
878895
}
879896

880897
if (fillCandFullTree) {
@@ -887,7 +904,7 @@ struct HfTaskCd {
887904
tofBetaDe, tpcInnerParamDe, tofExpMomDe,
888905
nSigmaTpcPi, nSigmaTofPi, nSigmaTpcKa, nSigmaTofKa,
889906
candidate.ct(o2::constants::physics::MassCDeuteron),
890-
candFlag, candSign, 0, -1, 0, 0, -1.f, collision.numContrib(), cent,
907+
candFlag, candSign, 0, -1, hypothesisMask, candidateGlobalIndex, 0, 0, -1.f, collision.numContrib(), cent,
891908
collision.posZ(), collision.globalIndex(), timeStamp);
892909
}
893910
};

0 commit comments

Comments
 (0)