diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 60e672fe819..1f818001bfd 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -121,7 +121,8 @@ struct femtoUniverseProducerTask { Configurable ConfEvtTriggerCheck{"ConfEvtTriggerCheck", true, "Evt sel: check for trigger"}; Configurable ConfEvtTriggerSel{"ConfEvtTriggerSel", kINT7, "Evt sel: trigger"}; Configurable ConfEvtOfflineCheck{"ConfEvtOfflineCheck", false, "Evt sel: check for offline selection"}; - Configurable ConfIsActivateV0{"ConfIsActivateV0", true, "Activate filling of V0 into femtouniverse tables"}; + Configurable ConfIsActivateV0{"ConfIsActivateV0", false, "Activate filling of V0 into femtouniverse tables"}; + Configurable ConfActivateSecondaries{"ConfActivateSecondaries", false, "Fill secondary MC gen particles that were reconstructed"}; Configurable ConfIsActivateCascade{"ConfIsActivateCascade", true, "Activate filling of Cascade into femtouniverse tables"}; Configurable ConfIsActivatePhi{"ConfIsActivatePhi", false, "Activate filling of Phi into femtouniverse tables"}; Configurable ConfMCTruthAnalysisWithPID{"ConfMCTruthAnalysisWithPID", true, "1: take only particles with specified PDG, 0: all particles (for MC Truth)"}; @@ -205,13 +206,12 @@ struct femtoUniverseProducerTask { } ConfFilterCuts; Filter GlobalCutFilter = requireGlobalTrackWoDCAInFilter(); - Filter CustomTrackFilter = (aod::track::pt > ConfFilterCuts.ConfPtLowFilterCut) && (aod::track::pt < ConfFilterCuts.ConfPtHighFilterCut) && (nabs(aod::track::eta) < ConfFilterCuts.ConfEtaFilterCut) && - (!ConfFilterCuts.ConfDxaXYCustom0Cut || (aod::track::dcaXY < ConfFilterCuts.ConfDcaXYFilterCut)) && + (!ConfFilterCuts.ConfDxaXYCustom0Cut || (aod::track::dcaXY < ConfFilterCuts.ConfDcaXYFilterCut)) && // true if configurable set to false or if configurable is true and it passes the selection (aod::track::dcaZ < ConfFilterCuts.ConfDcaZFilterCut) && - (!ConfFilterCuts.ConfDcaXYCustom1Cut || (nabs(aod::track::dcaXY) < ConfFilterCuts.ConfDcaXYCustom11FilterCut + ConfFilterCuts.ConfDcaXYCustom12FilterCut / aod::track::pt)); + (!ConfFilterCuts.ConfDcaXYCustom1Cut || (nabs(aod::track::dcaXY) < ConfFilterCuts.ConfDcaXYCustom11FilterCut + ConfFilterCuts.ConfDcaXYCustom12FilterCut / aod::track::pt)); // same logic here // CASCADE FemtoUniverseCascadeSelection cascadeCuts; @@ -262,10 +262,11 @@ struct femtoUniverseProducerTask { Configurable ConfLooseTOFNSigmaValue{"ConfLooseTOFNSigmaValue", 10, "Value for the loose TOF N Sigma for Kaon PID."}; Configurable ConfInvMassLowLimitPhi{"ConfInvMassLowLimitPhi", 1.011, "Lower limit of the Phi invariant mass"}; // change that to do invariant mass cut Configurable ConfInvMassUpLimitPhi{"ConfInvMassUpLimitPhi", 1.027, "Upper limit of the Phi invariant mass"}; - Configurable ConfPDGCodePartOne{"ConfPDGCodePartOne", 321, "Particle 1 - PDG code"}; - Configurable ConfPDGCodePartTwo{"ConfPDGCodePartTwo", 321, "Particle 2 - PDG code"}; } ConfPhiSelection; + Configurable ConfPDGCodePartOne{"ConfPDGCodePartOne", 321, "Particle 1 - PDG code"}; + Configurable ConfPDGCodePartTwo{"ConfPDGCodePartTwo", 321, "Particle 2 - PDG code"}; + // D0/D0bar mesons struct : o2::framework::ConfigurableGroup { Configurable ConfD0D0barCandMaxY{"ConfD0D0barCandMaxY", -1., "max. cand. rapidity"}; @@ -640,7 +641,7 @@ struct femtoUniverseProducerTask { int particleOrigin = 99; auto motherparticlesMC = particleMC.template mothers_as(); - if (abs(pdgCode) == abs(ConfPhiSelection.ConfPDGCodePartOne.value) || abs(pdgCode) == abs(ConfPhiSelection.ConfPDGCodePartTwo.value)) { + if (abs(pdgCode) == abs(ConfPDGCodePartOne.value) || abs(pdgCode) == abs(ConfPDGCodePartTwo.value)) { if (particleMC.isPhysicalPrimary()) { particleOrigin = aod::femtouniverseMCparticle::ParticleOriginMCTruth::kPrimary; } else if (!motherparticlesMC.empty()) { @@ -1155,6 +1156,9 @@ struct femtoUniverseProducerTask { std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index // lorentz vectors and filling the tables for (auto& [p1, p2] : combinations(soa::CombinationsFullIndexPolicy(tracks, tracks))) { + if (!trackCuts.isSelectedMinimal(p1) || !trackCuts.isSelectedMinimal(p1)) { + continue; + } // implementing PID cuts for phi children if (ConfPhiSelection.ConfLooseTPCNSigma) { if (!(IsKaonNSigmaTPCLoose(p1.pt(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon)))) { @@ -1186,8 +1190,8 @@ struct femtoUniverseProducerTask { TLorentzVector part1Vec; TLorentzVector part2Vec; - float mMassOne = TDatabasePDG::Instance()->GetParticle(ConfPhiSelection.ConfPDGCodePartOne)->Mass(); // FIXME: Get from the PDG service of the common header - float mMassTwo = TDatabasePDG::Instance()->GetParticle(ConfPhiSelection.ConfPDGCodePartTwo)->Mass(); // FIXME: Get from the PDG service of the common header + float mMassOne = TDatabasePDG::Instance()->GetParticle(321)->Mass(); // FIXME: Get from the PDG service of the common header + float mMassTwo = TDatabasePDG::Instance()->GetParticle(-321)->Mass(); // FIXME: Get from the PDG service of the common header part1Vec.SetPtEtaPhiM(p1.pt(), p1.eta(), p1.phi(), mMassOne); part2Vec.SetPtEtaPhiM(p2.pt(), p2.eta(), p2.phi(), mMassTwo); @@ -1217,7 +1221,7 @@ struct femtoUniverseProducerTask { continue; } - phiCuts.fillQA(col, p1, p1, p2, ConfPhiSelection.ConfPDGCodePartOne, ConfPhiSelection.ConfPDGCodePartTwo); ///\todo fill QA also for daughters + phiCuts.fillQA(col, p1, p1, p2, 321, -321); ///\todo fill QA also for daughters int postrackID = p1.globalIndex(); int rowInPrimaryTrackTablePos = -1; // does it do anything? @@ -1283,10 +1287,11 @@ struct femtoUniverseProducerTask { } } - template + template void fillParticles(TrackType const& tracks, std::optional>> recoMcIds = std::nullopt) { std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children + std::vector tmpIDtrack; for (auto& particle : tracks) { /// if the most open selection criteria are not fulfilled there is no @@ -1307,7 +1312,7 @@ struct femtoUniverseProducerTask { if (pdgCode == 333) { // ATTENTION: workaround for now, because all Phi mesons are NOT primary particles for now. pass = true; } else { - if (particle.isPhysicalPrimary() || (recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) + if (particle.isPhysicalPrimary() || (ConfActivateSecondaries && recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) pass = true; } } @@ -1328,6 +1333,10 @@ struct femtoUniverseProducerTask { // instead of the bitmask, the PDG of the particle is stored as uint32_t // now the table is filled + if constexpr (resolveDaughs) { + tmpIDtrack.push_back(particle.globalIndex()); + continue; + } outputParts(outputCollision.lastIndex(), particle.pt(), particle.eta(), @@ -1349,6 +1358,42 @@ struct femtoUniverseProducerTask { outputPartsMCLabels(-1); } } + if constexpr (resolveDaughs) { + childIDs[0] = 0; + childIDs[1] = 0; + for (int i = 0; i < tmpIDtrack.size(); i++) { + const auto& particle = tracks.iteratorAt(tmpIDtrack[i] - tracks.begin().globalIndex()); + for (int daughIndex = 0, n = std::min(2ul, particle.daughtersIds().size()); daughIndex < n; daughIndex++) { + // loop to find the corresponding index of the daughters + for (int j = 0; j < tmpIDtrack.size(); j++) { + if (tmpIDtrack[j] == particle.daughtersIds()[daughIndex]) { + childIDs[daughIndex] = i - j; + break; + } + } + } + outputParts(outputCollision.lastIndex(), + particle.pt(), + particle.eta(), + particle.phi(), + aod::femtouniverseparticle::ParticleType::kMCTruthTrack, + 0, + static_cast(particle.pdgCode()), + particle.pdgCode(), + childIDs, + 0, + 0); + if (ConfIsDebug) { + fillDebugParticle(particle); + } + + // Workaround to keep the FDParticles and MC label tables + // aligned, so that they can be joined in the task. + if constexpr (transientLabels) { + outputPartsMCLabels(-1); + } + } + } } template (groupedMCParticles, recoMcIds); // fills mc particles + fillMCTruthCollisions(groupedCollisions, groupedMCParticles); // fills the reco collisions for mc collision + fillParticles(groupedMCParticles, recoMcIds); // fills mc particles } } PROCESS_SWITCH(femtoUniverseProducerTask, processTruthAndFullMC, "Provide both MC truth and reco for tracks and V0s", false); diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx index 4617f5bd0c5..82561f7c408 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx @@ -182,6 +182,9 @@ struct femtoUniversePairTaskTrackPhi { bool IsProtonRejected(float mom, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK) { + if (mom < 0.5) { + return true; + } if (mom > 0.5) { if (TMath::Hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfBothTracks.ConfNsigmaRejectPion) { return true; @@ -236,6 +239,13 @@ struct femtoUniversePairTaskTrackPhi { bool IsKaonRejected(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi) { + if (mom < 0.5) { + if (TMath::Abs(nsigmaTPCPi) < ConfBothTracks.ConfNsigmaRejectPion) { + return true; + } else if (TMath::Abs(nsigmaTPCPr) < ConfBothTracks.ConfNsigmaRejectProton) { + return true; + } + } if (mom > 0.5) { if (TMath::Hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfBothTracks.ConfNsigmaRejectPion) { return true; @@ -271,6 +281,13 @@ struct femtoUniversePairTaskTrackPhi { bool IsPionRejected(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCK, float nsigmaTOFK) { + if (mom < 0.5) { + if (TMath::Abs(nsigmaTPCK) < ConfBothTracks.ConfNsigmaRejectKaon) { + return true; + } else if (TMath::Abs(nsigmaTPCPr) < ConfBothTracks.ConfNsigmaRejectProton) { + return true; + } + } if (mom > 0.5) { if (TMath::Hypot(nsigmaTOFK, nsigmaTPCK) < ConfBothTracks.ConfNsigmaRejectKaon) { return true; @@ -430,20 +447,6 @@ struct femtoUniversePairTaskTrackPhi { float tpcNSigmaPr, tofNSigmaPr, tpcNSigmaPi, tofNSigmaPi, tpcNSigmaKa, tofNSigmaKa; if (!ConfTrack.ConfIsSame) { for (auto& track : groupPartsTrack) { - // if (track.p() > ConfBothTracks.ConfCutTable->get("Track", "MaxP") || track.pt() > ConfBothTracks.ConfCutTable->get("Track", "MaxPt")) { - // continue; - // } - // if (!isFullPIDSelected(track.pidcut(), - // track.p(), - // ConfBothTracks.ConfCutTable->get("Track", "PIDthr"), - // vPIDTrack, - // ConfBothTracks.ConfNspecies, - // kNsigma, - // ConfBothTracks.ConfCutTable->get("Track", "nSigmaTPC"), - // ConfBothTracks.ConfCutTable->get("Track", "nSigmaTPCTOF"))) { - // continue; - // } - tpcNSigmaPi = trackCuts.getNsigmaTPC(track, o2::track::PID::Pion); tofNSigmaPi = trackCuts.getNsigmaTOF(track, o2::track::PID::Pion); tpcNSigmaKa = trackCuts.getNsigmaTPC(track, o2::track::PID::Kaon); @@ -475,27 +478,6 @@ struct femtoUniversePairTaskTrackPhi { } /// Now build the combinations for (auto& [track, phicandidate] : combinations(CombinationsFullIndexPolicy(groupPartsTrack, groupPartsPhi))) { - // if (track.p() > ConfBothTracks.ConfCutTable->get("PhiCandidate", "MaxP") || track.pt() > ConfBothTracks.ConfCutTable->get("PhiCandidate", "MaxPt") || phicandidate.p() > ConfBothTracks.ConfCutTable->get("Track", "MaxP") || phicandidate.pt() > ConfBothTracks.ConfCutTable->get("Track", "MaxPt")) { - // continue; - // } - // if (!isFullPIDSelected(track.pidcut(), - // track.p(), - // ConfBothTracks.ConfCutTable->get("PhiCandidate", "PIDthr"), - // vPIDPhiCandidate, - // ConfBothTracks.ConfNspecies, - // kNsigma, - // ConfBothTracks.ConfCutTable->get("PhiCandidate", "nSigmaTPC"), - // ConfBothTracks.ConfCutTable->get("PhiCandidate", "nSigmaTPCTOF")) || - // !isFullPIDSelected(phicandidate.pidcut(), - // phicandidate.p(), - // ConfBothTracks.ConfCutTable->get("Track", "PIDthr"), - // vPIDTrack, - // ConfBothTracks.ConfNspecies, - // kNsigma, - // ConfBothTracks.ConfCutTable->get("Track", "nSigmaTPC"), - // ConfBothTracks.ConfCutTable->get("Track", "nSigmaTPCTOF"))) { - // continue; - // } if (ConfTrack.ConfIsTrackIdentified) { if (!IsParticleNSigmaAccepted(track.p(), trackCuts.getNsigmaTPC(track, o2::track::PID::Proton), trackCuts.getNsigmaTOF(track, o2::track::PID::Proton), trackCuts.getNsigmaTPC(track, o2::track::PID::Pion), trackCuts.getNsigmaTOF(track, o2::track::PID::Pion), trackCuts.getNsigmaTPC(track, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(track, o2::track::PID::Kaon))) { continue; @@ -573,27 +555,6 @@ struct femtoUniversePairTaskTrackPhi { { for (auto& [track, phicandidate] : combinations(CombinationsFullIndexPolicy(groupPartsTrack, groupPartsPhi))) { - // if (track.p() > ConfBothTracks.ConfCutTable->get("PhiCandidate", "MaxP") || track.pt() > ConfBothTracks.ConfCutTable->get("PhiCandidate", "MaxPt") || phicandidate.p() > ConfBothTracks.ConfCutTable->get("Track", "MaxP") || phicandidate.pt() > ConfBothTracks.ConfCutTable->get("Track", "MaxPt")) { - // continue; - // } - // if (!isFullPIDSelected(track.pidcut(), - // track.p(), - // ConfBothTracks.ConfCutTable->get("PhiCandidate", "PIDthr"), - // vPIDPhiCandidate, - // ConfBothTracks.ConfNspecies, - // kNsigma, - // ConfBothTracks.ConfCutTable->get("PhiCandidate", "nSigmaTPC"), - // ConfBothTracks.ConfCutTable->get("PhiCandidate", "nSigmaTPCTOF")) || - // !isFullPIDSelected(phicandidate.pidcut(), - // phicandidate.p(), - // ConfBothTracks.ConfCutTable->get("Track", "PIDthr"), - // vPIDTrack, - // ConfBothTracks.ConfNspecies, - // kNsigma, - // ConfBothTracks.ConfCutTable->get("Track", "nSigmaTPC"), - // ConfBothTracks.ConfCutTable->get("Track", "nSigmaTPCTOF"))) { - // continue; - // } if (ConfTrack.ConfIsTrackIdentified) { if (!IsParticleNSigmaAccepted(track.p(), trackCuts.getNsigmaTPC(track, o2::track::PID::Proton), trackCuts.getNsigmaTOF(track, o2::track::PID::Proton), trackCuts.getNsigmaTPC(track, o2::track::PID::Pion), trackCuts.getNsigmaTOF(track, o2::track::PID::Pion), trackCuts.getNsigmaTPC(track, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(track, o2::track::PID::Kaon))) { continue;