From 0c69e9c33608c6f09e4551d9ba340abefb05c933 Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Tue, 14 Nov 2023 16:26:17 +0100 Subject: [PATCH 1/2] PWGHF: fix processing on MC for SigmaC. --- PWGHF/D2H/Tasks/taskSigmac.cxx | 13 ++++++++++--- .../candidateCreatorSigmac0plusplus.cxx | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskSigmac.cxx b/PWGHF/D2H/Tasks/taskSigmac.cxx index 439deb9ef44..33f61ea8633 100644 --- a/PWGHF/D2H/Tasks/taskSigmac.cxx +++ b/PWGHF/D2H/Tasks/taskSigmac.cxx @@ -427,9 +427,9 @@ struct HfTaskSigmac { /// @param mcParticles are the generated particles with flags wheter they are Σc0,++ or not /// @param void processMc(soa::Join const& candidatesSc, - aod::McParticles const& mcParticles, soa::Join const& mcParticlesSc, soa::Join const& mcParticlesLc, + aod::McParticles const& mcParticles, // this establishes the type of particle obtained with the .mcParticle() getter soa::Join const& candidatesLc, aod::TracksWMc const&) { @@ -881,17 +881,24 @@ struct HfTaskSigmac { if (enableTHn) { /// loop over Λc+ candidates w/o Σc0,++ mass-window cut for (const auto& candidateLc : candidatesLc) { + if (!(std::abs(candidateLc.flagMcMatchRec()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) { + continue; + } double massLc(-1.); double ptLc(candidateLc.pt()); double decLengthLc(candidateLc.decayLength()), decLengthXYLc(candidateLc.decayLengthXY()); double cpaLc(candidateLc.cpa()), cpaXYLc(candidateLc.cpaXY()); int origin = candidateLc.originMcRec(); auto channel = candidateLc.flagMcDecayChanRec(); /// 0: direct; 1: Λc± → p± K*; 2: Λc± → Δ(1232)±± K∓; 3: Λc± → Λ(1520) π± - if (candidateLc.isSelLcToPKPi() >= 1 && std::abs(candidateLc.prong0_as().mcParticle().pdgCode()) == kProton) { + int pdgAbs = -1; + if (candidateLc.prong0_as().has_mcParticle()) { + pdgAbs = std::abs(candidateLc.prong0_as().mcParticle().pdgCode()); + } + if (candidateLc.isSelLcToPKPi() >= 1 && pdgAbs == kProton) { massLc = hfHelper.invMassLcToPKPi(candidateLc); registry.get(HIST("hnLambdaC"))->Fill(ptLc, massLc, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, origin, channel); } - if (candidateLc.isSelLcToPiKP() >= 1 && std::abs(candidateLc.prong0_as().mcParticle().pdgCode()) == kPiPlus) { + if (candidateLc.isSelLcToPiKP() >= 1 && pdgAbs == kPiPlus) { massLc = hfHelper.invMassLcToPiKP(candidateLc); registry.get(HIST("hnLambdaC"))->Fill(ptLc, massLc, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, origin, channel); } diff --git a/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx b/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx index 674295848e2..c450e60d5c0 100644 --- a/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx +++ b/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx @@ -381,11 +381,12 @@ struct HfCandidateSigmac0plusplusMc { /// @param mcParticles table of generated particles void processMc(aod::McParticles const& mcParticles, aod::TracksWMc const& tracks, - LambdacMc const& /*, const LambdacMcGen&*/) + LambdacMc const& candsLc /*, const LambdacMcGen&*/) { // Match reconstructed candidates. candidatesSigmac->bindExternalIndices(&tracks); + candidatesSigmac->bindExternalIndices(&candsLc); int indexRec = -1; int8_t sign = 0; From 3b6c5c4503ac0f076ca0e8334e3f21ff56a267f2 Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Wed, 15 Nov 2023 18:39:57 +0100 Subject: [PATCH 2/2] Use TESTBIT to check flagMcMatchRec Co-authored-by: Fabrizio --- PWGHF/D2H/Tasks/taskSigmac.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/D2H/Tasks/taskSigmac.cxx b/PWGHF/D2H/Tasks/taskSigmac.cxx index 33f61ea8633..b9deabbaee2 100644 --- a/PWGHF/D2H/Tasks/taskSigmac.cxx +++ b/PWGHF/D2H/Tasks/taskSigmac.cxx @@ -881,7 +881,7 @@ struct HfTaskSigmac { if (enableTHn) { /// loop over Λc+ candidates w/o Σc0,++ mass-window cut for (const auto& candidateLc : candidatesLc) { - if (!(std::abs(candidateLc.flagMcMatchRec()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) { + if (!TESTBIT(std::abs(candidateLc.flagMcMatchRec()), aod::hf_cand_3prong::DecayType::LcToPKPi)) { continue; } double massLc(-1.);