diff --git a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx index bfa459f6502..da93877f57f 100644 --- a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx @@ -37,6 +37,7 @@ #include "Framework/HistogramRegistry.h" #include "Framework/O2DatabasePDGPlugin.h" #include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/PID.h" #include "ReconstructionDataFormats/Track.h" #include @@ -59,6 +60,7 @@ #include #include #include +#include #include #include #include @@ -132,14 +134,6 @@ struct BoundEfficiencyMap { } }; -/* -struct AnalysisRegion { - std::string suffix; - float minMass; - float maxMass; -}; -*/ - struct PhiStrangenessCorrelation { HistogramRegistry histos{"phiStrangenessCorrelation", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -161,7 +155,6 @@ struct PhiStrangenessCorrelation { Configurable cfgPVContributor{"cfgPVContributor", true, "PV contributor track selection"}; Configurable cMinKaonPtcut{"cMinKaonPtcut", 0.15f, "Track minimum pt cut"}; Configurable etaMax{"etaMax", 0.8f, "eta max"}; - Configurable pTToUseTOF{"pTToUseTOF", 0.5f, "pT above which use TOF"}; Configurable cMaxDCAzToPVcut{"cMaxDCAzToPVcut", 2.0f, "Track DCAz cut to PV Maximum"}; Configurable> cMaxDCArToPVPhi{"cMaxDCArToPVPhi", {0.004f, 0.013f, 1.0f}, "Track DCAr cut to PV for Phi"}; @@ -183,6 +176,12 @@ struct PhiStrangenessCorrelation { Configurable maxChi2TPC{"maxChi2TPC", 4.0f, "max chi2 per cluster TPC"}; Configurable minITSnCls{"minITSnCls", 4, "min number of ITS clusters"}; Configurable maxChi2ITS{"maxChi2ITS", 36.0f, "max chi2 per cluster ITS"}; + + Configurable forceTOF{"forceTOF", false, "force the TOF signal for the PID"}; + Configurable tofPIDThreshold{"tofPIDThreshold", 0.5, "minimum pT after which TOF PID is applicable"}; + Configurable> trkPIDspecies{"trkPIDspecies", std::vector{o2::track::PID::Pion, o2::track::PID::Kaon, o2::track::PID::Proton}, "Trk sel: Particles species for PID, proton, pion, kaon"}; + Configurable> pidTPCMax{"pidTPCMax", std::vector{2., 0., 0.}, "maximum nSigma TPC"}; + Configurable> pidTOFMax{"pidTOFMax", std::vector{2., 0., 0.}, "maximum nSigma TOF"}; } trackConfigs; // Configurables on phi selection @@ -270,10 +269,11 @@ struct PhiStrangenessCorrelation { // Preslice for manual slicing struct : PresliceGroup { - PresliceUnsorted collPerMCCollision = aod::mccollisionlabel::mcCollisionId; + Preslice collPerMCCollision = aod::mccollisionlabel::mcCollisionId; + Preslice v0PerCollision = aod::v0::collisionId; + Preslice trackPerCollision = aod::track::collisionId; Preslice phiCandPerCollision = aod::lf_selection_phi_candidate::collisionId; - Preslice v0PerCollision = aod::v0::collisionId; - Preslice trackPerCollision = aod::track::collisionId; + // Preslice mcPartPerMCCollision = aod::mcparticle::mcCollisionId; } preslices; @@ -344,8 +344,6 @@ struct PhiStrangenessCorrelation { ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); - // getEfficiencyMapsFromCCDB(); - for (int i = 0; i < 4; ++i) { loadEfficiencyMapFromCCDB(static_cast(i)); } @@ -360,12 +358,6 @@ struct PhiStrangenessCorrelation { LOG(info) << "Efficiency map for " << particleOfInterestLabels[poi] << " loaded from CCDB"; } - /* - void getEfficiencyMapsFromCCDB() - { - } - */ - // Compute weight based on efficiencies template float computeWeight(const BoundEffMaps&... boundEffMaps) @@ -435,7 +427,46 @@ struct PhiStrangenessCorrelation { return true; } - // Topological selection for pions + // PID selection for Pions + template + bool pidSelectionPion(const T& track) + { + for (size_t speciesIndex = 0; speciesIndex < trackConfigs.trkPIDspecies->size(); ++speciesIndex) { + auto const& pid = trackConfigs.trkPIDspecies->at(speciesIndex); + auto nSigmaTPC = aod::pidutils::tpcNSigma(pid, track); + + if (trackConfigs.forceTOF && !track.hasTOF()) { + return false; + } + + if (speciesIndex == 0) { // First species logic + if (std::abs(nSigmaTPC) >= trackConfigs.pidTPCMax->at(speciesIndex)) { + return false; // TPC check failed + } + if (trackConfigs.forceTOF || (track.pt() > trackConfigs.tofPIDThreshold && track.hasTOF())) { + auto nSigmaTOF = aod::pidutils::tofNSigma(pid, track); + if (std::abs(nSigmaTOF) >= trackConfigs.pidTOFMax->at(speciesIndex)) { + return false; // TOF check failed + } + } + } else { // Other species logic + if (std::abs(nSigmaTPC) < trackConfigs.pidTPCMax->at(speciesIndex)) { // Check TPC nSigma first + if (track.hasTOF()) { + auto nSigmaTOF = aod::pidutils::tofNSigma(pid, track); + if (std::abs(nSigmaTOF) < trackConfigs.pidTOFMax->at(speciesIndex)) { + return false; // Reject if both TPC and TOF are within thresholds + } + } else { + return false; // Reject if only TPC is within threshold and TOF is unavailable + } + } + } + } + + return true; + } + + // Track selection for Pions template bool selectionPion(const T& track) { @@ -460,15 +491,20 @@ struct PhiStrangenessCorrelation { return false; } - if (trackConfigs.cfgIsTOFChecked && track.pt() >= trackConfigs.pTToUseTOF && !track.hasTOF()) + if (trackConfigs.cfgIsTOFChecked && track.pt() >= trackConfigs.tofPIDThreshold && !track.hasTOF()) + return false; + + if (analysisMode == 1 && !pidSelectionPion(track)) return false; + /* if (analysisMode == 1) { - if (track.pt() < trackConfigs.pTToUseTOF && std::abs(track.tpcNSigmaPi()) >= trackConfigs.nSigmaCutTPCPrimPion) + if (track.pt() < trackConfigs.tofPIDThreshold && std::abs(track.tpcNSigmaPi()) >= trackConfigs.nSigmaCutTPCPrimPion) return false; - if (trackConfigs.cfgIsTOFChecked && track.pt() >= trackConfigs.pTToUseTOF && (std::pow(track.tofNSigmaPi(), 2) + std::pow(track.tpcNSigmaPi(), 2)) >= std::pow(trackConfigs.nSigmaCutCombinedPi, 2)) + if (trackConfigs.cfgIsTOFChecked && track.pt() >= trackConfigs.tofPIDThreshold && (std::pow(track.tofNSigmaPi(), 2) + std::pow(track.tpcNSigmaPi(), 2)) >= std::pow(trackConfigs.nSigmaCutCombinedPi, 2)) return false; } + */ if (std::abs(track.rapidity(massPi)) > yConfigs.cfgYAcceptance) return false; @@ -476,54 +512,6 @@ struct PhiStrangenessCorrelation { return true; } - /* - void processPhiK0SPionDeltayDeltaphiData2D(SelCollisions::iterator const& collision, aod::PhimesonCandidates const& phiCandidates, FullTracks const& fullTracks, FullV0s const& V0s, V0DauTracks const&) - { - float multiplicity = collision.centFT0M(); - - std::vector analysisRegions = { - {"Signal", phiConfigs.rangeMPhiSignal.first, phiConfigs.rangeMPhiSignal.second}, - {"Sideband", phiConfigs.rangeMPhiSideband.first, phiConfigs.rangeMPhiSideband.second}}; - - // Loop over all positive tracks - for (const auto& phiCand : phiCandidates) { - float weightPhi = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y())); - - histos.fill(HIST("phi/h3PhiData"), multiplicity, phiCand.pt(), phiCand.m(), weightPhi); - - for (const auto& region : analysisRegions) { - if (!phiCand.inMassRegion(region.minMass, region.maxMass)) - continue; - - // V0 already reconstructed by the builder - for (const auto& v0 : V0s) { - // Cut on V0 dynamic columns - if (!selectionV0(v0, collision)) - continue; - - float weightPhiK0S = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()), - BoundEfficiencyMap(effMapK0S, multiplicity, v0.pt(), v0.yK0Short())); - - histos.fill(HIST("phiK0S/h5PhiK0SData2PartCorr"), multiplicity, phiCand.pt(), v0.pt(), phiCand.y() - v0.yK0Short(), phiCand.phi() - v0.phi(), weightPhiK0S); - } - - // Loop over all primary pion candidates - for (const auto& track : fullTracks) { - if (!selectionPion(track)) - continue; - - float weightPhiPion = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()), - track.pt() < trackConfigs.pTToUseTOF ? BoundEfficiencyMap(effMapPionTPC, multiplicity, track.pt(), track.rapidity(massPi)) : BoundEfficiencyMap(effMapPionTPCTOF, multiplicity, track.pt(), track.rapidity(massPi))); - - histos.fill(HIST("phiPi/h5PhiPiData2PartCorr"), multiplicity, phiCand.pt(), track.pt(), phiCand.y() - track.rapidity(massPi), phiCand.phi() - track.phi(), weightPhiPion); - } - } - } - } - - PROCESS_SWITCH(PhiStrangenessCorrelation, processPhiK0SPionDeltayDeltaphiData2D, "Process function for Phi-K0S and Phi-Pion Deltay and Deltaphi 2D Correlations in Data", true); - */ - void processPhiK0SPionDeltayDeltaphiData2D(SelCollisions::iterator const& collision, aod::PhimesonCandidates const& phiCandidates, FullTracks const& fullTracks, FullV0s const& V0s, V0DauTracks const&) { float multiplicity = collision.centFT0M(); @@ -565,12 +553,12 @@ struct PhiStrangenessCorrelation { if (!selectionPion(track)) continue; - auto Pion = track.pt() < trackConfigs.pTToUseTOF ? PionTPC : PionTPCTOF; + auto Pion = track.pt() < trackConfigs.tofPIDThreshold ? PionTPC : PionTPCTOF; float weightPhiPion = computeWeight(BoundEfficiencyMap(effMaps[Phi], multiplicity, phiCand.pt(), phiCand.y()), BoundEfficiencyMap(effMaps[Pion], multiplicity, track.pt(), track.rapidity(massPi))); - /*auto effMapPion = track.pt() < trackConfigs.pTToUseTOF ? effMapPionTPC : effMapPionTPCTOF; + /*auto effMapPion = track.pt() < trackConfigs.tofPIDThreshold ? effMapPionTPC : effMapPionTPCTOF; float weightPhiPion = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()), BoundEfficiencyMap(effMapPion, multiplicity, track.pt(), track.rapidity(massPi)));*/