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
@@ -132,14 +133,6 @@ struct BoundEfficiencyMap {
132133 }
133134};
134135
135- /*
136- struct AnalysisRegion {
137- std::string suffix;
138- float minMass;
139- float maxMass;
140- };
141- */
142-
143136struct PhiStrangenessCorrelation {
144137 HistogramRegistry histos{" phiStrangenessCorrelation" , {}, OutputObjHandlingPolicy::AnalysisObject, true , true };
145138
@@ -161,7 +154,6 @@ struct PhiStrangenessCorrelation {
161154 Configurable<bool > cfgPVContributor{" cfgPVContributor" , true , " PV contributor track selection" };
162155 Configurable<float > cMinKaonPtcut{" cMinKaonPtcut" , 0 .15f , " Track minimum pt cut" };
163156 Configurable<float > etaMax{" etaMax" , 0 .8f , " eta max" };
164- Configurable<float > pTToUseTOF{" pTToUseTOF" , 0 .5f , " pT above which use TOF" };
165157 Configurable<float > cMaxDCAzToPVcut{" cMaxDCAzToPVcut" , 2 .0f , " Track DCAz cut to PV Maximum" };
166158 Configurable<std::vector<float >> cMaxDCArToPVPhi{" cMaxDCArToPVPhi" , {0 .004f , 0 .013f , 1 .0f }, " Track DCAr cut to PV for Phi" };
167159
@@ -183,6 +175,12 @@ struct PhiStrangenessCorrelation {
183175 Configurable<float > maxChi2TPC{" maxChi2TPC" , 4 .0f , " max chi2 per cluster TPC" };
184176 Configurable<int > minITSnCls{" minITSnCls" , 4 , " min number of ITS clusters" };
185177 Configurable<float > maxChi2ITS{" maxChi2ITS" , 36 .0f , " max chi2 per cluster ITS" };
178+
179+ Configurable<bool > forceTOF{" forceTOF" , false , " force the TOF signal for the PID" };
180+ Configurable<float > tofPIDThreshold{" tofPIDThreshold" , 0.5 , " minimum pT after which TOF PID is applicable" };
181+ 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" };
182+ Configurable<std::vector<float >> pidTPCMax{" pidTPCMax" , std::vector<float >{2 ., 0 ., 0 .}, " maximum nSigma TPC" };
183+ Configurable<std::vector<float >> pidTOFMax{" pidTOFMax" , std::vector<float >{2 ., 0 ., 0 .}, " maximum nSigma TOF" };
186184 } trackConfigs;
187185
188186 // Configurables on phi selection
@@ -270,10 +268,11 @@ struct PhiStrangenessCorrelation {
270268
271269 // Preslice for manual slicing
272270 struct : PresliceGroup {
273- PresliceUnsorted<aod::McCollisionLabels> collPerMCCollision = aod::mccollisionlabel::mcCollisionId;
271+ Preslice<SimCollisions> collPerMCCollision = aod::mccollisionlabel::mcCollisionId;
272+ Preslice<FullMCV0s> v0PerCollision = aod::v0::collisionId;
273+ Preslice<FullMCTracks> trackPerCollision = aod::track::collisionId;
274274 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;
275+
277276 // Preslice<aod::McParticles> mcPartPerMCCollision = aod::mcparticle::mcCollisionId;
278277 } preslices;
279278
@@ -344,8 +343,6 @@ struct PhiStrangenessCorrelation {
344343 ccdb->setLocalObjectValidityChecking ();
345344 ccdb->setFatalWhenNull (false );
346345
347- // getEfficiencyMapsFromCCDB();
348-
349346 for (int i = 0 ; i < 4 ; ++i) {
350347 loadEfficiencyMapFromCCDB (static_cast <ParticleOfInterest>(i));
351348 }
@@ -360,12 +357,6 @@ struct PhiStrangenessCorrelation {
360357 LOG (info) << " Efficiency map for " << particleOfInterestLabels[poi] << " loaded from CCDB" ;
361358 }
362359
363- /*
364- void getEfficiencyMapsFromCCDB()
365- {
366- }
367- */
368-
369360 // Compute weight based on efficiencies
370361 template <typename ... BoundEffMaps>
371362 float computeWeight (const BoundEffMaps&... boundEffMaps)
@@ -435,7 +426,46 @@ struct PhiStrangenessCorrelation {
435426 return true ;
436427 }
437428
438- // Topological selection for pions
429+ // PID selection for Pions
430+ template <typename T>
431+ bool pidSelectionPion (const T& track)
432+ {
433+ for (size_t speciesIndex = 0 ; speciesIndex < trackConfigs.trkPIDspecies ->size (); ++speciesIndex) {
434+ auto const & pid = trackConfigs.trkPIDspecies ->at (speciesIndex);
435+ auto nSigmaTPC = aod::pidutils::tpcNSigma (pid, track);
436+
437+ if (trackConfigs.forceTOF && !track.hasTOF ()) {
438+ return false ;
439+ }
440+
441+ if (speciesIndex == 0 ) { // First species logic
442+ if (std::abs (nSigmaTPC) >= trackConfigs.pidTPCMax ->at (speciesIndex)) {
443+ return false ; // TPC check failed
444+ }
445+ if (trackConfigs.forceTOF || (track.pt () > trackConfigs.tofPIDThreshold && track.hasTOF ())) {
446+ auto nSigmaTOF = aod::pidutils::tofNSigma (pid, track);
447+ if (std::abs (nSigmaTOF) >= trackConfigs.pidTOFMax ->at (speciesIndex)) {
448+ return false ; // TOF check failed
449+ }
450+ }
451+ } else { // Other species logic
452+ if (std::abs (nSigmaTPC) < trackConfigs.pidTPCMax ->at (speciesIndex)) { // Check TPC nSigma first
453+ if (track.hasTOF ()) {
454+ auto nSigmaTOF = aod::pidutils::tofNSigma (pid, track);
455+ if (std::abs (nSigmaTOF) < trackConfigs.pidTOFMax ->at (speciesIndex)) {
456+ return false ; // Reject if both TPC and TOF are within thresholds
457+ }
458+ } else {
459+ return false ; // Reject if only TPC is within threshold and TOF is unavailable
460+ }
461+ }
462+ }
463+ }
464+
465+ return true ;
466+ }
467+
468+ // Track selection for Pions
439469 template <typename T>
440470 bool selectionPion (const T& track)
441471 {
@@ -460,70 +490,27 @@ struct PhiStrangenessCorrelation {
460490 return false ;
461491 }
462492
463- if (trackConfigs.cfgIsTOFChecked && track.pt () >= trackConfigs.pTToUseTOF && !track.hasTOF ())
493+ if (trackConfigs.cfgIsTOFChecked && track.pt () >= trackConfigs.tofPIDThreshold && !track.hasTOF ())
494+ return false ;
495+
496+ if (analysisMode == 1 && !pidSelectionPion (track))
464497 return false ;
465498
499+ /*
466500 if (analysisMode == 1) {
467- if (track.pt () < trackConfigs.pTToUseTOF && std::abs (track.tpcNSigmaPi ()) >= trackConfigs.nSigmaCutTPCPrimPion )
501+ if (track.pt() < trackConfigs.tofPIDThreshold && std::abs(track.tpcNSigmaPi()) >= trackConfigs.nSigmaCutTPCPrimPion)
468502 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 ))
503+ if (trackConfigs.cfgIsTOFChecked && track.pt() >= trackConfigs.tofPIDThreshold && (std::pow(track.tofNSigmaPi(), 2) + std::pow(track.tpcNSigmaPi(), 2)) >= std::pow(trackConfigs.nSigmaCutCombinedPi, 2))
470504 return false;
471505 }
506+ */
472507
473508 if (std::abs (track.rapidity (massPi)) > yConfigs.cfgYAcceptance )
474509 return false ;
475510
476511 return true ;
477512 }
478513
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-
527514 void processPhiK0SPionDeltayDeltaphiData2D (SelCollisions::iterator const & collision, aod::PhimesonCandidates const & phiCandidates, FullTracks const & fullTracks, FullV0s const & V0s, V0DauTracks const &)
528515 {
529516 float multiplicity = collision.centFT0M ();
@@ -565,12 +552,12 @@ struct PhiStrangenessCorrelation {
565552 if (!selectionPion (track))
566553 continue ;
567554
568- auto Pion = track.pt () < trackConfigs.pTToUseTOF ? PionTPC : PionTPCTOF;
555+ auto Pion = track.pt () < trackConfigs.tofPIDThreshold ? PionTPC : PionTPCTOF;
569556
570557 float weightPhiPion = computeWeight (BoundEfficiencyMap (effMaps[Phi], multiplicity, phiCand.pt (), phiCand.y ()),
571558 BoundEfficiencyMap (effMaps[Pion], multiplicity, track.pt (), track.rapidity (massPi)));
572559
573- /* auto effMapPion = track.pt() < trackConfigs.pTToUseTOF ? effMapPionTPC : effMapPionTPCTOF;
560+ /* auto effMapPion = track.pt() < trackConfigs.tofPIDThreshold ? effMapPionTPC : effMapPionTPCTOF;
574561
575562 float weightPhiPion = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()),
576563 BoundEfficiencyMap(effMapPion, multiplicity, track.pt(), track.rapidity(massPi)));*/
0 commit comments