diff --git a/PWGHF/D2H/Tasks/taskOmegac0ToOmegaPiQa.cxx b/PWGHF/D2H/Tasks/taskOmegac0ToOmegaPiQa.cxx index 517198e4852..b745b55a41c 100644 --- a/PWGHF/D2H/Tasks/taskOmegac0ToOmegaPiQa.cxx +++ b/PWGHF/D2H/Tasks/taskOmegac0ToOmegaPiQa.cxx @@ -159,6 +159,15 @@ struct HfTaskOmegac0ToOmegaPiQa { registry.get(HIST("hReco"))->Sumw2(); } + template + bool hasMlScore(const CandType& candidate) + { + if (!candidate.mlProbOmegaC0ToOmegaPi().empty()) { + return true; + } + return false; + } + template void runDataAnalysis(const CandType& candidates) { @@ -169,6 +178,9 @@ struct HfTaskOmegac0ToOmegaPiQa { } if constexpr (ApplyMl) { + if (!hasMlScore(candidate)) { + continue; + } registry.fill(HIST("hReco"), HfHelper::invMassOmegaczeroToOmegaPi(candidate), candidate.pt(), yOmegac, candidate.mlProbOmegaC0ToOmegaPi()[0]); } else { registry.fill(HIST("hReco"), HfHelper::invMassOmegaczeroToOmegaPi(candidate), candidate.pt(), yOmegac); @@ -184,6 +196,12 @@ struct HfTaskOmegac0ToOmegaPiQa { return; } + if constexpr (ApplyMl) { + if (!hasMlScore(candidate)) { + return; + } + } + auto numPvContributors = collision.numContrib(); if constexpr (UseCentrality) { float const cent = o2::hf_centrality::getCentralityColl(collision); @@ -212,6 +230,9 @@ struct HfTaskOmegac0ToOmegaPiQa { } if constexpr (ApplyMl) { + if (!hasMlScore(candidate)) { + continue; + } registry.fill(HIST("hReco"), HfHelper::invMassOmegaczeroToOmegaPi(candidate), candidate.pt(), yOmegac, candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), candidate.mlProbOmegaC0ToOmegaPi()[0]); } else { registry.fill(HIST("hReco"), HfHelper::invMassOmegaczeroToOmegaPi(candidate), candidate.pt(), yOmegac, candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec()); @@ -249,9 +270,15 @@ struct HfTaskOmegac0ToOmegaPiQa { auto collision = candidate.template collision_as(); uint16_t const numPvContributors = collision.numContrib(); - float const mcCent = o2::hf_centrality::getCentralityColl(collision.template mcCollision_as()); + float mcCent = -1.; + if (collision.has_mcCollision()) { + mcCent = o2::hf_centrality::getCentralityColl(collision.template mcCollision_as()); + } if constexpr (ApplyMl) { + if (!hasMlScore(candidate)) { + continue; + } registry.fill(HIST("hReco"), HfHelper::invMassOmegaczeroToOmegaPi(candidate), candidate.pt(), yOmegac, mcCent, numPvContributors, candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), candidate.mlProbOmegaC0ToOmegaPi()[0]); } else { registry.fill(HIST("hReco"), HfHelper::invMassOmegaczeroToOmegaPi(candidate), candidate.pt(), yOmegac, mcCent, numPvContributors, candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec()); diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0Qa.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0Qa.cxx index 80e38f678dd..6e4be1f95a1 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0Qa.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0Qa.cxx @@ -97,7 +97,6 @@ struct HfCandidateCreatorXic0Omegac0Qa { std::string prefix = "lfBuilding"; // Options for internal cascade building - DCAFitter settings // ...Initial vaules taken from PWGLF/Utils/strangenessBuilderHelper - Configurable propagateToPCA{"propagateToPCA", true, "Create tracks version propagated to PCA"}; Configurable maxR{"maxR", 200., "Reject PCA's above this radius"}; Configurable maxDZIni{"maxDZIni", 1e9, "Reject (if>0) PCA candidate if tracks DZ exceeds this threshold"}; Configurable maxDXYIni{"maxDXYIni", 4.0f, "Reject (if>0) PCA candidate if tracks DXY exceeds this threshold"}; @@ -148,7 +147,6 @@ struct HfCandidateCreatorXic0Omegac0Qa { // Cascade pre selection Configurable cascadeMassWindow{"cascadeMassWindow", 0.01, "Invariant mass tolerance for cascades"}; // Options for DCAFitter - Configurable propagateToPCA{"propagateToPCA", true, "Create tracks version propagated to PCA"}; Configurable maxR{"maxR", 200., "Reject PCA's above this radius"}; Configurable maxDZIni{"maxDZIni", 4., "Reject (if>0) PCA candidate if tracks DZ exceeds this threshold"}; Configurable maxDXYIni{"maxDXYIni", 4., "Reject (if>0) PCA candidate if tracks DXY exceeds this threshold"}; @@ -270,7 +268,7 @@ struct HfCandidateCreatorXic0Omegac0Qa { straHelper.cascadeselections.maxDaughterEta = lfConfigs.maxDaughterEta; // Fitter setting - straHelper.fitter.setPropagateToPCA(lfConfigs.propagateToPCA); + straHelper.fitter.setPropagateToPCA(true); straHelper.fitter.setMaxR(lfConfigs.maxR); straHelper.fitter.setMaxDZIni(lfConfigs.maxDZIni); straHelper.fitter.setMaxDXYIni(lfConfigs.maxDXYIni); @@ -284,7 +282,7 @@ struct HfCandidateCreatorXic0Omegac0Qa { // Extra initialization for DCAFitter if (nProcessesDCA == 1) { registry.get(HIST("hVertexerType"))->Fill(aod::hf_cand::VertexerType::DCAFitter); - df.setPropagateToPCA(configs.propagateToPCA); + df.setPropagateToPCA(true); df.setMaxR(configs.maxR); df.setMaxDZIni(configs.maxDZIni); df.setMaxDXYIni(configs.maxDXYIni); @@ -589,6 +587,7 @@ struct HfCandidateCreatorXic0Omegac0Qa { } //----------Create charm baryon as KF Particle object starting from V0---------- + // TODO: investigate if we can use the KFParticle object of cascade from straHelper instead of creating a new one here // Create KFParticle object of V0 Daughter & Bachelor const KFPTrack kfTrack0 = createKFPTrackFromTrack(posTrack); const KFPTrack kfTrack1 = createKFPTrackFromTrack(negTrack); @@ -1092,6 +1091,11 @@ struct HfCandidateCreatorXic0Omegac0QaMc { void init(InitContext& initContext) { + const std::array mcProcesses{doprocessMcNoCent, doprocessMcCentFT0C, doprocessMcCentFT0M}; + if (std::accumulate(mcProcesses.begin(), mcProcesses.end(), 0) > 1) { + LOGP(fatal, "At most one MC process function can be enabled at a time."); + } + const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { if (device.name == "hf-candidate-creator-xic0-omegac0-qa") { diff --git a/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaPiQa.cxx b/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaPiQa.cxx index 2af3fd47a54..370de04e02d 100644 --- a/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaPiQa.cxx +++ b/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaPiQa.cxx @@ -133,7 +133,7 @@ struct HfCandidateSelectorToOmegaPiQa { // PID options Configurable usePidTpcOnly{"usePidTpcOnly", true, "Perform PID using only TPC"}; - Configurable usePidTpcTofCombined{"usePidTpcTofCombined", false, "Perform PID using TPC or TOF"}; + Configurable usePidTpcOrTof{"usePidTpcOrTof", false, "Perform PID using TPC or TOF"}; // PID - TPC selections Configurable ptPiPidTpcMin{"ptPiPidTpcMin", -1, "Lower bound of track pT for TPC PID for pion selection"}; @@ -204,10 +204,10 @@ struct HfCandidateSelectorToOmegaPiQa { Configurable v0Chi2OverNdfMax{"v0Chi2OverNdfMax", 100., "Maximum chi2Geo/NDF of V0"}; Configurable cascChi2OverNdfMax{"cascChi2OverNdfMax", 100., "Maximum chi2Geo/NDF of casc"}; Configurable omegacChi2OverNdfMax{"omegacChi2OverNdfMax", 100., "Maximum chi2Geo/NDF of Omegac"}; - Configurable chi2TopoV0ToCascMax{"chi2TopoV0ToCascMax", 100., "Maximum chi2Topo/NDF of V0ToCas"}; - Configurable chi2TopoOmegacToPvMax{"chi2TopoOmegacToPvMax", 100., "Maximum chi2Topo/NDF of OmegacToPv"}; - Configurable chi2TopoCascToOmegacMax{"chi2TopoCascToOmegacMax", 100., "Maximum chi2Topo/NDF of CascToOmegac"}; - Configurable chi2TopoCascToPvMax{"chi2TopoCascToPvMax", 100., "Maximum chi2Topo/NDF of CascToPv"}; + Configurable chi2TopoV0ToCascMax{"chi2TopoV0ToCascMax", 100., "Maximum chi2Topo of V0ToCasc"}; + Configurable chi2TopoOmegacToPvMax{"chi2TopoOmegacToPvMax", 100., "Maximum chi2Topo of OmegacToPv"}; + Configurable chi2TopoCascToOmegacMax{"chi2TopoCascToOmegacMax", 100., "Maximum chi2Topo of CascToOmegac"}; + Configurable chi2TopoCascToPvMax{"chi2TopoCascToPvMax", 100., "Maximum chi2Topo of CascToPv"}; Configurable decayLenXYOmegacMax{"decayLenXYOmegacMax", 1.5, "Maximum decay lengthXY of Omegac"}; Configurable decayLenXYCascMin{"decayLenXYCascMin", 1., "Minimum decay lengthXY of Cascade"}; Configurable decayLenXYLambdaMin{"decayLenXYLambdaMin", 0., "Minimum decay lengthXY of V0"}; @@ -223,8 +223,8 @@ struct HfCandidateSelectorToOmegaPiQa { LOGP(fatal, "Exactly one process function for selector can be enabled at a time."); } - if (usePidTpcOnly == usePidTpcTofCombined) { - LOGF(fatal, "Check the PID configurables, usePidTpcOnly and usePidTpcTofCombined can't have the same value"); + if (usePidTpcOnly == usePidTpcOrTof) { + LOGF(fatal, "Check the PID configurables, usePidTpcOnly and usePidTpcOrTof can't have the same value"); } selectorPion.setRangePtTpc(ptPiPidTpcMin, ptPiPidTpcMax); @@ -376,7 +376,7 @@ struct HfCandidateSelectorToOmegaPiQa { } } - // LF cuts - Cuts on LF tracks reco + // TODO: check if all these cuts are needed and remove those that are already applied in the candidate creator // Selection on LF related informations // returns true if all cuts are passed template @@ -507,8 +507,7 @@ struct HfCandidateSelectorToOmegaPiQa { } registry.fill(HIST("hSelStatusLf"), 22.0); - // TODO: fix cascRejectInvmass variable needed not available in the current table - + // TODO: cascRejectInvmass variable not available in the current table, check if needed // Competing Xi rejection // if (kfConfigurableGroup.applyCompetingCascRejection) { // const auto invMassXiHypothesis = candidate.cascRejectInvmass(); @@ -544,7 +543,7 @@ struct HfCandidateSelectorToOmegaPiQa { return true; } - // HF cuts - Cuts on Charm baryon reco + // TODO: check if all these cuts are needed and remove those that are already applied in the candidate creator // Apply cuts with charm baryon & charm bachelor related informations // returns true if all cuts are passed template @@ -597,11 +596,11 @@ struct HfCandidateSelectorToOmegaPiQa { registry.fill(HIST("hSelStatusHf"), 5.0); // Chi2 - if (candidate.chi2GeoOverNdfCascade() < 0 || candidate.chi2GeoOverNdfCascade() > kfConfigurableGroup.omegacChi2OverNdfMax) { + if (candidate.chi2GeoOverNdf() < 0 || candidate.chi2GeoOverNdf() > kfConfigurableGroup.omegacChi2OverNdfMax) { return false; } registry.fill(HIST("hSelStatusHf"), 6.0); - if (candidate.chi2TopoCascadeToPv() < 0 || candidate.chi2TopoCascadeToPv() > kfConfigurableGroup.chi2TopoOmegacToPvMax) { + if (candidate.chi2TopoToPv() < 0 || candidate.chi2TopoToPv() > kfConfigurableGroup.chi2TopoOmegacToPvMax) { return false; } registry.fill(HIST("hSelStatusHf"), 7.0); @@ -689,20 +688,19 @@ struct HfCandidateSelectorToOmegaPiQa { // apply PID selection on the decay products bool isSelectedPID(const TrackSelectorPID::Status pidPrFromLam, const TrackSelectorPID::Status pidPiFromLam, const TrackSelectorPID::Status pidKaFromCasc, const TrackSelectorPID::Status pidPiFromCharmBaryon) { - // TODO: check PID logic, usually we require particles to not be TrackSelectorPID::Rejected registry.fill(HIST("hSelStatusPID"), 0.0); - if (pidPrFromLam != TrackSelectorPID::Accepted || pidPiFromLam != TrackSelectorPID::Accepted) { + if (pidPrFromLam == TrackSelectorPID::Rejected || pidPiFromLam == TrackSelectorPID::Rejected) { return false; } registry.fill(HIST("hSelStatusPID"), 1.0); - if (pidKaFromCasc != TrackSelectorPID::Accepted) { + if (pidKaFromCasc == TrackSelectorPID::Rejected) { return false; } registry.fill(HIST("hSelStatusPID"), 2.0); - if (pidPiFromCharmBaryon != TrackSelectorPID::Accepted) { + if (pidPiFromCharmBaryon == TrackSelectorPID::Rejected) { return false; } registry.fill(HIST("hSelStatusPID"), 3.0); @@ -723,9 +721,7 @@ struct HfCandidateSelectorToOmegaPiQa { if (!TESTBIT(candidate.hfflag(), aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi)) { hfSelOmegaC0ToOmegaPiCandidate(statusOmegaC0ToOmegaPi); - if (applyMl) { - hfMlOmegaC0ToOmegaPiCandidate(outputMlOmegac); - } + hfMlOmegaC0ToOmegaPiCandidate(outputMlOmegac); continue; } SETBIT(statusOmegaC0ToOmegaPi, aod::SelectionStep::RecoSkims); @@ -753,9 +749,7 @@ struct HfCandidateSelectorToOmegaPiQa { if (!selectedLf || !selectedHf || !selectedTrackQuality) { hfSelOmegaC0ToOmegaPiCandidate(statusOmegaC0ToOmegaPi); - if (applyMl) { - hfMlOmegaC0ToOmegaPiCandidate(outputMlOmegac); - } + hfMlOmegaC0ToOmegaPiCandidate(outputMlOmegac); continue; } SETBIT(statusOmegaC0ToOmegaPi, aod::SelectionStep::RecoTopol); @@ -766,12 +760,13 @@ struct HfCandidateSelectorToOmegaPiQa { TrackSelectorPID::Status pidKaFromCasc{}; TrackSelectorPID::Status pidPiFromCharmBaryon{}; + // TODO: add TPC and TOF option for PID selection if (usePidTpcOnly) { pidPrFromLam = selectorProton.statusTpc(trackPrFromLam); pidPiFromLam = selectorPion.statusTpc(trackPiFromLam); pidKaFromCasc = selectorKaon.statusTpc(trackKaFromCasc); pidPiFromCharmBaryon = selectorPion.statusTpc(trackPiFromCharm); - } else if (usePidTpcTofCombined) { + } else if (usePidTpcOrTof) { pidPrFromLam = selectorProton.statusTpcOrTof(trackPrFromLam); pidPiFromLam = selectorPion.statusTpcOrTof(trackPiFromLam); pidKaFromCasc = selectorKaon.statusTpcOrTof(trackKaFromCasc); @@ -780,9 +775,7 @@ struct HfCandidateSelectorToOmegaPiQa { if (!isSelectedPID(pidPrFromLam, pidPiFromLam, pidKaFromCasc, pidPiFromCharmBaryon)) { hfSelOmegaC0ToOmegaPiCandidate(statusOmegaC0ToOmegaPi); - if (applyMl) { - hfMlOmegaC0ToOmegaPiCandidate(outputMlOmegac); - } + hfMlOmegaC0ToOmegaPiCandidate(outputMlOmegac); continue; } SETBIT(statusOmegaC0ToOmegaPi, aod::SelectionStep::RecoPID); @@ -808,6 +801,8 @@ struct HfCandidateSelectorToOmegaPiQa { continue; } SETBIT(statusOmegaC0ToOmegaPi, aod::SelectionStep::RecoMl); + } else { + hfMlOmegaC0ToOmegaPiCandidate(outputMlOmegac); } registry.fill(HIST("hInvMassCharmBaryon"), HfHelper::invMassOmegaczeroToOmegaPi(candidate)); diff --git a/PWGHF/TableProducer/candidateSelectorToXiPiQa.cxx b/PWGHF/TableProducer/candidateSelectorToXiPiQa.cxx index f6aa3f485c9..1cba8655af7 100644 --- a/PWGHF/TableProducer/candidateSelectorToXiPiQa.cxx +++ b/PWGHF/TableProducer/candidateSelectorToXiPiQa.cxx @@ -108,10 +108,10 @@ struct HfCandidateSelectorToXiPiQa { Configurable v0MassWindow{"v0MassWindow", 0.01, "v0 mass window"}; Configurable cascMassWindow{"cascMassWindow", 0.01, "cascade mass window"}; Configurable invMassCharmBaryonMin{"invMassCharmBaryonMin", 2.0, "Lower limit of invariant mass spectrum charm baryon"}; - Configurable invMassCharmBaryonMax{"invMassCharmBaryonMax", 3.1, "Lower limit of invariant mass spectrum charm baryon"}; + Configurable invMassCharmBaryonMax{"invMassCharmBaryonMax", 3.1, "Upper limit of invariant mass spectrum charm baryon"}; // PID options Configurable usePidTpcOnly{"usePidTpcOnly", false, "Perform PID using only TPC"}; - Configurable usePidTpcTofCombined{"usePidTpcTofCombined", true, "Perform PID using TPC & TOF"}; + Configurable usePidTpcOrTof{"usePidTpcOrTof", true, "Perform PID using TPC or TOF"}; // PID - TPC selections Configurable ptPiPidTpcMin{"ptPiPidTpcMin", -1, "Lower bound of track pT for TPC PID for pion selection"}; Configurable ptPiPidTpcMax{"ptPiPidTpcMax", 9999.9, "Upper bound of track pT for TPC PID for pion selection"}; @@ -292,7 +292,7 @@ struct HfCandidateSelectorToXiPiQa { } } - // LF cuts - Cuts on LF tracks reco + // TODO: check if all these cuts are needed and remove those that are already applied in the candidate creator // Selection on LF related informations // returns true if all cuts are passed template @@ -441,7 +441,7 @@ struct HfCandidateSelectorToXiPiQa { return true; } - // HF cuts - Cuts on Charm baryon reco + // TODO: check if all these cuts are needed and remove those that are already applied in the candidate creator // Apply cuts with charm baryon & charm bachelor related informations // returns true if all cuts are passed template @@ -492,8 +492,7 @@ struct HfCandidateSelectorToXiPiQa { return false; } registry.fill(HIST("hSelStatusHf"), 7.0); - // TODO: check if this is needed - // The QA KF table has no dedicated charm-bachelor-to-PV topological chi2 column. + // TODO: check if this cut is needed,the QA KF table has no dedicated charm-bachelor-to-PV topological chi2 column // if (candidate.chi2TopoPiFromXicToPv() < 0 || candidate.chi2TopoPiFromXicToPv() > cuts->get(inputPtBin, "chi2TopoPiFromXicToPv")) { // return false; // } @@ -509,6 +508,7 @@ struct HfCandidateSelectorToXiPiQa { } registry.fill(HIST("hSelStatusHf"), 10.0); + // TODO: this is not correct for the OmegaC0->XiPi decay, need to differentiate between the two decays // ctau if (std::abs(HfHelper::ctXiczero(candidate)) > cuts->get(inputPtBin, "cTauXic")) { return false; @@ -639,8 +639,8 @@ struct HfCandidateSelectorToXiPiQa { // Track level PID selection registry.fill(HIST("hSelStatusPID"), 0.0); - if (usePidTpcOnly == usePidTpcTofCombined) { - LOGF(fatal, "Check the PID configurables, usePidTpcOnly and usePidTpcTofCombined can't have the same value"); + if (usePidTpcOnly == usePidTpcOrTof) { + LOGF(fatal, "Check the PID configurables, usePidTpcOnly and usePidTpcOrTof can't have the same value"); } TrackSelectorPID::Status statusPidPrFromLam{}; @@ -648,18 +648,20 @@ struct HfCandidateSelectorToXiPiQa { TrackSelectorPID::Status statusPidPiFromCasc{}; TrackSelectorPID::Status statusPidPiFromCharmBaryon{}; + // TODO: add TPC and TOF option for PID selection if (usePidTpcOnly) { statusPidPrFromLam = selectorProton.statusTpc(trackPrFromLam); statusPidPiFromLam = selectorPion.statusTpc(trackPiFromLam); statusPidPiFromCasc = selectorPion.statusTpc(trackPiFromCasc); statusPidPiFromCharmBaryon = selectorPion.statusTpc(trackPiFromCharm); - } else if (usePidTpcTofCombined) { + } else if (usePidTpcOrTof) { statusPidPrFromLam = selectorProton.statusTpcOrTof(trackPrFromLam); statusPidPiFromLam = selectorPion.statusTpcOrTof(trackPiFromLam); statusPidPiFromCasc = selectorPion.statusTpcOrTof(trackPiFromCasc); statusPidPiFromCharmBaryon = selectorPion.statusTpcOrTof(trackPiFromCharm); } + // TODO: check PID logic, usually we require particles to not be TrackSelectorPID::Rejected const bool statusPidLambda = (statusPidPrFromLam == TrackSelectorPID::Accepted) && (statusPidPiFromLam == TrackSelectorPID::Accepted); if (statusPidLambda) { registry.fill(HIST("hSelStatusPID"), 1.0); diff --git a/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPiQa.cxx b/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPiQa.cxx index 6f7128bd76c..01ecdcab761 100644 --- a/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPiQa.cxx +++ b/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPiQa.cxx @@ -245,7 +245,7 @@ struct HfTreeCreatorToOmegaPiQa { using CollsWithMcLabels = soa::Join; using McCollsWithFT0M = soa::Join; - Filter filterOmegaCMatchedRec = nabs(aod::hf_cand_mc_flag::flagMcMatchRec) == static_cast(hf_decay::hf_cand_casc_bach_qa::DecayChannelMain::Omegac0ToOmegaPi); + Filter filterOmegaCMatchedRec = nabs(aod::hf_cand_mc_flag::flagMcMatchRec) == static_cast(hf_decay::hf_cand_casc_bach_qa::DecayChannelMain::Omegac0ToOmegaPi) || (keepOnlyMcSignal.node() == false); Filter filterSelectCandidates = aod::hf_sel_candidate_omegac0_qa::isSelOmegaC0ToOmegaPi >= selectionFlagOmegac0; void init(InitContext const&) @@ -265,17 +265,8 @@ struct HfTreeCreatorToOmegaPiQa { } template - void fillCandidate(const T& candidate, TracksSel const& tracks, TracksSelLf const& lfTracks, int8_t flagMc, int8_t originMc, float centrality = -999.f) + void fillCandidate(const T& candidate, TracksSel const& tracks, TracksSelLf const& lfTracks, int8_t flagMc, int8_t originMc, float centrality = -1.) { - - // save all candidate information - if constexpr (useCentrality) { - if (centrality < -998.f) { - auto const& collision = candidate.template collision_as(); - centrality = o2::hf_centrality::getCentralityColl(collision); - } - } - // retrive PID information auto trackV0PosDau = lfTracks.rawIteratorAt(candidate.posTrackId()); auto trackV0NegDau = lfTracks.rawIteratorAt(candidate.negTrackId()); @@ -289,8 +280,9 @@ struct HfTreeCreatorToOmegaPiQa { trackPrFromLam = trackV0NegDau; } + auto const& collision = candidate.template collision_as(); + if constexpr (svReco == DCAFITTER) { - auto const& collision = candidate.template collision_as(); rowCandidate(collision.posX(), collision.posY(), collision.posZ(), @@ -367,7 +359,7 @@ struct HfTreeCreatorToOmegaPiQa { originMc); } else { rowKfCandidate(centrality, - candidate.template collision_as().numContrib(), + collision.numContrib(), trackPiFromCharm.tpcNSigmaPi(), trackPiFromCharm.tofNSigmaPi(), trackKaFromCasc.tpcNSigmaKa(), @@ -463,7 +455,9 @@ struct HfTreeCreatorToOmegaPiQa { // Filling candidate properties rowCandidate.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidate(candidate, tracks, lfTracks, -7, RecoDecay::OriginType::None); + auto const& collision = candidate.template collision_as(); + float cent = o2::hf_centrality::getCentralityColl(collision); + fillCandidate(candidate, tracks, lfTracks, -7, RecoDecay::OriginType::None, cent); } } @@ -506,7 +500,9 @@ struct HfTreeCreatorToOmegaPiQa { // Filling candidate properties rowKfCandidate.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidate(candidate, tracks, lfTracks, -7, RecoDecay::OriginType::None); + auto const& collision = candidate.template collision_as(); + float cent = o2::hf_centrality::getCentralityColl(collision); + fillCandidate(candidate, tracks, lfTracks, -7, RecoDecay::OriginType::None, cent); } } @@ -556,9 +552,12 @@ struct HfTreeCreatorToOmegaPiQa { if (keepOnlyMcSignal && candidate.originMcRec() == RecoDecay::OriginType::None) { continue; } - auto mcCollision = candidate.collision_as().mcCollision_as(); - float centFt0m = o2::hf_centrality::getCentralityColl(mcCollision); - fillCandidate(candidate, tracks, lfTracks, candidate.flagMcMatchRec(), candidate.originMcRec(), centFt0m); + auto collision = candidate.collision_as(); + float cent = -1.; + if (collision.has_mcCollision()) { + cent = o2::hf_centrality::getCentralityColl(collision.mcCollision_as()); + } + fillCandidate(candidate, tracks, lfTracks, candidate.flagMcMatchRec(), candidate.originMcRec(), cent); } } @@ -608,9 +607,12 @@ struct HfTreeCreatorToOmegaPiQa { if (keepOnlyMcSignal && candidate.originMcRec() == RecoDecay::OriginType::None) { continue; } - auto mcCollision = candidate.collision_as().mcCollision_as(); - float centFt0m = o2::hf_centrality::getCentralityColl(mcCollision); - fillCandidate(candidate, tracks, lfTracks, candidate.flagMcMatchRec(), candidate.originMcRec(), centFt0m); + auto collision = candidate.collision_as(); + float cent = -1.; + if (collision.has_mcCollision()) { + cent = o2::hf_centrality::getCentralityColl(collision.mcCollision_as()); + } + fillCandidate(candidate, tracks, lfTracks, candidate.flagMcMatchRec(), candidate.originMcRec(), cent); } } diff --git a/PWGHF/TableProducer/treeCreatorToXiPiQa.cxx b/PWGHF/TableProducer/treeCreatorToXiPiQa.cxx index 93dcf26670d..7d10f17f3ff 100644 --- a/PWGHF/TableProducer/treeCreatorToXiPiQa.cxx +++ b/PWGHF/TableProducer/treeCreatorToXiPiQa.cxx @@ -324,7 +324,7 @@ struct HfTreeCreatorToXiPiQa { Configurable selectionFlag{"selectionFlag", 7, "Selection threshold: 1 skims, 3 topology, 7 PID, 15 ML"}; Configurable zPvCut{"zPvCut", 10., "Cut on absolute value of primary vertex z coordinate"}; - Configurable decayChannelSelection{"decayChannelSelection", hf_decay::hf_cand_casc_bach_qa::DecayChannelMain::Xic0ToXiPi, "Decay channel used to match particle information"}; + Configurable decayChannelSelection{"decayChannelSelection", hf_decay::hf_cand_casc_bach_qa::DecayChannelMain::Xic0ToXiPi, "Decay channel used to match particle information"}; Configurable fillGenTable{"fillGenTable", true, "Fill generated MC information if requested"}; using MyTrackTable = soa::Join; @@ -349,8 +349,8 @@ struct HfTreeCreatorToXiPiQa { using McCollisionsCentFT0Ms = soa::Join; Filter filterSelectCandidates = aod::hf_sel_candidate_to_xi_pi_qa::isSelToXiPi >= selectionFlag; - Filter filterRecXiPi = nabs(aod::hf_cand_mc_flag::flagMcMatchRec) == static_cast(decayChannelSelection); - Filter filterGenXiPi = nabs(aod::hf_cand_mc_flag::flagMcMatchGen) == static_cast(decayChannelSelection); + Filter filterRecXiPi = nabs(aod::hf_cand_mc_flag::flagMcMatchRec) == decayChannelSelection; + Filter filterGenXiPi = nabs(aod::hf_cand_mc_flag::flagMcMatchGen) == decayChannelSelection; PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; @@ -521,7 +521,7 @@ struct HfTreeCreatorToXiPiQa { candidate.cpaXYV0(), candidate.cpaXY(), candidate.cpaXYCascade(), - HfHelper::ctXiczero(candidate), + HfHelper::ctXiczero(candidate), // TODO: this gives incorrect value for Omegac0, need to use proper helper function for Omegac0->XiPi trackV0PosDau.eta(), trackV0NegDau.eta(), trackPiFromCasc.eta(), @@ -604,11 +604,11 @@ struct HfTreeCreatorToXiPiQa { candidate.massLambda(), candidate.massCascade(), HfHelper::invMassXiczeroToXiPi(candidate), - HfHelper::yXiczero(candidate), + HfHelper::yXiczero(candidate), // TODO: this gives incorrect value for Omegac0, need to use proper helper function for Omegac0->XiPi RecoDecay::sqrtSumOfSquares(candidate.pxProng1(), candidate.pyProng1()), candidate.pt(), - HfHelper::cosThetaStarXiczeroToXiPi(candidate), - HfHelper::ctXiczero(candidate), + HfHelper::cosThetaStarXiczeroToXiPi(candidate), // TODO: this gives incorrect value for Omegac0, need to use proper helper function for Omegac0->XiPi + HfHelper::ctXiczero(candidate), // TODO: this gives incorrect value for Omegac0, need to use proper helper function for Omegac0->XiPi candidate.eta(), candidate.ndfGeoV0(), candidate.ndfGeoCascade(),