@@ -142,7 +142,9 @@ struct Phik0shortanalysis {
142142 Configurable<bool > cfgiskNoITSROFrameBorder{" cfgiskNoITSROFrameBorder" , false , " kNoITSROFrameBorder request on RecMC collisions" };
143143
144144 // Configurable for MC closure
145- Configurable<bool > cfgisGenMCForClosure{" cfgisGenMCForClosure" , false , " isGenMCForClosure" };
145+ Configurable<bool > cfgisRecMCWPDGForClosure1{" cfgisRecMCWPDGForClosure1" , false , " RecoMC with PDG Codes for Closure only for Associated particles" };
146+ Configurable<bool > cfgisRecMCWPDGForClosure2{" cfgisRecMCWPDGForClosure2" , false , " RecoMC with PDG Codes for Closure" };
147+ Configurable<bool > cfgisGenMCForClosure{" cfgisGenMCForClosure" , false , " GenMC for Closure" };
146148
147149 // Constants
148150 double massKa = o2::constants::physics::MassKPlus;
@@ -1369,7 +1371,7 @@ struct Phik0shortanalysis {
13691371
13701372 PROCESS_SWITCH (Phik0shortanalysis, processRecMCClosurePhiQA, " Process for ReCMCQA and Phi in RecMCClosure" , false );
13711373
1372- void processRecMCClosurePhiK0S (SimCollisions::iterator const & collision, FullMCTracks const &, FullV0s const & V0s, V0DauMCTracks const &, MCCollisions const &)
1374+ void processRecMCClosurePhiK0S (SimCollisions::iterator const & collision, FullMCTracks const &, FullMCV0s const & V0s, V0DauMCTracks const &, MCCollisions const &)
13731375 {
13741376 if (!acceptEventQA<true >(collision, false ))
13751377 return ;
@@ -1386,6 +1388,14 @@ struct Phik0shortanalysis {
13861388
13871389 // V0 already reconstructed by the builder
13881390 for (const auto & v0 : V0s) {
1391+ if (cfgisRecMCWPDGForClosure1) {
1392+ if (!v0.has_mcParticle ())
1393+ continue ;
1394+ auto v0mcparticle = v0.mcParticle ();
1395+ if (v0mcparticle.pdgCode () != 310 || !v0mcparticle.isPhysicalPrimary ())
1396+ continue ;
1397+ }
1398+
13891399 const auto & posDaughterTrack = v0.posTrack_as <V0DauMCTracks>();
13901400 const auto & negDaughterTrack = v0.negTrack_as <V0DauMCTracks>();
13911401
@@ -1415,6 +1425,35 @@ struct Phik0shortanalysis {
14151425 if (track2ID == track1ID)
14161426 continue ; // condition to avoid double counting of pair
14171427
1428+ if (cfgisRecMCWPDGForClosure2) {
1429+ if (!track1.has_mcParticle ())
1430+ continue ;
1431+ auto mcTrack1 = track1.mcParticle_as <aod::McParticles>();
1432+ if (mcTrack1.pdgCode () != 321 || !mcTrack1.isPhysicalPrimary ())
1433+ continue ;
1434+
1435+ if (!track2.has_mcParticle ())
1436+ continue ;
1437+ auto mcTrack2 = track2.mcParticle_as <aod::McParticles>();
1438+ if (mcTrack2.pdgCode () != -321 || !mcTrack2.isPhysicalPrimary ())
1439+ continue ;
1440+
1441+ bool isMCMotherPhi = false ;
1442+ for (const auto & motherOfMcTrack1 : mcTrack1.mothers_as <aod::McParticles>()) {
1443+ for (const auto & motherOfMcTrack2 : mcTrack2.mothers_as <aod::McParticles>()) {
1444+ if (motherOfMcTrack1.pdgCode () != motherOfMcTrack2.pdgCode ())
1445+ continue ;
1446+ if (motherOfMcTrack1.globalIndex () != motherOfMcTrack2.globalIndex ())
1447+ continue ;
1448+ if (motherOfMcTrack1.pdgCode () != 333 )
1449+ continue ;
1450+ isMCMotherPhi = true ;
1451+ }
1452+ }
1453+ if (!isMCMotherPhi)
1454+ continue ;
1455+ }
1456+
14181457 TLorentzVector recPhi = recMother (track1, track2, massKa, massKa);
14191458
14201459 if (recPhi.M () < lowMPhi || recPhi.M () > upMPhi)
@@ -1461,6 +1500,13 @@ struct Phik0shortanalysis {
14611500
14621501 // Loop over all primary pion candidates
14631502 for (const auto & track : fullMCTracks) {
1503+ if (cfgisRecMCWPDGForClosure1) {
1504+ if (!track.has_mcParticle ())
1505+ continue ;
1506+ auto mcTrack = track.mcParticle_as <aod::McParticles>();
1507+ if (std::abs (mcTrack.pdgCode ()) != 211 || !mcTrack.isPhysicalPrimary ())
1508+ continue ;
1509+ }
14641510
14651511 // Pion selection
14661512 if (!selectionPion<true >(track))
@@ -1487,6 +1533,35 @@ struct Phik0shortanalysis {
14871533 if (track2ID == track1ID)
14881534 continue ; // condition to avoid double counting of pair
14891535
1536+ if (cfgisRecMCWPDGForClosure2) {
1537+ if (!track1.has_mcParticle ())
1538+ continue ;
1539+ auto mcTrack1 = track1.mcParticle_as <aod::McParticles>();
1540+ if (mcTrack1.pdgCode () != 321 || !mcTrack1.isPhysicalPrimary ())
1541+ continue ;
1542+
1543+ if (!track2.has_mcParticle ())
1544+ continue ;
1545+ auto mcTrack2 = track2.mcParticle_as <aod::McParticles>();
1546+ if (mcTrack2.pdgCode () != -321 || !mcTrack2.isPhysicalPrimary ())
1547+ continue ;
1548+
1549+ bool isMCMotherPhi = false ;
1550+ for (const auto & motherOfMcTrack1 : mcTrack1.mothers_as <aod::McParticles>()) {
1551+ for (const auto & motherOfMcTrack2 : mcTrack2.mothers_as <aod::McParticles>()) {
1552+ if (motherOfMcTrack1.pdgCode () != motherOfMcTrack2.pdgCode ())
1553+ continue ;
1554+ if (motherOfMcTrack1.globalIndex () != motherOfMcTrack2.globalIndex ())
1555+ continue ;
1556+ if (motherOfMcTrack1.pdgCode () != 333 )
1557+ continue ;
1558+ isMCMotherPhi = true ;
1559+ }
1560+ }
1561+ if (!isMCMotherPhi)
1562+ continue ;
1563+ }
1564+
14901565 TLorentzVector recPhi = recMother (track1, track2, massKa, massKa);
14911566
14921567 if (recPhi.M () < lowMPhi || recPhi.M () > upMPhi)
0 commit comments