3737#include " Framework/HistogramRegistry.h"
3838#include " Framework/O2DatabasePDGPlugin.h"
3939#include " Framework/runDataProcessing.h"
40+ #include " ReconstructionDataFormats/PID.h"
4041#include " ReconstructionDataFormats/Track.h"
4142#include < Framework/StaticFor.h>
4243
5960#include < array>
6061#include < cmath>
6162#include < cstdlib>
63+ #include < memory>
6264#include < ranges>
6365#include < string>
6466#include < string_view>
@@ -132,14 +134,6 @@ struct BoundEfficiencyMap {
132134 }
133135};
134136
135- /*
136- struct AnalysisRegion {
137- std::string suffix;
138- float minMass;
139- float maxMass;
140- };
141- */
142-
143137struct PhiStrangenessCorrelation {
144138 HistogramRegistry histos{" phiStrangenessCorrelation" , {}, OutputObjHandlingPolicy::AnalysisObject, true , true };
145139
@@ -161,7 +155,6 @@ struct PhiStrangenessCorrelation {
161155 Configurable<bool > cfgPVContributor{" cfgPVContributor" , true , " PV contributor track selection" };
162156 Configurable<float > cMinKaonPtcut{" cMinKaonPtcut" , 0 .15f , " Track minimum pt cut" };
163157 Configurable<float > etaMax{" etaMax" , 0 .8f , " eta max" };
164- Configurable<float > pTToUseTOF{" pTToUseTOF" , 0 .5f , " pT above which use TOF" };
165158 Configurable<float > cMaxDCAzToPVcut{" cMaxDCAzToPVcut" , 2 .0f , " Track DCAz cut to PV Maximum" };
166159 Configurable<std::vector<float >> cMaxDCArToPVPhi{" cMaxDCArToPVPhi" , {0 .004f , 0 .013f , 1 .0f }, " Track DCAr cut to PV for Phi" };
167160
@@ -183,6 +176,12 @@ struct PhiStrangenessCorrelation {
183176 Configurable<float > maxChi2TPC{" maxChi2TPC" , 4 .0f , " max chi2 per cluster TPC" };
184177 Configurable<int > minITSnCls{" minITSnCls" , 4 , " min number of ITS clusters" };
185178 Configurable<float > maxChi2ITS{" maxChi2ITS" , 36 .0f , " max chi2 per cluster ITS" };
179+
180+ Configurable<bool > forceTOF{" forceTOF" , false , " force the TOF signal for the PID" };
181+ Configurable<float > tofPIDThreshold{" tofPIDThreshold" , 0.5 , " minimum pT after which TOF PID is applicable" };
182+ Configurable<std::vector<int >> trkPIDspecies{" trkPIDspecies" , std::vector<int >{o2::track::PID::Pion, o2::track::PID::Kaon, o2::track::PID::Proton}, " Trk sel: Particles species for PID, proton, pion, kaon" };
183+ Configurable<std::vector<float >> pidTPCMax{" pidTPCMax" , std::vector<float >{2 ., 0 ., 0 .}, " maximum nSigma TPC" };
184+ Configurable<std::vector<float >> pidTOFMax{" pidTOFMax" , std::vector<float >{2 ., 0 ., 0 .}, " maximum nSigma TOF" };
186185 } trackConfigs;
187186
188187 // Configurables on phi selection
@@ -270,10 +269,11 @@ struct PhiStrangenessCorrelation {
270269
271270 // Preslice for manual slicing
272271 struct : PresliceGroup {
273- PresliceUnsorted<aod::McCollisionLabels> collPerMCCollision = aod::mccollisionlabel::mcCollisionId;
272+ Preslice<SimCollisions> collPerMCCollision = aod::mccollisionlabel::mcCollisionId;
273+ Preslice<FullMCV0s> v0PerCollision = aod::v0::collisionId;
274+ Preslice<FullMCTracks> trackPerCollision = aod::track::collisionId;
274275 Preslice<aod::PhimesonCandidates> phiCandPerCollision = aod::lf_selection_phi_candidate::collisionId;
275- Preslice<aod::V0Datas> v0PerCollision = aod::v0::collisionId;
276- Preslice<aod::Tracks> trackPerCollision = aod::track::collisionId;
276+
277277 // Preslice<aod::McParticles> mcPartPerMCCollision = aod::mcparticle::mcCollisionId;
278278 } preslices;
279279
@@ -344,8 +344,6 @@ struct PhiStrangenessCorrelation {
344344 ccdb->setLocalObjectValidityChecking ();
345345 ccdb->setFatalWhenNull (false );
346346
347- // getEfficiencyMapsFromCCDB();
348-
349347 for (int i = 0 ; i < 4 ; ++i) {
350348 loadEfficiencyMapFromCCDB (static_cast <ParticleOfInterest>(i));
351349 }
@@ -360,12 +358,6 @@ struct PhiStrangenessCorrelation {
360358 LOG (info) << " Efficiency map for " << particleOfInterestLabels[poi] << " loaded from CCDB" ;
361359 }
362360
363- /*
364- void getEfficiencyMapsFromCCDB()
365- {
366- }
367- */
368-
369361 // Compute weight based on efficiencies
370362 template <typename ... BoundEffMaps>
371363 float computeWeight (const BoundEffMaps&... boundEffMaps)
@@ -435,7 +427,46 @@ struct PhiStrangenessCorrelation {
435427 return true ;
436428 }
437429
438- // Topological selection for pions
430+ // PID selection for Pions
431+ template <typename T>
432+ bool pidSelectionPion (const T& track)
433+ {
434+ for (size_t speciesIndex = 0 ; speciesIndex < trackConfigs.trkPIDspecies ->size (); ++speciesIndex) {
435+ auto const & pid = trackConfigs.trkPIDspecies ->at (speciesIndex);
436+ auto nSigmaTPC = aod::pidutils::tpcNSigma (pid, track);
437+
438+ if (trackConfigs.forceTOF && !track.hasTOF ()) {
439+ return false ;
440+ }
441+
442+ if (speciesIndex == 0 ) { // First species logic
443+ if (std::abs (nSigmaTPC) >= trackConfigs.pidTPCMax ->at (speciesIndex)) {
444+ return false ; // TPC check failed
445+ }
446+ if (trackConfigs.forceTOF || (track.pt () > trackConfigs.tofPIDThreshold && track.hasTOF ())) {
447+ auto nSigmaTOF = aod::pidutils::tofNSigma (pid, track);
448+ if (std::abs (nSigmaTOF) >= trackConfigs.pidTOFMax ->at (speciesIndex)) {
449+ return false ; // TOF check failed
450+ }
451+ }
452+ } else { // Other species logic
453+ if (std::abs (nSigmaTPC) < trackConfigs.pidTPCMax ->at (speciesIndex)) { // Check TPC nSigma first
454+ if (track.hasTOF ()) {
455+ auto nSigmaTOF = aod::pidutils::tofNSigma (pid, track);
456+ if (std::abs (nSigmaTOF) < trackConfigs.pidTOFMax ->at (speciesIndex)) {
457+ return false ; // Reject if both TPC and TOF are within thresholds
458+ }
459+ } else {
460+ return false ; // Reject if only TPC is within threshold and TOF is unavailable
461+ }
462+ }
463+ }
464+ }
465+
466+ return true ;
467+ }
468+
469+ // Track selection for Pions
439470 template <typename T>
440471 bool selectionPion (const T& track)
441472 {
@@ -460,70 +491,27 @@ struct PhiStrangenessCorrelation {
460491 return false ;
461492 }
462493
463- if (trackConfigs.cfgIsTOFChecked && track.pt () >= trackConfigs.pTToUseTOF && !track.hasTOF ())
494+ if (trackConfigs.cfgIsTOFChecked && track.pt () >= trackConfigs.tofPIDThreshold && !track.hasTOF ())
495+ return false ;
496+
497+ if (analysisMode == 1 && !pidSelectionPion (track))
464498 return false ;
465499
500+ /*
466501 if (analysisMode == 1) {
467- if (track.pt () < trackConfigs.pTToUseTOF && std::abs (track.tpcNSigmaPi ()) >= trackConfigs.nSigmaCutTPCPrimPion )
502+ if (track.pt() < trackConfigs.tofPIDThreshold && std::abs(track.tpcNSigmaPi()) >= trackConfigs.nSigmaCutTPCPrimPion)
468503 return false;
469- if (trackConfigs.cfgIsTOFChecked && track.pt () >= trackConfigs.pTToUseTOF && (std::pow (track.tofNSigmaPi (), 2 ) + std::pow (track.tpcNSigmaPi (), 2 )) >= std::pow (trackConfigs.nSigmaCutCombinedPi , 2 ))
504+ if (trackConfigs.cfgIsTOFChecked && track.pt() >= trackConfigs.tofPIDThreshold && (std::pow(track.tofNSigmaPi(), 2) + std::pow(track.tpcNSigmaPi(), 2)) >= std::pow(trackConfigs.nSigmaCutCombinedPi, 2))
470505 return false;
471506 }
507+ */
472508
473509 if (std::abs (track.rapidity (massPi)) > yConfigs.cfgYAcceptance )
474510 return false ;
475511
476512 return true ;
477513 }
478514
479- /*
480- void processPhiK0SPionDeltayDeltaphiData2D(SelCollisions::iterator const& collision, aod::PhimesonCandidates const& phiCandidates, FullTracks const& fullTracks, FullV0s const& V0s, V0DauTracks const&)
481- {
482- float multiplicity = collision.centFT0M();
483-
484- std::vector<AnalysisRegion> analysisRegions = {
485- {"Signal", phiConfigs.rangeMPhiSignal.first, phiConfigs.rangeMPhiSignal.second},
486- {"Sideband", phiConfigs.rangeMPhiSideband.first, phiConfigs.rangeMPhiSideband.second}};
487-
488- // Loop over all positive tracks
489- for (const auto& phiCand : phiCandidates) {
490- float weightPhi = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()));
491-
492- histos.fill(HIST("phi/h3PhiData"), multiplicity, phiCand.pt(), phiCand.m(), weightPhi);
493-
494- for (const auto& region : analysisRegions) {
495- if (!phiCand.inMassRegion(region.minMass, region.maxMass))
496- continue;
497-
498- // V0 already reconstructed by the builder
499- for (const auto& v0 : V0s) {
500- // Cut on V0 dynamic columns
501- if (!selectionV0<false>(v0, collision))
502- continue;
503-
504- float weightPhiK0S = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()),
505- BoundEfficiencyMap(effMapK0S, multiplicity, v0.pt(), v0.yK0Short()));
506-
507- histos.fill(HIST("phiK0S/h5PhiK0SData2PartCorr"), multiplicity, phiCand.pt(), v0.pt(), phiCand.y() - v0.yK0Short(), phiCand.phi() - v0.phi(), weightPhiK0S);
508- }
509-
510- // Loop over all primary pion candidates
511- for (const auto& track : fullTracks) {
512- if (!selectionPion(track))
513- continue;
514-
515- float weightPhiPion = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()),
516- track.pt() < trackConfigs.pTToUseTOF ? BoundEfficiencyMap(effMapPionTPC, multiplicity, track.pt(), track.rapidity(massPi)) : BoundEfficiencyMap(effMapPionTPCTOF, multiplicity, track.pt(), track.rapidity(massPi)));
517-
518- histos.fill(HIST("phiPi/h5PhiPiData2PartCorr"), multiplicity, phiCand.pt(), track.pt(), phiCand.y() - track.rapidity(massPi), phiCand.phi() - track.phi(), weightPhiPion);
519- }
520- }
521- }
522- }
523-
524- PROCESS_SWITCH(PhiStrangenessCorrelation, processPhiK0SPionDeltayDeltaphiData2D, "Process function for Phi-K0S and Phi-Pion Deltay and Deltaphi 2D Correlations in Data", true);
525- */
526-
527515 void processPhiK0SPionDeltayDeltaphiData2D (SelCollisions::iterator const & collision, aod::PhimesonCandidates const & phiCandidates, FullTracks const & fullTracks, FullV0s const & V0s, V0DauTracks const &)
528516 {
529517 float multiplicity = collision.centFT0M ();
@@ -565,12 +553,12 @@ struct PhiStrangenessCorrelation {
565553 if (!selectionPion (track))
566554 continue ;
567555
568- auto Pion = track.pt () < trackConfigs.pTToUseTOF ? PionTPC : PionTPCTOF;
556+ auto Pion = track.pt () < trackConfigs.tofPIDThreshold ? PionTPC : PionTPCTOF;
569557
570558 float weightPhiPion = computeWeight (BoundEfficiencyMap (effMaps[Phi], multiplicity, phiCand.pt (), phiCand.y ()),
571559 BoundEfficiencyMap (effMaps[Pion], multiplicity, track.pt (), track.rapidity (massPi)));
572560
573- /* auto effMapPion = track.pt() < trackConfigs.pTToUseTOF ? effMapPionTPC : effMapPionTPCTOF;
561+ /* auto effMapPion = track.pt() < trackConfigs.tofPIDThreshold ? effMapPionTPC : effMapPionTPCTOF;
574562
575563 float weightPhiPion = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()),
576564 BoundEfficiencyMap(effMapPion, multiplicity, track.pt(), track.rapidity(massPi)));*/
0 commit comments