From 084de4836bbc99871458b5959a9e337cff41667e Mon Sep 17 00:00:00 2001 From: Stefano Cannito Date: Fri, 7 Feb 2025 15:01:02 +0100 Subject: [PATCH 1/4] Add cfg for closure --- PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx index f7b80611267..73db4524bc6 100644 --- a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx @@ -142,7 +142,8 @@ struct Phik0shortanalysis { Configurable cfgiskNoITSROFrameBorder{"cfgiskNoITSROFrameBorder", false, "kNoITSROFrameBorder request on RecMC collisions"}; // Configurable for MC closure - Configurable cfgisGenMCForClosure{"cfgisGenMCForClosure", false, "isGenMCForClosure"}; + Configurable cfgisRecMCWPDGForClosure{"cfgisRecMCWPDGForClosure", false, "RecoMC with PDG Codes for Closure"}; + Configurable cfgisGenMCForClosure{"cfgisGenMCForClosure", false, "GenMC for Closure"}; // Constants double massKa = o2::constants::physics::MassKPlus; @@ -1386,6 +1387,7 @@ struct Phik0shortanalysis { // V0 already reconstructed by the builder for (const auto& v0 : V0s) { + const auto& posDaughterTrack = v0.posTrack_as(); const auto& negDaughterTrack = v0.negTrack_as(); From 7fb9eec0ee6c25793d7380723169b4792c2632c6 Mon Sep 17 00:00:00 2001 From: Stefano Cannito Date: Fri, 7 Feb 2025 15:11:45 +0100 Subject: [PATCH 2/4] New type of closure 1 --- PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx index 73db4524bc6..1b929f8ec2a 100644 --- a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx @@ -1387,7 +1387,14 @@ struct Phik0shortanalysis { // V0 already reconstructed by the builder for (const auto& v0 : V0s) { - + if (cfgisRecMCWPDGForClosure) { + if (!v0.has_mcParticle()) + continue; + auto v0mcparticle = v0.mcParticle(); + if (v0mcparticle.pdgCode() != 310 || !v0mcparticle.isPhysicalPrimary()) + continue; + } + const auto& posDaughterTrack = v0.posTrack_as(); const auto& negDaughterTrack = v0.negTrack_as(); @@ -1463,6 +1470,13 @@ struct Phik0shortanalysis { // Loop over all primary pion candidates for (const auto& track : fullMCTracks) { + if (cfgisRecMCWPDGForClosure) { + if (!track.has_mcParticle()) + continue; + auto mcTrack = track.mcParticle_as(); + if (std::abs(mcTrack.pdgCode()) != 211 || !mcTrack.isPhysicalPrimary()) + continue; + } // Pion selection if (!selectionPion(track)) From 1af684c54e84afcedd7fdded2a8d4141c012ca54 Mon Sep 17 00:00:00 2001 From: Stefano Cannito Date: Fri, 7 Feb 2025 16:23:01 +0100 Subject: [PATCH 3/4] New type of closure 2 --- .../Tasks/Strangeness/phik0shortanalysis.cxx | 69 ++++++++++++++++++- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx index 1b929f8ec2a..c7f00132753 100644 --- a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx @@ -142,7 +142,8 @@ struct Phik0shortanalysis { Configurable cfgiskNoITSROFrameBorder{"cfgiskNoITSROFrameBorder", false, "kNoITSROFrameBorder request on RecMC collisions"}; // Configurable for MC closure - Configurable cfgisRecMCWPDGForClosure{"cfgisRecMCWPDGForClosure", false, "RecoMC with PDG Codes for Closure"}; + Configurable cfgisRecMCWPDGForClosure1{"cfgisRecMCWPDGForClosure1", false, "RecoMC with PDG Codes for Closure only for Associated particles"}; + Configurable cfgisRecMCWPDGForClosure2{"cfgisRecMCWPDGForClosure2", false, "RecoMC with PDG Codes for Closure"}; Configurable cfgisGenMCForClosure{"cfgisGenMCForClosure", false, "GenMC for Closure"}; // Constants @@ -1387,7 +1388,7 @@ struct Phik0shortanalysis { // V0 already reconstructed by the builder for (const auto& v0 : V0s) { - if (cfgisRecMCWPDGForClosure) { + if (cfgisRecMCWPDGForClosure1) { if (!v0.has_mcParticle()) continue; auto v0mcparticle = v0.mcParticle(); @@ -1416,6 +1417,14 @@ struct Phik0shortanalysis { auto track1ID = track1.globalIndex(); + if (cfgisRecMCWPDGForClosure2) { + if (!track1.has_mcParticle()) + continue; + auto mcTrack1 = track1.mcParticle_as(); + if (mcTrack1.pdgCode() != 321 || !mcTrack1.isPhysicalPrimary()) + continue; + } + for (const auto& track2 : negThisColl) { if (!selectionTrackResonance(track2) || !selectionPIDKaonpTdependent(track2)) continue; // topological and PID selection @@ -1424,6 +1433,29 @@ struct Phik0shortanalysis { if (track2ID == track1ID) continue; // condition to avoid double counting of pair + if (cfgisRecMCWPDGForClosure2) { + if (!track2.has_mcParticle()) + continue; + auto mcTrack2 = track2.mcParticle_as(); + if (mcTrack2.pdgCode() != -321 || !mcTrack2.isPhysicalPrimary()) + continue; + + bool isMCMotherPhi = false; + for (const auto& motherOfMcTrack1 : mcTrack1.mothers_as()) { + for (const auto& motherOfMcTrack2 : mcTrack2.mothers_as()) { + if (motherOfMcTrack1.pdgCode() != motherOfMcTrack2.pdgCode()) + continue; + if (motherOfMcTrack1.globalIndex() != motherOfMcTrack2.globalIndex()) + continue; + if (motherOfMcTrack1.pdgCode() != 333) + continue; + isMCMotherPhi = true; + } + } + if (!isMCMotherPhi) + continue; + } + TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) @@ -1470,7 +1502,7 @@ struct Phik0shortanalysis { // Loop over all primary pion candidates for (const auto& track : fullMCTracks) { - if (cfgisRecMCWPDGForClosure) { + if (cfgisRecMCWPDGForClosure1) { if (!track.has_mcParticle()) continue; auto mcTrack = track.mcParticle_as(); @@ -1495,6 +1527,14 @@ struct Phik0shortanalysis { auto track1ID = track1.globalIndex(); + if (cfgisRecMCWPDGForClosure2) { + if (!track1.has_mcParticle()) + continue; + auto mcTrack1 = track1.mcParticle_as(); + if (mcTrack1.pdgCode() != 321 || !mcTrack1.isPhysicalPrimary()) + continue; + } + for (const auto& track2 : negThisColl) { if (!selectionTrackResonance(track2) || !selectionPIDKaonpTdependent(track2)) continue; // topological and PID selection @@ -1503,6 +1543,29 @@ struct Phik0shortanalysis { if (track2ID == track1ID) continue; // condition to avoid double counting of pair + if (cfgisRecMCWPDGForClosure2) { + if (!track2.has_mcParticle()) + continue; + auto mcTrack2 = track2.mcParticle_as(); + if (mcTrack2.pdgCode() != -321 || !mcTrack2.isPhysicalPrimary()) + continue; + + bool isMCMotherPhi = false; + for (const auto& motherOfMcTrack1 : mcTrack1.mothers_as()) { + for (const auto& motherOfMcTrack2 : mcTrack2.mothers_as()) { + if (motherOfMcTrack1.pdgCode() != motherOfMcTrack2.pdgCode()) + continue; + if (motherOfMcTrack1.globalIndex() != motherOfMcTrack2.globalIndex()) + continue; + if (motherOfMcTrack1.pdgCode() != 333) + continue; + isMCMotherPhi = true; + } + } + if (!isMCMotherPhi) + continue; + } + TLorentzVector recPhi = recMother(track1, track2, massKa, massKa); if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) From c08ebba589a8155bc320a38839bffa6b17d7fa29 Mon Sep 17 00:00:00 2001 From: Stefano Cannito Date: Fri, 7 Feb 2025 17:04:50 +0100 Subject: [PATCH 4/4] New type of closure 3 --- .../Tasks/Strangeness/phik0shortanalysis.cxx | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx index c7f00132753..8c65cca608d 100644 --- a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx @@ -1371,7 +1371,7 @@ struct Phik0shortanalysis { PROCESS_SWITCH(Phik0shortanalysis, processRecMCClosurePhiQA, "Process for ReCMCQA and Phi in RecMCClosure", false); - void processRecMCClosurePhiK0S(SimCollisions::iterator const& collision, FullMCTracks const&, FullV0s const& V0s, V0DauMCTracks const&, MCCollisions const&) + void processRecMCClosurePhiK0S(SimCollisions::iterator const& collision, FullMCTracks const&, FullMCV0s const& V0s, V0DauMCTracks const&, MCCollisions const&) { if (!acceptEventQA(collision, false)) return; @@ -1417,14 +1417,6 @@ struct Phik0shortanalysis { auto track1ID = track1.globalIndex(); - if (cfgisRecMCWPDGForClosure2) { - if (!track1.has_mcParticle()) - continue; - auto mcTrack1 = track1.mcParticle_as(); - if (mcTrack1.pdgCode() != 321 || !mcTrack1.isPhysicalPrimary()) - continue; - } - for (const auto& track2 : negThisColl) { if (!selectionTrackResonance(track2) || !selectionPIDKaonpTdependent(track2)) continue; // topological and PID selection @@ -1434,6 +1426,12 @@ struct Phik0shortanalysis { continue; // condition to avoid double counting of pair if (cfgisRecMCWPDGForClosure2) { + if (!track1.has_mcParticle()) + continue; + auto mcTrack1 = track1.mcParticle_as(); + if (mcTrack1.pdgCode() != 321 || !mcTrack1.isPhysicalPrimary()) + continue; + if (!track2.has_mcParticle()) continue; auto mcTrack2 = track2.mcParticle_as(); @@ -1527,14 +1525,6 @@ struct Phik0shortanalysis { auto track1ID = track1.globalIndex(); - if (cfgisRecMCWPDGForClosure2) { - if (!track1.has_mcParticle()) - continue; - auto mcTrack1 = track1.mcParticle_as(); - if (mcTrack1.pdgCode() != 321 || !mcTrack1.isPhysicalPrimary()) - continue; - } - for (const auto& track2 : negThisColl) { if (!selectionTrackResonance(track2) || !selectionPIDKaonpTdependent(track2)) continue; // topological and PID selection @@ -1544,6 +1534,12 @@ struct Phik0shortanalysis { continue; // condition to avoid double counting of pair if (cfgisRecMCWPDGForClosure2) { + if (!track1.has_mcParticle()) + continue; + auto mcTrack1 = track1.mcParticle_as(); + if (mcTrack1.pdgCode() != 321 || !mcTrack1.isPhysicalPrimary()) + continue; + if (!track2.has_mcParticle()) continue; auto mcTrack2 = track2.mcParticle_as();