@@ -938,7 +938,7 @@ struct Phik0shortanalysis {
938938 }
939939
940940 template <typename T1, typename T2>
941- bool eventHasPhi (const T1& posTracks, const T2& negTracks)
941+ bool eventHasRecoPhi (const T1& posTracks, const T2& negTracks)
942942 {
943943 int nPhi = 0 ;
944944
@@ -957,7 +957,7 @@ struct Phik0shortanalysis {
957957 continue ; // condition to avoid double counting of pair
958958
959959 ROOT::Math::PxPyPzMVector recPhi = recMother (track1, track2, massKa, massKa);
960- if (recPhi.Pt () < minPhiPt || recPhi. Pt () > maxPhiPt )
960+ if (recPhi.Pt () < minPhiPt)
961961 continue ;
962962 if (recPhi.M () < lowMPhi || recPhi.M () > upMPhi)
963963 continue ;
@@ -973,19 +973,95 @@ struct Phik0shortanalysis {
973973 return false ;
974974 }
975975
976+ template <typename T1, typename T2>
977+ bool eventHasRecoPhiWPDG (const T1& posTracks, const T2& negTracks)
978+ {
979+ int nPhi = 0 ;
980+
981+ for (const auto & track1 : posTracks) {
982+ if (!selectionTrackResonance<true >(track1, false ) || !selectionPIDKaonpTdependent (track1))
983+ continue ; // topological and PID selection
984+
985+ auto track1ID = track1.globalIndex ();
986+
987+ if (!track1.has_mcParticle ())
988+ continue ;
989+ auto mcTrack1 = track1.template mcParticle_as <aod::McParticles>();
990+ if (mcTrack1.pdgCode () != PDG_t::kKPlus || !mcTrack1.isPhysicalPrimary ())
991+ continue ;
992+
993+ for (const auto & track2 : negTracks) {
994+ if (!selectionTrackResonance<true >(track2, false ) || !selectionPIDKaonpTdependent (track2))
995+ continue ; // topological and PID selection
996+
997+ auto track2ID = track2.globalIndex ();
998+ if (track2ID == track1ID)
999+ continue ; // condition to avoid double counting of pair
1000+
1001+ if (!track2.has_mcParticle ())
1002+ continue ;
1003+ auto mcTrack2 = track2.template mcParticle_as <aod::McParticles>();
1004+ if (mcTrack2.pdgCode () != PDG_t::kKMinus || !mcTrack2.isPhysicalPrimary ())
1005+ continue ;
1006+
1007+ float pTMother = -1 .0f ;
1008+ float yMother = -1 .0f ;
1009+ bool isMCMotherPhi = false ;
1010+ for (const auto & motherOfMcTrack1 : mcTrack1.template mothers_as <aod::McParticles>()) {
1011+ for (const auto & motherOfMcTrack2 : mcTrack2.template mothers_as <aod::McParticles>()) {
1012+ if (motherOfMcTrack1.pdgCode () != motherOfMcTrack2.pdgCode ())
1013+ continue ;
1014+ if (motherOfMcTrack1.globalIndex () != motherOfMcTrack2.globalIndex ())
1015+ continue ;
1016+ if (motherOfMcTrack1.pdgCode () != o2::constants::physics::Pdg::kPhi )
1017+ continue ;
1018+
1019+ pTMother = motherOfMcTrack1.pt ();
1020+ yMother = motherOfMcTrack1.y ();
1021+ isMCMotherPhi = true ;
1022+ }
1023+ }
1024+
1025+ if (!isMCMotherPhi)
1026+ continue ;
1027+ if (pTMother < minPhiPt || std::abs (yMother) > deltaYConfigs.cfgYAcceptance )
1028+ continue ;
1029+
1030+ nPhi++;
1031+ }
1032+ }
1033+
1034+ if (nPhi > 0 )
1035+ return true ;
1036+ return false ;
1037+ }
1038+
9761039 template <typename T>
977- bool eventHasMCPhi (const T& mcParticles)
1040+ bool eventHasGenPhi (const T& mcParticles)
9781041 {
9791042 int nPhi = 0 ;
9801043
9811044 for (const auto & mcParticle : mcParticles) {
9821045 if (mcParticle.pdgCode () != o2::constants::physics::Pdg::kPhi )
9831046 continue ;
984- if (mcParticle.pt () < minPhiPt || mcParticle. pt () > maxPhiPt )
1047+ if (mcParticle.pt () < minPhiPt)
9851048 continue ;
9861049 if (std::abs (mcParticle.y ()) > deltaYConfigs.cfgYAcceptance )
9871050 continue ;
9881051
1052+ auto kDaughters = mcParticle.template daughters_as <aod::McParticles>();
1053+ if (kDaughters .size () != 2 )
1054+ continue ;
1055+ bool isPosKaon = false , isNegKaon = false ;
1056+ for (const auto & kDaughter : kDaughters ) {
1057+ if (kDaughter .pdgCode () == PDG_t::kKPlus )
1058+ isPosKaon = true ;
1059+ if (kDaughter .pdgCode () == PDG_t::kKMinus )
1060+ isNegKaon = true ;
1061+ }
1062+ if (!isPosKaon || !isNegKaon)
1063+ continue ;
1064+
9891065 nPhi++;
9901066 }
9911067
@@ -2489,7 +2565,7 @@ struct Phik0shortanalysis {
24892565 auto negThisColl = negFiltTracks->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
24902566
24912567 // Check if the event contains a phi candidate
2492- if (!eventHasPhi (posThisColl, negThisColl))
2568+ if (!eventHasRecoPhi (posThisColl, negThisColl))
24932569 return ;
24942570
24952571 dataEventHist.fill (HIST (" hMultiplicityPercent" ), collision.centFT0M ());
@@ -2523,7 +2599,7 @@ struct Phik0shortanalysis {
25232599
25242600 if (furtherCheckonMcCollision && (std::abs (mcCollision.posZ ()) > cutZVertex || !pwglf::isINELgtNmc (mcParticlesThisColl, 0 , pdgDB)))
25252601 return ;
2526- if (filterOnMcPhi && !eventHasMCPhi (mcParticlesThisColl))
2602+ if (filterOnMcPhi && !eventHasGenPhi (mcParticlesThisColl))
25272603 return ;
25282604
25292605 mcEventHist.fill (HIST (" hRecoMCMultiplicityPercent" ), mcCollision.centFT0M ());
@@ -2577,7 +2653,7 @@ struct Phik0shortanalysis {
25772653 return ;
25782654 if (!pwglf::isINELgtNmc (mcParticles, 0 , pdgDB))
25792655 return ;
2580- if (filterOnMcPhi && !eventHasMCPhi (mcParticles))
2656+ if (filterOnMcPhi && !eventHasGenPhi (mcParticles))
25812657 return ;
25822658
25832659 uint64_t numberAssocColl = 0 ;
0 commit comments