Skip to content

Commit 8812e2b

Browse files
authored
Some fixes in SigmaC MC matching (#14093)
1 parent a5083f4 commit 8812e2b

File tree

2 files changed

+49
-15
lines changed

2 files changed

+49
-15
lines changed

PWGHF/D2H/Tasks/taskSigmac.cxx

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,24 @@ struct HfTaskSigmac {
585585
} /// end THn for candidate Λc+ cut variation w/o Σc0,++ mass-window cut
586586
}; /// end fillHistosData
587587

588+
/// @brief function to remap the value of the resonant decay channel to fit the binning of the thnAxisChannel axis
589+
/// @param channel the value obtained from candidateLc.flagMcDecayChanGen() or particleLc.flagMcDecayChanGen()
590+
int remapResoChannelLc(int channel)
591+
{
592+
switch (channel) {
593+
case 0:
594+
// direct channel
595+
return 0;
596+
case o2::hf_decay::hf_cand_3prong::DecayChannelResonant::LcToPKstar0:
597+
return 1;
598+
case o2::hf_decay::hf_cand_3prong::DecayChannelResonant::LcToDeltaplusplusK:
599+
return 2;
600+
case o2::hf_decay::hf_cand_3prong::DecayChannelResonant::LcToL1520Pi:
601+
return 3;
602+
}
603+
return -1;
604+
}
605+
588606
/// @brief function to fill the histograms needed in analysis (MC)
589607
/// @param candidatesSc are the reconstructed candidate Σc0,++ with MC info
590608
/// @param mcParticles are the generated particles with flags wheter they are Σc0,++ or not
@@ -679,6 +697,7 @@ struct HfTaskSigmac {
679697
etaGenSoftPi = daugSoftPi.eta();
680698
phiGenSoftPi = daugSoftPi.phi();
681699
}
700+
channel = remapResoChannelLc(channel);
682701

683702
/// Fill histograms
684703
int sigmacSpecies = -1;
@@ -770,7 +789,8 @@ struct HfTaskSigmac {
770789
}
771790
double ptGenLc(particle.pt()), ptGenLcBMother(-1.);
772791
int const origin = particle.originMcGen();
773-
int const channel = particle.flagMcDecayChanGen();
792+
int channel = particle.flagMcDecayChanGen();
793+
channel = remapResoChannelLc(channel);
774794
if (origin == RecoDecay::OriginType::Prompt) {
775795
registry.fill(HIST("MC/generated/hnLambdaCGen"), ptGenLc, ptGenLcBMother, origin, channel);
776796
} else {
@@ -802,7 +822,21 @@ struct HfTaskSigmac {
802822
bool const isTrueScStar0Reco = std::abs(candSc.flagMcMatchRec()) == o2::hf_decay::hf_cand_sigmac::DecayChannelMain::ScStar0ToPKPiPi;
803823
bool const isTrueScPlusPlusReco = std::abs(candSc.flagMcMatchRec()) == o2::hf_decay::hf_cand_sigmac::DecayChannelMain::ScplusplusToPKPiPi;
804824
bool const isTrueScStarPlusPlusReco = std::abs(candSc.flagMcMatchRec()) == o2::hf_decay::hf_cand_sigmac::DecayChannelMain::ScStarPlusPlusToPKPiPi;
825+
if (!isTrueSc0Reco && !isTrueScStar0Reco && !isTrueScPlusPlusReco && !isTrueScStarPlusPlusReco) {
826+
continue;
827+
}
805828
int sigmacSpecies = -1;
829+
830+
/// debug
831+
if ((isTrueSc0Reco || isTrueScStar0Reco) && chargeSc != o2::aod::hf_cand_sigmac::ChargeNull) {
832+
/// this should never happen
833+
LOG(fatal) << "isTrueSc0Reco=" << isTrueSc0Reco << ", isTrueScStar0Reco=" << isTrueScStar0Reco << ", but chargeSc = " << static_cast<int>(chargeSc) << "! Not possible, abort...";
834+
}
835+
if ((isTrueScPlusPlusReco || isTrueScStarPlusPlusReco) && std::abs(chargeSc) != o2::aod::hf_cand_sigmac::ChargePlusPlus) {
836+
/// this should never happen
837+
LOG(fatal) << "isTrueScPlusPlusReco=" << isTrueScPlusPlusReco << ", isTrueScStarPlusPlusReco=" << isTrueScStarPlusPlusReco << ", but chargeSc = " << static_cast<int>(chargeSc) << "! Not possible, abort...";
838+
}
839+
806840
if ((isTrueSc0Reco || isTrueScStar0Reco) && (chargeSc == o2::aod::hf_cand_sigmac::ChargeNull)) {
807841
/// Reconstructed Σc0 signal
808842
// Get the corresponding MC particle for Sc, found as the mother of the soft pion
@@ -820,7 +854,7 @@ struct HfTaskSigmac {
820854
// Get the corresponding MC particle for Lc
821855
auto arrayDaughtersLc = std::array{candidateLc.template prong0_as<aod::TracksWMc>(), candidateLc.template prong1_as<aod::TracksWMc>(), candidateLc.template prong2_as<aod::TracksWMc>()};
822856
int8_t sign = 0;
823-
int const indexMcLcRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersLc, o2::constants::physics::Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2);
857+
int const indexMcLcRec = RecoDecay::getMatchedMCRec<false, false, false, true, true>(mcParticles, arrayDaughtersLc, o2::constants::physics::Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2);
824858
auto particleLc = mcParticles.rawIteratorAt(indexMcLcRec);
825859
// Get the corresponding MC particle for soft pion
826860
auto particleSoftPi = candSc.prong1_as<aod::TracksWMc>().mcParticle();
@@ -837,6 +871,7 @@ struct HfTaskSigmac {
837871
double cpaLc(candidateLc.cpa()), cpaXYLc(candidateLc.cpaXY());
838872
int const origin = candSc.originMcRec();
839873
auto channel = candidateLc.flagMcDecayChanRec(); /// 0: direct; 1: Λc± → p± K*; 2: Λc± → Δ(1232)±± K∓; 3: Λc± → Λ(1520) π±
874+
channel = remapResoChannelLc(channel);
840875

841876
/// candidate Λc+ → pK-π+ (and charge conjugate) within the range of M(pK-π+) chosen in the Σc0,++ builder
842877
if ((TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PKPi)) && std::abs(candidateLc.template prong0_as<aod::TracksWMc>().mcParticle().pdgCode()) == kProton) {
@@ -1026,7 +1061,7 @@ struct HfTaskSigmac {
10261061
// Get the corresponding MC particle for Lc
10271062
auto arrayDaughtersLc = std::array{candidateLc.template prong0_as<aod::TracksWMc>(), candidateLc.template prong1_as<aod::TracksWMc>(), candidateLc.template prong2_as<aod::TracksWMc>()};
10281063
int8_t sign = 0;
1029-
int const indexMcLcRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersLc, o2::constants::physics::Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2);
1064+
int const indexMcLcRec = RecoDecay::getMatchedMCRec<false, false, false, true, true>(mcParticles, arrayDaughtersLc, o2::constants::physics::Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2);
10301065
auto particleLc = mcParticles.rawIteratorAt(indexMcLcRec);
10311066
// Get the corresponding MC particle for soft pion
10321067
auto particleSoftPi = candSc.prong1_as<aod::TracksWMc>().mcParticle();
@@ -1043,6 +1078,7 @@ struct HfTaskSigmac {
10431078
double cpaLc(candidateLc.cpa()), cpaXYLc(candidateLc.cpaXY());
10441079
int const origin = candSc.originMcRec();
10451080
auto channel = candidateLc.flagMcDecayChanRec(); /// 0: direct; 1: Λc± → p± K*; 2: Λc± → Δ(1232)±± K∓; 3: Λc± → Λ(1520) π±; FIXME: DecayChannelResonant
1081+
channel = remapResoChannelLc(channel);
10461082

10471083
/// candidate Λc+ → pK-π+ (and charge conjugate) within the range of M(pK-π+) chosen in the Σc0,++ builder
10481084
if ((TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PKPi)) && std::abs(candidateLc.template prong0_as<aod::TracksWMc>().mcParticle().pdgCode()) == kProton) {
@@ -1229,6 +1265,7 @@ struct HfTaskSigmac {
12291265
double cpaLc(candidateLc.cpa()), cpaXYLc(candidateLc.cpaXY());
12301266
int const origin = candidateLc.originMcRec();
12311267
auto channel = candidateLc.flagMcDecayChanRec(); /// 0: direct; 1: Λc± → p± K*; 2: Λc± → Δ(1232)±± K∓; 3: Λc± → Λ(1520) π±
1268+
channel = remapResoChannelLc(channel);
12321269
int pdgAbs = -1;
12331270
if (candidateLc.template prong0_as<aod::TracksWMc>().has_mcParticle()) {
12341271
pdgAbs = std::abs(candidateLc.template prong0_as<aod::TracksWMc>().mcParticle().pdgCode());

PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -516,20 +516,18 @@ struct HfCandidateSigmac0plusplusMc {
516516
/// 3. in case of (ii): resonant channel to pK-π+
517517

518518
/// look for Σc0(2455)
519-
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kSigmaC0, std::array{+kProton, -kKPlus, +kPiPlus, -kPiPlus}, true, &sign, 3);
519+
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true, true>(mcParticles, arrayDaughters, Pdg::kSigmaC0, std::array{+kProton, -kKPlus, +kPiPlus, -kPiPlus}, true, &sign, 3);
520520
if (indexRec > -1) { /// due to (*) no need to check anything for LambdaC
521521
flag = sign * o2::hf_decay::hf_cand_sigmac::DecayChannelMain::Sc0ToPKPiPi;
522+
auto particle = mcParticles.rawIteratorAt(indexRec);
523+
particleAntiparticle = isParticleAntiparticle(particle, Pdg::kSigmaC0);
522524
}
523-
auto particle = mcParticles.rawIteratorAt(indexRec);
524-
particleAntiparticle = isParticleAntiparticle(particle, Pdg::kSigmaC0);
525525

526526
/// look for Σc0(2520)
527527
if (flag == 0) {
528-
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kSigmaCStar0, std::array{+kProton, -kKPlus, +kPiPlus, -kPiPlus}, true, &sign, 3);
528+
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true, true>(mcParticles, arrayDaughters, Pdg::kSigmaCStar0, std::array{+kProton, -kKPlus, +kPiPlus, -kPiPlus}, true, &sign, 3);
529529
if (indexRec > -1) { /// due to (*) no need to check anything for LambdaC
530530
flag = sign * o2::hf_decay::hf_cand_sigmac::DecayChannelMain::ScStar0ToPKPiPi;
531-
}
532-
if (particleAntiparticle < 0) {
533531
auto particle = mcParticles.rawIteratorAt(indexRec);
534532
particleAntiparticle = isParticleAntiparticle(particle, Pdg::kSigmaCStar0);
535533
}
@@ -543,20 +541,18 @@ struct HfCandidateSigmac0plusplusMc {
543541
/// 3. in case of (ii): resonant channel to pK-π+
544542

545543
/// look for Σc++(2455)
546-
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kSigmaCPlusPlus, std::array{+kProton, -kKPlus, +kPiPlus, +kPiPlus}, true, &sign, 3);
544+
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true, true>(mcParticles, arrayDaughters, Pdg::kSigmaCPlusPlus, std::array{+kProton, -kKPlus, +kPiPlus, +kPiPlus}, true, &sign, 3);
547545
if (indexRec > -1) { /// due to (*) no need to check anything for LambdaC
548546
flag = sign * o2::hf_decay::hf_cand_sigmac::DecayChannelMain::ScplusplusToPKPiPi;
547+
auto particle = mcParticles.rawIteratorAt(indexRec);
548+
particleAntiparticle = isParticleAntiparticle(particle, Pdg::kSigmaCPlusPlus);
549549
}
550-
auto particle = mcParticles.rawIteratorAt(indexRec);
551-
particleAntiparticle = isParticleAntiparticle(particle, Pdg::kSigmaCPlusPlus);
552550

553551
/// look for Σc++(2520)
554552
if (flag == 0) {
555-
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kSigmaCStarPlusPlus, std::array{+kProton, -kKPlus, +kPiPlus, +kPiPlus}, true, &sign, 3);
553+
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true, true>(mcParticles, arrayDaughters, Pdg::kSigmaCStarPlusPlus, std::array{+kProton, -kKPlus, +kPiPlus, +kPiPlus}, true, &sign, 3);
556554
if (indexRec > -1) { /// due to (*) no need to check anything for LambdaC
557555
flag = sign * o2::hf_decay::hf_cand_sigmac::DecayChannelMain::ScStarPlusPlusToPKPiPi;
558-
}
559-
if (particleAntiparticle < 0) {
560556
auto particle = mcParticles.rawIteratorAt(indexRec);
561557
particleAntiparticle = isParticleAntiparticle(particle, Pdg::kSigmaCStarPlusPlus);
562558
}
@@ -581,6 +577,7 @@ struct HfCandidateSigmac0plusplusMc {
581577
for (const auto& particle : mcParticles) {
582578
flag = 0;
583579
origin = 0;
580+
sign = 0;
584581
std::vector<int> idxBhadMothers{};
585582
int8_t particleAntiparticle = -1;
586583

0 commit comments

Comments
 (0)